Tue, 28 Aug 2007 12:34:33 +0000
Fix printf(%s, NULL).
|
18650
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
1 | /* |
|
8a34ac83df75
- 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 |
|
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
3 | * @ingroup pidgin |
|
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
4 | * |
|
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
5 | * pidgin |
|
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
6 | * |
|
8a34ac83df75
- 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 |
|
8a34ac83df75
- 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 |
|
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
9 | * source distribution. |
|
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
10 | * |
|
8a34ac83df75
- 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 |
|
8a34ac83df75
- 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 |
|
8a34ac83df75
- 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 |
|
8a34ac83df75
- 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. |
|
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
15 | * |
|
8a34ac83df75
- 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, |
|
8a34ac83df75
- 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 |
|
8a34ac83df75
- 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 |
|
8a34ac83df75
- 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. |
|
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
20 | * |
|
8a34ac83df75
- 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 |
|
8a34ac83df75
- 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 |
|
8a34ac83df75
- 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 |
|
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
24 | * |
|
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
25 | */ |
|
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
26 | |
|
18815
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
27 | #include <glib.h> |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
28 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
29 | #include "core.h" |
|
18650
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
30 | #include "internal.h" |
|
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
31 | #include "pidgin.h" |
|
19667
4a8d8a6bd2b0
Make the gtkcert stuff compile on GTK+ older than 2.8
Daniel Atallah <datallah@pidgin.im>
parents:
19483
diff
changeset
|
32 | #include "pidginstock.h" |
|
18650
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
33 | |
|
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
34 | #include "certificate.h" |
|
18664
47b3d40a2eb8
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18650
diff
changeset
|
35 | #include "debug.h" |
|
18650
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
36 | #include "notify.h" |
|
19002
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
37 | #include "request.h" |
|
18650
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
38 | |
|
18815
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
39 | #include "gtkblist.h" |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
40 | #include "gtkutils.h" |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
41 | |
|
18650
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
42 | #include "gtkcertmgr.h" |
|
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
43 | |
|
18819
f0114d3a5bb1
- Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18816
diff
changeset
|
44 | /***************************************************************************** |
|
18822
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
45 | * X.509 tls_peers management interface * |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
46 | *****************************************************************************/ |
|
18823
da1d1529d4cd
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18822
diff
changeset
|
47 | |
|
18902
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
48 | typedef struct { |
|
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
49 | GtkWidget *mgmt_widget; |
|
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
50 | GtkTreeView *listview; |
|
18904
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
51 | GtkTreeSelection *listselect; |
|
18902
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
52 | GtkWidget *importbutton; |
|
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
53 | GtkWidget *exportbutton; |
|
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
54 | GtkWidget *infobutton; |
|
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
55 | GtkWidget *deletebutton; |
|
18903
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
56 | PurpleCertificatePool *tls_peers; |
|
18902
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
57 | } tls_peers_mgmt_data; |
|
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
58 | |
|
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
59 | tls_peers_mgmt_data *tpm_dat = NULL; |
|
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
60 | |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
61 | /* Columns |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
62 | See http://developer.gnome.org/doc/API/2.0/gtk/TreeWidget.html */ |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
63 | enum |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
64 | { |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
65 | TPM_HOSTNAME_COLUMN, |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
66 | TPM_N_COLUMNS |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
67 | }; |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
68 | |
|
18823
da1d1529d4cd
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18822
diff
changeset
|
69 | static void |
|
da1d1529d4cd
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18822
diff
changeset
|
70 | tls_peers_mgmt_destroy(GtkWidget *mgmt_widget, gpointer data) |
|
da1d1529d4cd
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18822
diff
changeset
|
71 | { |
|
da1d1529d4cd
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18822
diff
changeset
|
72 | purple_debug_info("certmgr", |
|
da1d1529d4cd
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18822
diff
changeset
|
73 | "tls peers self-destructs\n"); |
|
18902
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
74 | |
|
18903
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
75 | purple_signals_disconnect_by_handle(tpm_dat); |
|
19002
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
76 | purple_request_close_with_handle(tpm_dat); |
|
18902
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
77 | g_free(tpm_dat); tpm_dat = NULL; |
|
18823
da1d1529d4cd
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18822
diff
changeset
|
78 | } |
|
da1d1529d4cd
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18822
diff
changeset
|
79 | |
|
18892
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
80 | static void |
|
18902
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
81 | tls_peers_mgmt_repopulate_list(void) |
|
18892
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
82 | { |
|
18902
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
83 | GtkTreeView *listview = tpm_dat->listview; |
|
18892
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
84 | PurpleCertificatePool *tls_peers; |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
85 | GList *idlist, *l; |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
86 | |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
87 | GtkListStore *store = GTK_LIST_STORE( |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
88 | gtk_tree_view_get_model(GTK_TREE_VIEW(listview))); |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
89 | |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
90 | /* First, delete everything in the list */ |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
91 | gtk_list_store_clear(store); |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
92 | |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
93 | /* Locate the "tls_peers" pool */ |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
94 | tls_peers = purple_certificate_find_pool("x509", "tls_peers"); |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
95 | g_return_if_fail(tls_peers); |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
96 | |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
97 | /* Grab the loaded certificates */ |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
98 | idlist = purple_certificate_pool_get_idlist(tls_peers); |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
99 | |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
100 | /* Populate the listview */ |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
101 | for (l = idlist; l; l = l->next) { |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
102 | GtkTreeIter iter; |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
103 | gtk_list_store_append(store, &iter); |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
104 | |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
105 | gtk_list_store_set(GTK_LIST_STORE(store), &iter, |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
106 | TPM_HOSTNAME_COLUMN, l->data, |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
107 | -1); |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
108 | } |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
109 | purple_certificate_pool_destroy_idlist(idlist); |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
110 | } |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
111 | |
|
18903
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
112 | static void |
|
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
113 | tls_peers_mgmt_mod_cb(PurpleCertificatePool *pool, const gchar *id, gpointer data) |
|
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
114 | { |
|
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
115 | g_assert (pool == tpm_dat->tls_peers); |
|
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
116 | |
|
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
117 | tls_peers_mgmt_repopulate_list(); |
|
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
118 | } |
|
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
119 | |
|
18904
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
120 | static void |
|
18906
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
121 | tls_peers_mgmt_select_chg_cb(GtkTreeSelection *ignored, gpointer data) |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
122 | { |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
123 | GtkTreeSelection *select = tpm_dat->listselect; |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
124 | GtkTreeIter iter; |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
125 | GtkTreeModel *model; |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
126 | |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
127 | /* See if things are selected */ |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
128 | if (gtk_tree_selection_get_selected(select, &model, &iter)) { |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
129 | /* Enable buttons if something is selected */ |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
130 | gtk_widget_set_sensitive(GTK_WIDGET(tpm_dat->exportbutton), TRUE); |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
131 | gtk_widget_set_sensitive(GTK_WIDGET(tpm_dat->infobutton), TRUE); |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
132 | gtk_widget_set_sensitive(GTK_WIDGET(tpm_dat->deletebutton), TRUE); |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
133 | } else { |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
134 | /* Otherwise, disable them */ |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
135 | gtk_widget_set_sensitive(GTK_WIDGET(tpm_dat->exportbutton), FALSE); |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
136 | gtk_widget_set_sensitive(GTK_WIDGET(tpm_dat->infobutton), FALSE); |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
137 | gtk_widget_set_sensitive(GTK_WIDGET(tpm_dat->deletebutton), FALSE); |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
138 | |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
139 | } |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
140 | } |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
141 | |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
142 | static void |
|
19002
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
143 | tls_peers_mgmt_import_ok2_cb(gpointer data, const char *result) |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
144 | { |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
145 | PurpleCertificate *crt = (PurpleCertificate *) data; |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
146 | const char *id = result; |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
147 | |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
148 | /* TODO: Perhaps prompt if you're overwriting a cert? */ |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
149 | |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
150 | /* Drop the certificate into the pool */ |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
151 | purple_certificate_pool_store(tpm_dat->tls_peers, id, crt); |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
152 | |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
153 | /* And this certificate is not needed any more */ |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
154 | purple_certificate_destroy(crt); |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
155 | } |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
156 | |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
157 | static void |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
158 | tls_peers_mgmt_import_cancel2_cb(gpointer data, const char *result) |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
159 | { |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
160 | PurpleCertificate *crt = (PurpleCertificate *) data; |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
161 | purple_certificate_destroy(crt); |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
162 | } |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
163 | |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
164 | static void |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
165 | tls_peers_mgmt_import_ok_cb(gpointer data, const char *filename) |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
166 | { |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
167 | PurpleCertificateScheme *x509; |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
168 | PurpleCertificate *crt; |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
169 | |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
170 | /* Load the scheme of our tls_peers pool (ought to be x509) */ |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
171 | x509 = purple_certificate_pool_get_scheme(tpm_dat->tls_peers); |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
172 | |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
173 | /* Now load the certificate from disk */ |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
174 | crt = purple_certificate_import(x509, filename); |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
175 | |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
176 | /* Did it work? */ |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
177 | if (crt != NULL) { |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
178 | gchar *default_hostname; |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
179 | /* Get name to add to pool as */ |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
180 | /* Make a guess about what the hostname should be */ |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
181 | default_hostname = purple_certificate_get_subject_name(crt); |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
182 | /* TODO: Find a way to make sure that crt gets destroyed |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
183 | if the window gets closed unusually, such as by handle |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
184 | deletion */ |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
185 | /* TODO: Display some more information on the certificate? */ |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
186 | purple_request_input(tpm_dat, |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
187 | _("Certificate Import"), |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
188 | _("Specify a hostname"), |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
189 | _("Type the host name this certificate is for."), |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
190 | default_hostname, |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
191 | FALSE, /* Not multiline */ |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
192 | FALSE, /* Not masked? */ |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
193 | NULL, /* No hints? */ |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
194 | _("OK"), |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
195 | G_CALLBACK(tls_peers_mgmt_import_ok2_cb), |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
196 | _("Cancel"), |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
197 | G_CALLBACK(tls_peers_mgmt_import_cancel2_cb), |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
198 | NULL, NULL, NULL, /* No account/who/conv*/ |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
199 | crt /* Pass cert instance to callback*/ |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
200 | ); |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
201 | |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
202 | g_free(default_hostname); |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
203 | } else { |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
204 | /* Errors! Oh no! */ |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
205 | /* TODO: Perhaps find a way to be specific about what just |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
206 | went wrong? */ |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
207 | gchar * secondary; |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
208 | |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
209 | secondary = g_strdup_printf(_("File %s could not be imported.\nMake sure that the file is readable and in PEM format.\n"), filename); |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
210 | purple_notify_error(NULL, |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
211 | _("Certificate Import Error"), |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
212 | _("X.509 certificate import failed"), |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
213 | secondary); |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
214 | g_free(secondary); |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
215 | } |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
216 | } |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
217 | |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
218 | static void |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
219 | tls_peers_mgmt_import_cb(GtkWidget *button, gpointer data) |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
220 | { |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
221 | /* TODO: need to tell the user that we want a .PEM file! */ |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
222 | purple_request_file(tpm_dat, |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
223 | _("Select a PEM certificate"), |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
224 | "certificate.pem", |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
225 | FALSE, /* Not a save dialog */ |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
226 | G_CALLBACK(tls_peers_mgmt_import_ok_cb), |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
227 | NULL, /* Do nothing if cancelled */ |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
228 | NULL, NULL, NULL, NULL );/* No account,conv,etc. */ |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
229 | } |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
230 | |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
231 | static void |
|
19004
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
232 | tls_peers_mgmt_export_ok_cb(gpointer data, const char *filename) |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
233 | { |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
234 | PurpleCertificate *crt = (PurpleCertificate *) data; |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
235 | |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
236 | g_assert(filename); |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
237 | |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
238 | if (!purple_certificate_export(filename, crt)) { |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
239 | /* Errors! Oh no! */ |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
240 | /* TODO: Perhaps find a way to be specific about what just |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
241 | went wrong? */ |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
242 | gchar * secondary; |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
243 | |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
244 | secondary = g_strdup_printf(_("Export to file %s failed.\nCheck that you have write permission to the target path\n"), filename); |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
245 | purple_notify_error(NULL, |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
246 | _("Certificate Export Error"), |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
247 | _("X.509 certificate export failed"), |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
248 | secondary); |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
249 | g_free(secondary); |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
250 | } |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
251 | |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
252 | purple_certificate_destroy(crt); |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
253 | } |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
254 | |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
255 | static void |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
256 | tls_peers_mgmt_export_cancel_cb(gpointer data, const char *filename) |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
257 | { |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
258 | PurpleCertificate *crt = (PurpleCertificate *) data; |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
259 | /* Pressing cancel just frees the duplicated certificate */ |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
260 | purple_certificate_destroy(crt); |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
261 | } |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
262 | |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
263 | static void |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
264 | tls_peers_mgmt_export_cb(GtkWidget *button, gpointer data) |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
265 | { |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
266 | PurpleCertificate *crt; |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
267 | GtkTreeSelection *select = tpm_dat->listselect; |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
268 | GtkTreeIter iter; |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
269 | GtkTreeModel *model; |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
270 | gchar *id; |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
271 | |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
272 | /* See if things are selected */ |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
273 | if (!gtk_tree_selection_get_selected(select, &model, &iter)) { |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
274 | purple_debug_warning("gtkcertmgr/tls_peers_mgmt", |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
275 | "Export clicked with no selection?\n"); |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
276 | return; |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
277 | } |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
278 | |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
279 | /* Retrieve the selected hostname */ |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
280 | gtk_tree_model_get(model, &iter, TPM_HOSTNAME_COLUMN, &id, -1); |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
281 | |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
282 | /* Extract the certificate from the pool now to make sure it doesn't |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
283 | get deleted out from under us */ |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
284 | crt = purple_certificate_pool_retrieve(tpm_dat->tls_peers, id); |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
285 | |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
286 | if (NULL == crt) { |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
287 | purple_debug_error("gtkcertmgr/tls_peers_mgmt", |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
288 | "Id %s was not in the peers cache?!\n", |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
289 | id); |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
290 | g_free(id); |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
291 | return; |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
292 | } |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
293 | g_free(id); |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
294 | |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
295 | |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
296 | /* TODO: inform user that it will be a PEM? */ |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
297 | purple_request_file(tpm_dat, |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
298 | _("PEM X.509 Certificate Export"), |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
299 | "certificate.pem", |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
300 | TRUE, /* Is a save dialog */ |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
301 | G_CALLBACK(tls_peers_mgmt_export_ok_cb), |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
302 | G_CALLBACK(tls_peers_mgmt_export_cancel_cb), |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
303 | NULL, NULL, NULL, /* No account,conv,etc. */ |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
304 | crt); /* Pass the certificate on to the callback */ |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
305 | } |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
306 | |
|
19005
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
307 | static void |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
308 | tls_peers_mgmt_info_cb(GtkWidget *button, gpointer data) |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
309 | { |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
310 | GtkTreeSelection *select = tpm_dat->listselect; |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
311 | GtkTreeIter iter; |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
312 | GtkTreeModel *model; |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
313 | gchar *id; |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
314 | PurpleCertificate *crt; |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
315 | gchar *subject; |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
316 | GByteArray *fpr_sha1; |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
317 | gchar *fpr_sha1_asc; |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
318 | gchar *primary, *secondary; |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
319 | |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
320 | /* See if things are selected */ |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
321 | if (!gtk_tree_selection_get_selected(select, &model, &iter)) { |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
322 | purple_debug_warning("gtkcertmgr/tls_peers_mgmt", |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
323 | "Info clicked with no selection?\n"); |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
324 | return; |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
325 | } |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
326 | |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
327 | /* Retrieve the selected hostname */ |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
328 | gtk_tree_model_get(model, &iter, TPM_HOSTNAME_COLUMN, &id, -1); |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
329 | |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
330 | /* Now retrieve the certificate */ |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
331 | crt = purple_certificate_pool_retrieve(tpm_dat->tls_peers, id); |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
332 | g_return_if_fail(crt); |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
333 | |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
334 | /* Build a notification thing */ |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
335 | /* TODO: This needs a better GUI, but a notification will do for now */ |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
336 | primary = g_strdup_printf(_("Certificate for %s"), id); |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
337 | |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
338 | fpr_sha1 = purple_certificate_get_fingerprint_sha1(crt); |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
339 | fpr_sha1_asc = purple_base16_encode_chunked(fpr_sha1->data, |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
340 | fpr_sha1->len); |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
341 | subject = purple_certificate_get_subject_name(crt); |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
342 | |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
343 | secondary = g_strdup_printf(_("Common name: %s\n\nSHA1 fingerprint:\n%s"), subject, fpr_sha1_asc); |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
344 | |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
345 | purple_notify_info(tpm_dat, |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
346 | _("SSL Host Certificate"), primary, secondary ); |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
347 | |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
348 | g_free(primary); |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
349 | g_free(secondary); |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
350 | g_byte_array_free(fpr_sha1, TRUE); |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
351 | g_free(fpr_sha1_asc); |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
352 | g_free(subject); |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
353 | g_free(id); |
|
19360
07fb474c019a
- Fix a memleak
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19006
diff
changeset
|
354 | purple_certificate_destroy(crt); |
|
19005
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
355 | } |
|
19004
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
356 | |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
357 | static void |
|
19006
ffeab9433f97
- Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19005
diff
changeset
|
358 | tls_peers_mgmt_delete_confirm_cb(gchar *id, gint choice) |
|
ffeab9433f97
- Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19005
diff
changeset
|
359 | { |
|
ffeab9433f97
- Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19005
diff
changeset
|
360 | if (1 == choice) { |
|
ffeab9433f97
- Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19005
diff
changeset
|
361 | /* Yes, delete was confirmed */ |
|
ffeab9433f97
- Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19005
diff
changeset
|
362 | /* Now delete the thing */ |
|
19483
95243782d176
- Fix some overzealous g_asserts leading to a crash
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19360
diff
changeset
|
363 | if (!purple_certificate_pool_delete(tpm_dat->tls_peers, id)) { |
|
95243782d176
- Fix some overzealous g_asserts leading to a crash
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19360
diff
changeset
|
364 | purple_debug_warning("gtkcertmgr/tls_peers_mgmt", |
|
95243782d176
- Fix some overzealous g_asserts leading to a crash
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19360
diff
changeset
|
365 | "Deletion failed on id %s\n", |
|
95243782d176
- Fix some overzealous g_asserts leading to a crash
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19360
diff
changeset
|
366 | id); |
|
95243782d176
- Fix some overzealous g_asserts leading to a crash
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19360
diff
changeset
|
367 | }; |
|
19006
ffeab9433f97
- Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19005
diff
changeset
|
368 | } |
|
ffeab9433f97
- Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19005
diff
changeset
|
369 | |
|
ffeab9433f97
- Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19005
diff
changeset
|
370 | g_free(id); |
|
ffeab9433f97
- Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19005
diff
changeset
|
371 | } |
|
ffeab9433f97
- Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19005
diff
changeset
|
372 | |
|
ffeab9433f97
- Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19005
diff
changeset
|
373 | static void |
|
18904
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
374 | tls_peers_mgmt_delete_cb(GtkWidget *button, gpointer data) |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
375 | { |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
376 | GtkTreeSelection *select = tpm_dat->listselect; |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
377 | GtkTreeIter iter; |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
378 | GtkTreeModel *model; |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
379 | |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
380 | /* See if things are selected */ |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
381 | if (gtk_tree_selection_get_selected(select, &model, &iter)) { |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
382 | |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
383 | gchar *id; |
|
19006
ffeab9433f97
- Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19005
diff
changeset
|
384 | gchar *primary; |
|
18904
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
385 | |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
386 | /* Retrieve the selected hostname */ |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
387 | gtk_tree_model_get(model, &iter, TPM_HOSTNAME_COLUMN, &id, -1); |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
388 | |
|
19006
ffeab9433f97
- Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19005
diff
changeset
|
389 | /* Prompt to confirm deletion */ |
|
ffeab9433f97
- Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19005
diff
changeset
|
390 | primary = g_strdup_printf( |
|
ffeab9433f97
- Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19005
diff
changeset
|
391 | _("Really delete certificate for %s?"), id ); |
|
18904
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
392 | |
|
19006
ffeab9433f97
- Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19005
diff
changeset
|
393 | purple_request_yes_no(tpm_dat, _("Confirm certificate delete"), |
|
ffeab9433f97
- Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19005
diff
changeset
|
394 | primary, NULL, /* Can this be NULL? */ |
|
ffeab9433f97
- Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19005
diff
changeset
|
395 | 2, /* NO is default action */ |
|
ffeab9433f97
- Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19005
diff
changeset
|
396 | NULL, NULL, NULL, |
|
ffeab9433f97
- Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19005
diff
changeset
|
397 | id, /* id ownership passed to callback */ |
|
ffeab9433f97
- Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19005
diff
changeset
|
398 | tls_peers_mgmt_delete_confirm_cb, |
|
ffeab9433f97
- Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19005
diff
changeset
|
399 | tls_peers_mgmt_delete_confirm_cb ); |
|
ffeab9433f97
- Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19005
diff
changeset
|
400 | |
|
ffeab9433f97
- Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19005
diff
changeset
|
401 | g_free(primary); |
|
ffeab9433f97
- Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19005
diff
changeset
|
402 | |
|
18904
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
403 | } else { |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
404 | purple_debug_warning("gtkcertmgr/tls_peers_mgmt", |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
405 | "Delete clicked with no selection?\n"); |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
406 | return; |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
407 | } |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
408 | } |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
409 | |
|
18822
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
410 | static GtkWidget * |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
411 | tls_peers_mgmt_build(void) |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
412 | { |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
413 | GtkWidget *bbox; |
|
18902
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
414 | GtkListStore *store; |
|
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
415 | |
|
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
416 | /* This block of variables will end up in tpm_dat */ |
|
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
417 | GtkTreeView *listview; |
|
18905
d418c21a441a
- Code cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18904
diff
changeset
|
418 | GtkTreeSelection *select; |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
419 | GtkWidget *importbutton; |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
420 | GtkWidget *exportbutton; |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
421 | GtkWidget *infobutton; |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
422 | GtkWidget *deletebutton; |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
423 | /** Element to return to the Certmgr window to put in the Notebook */ |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
424 | GtkWidget *mgmt_widget; |
|
18902
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
425 | |
|
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
426 | /* Create a struct to store context information about this window */ |
|
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
427 | tpm_dat = g_new0(tls_peers_mgmt_data, 1); |
|
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
428 | |
|
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
429 | tpm_dat->mgmt_widget = mgmt_widget = |
|
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
430 | gtk_hbox_new(FALSE, /* Non-homogeneous */ |
|
18908
2453c24d2b22
- HIG compliance improved
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18907
diff
changeset
|
431 | PIDGIN_HIG_BORDER); |
|
18823
da1d1529d4cd
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18822
diff
changeset
|
432 | gtk_widget_show(mgmt_widget); |
|
da1d1529d4cd
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18822
diff
changeset
|
433 | |
|
da1d1529d4cd
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18822
diff
changeset
|
434 | /* Ensure that everything gets cleaned up when the dialog box |
|
da1d1529d4cd
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18822
diff
changeset
|
435 | is closed */ |
|
da1d1529d4cd
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18822
diff
changeset
|
436 | g_signal_connect(G_OBJECT(mgmt_widget), "destroy", |
|
da1d1529d4cd
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18822
diff
changeset
|
437 | G_CALLBACK(tls_peers_mgmt_destroy), NULL); |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
438 | |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
439 | /* List view */ |
|
18892
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
440 | store = gtk_list_store_new(TPM_N_COLUMNS, G_TYPE_STRING); |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
441 | |
|
18902
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
442 | tpm_dat->listview = listview = |
|
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
443 | GTK_TREE_VIEW(gtk_tree_view_new_with_model(GTK_TREE_MODEL(store))); |
|
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
444 | |
|
18892
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
445 | { |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
446 | GtkCellRenderer *renderer; |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
447 | GtkTreeViewColumn *column; |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
448 | |
|
18893
c3c789b74621
- Specify the selection mode on the tls_peers_mgmt listview (may not be
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18892
diff
changeset
|
449 | /* Set up the display columns */ |
|
18892
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
450 | renderer = gtk_cell_renderer_text_new(); |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
451 | column = gtk_tree_view_column_new_with_attributes( |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
452 | "Hostname", |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
453 | renderer, |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
454 | "text", TPM_HOSTNAME_COLUMN, |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
455 | NULL); |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
456 | gtk_tree_view_append_column(GTK_TREE_VIEW(listview), column); |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
457 | } |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
458 | |
|
18905
d418c21a441a
- Code cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18904
diff
changeset
|
459 | /* Get the treeview selector into the struct */ |
|
d418c21a441a
- Code cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18904
diff
changeset
|
460 | tpm_dat->listselect = select = |
|
d418c21a441a
- Code cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18904
diff
changeset
|
461 | gtk_tree_view_get_selection(GTK_TREE_VIEW(listview)); |
|
d418c21a441a
- Code cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18904
diff
changeset
|
462 | |
|
d418c21a441a
- Code cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18904
diff
changeset
|
463 | /* Force the selection mode */ |
|
d418c21a441a
- Code cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18904
diff
changeset
|
464 | gtk_tree_selection_set_mode(select, GTK_SELECTION_SINGLE); |
|
18906
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
465 | |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
466 | /* Use a callback to enable/disable the buttons based on whether |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
467 | something is selected */ |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
468 | g_signal_connect(G_OBJECT(select), "changed", |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
469 | G_CALLBACK(tls_peers_mgmt_select_chg_cb), NULL); |
|
18905
d418c21a441a
- Code cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18904
diff
changeset
|
470 | |
|
18902
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
471 | gtk_box_pack_start(GTK_BOX(mgmt_widget), GTK_WIDGET(listview), |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
472 | TRUE, TRUE, /* Take up lots of space */ |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
473 | 0); /* TODO: this padding is wrong */ |
|
18902
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
474 | gtk_widget_show(GTK_WIDGET(listview)); |
|
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
475 | |
|
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
476 | /* Fill the list for the first time */ |
|
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
477 | tls_peers_mgmt_repopulate_list(); |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
478 | |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
479 | /* Right-hand side controls box */ |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
480 | bbox = gtk_vbutton_box_new(); |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
481 | gtk_box_pack_end(GTK_BOX(mgmt_widget), bbox, |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
482 | FALSE, FALSE, /* Do not take up space */ |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
483 | 0); /* TODO: this padding is probably wrong */ |
|
18908
2453c24d2b22
- HIG compliance improved
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18907
diff
changeset
|
484 | gtk_box_set_spacing(GTK_BOX(bbox), PIDGIN_HIG_BOX_SPACE); |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
485 | gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_START); |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
486 | gtk_widget_show(bbox); |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
487 | |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
488 | /* Import button */ |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
489 | /* TODO: This is the wrong stock button */ |
|
18902
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
490 | tpm_dat->importbutton = importbutton = |
|
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
491 | gtk_button_new_from_stock(GTK_STOCK_ADD); |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
492 | gtk_box_pack_start(GTK_BOX(bbox), importbutton, FALSE, FALSE, 0); |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
493 | gtk_widget_show(importbutton); |
|
19002
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
494 | g_signal_connect(G_OBJECT(importbutton), "clicked", |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
495 | G_CALLBACK(tls_peers_mgmt_import_cb), NULL); |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
496 | |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
497 | |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
498 | /* Export button */ |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
499 | /* TODO: This is the wrong stock button */ |
|
18902
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
500 | tpm_dat->exportbutton = exportbutton = |
|
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
501 | gtk_button_new_from_stock(GTK_STOCK_SAVE); |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
502 | gtk_box_pack_start(GTK_BOX(bbox), exportbutton, FALSE, FALSE, 0); |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
503 | gtk_widget_show(exportbutton); |
|
19004
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
504 | g_signal_connect(G_OBJECT(exportbutton), "clicked", |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
505 | G_CALLBACK(tls_peers_mgmt_export_cb), NULL); |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
506 | |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
507 | |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
508 | /* Info button */ |
|
18902
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
509 | tpm_dat->infobutton = infobutton = |
|
19667
4a8d8a6bd2b0
Make the gtkcert stuff compile on GTK+ older than 2.8
Daniel Atallah <datallah@pidgin.im>
parents:
19483
diff
changeset
|
510 | gtk_button_new_from_stock(PIDGIN_STOCK_INFO); |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
511 | gtk_box_pack_start(GTK_BOX(bbox), infobutton, FALSE, FALSE, 0); |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
512 | gtk_widget_show(infobutton); |
|
19005
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
513 | g_signal_connect(G_OBJECT(infobutton), "clicked", |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
514 | G_CALLBACK(tls_peers_mgmt_info_cb), NULL); |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
515 | |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
516 | |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
517 | /* Delete button */ |
|
18902
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
518 | tpm_dat->deletebutton = deletebutton = |
|
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
519 | gtk_button_new_from_stock(GTK_STOCK_DELETE); |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
520 | gtk_box_pack_start(GTK_BOX(bbox), deletebutton, FALSE, FALSE, 0); |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
521 | gtk_widget_show(deletebutton); |
|
18904
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
522 | g_signal_connect(G_OBJECT(deletebutton), "clicked", |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
523 | G_CALLBACK(tls_peers_mgmt_delete_cb), NULL); |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
524 | |
|
18907
07343a83e67c
- Delegate all button enabling/disabling in tls_peers_mgmt to its "is
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18906
diff
changeset
|
525 | /* Call the "selection changed" callback, which will probably disable |
|
07343a83e67c
- Delegate all button enabling/disabling in tls_peers_mgmt to its "is
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18906
diff
changeset
|
526 | all the buttons since nothing is selected yet */ |
|
07343a83e67c
- Delegate all button enabling/disabling in tls_peers_mgmt to its "is
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18906
diff
changeset
|
527 | tls_peers_mgmt_select_chg_cb(select, NULL); |
|
18902
aaf51e9e305d
- Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18893
diff
changeset
|
528 | |
|
18903
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
529 | /* Bind us to the tls_peers pool */ |
|
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
530 | tpm_dat->tls_peers = purple_certificate_find_pool("x509", "tls_peers"); |
|
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
531 | |
|
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
532 | /**** libpurple signals ****/ |
|
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
533 | /* Respond to certificate add/remove by just reloading everything */ |
|
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
534 | purple_signal_connect(tpm_dat->tls_peers, "certificate-stored", |
|
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
535 | tpm_dat, PURPLE_CALLBACK(tls_peers_mgmt_mod_cb), |
|
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
536 | NULL); |
|
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
537 | purple_signal_connect(tpm_dat->tls_peers, "certificate-deleted", |
|
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
538 | tpm_dat, PURPLE_CALLBACK(tls_peers_mgmt_mod_cb), |
|
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
539 | NULL); |
|
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
540 | |
|
18823
da1d1529d4cd
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18822
diff
changeset
|
541 | return mgmt_widget; |
|
18822
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
542 | } |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
543 | |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
544 | PidginCertificateManager tls_peers_mgmt = { |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
545 | tls_peers_mgmt_build, /* Widget creation function */ |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
546 | N_("SSL Servers") |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
547 | }; |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
548 | |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
549 | /***************************************************************************** |
|
18819
f0114d3a5bb1
- Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18816
diff
changeset
|
550 | * GTK+ main certificate manager * |
|
f0114d3a5bb1
- Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18816
diff
changeset
|
551 | *****************************************************************************/ |
|
18815
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
552 | typedef struct |
|
18650
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
553 | { |
|
18815
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
554 | GtkWidget *window; |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
555 | GtkWidget *notebook; |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
556 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
557 | GtkWidget *closebutton; |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
558 | } CertMgrDialog; |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
559 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
560 | /* If a certificate manager window is open, this will point to it. |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
561 | So if it is set, don't open another one! */ |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
562 | CertMgrDialog *certmgr_dialog = NULL; |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
563 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
564 | static void |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
565 | certmgr_close_cb(GtkWidget *w, CertMgrDialog *dlg) |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
566 | { |
|
18819
f0114d3a5bb1
- Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18816
diff
changeset
|
567 | /* TODO: Ignoring the arguments to this function may not be ideal, |
|
f0114d3a5bb1
- Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18816
diff
changeset
|
568 | but there *should* only be "one dialog to rule them all" at a time*/ |
|
18815
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
569 | pidgin_certmgr_hide(); |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
570 | } |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
571 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
572 | void |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
573 | pidgin_certmgr_show(void) |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
574 | { |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
575 | CertMgrDialog *dlg; |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
576 | GtkWidget *win; |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
577 | GtkWidget *vbox; |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
578 | GtkWidget *bbox; |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
579 | |
|
18664
47b3d40a2eb8
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18650
diff
changeset
|
580 | /* Enumerate all the certificates on file */ |
|
47b3d40a2eb8
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18650
diff
changeset
|
581 | { |
|
47b3d40a2eb8
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18650
diff
changeset
|
582 | GList *idlist, *poollist; |
|
47b3d40a2eb8
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18650
diff
changeset
|
583 | |
|
47b3d40a2eb8
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18650
diff
changeset
|
584 | for ( poollist = purple_certificate_get_pools(); |
|
47b3d40a2eb8
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18650
diff
changeset
|
585 | poollist; |
|
47b3d40a2eb8
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18650
diff
changeset
|
586 | poollist = poollist->next ) { |
|
47b3d40a2eb8
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18650
diff
changeset
|
587 | PurpleCertificatePool *pool = poollist->data; |
|
47b3d40a2eb8
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18650
diff
changeset
|
588 | GList *l; |
|
47b3d40a2eb8
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18650
diff
changeset
|
589 | |
|
47b3d40a2eb8
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18650
diff
changeset
|
590 | purple_debug_info("gtkcertmgr", |
|
47b3d40a2eb8
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18650
diff
changeset
|
591 | "Pool %s found for scheme %s -" |
|
47b3d40a2eb8
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18650
diff
changeset
|
592 | "Enumerating certificates:\n", |
|
47b3d40a2eb8
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18650
diff
changeset
|
593 | pool->name, pool->scheme_name); |
|
47b3d40a2eb8
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18650
diff
changeset
|
594 | |
|
47b3d40a2eb8
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18650
diff
changeset
|
595 | idlist = purple_certificate_pool_get_idlist(pool); |
|
47b3d40a2eb8
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18650
diff
changeset
|
596 | |
|
47b3d40a2eb8
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18650
diff
changeset
|
597 | for (l=idlist; l; l = l->next) { |
|
47b3d40a2eb8
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18650
diff
changeset
|
598 | purple_debug_info("gtkcertmgr", |
|
47b3d40a2eb8
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18650
diff
changeset
|
599 | "- %s\n", |
|
19676
f4952bab5b50
Fix printf(%s, NULL).
Daniel Atallah <datallah@pidgin.im>
parents:
19667
diff
changeset
|
600 | l->data ? (gchar *) l->data : "(null)"); |
|
18664
47b3d40a2eb8
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18650
diff
changeset
|
601 | } /* idlist */ |
|
47b3d40a2eb8
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18650
diff
changeset
|
602 | purple_certificate_pool_destroy_idlist(idlist); |
|
47b3d40a2eb8
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18650
diff
changeset
|
603 | } /* poollist */ |
|
47b3d40a2eb8
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18650
diff
changeset
|
604 | } |
|
18815
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
605 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
606 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
607 | /* If the manager is already open, bring it to the front */ |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
608 | if (certmgr_dialog != NULL) { |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
609 | gtk_window_present(GTK_WINDOW(certmgr_dialog->window)); |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
610 | return; |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
611 | } |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
612 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
613 | /* Create the dialog, and set certmgr_dialog so we never create |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
614 | more than one at a time */ |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
615 | dlg = certmgr_dialog = g_new0(CertMgrDialog, 1); |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
616 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
617 | win = dlg->window = |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
618 | pidgin_create_window(_("Certificate Manager"),/* Title */ |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
619 | PIDGIN_HIG_BORDER, /*Window border*/ |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
620 | "certmgr", /* Role */ |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
621 | TRUE); /* Allow resizing */ |
|
18816
a6a20fabe100
- CertMgr window responds properly to delete_event
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18815
diff
changeset
|
622 | g_signal_connect(G_OBJECT(win), "delete_event", |
|
a6a20fabe100
- CertMgr window responds properly to delete_event
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18815
diff
changeset
|
623 | G_CALLBACK(certmgr_close_cb), dlg); |
|
a6a20fabe100
- CertMgr window responds properly to delete_event
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18815
diff
changeset
|
624 | |
|
18815
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
625 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
626 | /* TODO: Retrieve the user-set window size and use it */ |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
627 | gtk_window_set_default_size(GTK_WINDOW(win), 400, 400); |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
628 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
629 | /* Main vbox */ |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
630 | vbox = gtk_vbox_new( FALSE, PIDGIN_HIG_BORDER ); |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
631 | gtk_container_add(GTK_CONTAINER(win), vbox); |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
632 | gtk_widget_show(vbox); |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
633 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
634 | /* Notebook of various certificate managers */ |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
635 | dlg->notebook = gtk_notebook_new(); |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
636 | gtk_box_pack_start(GTK_BOX(vbox), dlg->notebook, |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
637 | TRUE, TRUE, /* Notebook should take extra space */ |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
638 | 0); |
|
18822
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
639 | gtk_widget_show(dlg->notebook); |
|
18815
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
640 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
641 | /* Box for the close button */ |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
642 | bbox = gtk_hbutton_box_new(); |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
643 | gtk_box_set_spacing(GTK_BOX(bbox), PIDGIN_HIG_BOX_SPACE); |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
644 | gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
645 | gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, TRUE, 0); |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
646 | gtk_widget_show(bbox); |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
647 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
648 | /* Close button */ |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
649 | dlg->closebutton = gtk_button_new_from_stock(GTK_STOCK_CLOSE); |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
650 | gtk_box_pack_start(GTK_BOX(bbox), dlg->closebutton, FALSE, FALSE, 0); |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
651 | gtk_widget_show(dlg->closebutton); |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
652 | g_signal_connect(G_OBJECT(dlg->closebutton), "clicked", |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
653 | G_CALLBACK(certmgr_close_cb), dlg); |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
654 | |
|
18822
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
655 | /* Add the defined certificate managers */ |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
656 | /* TODO: Find a way of determining whether each is shown or not */ |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
657 | /* TODO: Implement this correctly */ |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
658 | gtk_notebook_append_page(GTK_NOTEBOOK (dlg->notebook), |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
659 | (tls_peers_mgmt.build)(), |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
660 | gtk_label_new(_(tls_peers_mgmt.label)) ); |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
661 | |
|
18815
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
662 | gtk_widget_show(win); |
|
18650
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
663 | } |
|
18815
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
664 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
665 | void |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
666 | pidgin_certmgr_hide(void) |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
667 | { |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
668 | /* If it isn't open, do nothing */ |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
669 | if (certmgr_dialog == NULL) { |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
670 | return; |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
671 | } |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
672 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
673 | purple_signals_disconnect_by_handle(certmgr_dialog); |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
674 | purple_prefs_disconnect_by_handle(certmgr_dialog); |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
675 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
676 | gtk_widget_destroy(certmgr_dialog->window); |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
677 | g_free(certmgr_dialog); |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
678 | certmgr_dialog = NULL; |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
679 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
680 | /* If this was the only window left, quit */ |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
681 | if (PIDGIN_BLIST(purple_get_blist())->window == NULL && |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
682 | purple_connections_get_all() == NULL) { |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
683 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
684 | purple_core_quit(); |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
685 | } |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
686 | } |