Mercurial > pidgin.yaz
annotate pidgin/gtkcertmgr.c @ 19039:3054f7c6b30d
- Add logic to allow tls_peers manager to properly uninit itself when
the certmgr is closed
author | William Ehlhardt <williamehlhardt@gmail.com> |
---|---|
date | Fri, 20 Jul 2007 08:39:00 +0000 |
parents | 5040616cace9 |
children | dd4444be5e26 |
rev | line source |
---|---|
19015
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
1 /* |
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
2 * @file gtkcertmgr.c GTK+ Certificate Manager API |
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
3 * @ingroup pidgin |
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
4 * |
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
5 * pidgin |
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
6 * |
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
7 * Pidgin is the legal property of its developers, whose names are too numerous |
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
8 * to list here. Please refer to the COPYRIGHT file distributed with this |
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
9 * source distribution. |
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
10 * |
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
11 * This program is free software; you can redistribute it and/or modify |
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
12 * it under the terms of the GNU General Public License as published by |
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
13 * the Free Software Foundation; either version 2 of the License, or |
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
14 * (at your option) any later version. |
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
15 * |
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
16 * This program is distributed in the hope that it will be useful, |
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
19 * GNU General Public License for more details. |
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
20 * |
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
21 * You should have received a copy of the GNU General Public License |
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
22 * along with this program; if not, write to the Free Software |
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
24 * |
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
25 */ |
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
26 |
19031
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
27 #include <glib.h> |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
28 |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
29 #include "core.h" |
19015
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
30 #include "internal.h" |
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
31 #include "pidgin.h" |
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
32 |
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
33 #include "certificate.h" |
19029
3f929a770f1b
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19015
diff
changeset
|
34 #include "debug.h" |
19015
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
35 #include "notify.h" |
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
36 |
19031
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
37 #include "gtkblist.h" |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
38 #include "gtkutils.h" |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
39 |
19015
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
40 #include "gtkcertmgr.h" |
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
41 |
19035
284199d26040
- Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19032
diff
changeset
|
42 /***************************************************************************** |
19038
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
43 * X.509 tls_peers management interface * |
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
44 *****************************************************************************/ |
19039
3054f7c6b30d
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19038
diff
changeset
|
45 |
3054f7c6b30d
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19038
diff
changeset
|
46 static void |
3054f7c6b30d
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19038
diff
changeset
|
47 tls_peers_mgmt_destroy(GtkWidget *mgmt_widget, gpointer data) |
3054f7c6b30d
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19038
diff
changeset
|
48 { |
3054f7c6b30d
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19038
diff
changeset
|
49 purple_debug_info("certmgr", |
3054f7c6b30d
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19038
diff
changeset
|
50 "tls peers self-destructs\n"); |
3054f7c6b30d
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19038
diff
changeset
|
51 } |
3054f7c6b30d
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19038
diff
changeset
|
52 |
19038
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
53 static GtkWidget * |
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
54 tls_peers_mgmt_build(void) |
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
55 { |
19039
3054f7c6b30d
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19038
diff
changeset
|
56 GtkWidget *mgmt_widget = gtk_label_new("TLS PEEERSSSSS!!!"); |
3054f7c6b30d
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19038
diff
changeset
|
57 gtk_widget_show(mgmt_widget); |
3054f7c6b30d
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19038
diff
changeset
|
58 |
3054f7c6b30d
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19038
diff
changeset
|
59 /* Ensure that everything gets cleaned up when the dialog box |
3054f7c6b30d
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19038
diff
changeset
|
60 is closed */ |
3054f7c6b30d
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19038
diff
changeset
|
61 g_signal_connect(G_OBJECT(mgmt_widget), "destroy", |
3054f7c6b30d
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19038
diff
changeset
|
62 G_CALLBACK(tls_peers_mgmt_destroy), NULL); |
3054f7c6b30d
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19038
diff
changeset
|
63 return mgmt_widget; |
19038
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
64 } |
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
65 |
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
66 PidginCertificateManager tls_peers_mgmt = { |
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
67 tls_peers_mgmt_build, /* Widget creation function */ |
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
68 N_("SSL Servers") |
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
69 }; |
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
70 |
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
71 /***************************************************************************** |
19035
284199d26040
- Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19032
diff
changeset
|
72 * GTK+ main certificate manager * |
284199d26040
- Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19032
diff
changeset
|
73 *****************************************************************************/ |
19031
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
74 typedef struct |
19015
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
75 { |
19031
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
76 GtkWidget *window; |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
77 GtkWidget *notebook; |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
78 |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
79 GtkWidget *closebutton; |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
80 } CertMgrDialog; |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
81 |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
82 /* If a certificate manager window is open, this will point to it. |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
83 So if it is set, don't open another one! */ |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
84 CertMgrDialog *certmgr_dialog = NULL; |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
85 |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
86 static void |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
87 certmgr_close_cb(GtkWidget *w, CertMgrDialog *dlg) |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
88 { |
19035
284199d26040
- Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19032
diff
changeset
|
89 /* TODO: Ignoring the arguments to this function may not be ideal, |
284199d26040
- Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19032
diff
changeset
|
90 but there *should* only be "one dialog to rule them all" at a time*/ |
19031
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
91 pidgin_certmgr_hide(); |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
92 } |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
93 |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
94 void |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
95 pidgin_certmgr_show(void) |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
96 { |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
97 CertMgrDialog *dlg; |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
98 GtkWidget *win; |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
99 GtkWidget *vbox; |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
100 GtkWidget *bbox; |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
101 |
19029
3f929a770f1b
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19015
diff
changeset
|
102 /* Enumerate all the certificates on file */ |
3f929a770f1b
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19015
diff
changeset
|
103 { |
3f929a770f1b
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19015
diff
changeset
|
104 GList *idlist, *poollist; |
3f929a770f1b
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19015
diff
changeset
|
105 |
3f929a770f1b
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19015
diff
changeset
|
106 for ( poollist = purple_certificate_get_pools(); |
3f929a770f1b
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19015
diff
changeset
|
107 poollist; |
3f929a770f1b
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19015
diff
changeset
|
108 poollist = poollist->next ) { |
3f929a770f1b
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19015
diff
changeset
|
109 PurpleCertificatePool *pool = poollist->data; |
3f929a770f1b
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19015
diff
changeset
|
110 GList *l; |
3f929a770f1b
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19015
diff
changeset
|
111 |
3f929a770f1b
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19015
diff
changeset
|
112 purple_debug_info("gtkcertmgr", |
3f929a770f1b
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19015
diff
changeset
|
113 "Pool %s found for scheme %s -" |
3f929a770f1b
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19015
diff
changeset
|
114 "Enumerating certificates:\n", |
3f929a770f1b
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19015
diff
changeset
|
115 pool->name, pool->scheme_name); |
3f929a770f1b
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19015
diff
changeset
|
116 |
3f929a770f1b
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19015
diff
changeset
|
117 idlist = purple_certificate_pool_get_idlist(pool); |
3f929a770f1b
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19015
diff
changeset
|
118 |
3f929a770f1b
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19015
diff
changeset
|
119 for (l=idlist; l; l = l->next) { |
3f929a770f1b
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19015
diff
changeset
|
120 purple_debug_info("gtkcertmgr", |
3f929a770f1b
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19015
diff
changeset
|
121 "- %s\n", |
3f929a770f1b
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19015
diff
changeset
|
122 (gchar *) l->data); |
3f929a770f1b
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19015
diff
changeset
|
123 } /* idlist */ |
3f929a770f1b
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19015
diff
changeset
|
124 purple_certificate_pool_destroy_idlist(idlist); |
3f929a770f1b
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19015
diff
changeset
|
125 } /* poollist */ |
3f929a770f1b
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19015
diff
changeset
|
126 } |
19031
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
127 |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
128 |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
129 /* If the manager is already open, bring it to the front */ |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
130 if (certmgr_dialog != NULL) { |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
131 gtk_window_present(GTK_WINDOW(certmgr_dialog->window)); |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
132 return; |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
133 } |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
134 |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
135 /* Create the dialog, and set certmgr_dialog so we never create |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
136 more than one at a time */ |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
137 dlg = certmgr_dialog = g_new0(CertMgrDialog, 1); |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
138 |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
139 win = dlg->window = |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
140 pidgin_create_window(_("Certificate Manager"),/* Title */ |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
141 PIDGIN_HIG_BORDER, /*Window border*/ |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
142 "certmgr", /* Role */ |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
143 TRUE); /* Allow resizing */ |
19032
73172682eefd
- CertMgr window responds properly to delete_event
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19031
diff
changeset
|
144 g_signal_connect(G_OBJECT(win), "delete_event", |
73172682eefd
- CertMgr window responds properly to delete_event
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19031
diff
changeset
|
145 G_CALLBACK(certmgr_close_cb), dlg); |
73172682eefd
- CertMgr window responds properly to delete_event
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19031
diff
changeset
|
146 |
19031
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
147 |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
148 /* TODO: Retrieve the user-set window size and use it */ |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
149 gtk_window_set_default_size(GTK_WINDOW(win), 400, 400); |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
150 |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
151 /* Main vbox */ |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
152 vbox = gtk_vbox_new( FALSE, PIDGIN_HIG_BORDER ); |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
153 gtk_container_add(GTK_CONTAINER(win), vbox); |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
154 gtk_widget_show(vbox); |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
155 |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
156 /* Notebook of various certificate managers */ |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
157 dlg->notebook = gtk_notebook_new(); |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
158 gtk_box_pack_start(GTK_BOX(vbox), dlg->notebook, |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
159 TRUE, TRUE, /* Notebook should take extra space */ |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
160 0); |
19038
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
161 gtk_widget_show(dlg->notebook); |
19031
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
162 |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
163 /* Box for the close button */ |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
164 bbox = gtk_hbutton_box_new(); |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
165 gtk_box_set_spacing(GTK_BOX(bbox), PIDGIN_HIG_BOX_SPACE); |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
166 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
167 gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, TRUE, 0); |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
168 gtk_widget_show(bbox); |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
169 |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
170 /* Close button */ |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
171 dlg->closebutton = gtk_button_new_from_stock(GTK_STOCK_CLOSE); |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
172 gtk_box_pack_start(GTK_BOX(bbox), dlg->closebutton, FALSE, FALSE, 0); |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
173 gtk_widget_show(dlg->closebutton); |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
174 g_signal_connect(G_OBJECT(dlg->closebutton), "clicked", |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
175 G_CALLBACK(certmgr_close_cb), dlg); |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
176 |
19038
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
177 /* Add the defined certificate managers */ |
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
178 /* TODO: Find a way of determining whether each is shown or not */ |
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
179 /* TODO: Implement this correctly */ |
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
180 gtk_notebook_append_page(GTK_NOTEBOOK (dlg->notebook), |
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
181 (tls_peers_mgmt.build)(), |
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
182 gtk_label_new(_(tls_peers_mgmt.label)) ); |
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
183 |
19031
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
184 gtk_widget_show(win); |
19015
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
185 } |
19031
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
186 |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
187 void |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
188 pidgin_certmgr_hide(void) |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
189 { |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
190 /* If it isn't open, do nothing */ |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
191 if (certmgr_dialog == NULL) { |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
192 return; |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
193 } |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
194 |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
195 purple_signals_disconnect_by_handle(certmgr_dialog); |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
196 purple_prefs_disconnect_by_handle(certmgr_dialog); |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
197 |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
198 gtk_widget_destroy(certmgr_dialog->window); |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
199 g_free(certmgr_dialog); |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
200 certmgr_dialog = NULL; |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
201 |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
202 /* If this was the only window left, quit */ |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
203 if (PIDGIN_BLIST(purple_get_blist())->window == NULL && |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
204 purple_connections_get_all() == NULL) { |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
205 |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
206 purple_core_quit(); |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
207 } |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
208 } |