Mercurial > pidgin.yaz
annotate pidgin/gtkcertmgr.c @ 19064:f407244c4e57
- Export button now functional due to the magic of copy-paste coding
author | William Ehlhardt <williamehlhardt@gmail.com> |
---|---|
date | Wed, 01 Aug 2007 05:13:46 +0000 |
parents | da88aa8f83ad |
children | ebae00bbb57e |
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" |
19062
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
36 #include "request.h" |
19015
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
37 |
19031
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
38 #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
|
39 #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
|
40 |
19015
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
41 #include "gtkcertmgr.h" |
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
42 |
19035
284199d26040
- Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19032
diff
changeset
|
43 /***************************************************************************** |
19038
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
44 * X.509 tls_peers management interface * |
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
45 *****************************************************************************/ |
19039
3054f7c6b30d
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19038
diff
changeset
|
46 |
19052
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
47 typedef struct { |
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
48 GtkWidget *mgmt_widget; |
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
49 GtkTreeView *listview; |
19054
ffeb39523eb6
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19053
diff
changeset
|
50 GtkTreeSelection *listselect; |
19052
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
51 GtkWidget *importbutton; |
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
52 GtkWidget *exportbutton; |
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
53 GtkWidget *infobutton; |
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
54 GtkWidget *deletebutton; |
19053
95a8469cd1e3
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19052
diff
changeset
|
55 PurpleCertificatePool *tls_peers; |
19052
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
56 } tls_peers_mgmt_data; |
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
57 |
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
58 tls_peers_mgmt_data *tpm_dat = NULL; |
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
59 |
19041
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
60 /* Columns |
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
61 See http://developer.gnome.org/doc/API/2.0/gtk/TreeWidget.html */ |
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
62 enum |
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
63 { |
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
64 TPM_HOSTNAME_COLUMN, |
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
65 TPM_N_COLUMNS |
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
66 }; |
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
67 |
19039
3054f7c6b30d
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19038
diff
changeset
|
68 static void |
3054f7c6b30d
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19038
diff
changeset
|
69 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
|
70 { |
3054f7c6b30d
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19038
diff
changeset
|
71 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
|
72 "tls peers self-destructs\n"); |
19052
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
73 |
19053
95a8469cd1e3
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19052
diff
changeset
|
74 purple_signals_disconnect_by_handle(tpm_dat); |
19062
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
75 purple_request_close_with_handle(tpm_dat); |
19052
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
76 g_free(tpm_dat); tpm_dat = NULL; |
19039
3054f7c6b30d
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19038
diff
changeset
|
77 } |
3054f7c6b30d
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19038
diff
changeset
|
78 |
19042
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
79 static void |
19052
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
80 tls_peers_mgmt_repopulate_list(void) |
19042
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
81 { |
19052
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
82 GtkTreeView *listview = tpm_dat->listview; |
19042
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
83 PurpleCertificatePool *tls_peers; |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
84 GList *idlist, *l; |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
85 |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
86 GtkListStore *store = GTK_LIST_STORE( |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
87 gtk_tree_view_get_model(GTK_TREE_VIEW(listview))); |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
88 |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
89 /* First, delete everything in the list */ |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
90 gtk_list_store_clear(store); |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
91 |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
92 /* Locate the "tls_peers" pool */ |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
93 tls_peers = purple_certificate_find_pool("x509", "tls_peers"); |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
94 g_return_if_fail(tls_peers); |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
95 |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
96 /* Grab the loaded certificates */ |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
97 idlist = purple_certificate_pool_get_idlist(tls_peers); |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
98 |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
99 /* Populate the listview */ |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
100 for (l = idlist; l; l = l->next) { |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
101 GtkTreeIter iter; |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
102 gtk_list_store_append(store, &iter); |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
103 |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
104 gtk_list_store_set(GTK_LIST_STORE(store), &iter, |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
105 TPM_HOSTNAME_COLUMN, l->data, |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
106 -1); |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
107 } |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
108 purple_certificate_pool_destroy_idlist(idlist); |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
109 } |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
110 |
19053
95a8469cd1e3
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19052
diff
changeset
|
111 static void |
95a8469cd1e3
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19052
diff
changeset
|
112 tls_peers_mgmt_mod_cb(PurpleCertificatePool *pool, const gchar *id, gpointer data) |
95a8469cd1e3
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19052
diff
changeset
|
113 { |
95a8469cd1e3
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19052
diff
changeset
|
114 g_assert (pool == tpm_dat->tls_peers); |
95a8469cd1e3
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19052
diff
changeset
|
115 |
95a8469cd1e3
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19052
diff
changeset
|
116 tls_peers_mgmt_repopulate_list(); |
95a8469cd1e3
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19052
diff
changeset
|
117 } |
95a8469cd1e3
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19052
diff
changeset
|
118 |
19054
ffeb39523eb6
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19053
diff
changeset
|
119 static void |
19056
9e747806bb07
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19055
diff
changeset
|
120 tls_peers_mgmt_select_chg_cb(GtkTreeSelection *ignored, gpointer data) |
9e747806bb07
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19055
diff
changeset
|
121 { |
9e747806bb07
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19055
diff
changeset
|
122 GtkTreeSelection *select = tpm_dat->listselect; |
9e747806bb07
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19055
diff
changeset
|
123 GtkTreeIter iter; |
9e747806bb07
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19055
diff
changeset
|
124 GtkTreeModel *model; |
9e747806bb07
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19055
diff
changeset
|
125 |
9e747806bb07
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19055
diff
changeset
|
126 /* See if things are selected */ |
9e747806bb07
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19055
diff
changeset
|
127 if (gtk_tree_selection_get_selected(select, &model, &iter)) { |
9e747806bb07
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19055
diff
changeset
|
128 /* Enable buttons if something is selected */ |
9e747806bb07
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19055
diff
changeset
|
129 gtk_widget_set_sensitive(GTK_WIDGET(tpm_dat->exportbutton), TRUE); |
9e747806bb07
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19055
diff
changeset
|
130 gtk_widget_set_sensitive(GTK_WIDGET(tpm_dat->infobutton), TRUE); |
9e747806bb07
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19055
diff
changeset
|
131 gtk_widget_set_sensitive(GTK_WIDGET(tpm_dat->deletebutton), TRUE); |
9e747806bb07
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19055
diff
changeset
|
132 } else { |
9e747806bb07
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19055
diff
changeset
|
133 /* Otherwise, disable them */ |
9e747806bb07
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19055
diff
changeset
|
134 gtk_widget_set_sensitive(GTK_WIDGET(tpm_dat->exportbutton), FALSE); |
9e747806bb07
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19055
diff
changeset
|
135 gtk_widget_set_sensitive(GTK_WIDGET(tpm_dat->infobutton), FALSE); |
9e747806bb07
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19055
diff
changeset
|
136 gtk_widget_set_sensitive(GTK_WIDGET(tpm_dat->deletebutton), FALSE); |
9e747806bb07
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19055
diff
changeset
|
137 |
9e747806bb07
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19055
diff
changeset
|
138 } |
9e747806bb07
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19055
diff
changeset
|
139 } |
9e747806bb07
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19055
diff
changeset
|
140 |
9e747806bb07
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19055
diff
changeset
|
141 static void |
19062
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
142 tls_peers_mgmt_import_ok2_cb(gpointer data, const char *result) |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
143 { |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
144 PurpleCertificate *crt = (PurpleCertificate *) data; |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
145 const char *id = result; |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
146 |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
147 /* TODO: Perhaps prompt if you're overwriting a cert? */ |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
148 |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
149 /* Drop the certificate into the pool */ |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
150 purple_certificate_pool_store(tpm_dat->tls_peers, id, crt); |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
151 |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
152 /* And this certificate is not needed any more */ |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
153 purple_certificate_destroy(crt); |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
154 } |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
155 |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
156 static void |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
157 tls_peers_mgmt_import_cancel2_cb(gpointer data, const char *result) |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
158 { |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
159 PurpleCertificate *crt = (PurpleCertificate *) data; |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
160 purple_certificate_destroy(crt); |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
161 } |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
162 |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
163 static void |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
164 tls_peers_mgmt_import_ok_cb(gpointer data, const char *filename) |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
165 { |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
166 PurpleCertificateScheme *x509; |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
167 PurpleCertificate *crt; |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
168 |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
169 /* Load the scheme of our tls_peers pool (ought to be x509) */ |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
170 x509 = purple_certificate_pool_get_scheme(tpm_dat->tls_peers); |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
171 |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
172 /* Now load the certificate from disk */ |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
173 crt = purple_certificate_import(x509, filename); |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
174 |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
175 /* Did it work? */ |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
176 if (crt != NULL) { |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
177 gchar *default_hostname; |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
178 /* Get name to add to pool as */ |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
179 /* Make a guess about what the hostname should be */ |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
180 default_hostname = purple_certificate_get_subject_name(crt); |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
181 /* TODO: Find a way to make sure that crt gets destroyed |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
182 if the window gets closed unusually, such as by handle |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
183 deletion */ |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
184 /* TODO: Display some more information on the certificate? */ |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
185 purple_request_input(tpm_dat, |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
186 _("Certificate Import"), |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
187 _("Specify a hostname"), |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
188 _("Type the host name this certificate is for."), |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
189 default_hostname, |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
190 FALSE, /* Not multiline */ |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
191 FALSE, /* Not masked? */ |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
192 NULL, /* No hints? */ |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
193 _("OK"), |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
194 G_CALLBACK(tls_peers_mgmt_import_ok2_cb), |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
195 _("Cancel"), |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
196 G_CALLBACK(tls_peers_mgmt_import_cancel2_cb), |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
197 NULL, NULL, NULL, /* No account/who/conv*/ |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
198 crt /* Pass cert instance to callback*/ |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
199 ); |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
200 |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
201 g_free(default_hostname); |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
202 } else { |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
203 /* Errors! Oh no! */ |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
204 /* TODO: Perhaps find a way to be specific about what just |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
205 went wrong? */ |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
206 gchar * secondary; |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
207 |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
208 secondary = g_strdup_printf(_("File %s could not be imported.\nMake sure that the file is readable and in PEM format.\n"), filename); |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
209 purple_notify_error(NULL, |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
210 _("Certificate Import Error"), |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
211 _("X.509 certificate import failed"), |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
212 secondary); |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
213 g_free(secondary); |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
214 } |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
215 } |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
216 |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
217 static void |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
218 tls_peers_mgmt_import_cb(GtkWidget *button, gpointer data) |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
219 { |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
220 /* TODO: need to tell the user that we want a .PEM file! */ |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
221 purple_request_file(tpm_dat, |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
222 _("Select a PEM certificate"), |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
223 "certificate.pem", |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
224 FALSE, /* Not a save dialog */ |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
225 G_CALLBACK(tls_peers_mgmt_import_ok_cb), |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
226 NULL, /* Do nothing if cancelled */ |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
227 NULL, NULL, NULL, NULL );/* No account,conv,etc. */ |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
228 } |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
229 |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
230 static void |
19064
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
231 tls_peers_mgmt_export_ok_cb(gpointer data, const char *filename) |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
232 { |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
233 PurpleCertificate *crt = (PurpleCertificate *) data; |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
234 |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
235 g_assert(filename); |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
236 |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
237 if (!purple_certificate_export(filename, crt)) { |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
238 /* Errors! Oh no! */ |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
239 /* TODO: Perhaps find a way to be specific about what just |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
240 went wrong? */ |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
241 gchar * secondary; |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
242 |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
243 secondary = g_strdup_printf(_("Export to file %s failed.\nCheck that you have write permission to the target path\n"), filename); |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
244 purple_notify_error(NULL, |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
245 _("Certificate Export Error"), |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
246 _("X.509 certificate export failed"), |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
247 secondary); |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
248 g_free(secondary); |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
249 } |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
250 |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
251 purple_certificate_destroy(crt); |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
252 } |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
253 |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
254 static void |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
255 tls_peers_mgmt_export_cancel_cb(gpointer data, const char *filename) |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
256 { |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
257 PurpleCertificate *crt = (PurpleCertificate *) data; |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
258 /* Pressing cancel just frees the duplicated certificate */ |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
259 purple_certificate_destroy(crt); |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
260 } |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
261 |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
262 static void |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
263 tls_peers_mgmt_export_cb(GtkWidget *button, gpointer data) |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
264 { |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
265 PurpleCertificate *crt; |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
266 GtkTreeSelection *select = tpm_dat->listselect; |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
267 GtkTreeIter iter; |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
268 GtkTreeModel *model; |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
269 gchar *id; |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
270 |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
271 /* See if things are selected */ |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
272 if (!gtk_tree_selection_get_selected(select, &model, &iter)) { |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
273 purple_debug_warning("gtkcertmgr/tls_peers_mgmt", |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
274 "Export clicked with no selection?\n"); |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
275 return; |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
276 } |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
277 |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
278 /* Retrieve the selected hostname */ |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
279 gtk_tree_model_get(model, &iter, TPM_HOSTNAME_COLUMN, &id, -1); |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
280 |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
281 /* Extract the certificate from the pool now to make sure it doesn't |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
282 get deleted out from under us */ |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
283 crt = purple_certificate_pool_retrieve(tpm_dat->tls_peers, id); |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
284 |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
285 if (NULL == crt) { |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
286 purple_debug_error("gtkcertmgr/tls_peers_mgmt", |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
287 "Id %s was not in the peers cache?!\n", |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
288 id); |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
289 g_free(id); |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
290 return; |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
291 } |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
292 g_free(id); |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
293 |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
294 |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
295 /* TODO: inform user that it will be a PEM? */ |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
296 purple_request_file(tpm_dat, |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
297 _("PEM X.509 Certificate Export"), |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
298 "certificate.pem", |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
299 TRUE, /* Is a save dialog */ |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
300 G_CALLBACK(tls_peers_mgmt_export_ok_cb), |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
301 G_CALLBACK(tls_peers_mgmt_export_cancel_cb), |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
302 NULL, NULL, NULL, /* No account,conv,etc. */ |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
303 crt); /* Pass the certificate on to the callback */ |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
304 } |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
305 |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
306 |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
307 static void |
19054
ffeb39523eb6
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19053
diff
changeset
|
308 tls_peers_mgmt_delete_cb(GtkWidget *button, gpointer data) |
ffeb39523eb6
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19053
diff
changeset
|
309 { |
ffeb39523eb6
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19053
diff
changeset
|
310 GtkTreeSelection *select = tpm_dat->listselect; |
ffeb39523eb6
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19053
diff
changeset
|
311 GtkTreeIter iter; |
ffeb39523eb6
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19053
diff
changeset
|
312 GtkTreeModel *model; |
ffeb39523eb6
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19053
diff
changeset
|
313 |
ffeb39523eb6
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19053
diff
changeset
|
314 /* See if things are selected */ |
ffeb39523eb6
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19053
diff
changeset
|
315 if (gtk_tree_selection_get_selected(select, &model, &iter)) { |
ffeb39523eb6
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19053
diff
changeset
|
316 |
ffeb39523eb6
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19053
diff
changeset
|
317 gchar *id; |
ffeb39523eb6
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19053
diff
changeset
|
318 |
ffeb39523eb6
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19053
diff
changeset
|
319 /* Retrieve the selected hostname */ |
ffeb39523eb6
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19053
diff
changeset
|
320 gtk_tree_model_get(model, &iter, TPM_HOSTNAME_COLUMN, &id, -1); |
ffeb39523eb6
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19053
diff
changeset
|
321 |
ffeb39523eb6
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19053
diff
changeset
|
322 /* Now delete the thing */ |
ffeb39523eb6
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19053
diff
changeset
|
323 g_assert(purple_certificate_pool_delete(tpm_dat->tls_peers, id)); |
ffeb39523eb6
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19053
diff
changeset
|
324 |
ffeb39523eb6
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19053
diff
changeset
|
325 g_free(id); |
ffeb39523eb6
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19053
diff
changeset
|
326 } else { |
ffeb39523eb6
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19053
diff
changeset
|
327 purple_debug_warning("gtkcertmgr/tls_peers_mgmt", |
ffeb39523eb6
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19053
diff
changeset
|
328 "Delete clicked with no selection?\n"); |
ffeb39523eb6
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19053
diff
changeset
|
329 return; |
ffeb39523eb6
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19053
diff
changeset
|
330 } |
ffeb39523eb6
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19053
diff
changeset
|
331 } |
ffeb39523eb6
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19053
diff
changeset
|
332 |
19038
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
333 static GtkWidget * |
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
334 tls_peers_mgmt_build(void) |
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
335 { |
19041
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
336 GtkWidget *bbox; |
19052
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
337 GtkListStore *store; |
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
338 |
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
339 /* This block of variables will end up in tpm_dat */ |
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
340 GtkTreeView *listview; |
19055
e5981fc8733f
- Code cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19054
diff
changeset
|
341 GtkTreeSelection *select; |
19041
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
342 GtkWidget *importbutton; |
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
343 GtkWidget *exportbutton; |
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
344 GtkWidget *infobutton; |
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
345 GtkWidget *deletebutton; |
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
346 /** Element to return to the Certmgr window to put in the Notebook */ |
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
347 GtkWidget *mgmt_widget; |
19052
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
348 |
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
349 /* Create a struct to store context information about this window */ |
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
350 tpm_dat = g_new0(tls_peers_mgmt_data, 1); |
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
351 |
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
352 tpm_dat->mgmt_widget = mgmt_widget = |
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
353 gtk_hbox_new(FALSE, /* Non-homogeneous */ |
19058
ba99c1100e98
- HIG compliance improved
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19057
diff
changeset
|
354 PIDGIN_HIG_BORDER); |
19039
3054f7c6b30d
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19038
diff
changeset
|
355 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
|
356 |
3054f7c6b30d
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19038
diff
changeset
|
357 /* 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
|
358 is closed */ |
3054f7c6b30d
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19038
diff
changeset
|
359 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
|
360 G_CALLBACK(tls_peers_mgmt_destroy), NULL); |
19041
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
361 |
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
362 /* List view */ |
19042
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
363 store = gtk_list_store_new(TPM_N_COLUMNS, G_TYPE_STRING); |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
364 |
19052
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
365 tpm_dat->listview = listview = |
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
366 GTK_TREE_VIEW(gtk_tree_view_new_with_model(GTK_TREE_MODEL(store))); |
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
367 |
19042
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
368 { |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
369 GtkCellRenderer *renderer; |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
370 GtkTreeViewColumn *column; |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
371 |
19043
8026af6fbb3b
- Specify the selection mode on the tls_peers_mgmt listview (may not be
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19042
diff
changeset
|
372 /* Set up the display columns */ |
19042
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
373 renderer = gtk_cell_renderer_text_new(); |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
374 column = gtk_tree_view_column_new_with_attributes( |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
375 "Hostname", |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
376 renderer, |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
377 "text", TPM_HOSTNAME_COLUMN, |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
378 NULL); |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
379 gtk_tree_view_append_column(GTK_TREE_VIEW(listview), column); |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
380 } |
276c4b70d9cb
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19041
diff
changeset
|
381 |
19055
e5981fc8733f
- Code cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19054
diff
changeset
|
382 /* Get the treeview selector into the struct */ |
e5981fc8733f
- Code cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19054
diff
changeset
|
383 tpm_dat->listselect = select = |
e5981fc8733f
- Code cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19054
diff
changeset
|
384 gtk_tree_view_get_selection(GTK_TREE_VIEW(listview)); |
e5981fc8733f
- Code cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19054
diff
changeset
|
385 |
e5981fc8733f
- Code cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19054
diff
changeset
|
386 /* Force the selection mode */ |
e5981fc8733f
- Code cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19054
diff
changeset
|
387 gtk_tree_selection_set_mode(select, GTK_SELECTION_SINGLE); |
19056
9e747806bb07
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19055
diff
changeset
|
388 |
9e747806bb07
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19055
diff
changeset
|
389 /* Use a callback to enable/disable the buttons based on whether |
9e747806bb07
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19055
diff
changeset
|
390 something is selected */ |
9e747806bb07
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19055
diff
changeset
|
391 g_signal_connect(G_OBJECT(select), "changed", |
9e747806bb07
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19055
diff
changeset
|
392 G_CALLBACK(tls_peers_mgmt_select_chg_cb), NULL); |
19055
e5981fc8733f
- Code cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19054
diff
changeset
|
393 |
19052
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
394 gtk_box_pack_start(GTK_BOX(mgmt_widget), GTK_WIDGET(listview), |
19041
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
395 TRUE, TRUE, /* Take up lots of space */ |
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
396 0); /* TODO: this padding is wrong */ |
19052
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
397 gtk_widget_show(GTK_WIDGET(listview)); |
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
398 |
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
399 /* Fill the list for the first time */ |
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
400 tls_peers_mgmt_repopulate_list(); |
19041
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
401 |
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
402 /* Right-hand side controls box */ |
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
403 bbox = gtk_vbutton_box_new(); |
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
404 gtk_box_pack_end(GTK_BOX(mgmt_widget), bbox, |
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
405 FALSE, FALSE, /* Do not take up space */ |
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
406 0); /* TODO: this padding is probably wrong */ |
19058
ba99c1100e98
- HIG compliance improved
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19057
diff
changeset
|
407 gtk_box_set_spacing(GTK_BOX(bbox), PIDGIN_HIG_BOX_SPACE); |
19041
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
408 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_START); |
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
409 gtk_widget_show(bbox); |
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
410 |
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
411 /* Import button */ |
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
412 /* TODO: This is the wrong stock button */ |
19052
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
413 tpm_dat->importbutton = importbutton = |
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
414 gtk_button_new_from_stock(GTK_STOCK_ADD); |
19041
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
415 gtk_box_pack_start(GTK_BOX(bbox), importbutton, FALSE, FALSE, 0); |
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
416 gtk_widget_show(importbutton); |
19062
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
417 g_signal_connect(G_OBJECT(importbutton), "clicked", |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
418 G_CALLBACK(tls_peers_mgmt_import_cb), NULL); |
da88aa8f83ad
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19061
diff
changeset
|
419 |
19041
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
420 |
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
421 /* Export button */ |
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
422 /* TODO: This is the wrong stock button */ |
19052
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
423 tpm_dat->exportbutton = exportbutton = |
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
424 gtk_button_new_from_stock(GTK_STOCK_SAVE); |
19041
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
425 gtk_box_pack_start(GTK_BOX(bbox), exportbutton, FALSE, FALSE, 0); |
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
426 gtk_widget_show(exportbutton); |
19064
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
427 g_signal_connect(G_OBJECT(exportbutton), "clicked", |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
428 G_CALLBACK(tls_peers_mgmt_export_cb), NULL); |
f407244c4e57
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19062
diff
changeset
|
429 |
19041
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
430 |
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
431 /* Info button */ |
19052
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
432 tpm_dat->infobutton = infobutton = |
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
433 gtk_button_new_from_stock(GTK_STOCK_INFO); |
19041
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
434 gtk_box_pack_start(GTK_BOX(bbox), infobutton, FALSE, FALSE, 0); |
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
435 gtk_widget_show(infobutton); |
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
436 |
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
437 /* Delete button */ |
19052
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
438 tpm_dat->deletebutton = deletebutton = |
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
439 gtk_button_new_from_stock(GTK_STOCK_DELETE); |
19041
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
440 gtk_box_pack_start(GTK_BOX(bbox), deletebutton, FALSE, FALSE, 0); |
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
441 gtk_widget_show(deletebutton); |
19054
ffeb39523eb6
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19053
diff
changeset
|
442 g_signal_connect(G_OBJECT(deletebutton), "clicked", |
ffeb39523eb6
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19053
diff
changeset
|
443 G_CALLBACK(tls_peers_mgmt_delete_cb), NULL); |
19041
dd4444be5e26
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19039
diff
changeset
|
444 |
19057
3cc03c2801ed
- Delegate all button enabling/disabling in tls_peers_mgmt to its "is
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19056
diff
changeset
|
445 /* Call the "selection changed" callback, which will probably disable |
3cc03c2801ed
- Delegate all button enabling/disabling in tls_peers_mgmt to its "is
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19056
diff
changeset
|
446 all the buttons since nothing is selected yet */ |
3cc03c2801ed
- Delegate all button enabling/disabling in tls_peers_mgmt to its "is
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19056
diff
changeset
|
447 tls_peers_mgmt_select_chg_cb(select, NULL); |
19052
78f185af7952
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19043
diff
changeset
|
448 |
19053
95a8469cd1e3
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19052
diff
changeset
|
449 /* Bind us to the tls_peers pool */ |
95a8469cd1e3
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19052
diff
changeset
|
450 tpm_dat->tls_peers = purple_certificate_find_pool("x509", "tls_peers"); |
95a8469cd1e3
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19052
diff
changeset
|
451 |
95a8469cd1e3
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19052
diff
changeset
|
452 /**** libpurple signals ****/ |
95a8469cd1e3
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19052
diff
changeset
|
453 /* Respond to certificate add/remove by just reloading everything */ |
95a8469cd1e3
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19052
diff
changeset
|
454 purple_signal_connect(tpm_dat->tls_peers, "certificate-stored", |
95a8469cd1e3
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19052
diff
changeset
|
455 tpm_dat, PURPLE_CALLBACK(tls_peers_mgmt_mod_cb), |
95a8469cd1e3
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19052
diff
changeset
|
456 NULL); |
95a8469cd1e3
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19052
diff
changeset
|
457 purple_signal_connect(tpm_dat->tls_peers, "certificate-deleted", |
95a8469cd1e3
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19052
diff
changeset
|
458 tpm_dat, PURPLE_CALLBACK(tls_peers_mgmt_mod_cb), |
95a8469cd1e3
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19052
diff
changeset
|
459 NULL); |
95a8469cd1e3
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19052
diff
changeset
|
460 |
19039
3054f7c6b30d
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19038
diff
changeset
|
461 return mgmt_widget; |
19038
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
462 } |
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
463 |
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
464 PidginCertificateManager tls_peers_mgmt = { |
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
465 tls_peers_mgmt_build, /* Widget creation function */ |
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
466 N_("SSL Servers") |
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
467 }; |
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
468 |
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
469 /***************************************************************************** |
19035
284199d26040
- Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19032
diff
changeset
|
470 * GTK+ main certificate manager * |
284199d26040
- Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19032
diff
changeset
|
471 *****************************************************************************/ |
19031
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
472 typedef struct |
19015
720c61141f4b
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
473 { |
19031
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
474 GtkWidget *window; |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
475 GtkWidget *notebook; |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
476 |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
477 GtkWidget *closebutton; |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
478 } CertMgrDialog; |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
479 |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
480 /* 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
|
481 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
|
482 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
|
483 |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
484 static void |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
485 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
|
486 { |
19035
284199d26040
- Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19032
diff
changeset
|
487 /* TODO: Ignoring the arguments to this function may not be ideal, |
284199d26040
- Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19032
diff
changeset
|
488 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
|
489 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
|
490 } |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
491 |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
492 void |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
493 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
|
494 { |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
495 CertMgrDialog *dlg; |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
496 GtkWidget *win; |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
497 GtkWidget *vbox; |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
498 GtkWidget *bbox; |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
499 |
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
|
500 /* 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
|
501 { |
3f929a770f1b
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19015
diff
changeset
|
502 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
|
503 |
3f929a770f1b
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19015
diff
changeset
|
504 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
|
505 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
|
506 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
|
507 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
|
508 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
|
509 |
3f929a770f1b
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19015
diff
changeset
|
510 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
|
511 "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
|
512 "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
|
513 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
|
514 |
3f929a770f1b
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19015
diff
changeset
|
515 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
|
516 |
3f929a770f1b
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19015
diff
changeset
|
517 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
|
518 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
|
519 "- %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
|
520 (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
|
521 } /* 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
|
522 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
|
523 } /* 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
|
524 } |
19031
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
525 |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
526 |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
527 /* 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
|
528 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
|
529 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
|
530 return; |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
531 } |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
532 |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
533 /* 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
|
534 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
|
535 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
|
536 |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
537 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
|
538 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
|
539 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
|
540 "certmgr", /* Role */ |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
541 TRUE); /* Allow resizing */ |
19032
73172682eefd
- CertMgr window responds properly to delete_event
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19031
diff
changeset
|
542 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
|
543 G_CALLBACK(certmgr_close_cb), dlg); |
73172682eefd
- CertMgr window responds properly to delete_event
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19031
diff
changeset
|
544 |
19031
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
545 |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
546 /* 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
|
547 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
|
548 |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
549 /* Main vbox */ |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
550 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
|
551 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
|
552 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
|
553 |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
554 /* 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
|
555 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
|
556 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
|
557 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
|
558 0); |
19038
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
559 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
|
560 |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
561 /* 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
|
562 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
|
563 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
|
564 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
|
565 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
|
566 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
|
567 |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
568 /* Close button */ |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
569 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
|
570 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
|
571 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
|
572 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
|
573 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
|
574 |
19038
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
575 /* Add the defined certificate managers */ |
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
576 /* 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
|
577 /* TODO: Implement this correctly */ |
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
578 gtk_notebook_append_page(GTK_NOTEBOOK (dlg->notebook), |
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
579 (tls_peers_mgmt.build)(), |
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
580 gtk_label_new(_(tls_peers_mgmt.label)) ); |
5040616cace9
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19035
diff
changeset
|
581 |
19031
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
582 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
|
583 } |
19031
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
584 |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
585 void |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
586 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
|
587 { |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
588 /* 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
|
589 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
|
590 return; |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
591 } |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
592 |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
593 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
|
594 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
|
595 |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
596 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
|
597 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
|
598 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
|
599 |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
600 /* 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
|
601 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
|
602 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
|
603 |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
604 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
|
605 } |
8c3fecc32451
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19029
diff
changeset
|
606 } |