Mon, 30 Jul 2007 07:20:04 +0000
- The tls_peers_mgmt import button should be enabled whether there are
any certificates already or not
|
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" |
|
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
32 | |
|
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
33 | #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
|
34 | #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
|
35 | #include "notify.h" |
|
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
36 | |
|
18815
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
37 | #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
|
38 | #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
|
39 | |
|
18650
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
40 | #include "gtkcertmgr.h" |
|
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
41 | |
|
18819
f0114d3a5bb1
- Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18816
diff
changeset
|
42 | /***************************************************************************** |
|
18822
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
43 | * X.509 tls_peers management interface * |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
44 | *****************************************************************************/ |
|
18823
da1d1529d4cd
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18822
diff
changeset
|
45 | |
|
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
|
46 | 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
|
47 | 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
|
48 | GtkTreeView *listview; |
|
18904
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
49 | 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
|
50 | 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
|
51 | 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
|
52 | 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
|
53 | GtkWidget *deletebutton; |
|
18903
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
54 | 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
|
55 | } 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
|
56 | |
|
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 *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
|
58 | |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
59 | /* Columns |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
60 | 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
|
61 | enum |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
62 | { |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
63 | TPM_HOSTNAME_COLUMN, |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
64 | TPM_N_COLUMNS |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
65 | }; |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
66 | |
|
18823
da1d1529d4cd
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18822
diff
changeset
|
67 | static void |
|
da1d1529d4cd
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18822
diff
changeset
|
68 | 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
|
69 | { |
|
da1d1529d4cd
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18822
diff
changeset
|
70 | 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
|
71 | "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
|
72 | |
|
18903
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
73 | purple_signals_disconnect_by_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
|
74 | 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
|
75 | } |
|
da1d1529d4cd
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18822
diff
changeset
|
76 | |
|
18892
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
77 | 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
|
78 | 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
|
79 | { |
|
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
|
80 | GtkTreeView *listview = tpm_dat->listview; |
|
18892
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
81 | PurpleCertificatePool *tls_peers; |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
82 | GList *idlist, *l; |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
83 | |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
84 | GtkListStore *store = GTK_LIST_STORE( |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
85 | 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
|
86 | |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
87 | /* First, delete everything in the list */ |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
88 | gtk_list_store_clear(store); |
|
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 | /* Locate the "tls_peers" pool */ |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
91 | 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
|
92 | g_return_if_fail(tls_peers); |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
93 | |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
94 | /* Grab the loaded certificates */ |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
95 | 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
|
96 | |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
97 | /* Populate the listview */ |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
98 | 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
|
99 | GtkTreeIter iter; |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
100 | gtk_list_store_append(store, &iter); |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
101 | |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
102 | 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
|
103 | TPM_HOSTNAME_COLUMN, l->data, |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
104 | -1); |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
105 | } |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
106 | purple_certificate_pool_destroy_idlist(idlist); |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
107 | } |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
108 | |
|
18903
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
109 | static void |
|
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
110 | 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
|
111 | { |
|
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
112 | 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
|
113 | |
|
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
114 | tls_peers_mgmt_repopulate_list(); |
|
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
115 | } |
|
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
116 | |
|
18904
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
117 | static void |
|
18906
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
118 | tls_peers_mgmt_select_chg_cb(GtkTreeSelection *ignored, gpointer data) |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
119 | { |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
120 | GtkTreeSelection *select = tpm_dat->listselect; |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
121 | GtkTreeIter iter; |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
122 | GtkTreeModel *model; |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
123 | |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
124 | /* See if things are selected */ |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
125 | if (gtk_tree_selection_get_selected(select, &model, &iter)) { |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
126 | /* Enable buttons if something is selected */ |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
127 | gtk_widget_set_sensitive(GTK_WIDGET(tpm_dat->exportbutton), TRUE); |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
128 | gtk_widget_set_sensitive(GTK_WIDGET(tpm_dat->infobutton), TRUE); |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
129 | gtk_widget_set_sensitive(GTK_WIDGET(tpm_dat->deletebutton), TRUE); |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
130 | } else { |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
131 | /* Otherwise, disable them */ |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
132 | gtk_widget_set_sensitive(GTK_WIDGET(tpm_dat->exportbutton), FALSE); |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
133 | gtk_widget_set_sensitive(GTK_WIDGET(tpm_dat->infobutton), FALSE); |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
134 | gtk_widget_set_sensitive(GTK_WIDGET(tpm_dat->deletebutton), FALSE); |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
135 | |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
136 | } |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
137 | } |
|
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 | static void |
|
18904
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
140 | 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
|
141 | { |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
142 | GtkTreeSelection *select = tpm_dat->listselect; |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
143 | GtkTreeIter iter; |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
144 | GtkTreeModel *model; |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
145 | |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
146 | /* See if things are selected */ |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
147 | 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
|
148 | |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
149 | gchar *id; |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
150 | |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
151 | /* Retrieve the selected hostname */ |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
152 | 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
|
153 | |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
154 | /* Now delete the thing */ |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
155 | g_assert(purple_certificate_pool_delete(tpm_dat->tls_peers, id)); |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
156 | |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
157 | g_free(id); |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
158 | } else { |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
159 | 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
|
160 | "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
|
161 | return; |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
162 | } |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
163 | } |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
164 | |
|
18822
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
165 | static GtkWidget * |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
166 | tls_peers_mgmt_build(void) |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
167 | { |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
168 | 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
|
169 | 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
|
170 | |
|
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
|
171 | /* 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
|
172 | GtkTreeView *listview; |
|
18905
d418c21a441a
- Code cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18904
diff
changeset
|
173 | GtkTreeSelection *select; |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
174 | GtkWidget *importbutton; |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
175 | GtkWidget *exportbutton; |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
176 | GtkWidget *infobutton; |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
177 | GtkWidget *deletebutton; |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
178 | /** 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
|
179 | 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
|
180 | |
|
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
|
181 | /* 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
|
182 | 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
|
183 | |
|
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
|
184 | 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
|
185 | gtk_hbox_new(FALSE, /* Non-homogeneous */ |
|
18908
2453c24d2b22
- HIG compliance improved
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18907
diff
changeset
|
186 | 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
|
187 | 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
|
188 | |
|
da1d1529d4cd
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18822
diff
changeset
|
189 | /* 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
|
190 | is closed */ |
|
da1d1529d4cd
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18822
diff
changeset
|
191 | 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
|
192 | G_CALLBACK(tls_peers_mgmt_destroy), NULL); |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
193 | |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
194 | /* List view */ |
|
18892
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
195 | 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
|
196 | |
|
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
|
197 | 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
|
198 | 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
|
199 | |
|
18892
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
200 | { |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
201 | GtkCellRenderer *renderer; |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
202 | GtkTreeViewColumn *column; |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
203 | |
|
18893
c3c789b74621
- Specify the selection mode on the tls_peers_mgmt listview (may not be
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18892
diff
changeset
|
204 | /* Set up the display columns */ |
|
18892
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
205 | renderer = gtk_cell_renderer_text_new(); |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
206 | 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
|
207 | "Hostname", |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
208 | renderer, |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
209 | "text", TPM_HOSTNAME_COLUMN, |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
210 | NULL); |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
211 | 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
|
212 | } |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
213 | |
|
18905
d418c21a441a
- Code cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18904
diff
changeset
|
214 | /* Get the treeview selector into the struct */ |
|
d418c21a441a
- Code cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18904
diff
changeset
|
215 | tpm_dat->listselect = select = |
|
d418c21a441a
- Code cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18904
diff
changeset
|
216 | gtk_tree_view_get_selection(GTK_TREE_VIEW(listview)); |
|
d418c21a441a
- Code cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18904
diff
changeset
|
217 | |
|
d418c21a441a
- Code cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18904
diff
changeset
|
218 | /* Force the selection mode */ |
|
d418c21a441a
- Code cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18904
diff
changeset
|
219 | gtk_tree_selection_set_mode(select, GTK_SELECTION_SINGLE); |
|
18906
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
220 | |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
221 | /* 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
|
222 | something is selected */ |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
223 | g_signal_connect(G_OBJECT(select), "changed", |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
224 | G_CALLBACK(tls_peers_mgmt_select_chg_cb), NULL); |
|
18905
d418c21a441a
- Code cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18904
diff
changeset
|
225 | |
|
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
|
226 | 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
|
227 | TRUE, TRUE, /* Take up lots of space */ |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
228 | 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
|
229 | 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
|
230 | |
|
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
|
231 | /* 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
|
232 | tls_peers_mgmt_repopulate_list(); |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
233 | |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
234 | /* Right-hand side controls box */ |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
235 | bbox = gtk_vbutton_box_new(); |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
236 | gtk_box_pack_end(GTK_BOX(mgmt_widget), bbox, |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
237 | FALSE, FALSE, /* Do not take up space */ |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
238 | 0); /* TODO: this padding is probably wrong */ |
|
18908
2453c24d2b22
- HIG compliance improved
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18907
diff
changeset
|
239 | 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
|
240 | 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
|
241 | gtk_widget_show(bbox); |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
242 | |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
243 | /* Import button */ |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
244 | /* 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
|
245 | 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
|
246 | gtk_button_new_from_stock(GTK_STOCK_ADD); |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
247 | 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
|
248 | gtk_widget_show(importbutton); |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
249 | |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
250 | /* Export button */ |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
251 | /* 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
|
252 | 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
|
253 | gtk_button_new_from_stock(GTK_STOCK_SAVE); |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
254 | 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
|
255 | gtk_widget_show(exportbutton); |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
256 | |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
257 | /* 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
|
258 | tpm_dat->infobutton = 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
|
259 | gtk_button_new_from_stock(GTK_STOCK_INFO); |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
260 | 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
|
261 | gtk_widget_show(infobutton); |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
262 | |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
263 | /* 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
|
264 | 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
|
265 | gtk_button_new_from_stock(GTK_STOCK_DELETE); |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
266 | 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
|
267 | gtk_widget_show(deletebutton); |
|
18904
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
268 | 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
|
269 | G_CALLBACK(tls_peers_mgmt_delete_cb), NULL); |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
270 | |
|
18907
07343a83e67c
- Delegate all button enabling/disabling in tls_peers_mgmt to its "is
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18906
diff
changeset
|
271 | /* 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
|
272 | 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
|
273 | 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
|
274 | |
|
18903
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
275 | /* 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
|
276 | 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
|
277 | |
|
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
278 | /**** libpurple signals ****/ |
|
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
279 | /* 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
|
280 | 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
|
281 | 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
|
282 | NULL); |
|
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
283 | 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
|
284 | 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
|
285 | NULL); |
|
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
286 | |
|
18823
da1d1529d4cd
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18822
diff
changeset
|
287 | return mgmt_widget; |
|
18822
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
288 | } |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
289 | |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
290 | PidginCertificateManager tls_peers_mgmt = { |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
291 | tls_peers_mgmt_build, /* Widget creation function */ |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
292 | N_("SSL Servers") |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
293 | }; |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
294 | |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
295 | /***************************************************************************** |
|
18819
f0114d3a5bb1
- Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18816
diff
changeset
|
296 | * GTK+ main certificate manager * |
|
f0114d3a5bb1
- Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18816
diff
changeset
|
297 | *****************************************************************************/ |
|
18815
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
298 | typedef struct |
|
18650
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
299 | { |
|
18815
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
300 | GtkWidget *window; |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
301 | GtkWidget *notebook; |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
302 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
303 | GtkWidget *closebutton; |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
304 | } CertMgrDialog; |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
305 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
306 | /* 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
|
307 | 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
|
308 | 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
|
309 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
310 | static void |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
311 | 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
|
312 | { |
|
18819
f0114d3a5bb1
- Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18816
diff
changeset
|
313 | /* TODO: Ignoring the arguments to this function may not be ideal, |
|
f0114d3a5bb1
- Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18816
diff
changeset
|
314 | 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
|
315 | 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
|
316 | } |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
317 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
318 | void |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
319 | 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
|
320 | { |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
321 | CertMgrDialog *dlg; |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
322 | GtkWidget *win; |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
323 | GtkWidget *vbox; |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
324 | GtkWidget *bbox; |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
325 | |
|
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
|
326 | /* 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
|
327 | { |
|
47b3d40a2eb8
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18650
diff
changeset
|
328 | 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
|
329 | |
|
47b3d40a2eb8
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18650
diff
changeset
|
330 | 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
|
331 | 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
|
332 | 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
|
333 | 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
|
334 | 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
|
335 | |
|
47b3d40a2eb8
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18650
diff
changeset
|
336 | 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
|
337 | "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
|
338 | "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
|
339 | 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
|
340 | |
|
47b3d40a2eb8
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18650
diff
changeset
|
341 | 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
|
342 | |
|
47b3d40a2eb8
- Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18650
diff
changeset
|
343 | 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
|
344 | 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
|
345 | "- %s\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
|
346 | (gchar *) l->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
|
347 | } /* 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
|
348 | 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
|
349 | } /* 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
|
350 | } |
|
18815
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
351 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
352 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
353 | /* 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
|
354 | 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
|
355 | 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
|
356 | return; |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
357 | } |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
358 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
359 | /* 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
|
360 | 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
|
361 | 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
|
362 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
363 | 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
|
364 | 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
|
365 | 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
|
366 | "certmgr", /* Role */ |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
367 | TRUE); /* Allow resizing */ |
|
18816
a6a20fabe100
- CertMgr window responds properly to delete_event
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18815
diff
changeset
|
368 | 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
|
369 | G_CALLBACK(certmgr_close_cb), dlg); |
|
a6a20fabe100
- CertMgr window responds properly to delete_event
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18815
diff
changeset
|
370 | |
|
18815
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
371 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
372 | /* 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
|
373 | 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
|
374 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
375 | /* Main vbox */ |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
376 | 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
|
377 | 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
|
378 | 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
|
379 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
380 | /* 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
|
381 | 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
|
382 | 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
|
383 | 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
|
384 | 0); |
|
18822
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
385 | 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
|
386 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
387 | /* 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
|
388 | 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
|
389 | 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
|
390 | 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
|
391 | 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
|
392 | 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
|
393 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
394 | /* Close button */ |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
395 | 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
|
396 | 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
|
397 | 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
|
398 | 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
|
399 | 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
|
400 | |
|
18822
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
401 | /* Add the defined certificate managers */ |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
402 | /* 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
|
403 | /* TODO: Implement this correctly */ |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
404 | gtk_notebook_append_page(GTK_NOTEBOOK (dlg->notebook), |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
405 | (tls_peers_mgmt.build)(), |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
406 | gtk_label_new(_(tls_peers_mgmt.label)) ); |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
407 | |
|
18815
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
408 | 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
|
409 | } |
|
18815
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
410 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
411 | void |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
412 | 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
|
413 | { |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
414 | /* 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
|
415 | 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
|
416 | return; |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
417 | } |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
418 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
419 | 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
|
420 | 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
|
421 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
422 | 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
|
423 | 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
|
424 | 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
|
425 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
426 | /* 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
|
427 | 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
|
428 | 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
|
429 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
430 | 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
|
431 | } |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
432 | } |