Tue, 08 May 2018 05:31:09 -0400
Fix build with plugins disabled.
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19981
diff
changeset
|
1 | /* pidgin |
|
18650
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
2 | * |
|
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
3 | * 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
|
4 | * 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
|
5 | * source distribution. |
|
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 | * 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
|
8 | * 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
|
9 | * 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
|
10 | * (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
|
11 | * |
|
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
12 | * 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
|
13 | * 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
|
14 | * 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
|
15 | * 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
|
16 | * |
|
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
17 | * 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
|
18 | * along with this program; if not, write to the Free Software |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19829
diff
changeset
|
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
18650
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 | */ |
|
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
22 | |
|
28981
4e3922ab4844
Include 'internal.h' before all other headers to make some non-gcc compilers happy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28196
diff
changeset
|
23 | #include "internal.h" |
|
18815
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
24 | #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
|
25 | #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
|
26 | #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
|
27 | |
|
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
|
28 | #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
|
29 | #include "notify.h" |
|
19002
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
30 | #include "request.h" |
|
37632
4879ef4db7cf
Move Tls Certificate parsing code into tls-certificate-info.[ch]
Mike Ruprecht <cmaiku@gmail.com>
parents:
37625
diff
changeset
|
31 | #include "tls-certificate.h" |
|
4879ef4db7cf
Move Tls Certificate parsing code into tls-certificate-info.[ch]
Mike Ruprecht <cmaiku@gmail.com>
parents:
37625
diff
changeset
|
32 | #include "tls-certificate-info.h" |
|
18650
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
33 | |
|
35527
707c3c2b2c8a
Fix more gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35454
diff
changeset
|
34 | #include "gtk3compat.h" |
|
18815
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
35 | #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
|
36 | #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
|
37 | |
|
18650
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
38 | #include "gtkcertmgr.h" |
|
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
39 | |
|
18819
f0114d3a5bb1
- Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18816
diff
changeset
|
40 | /***************************************************************************** |
|
37625
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
41 | * X.509 certificate management interface * |
|
18822
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
42 | *****************************************************************************/ |
|
18823
da1d1529d4cd
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18822
diff
changeset
|
43 | |
|
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
|
44 | 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
|
45 | 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
|
46 | GtkTreeView *listview; |
|
18904
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
47 | 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
|
48 | 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
|
49 | 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
|
50 | 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
|
51 | GtkWidget *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
|
52 | } 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
|
53 | |
|
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 | 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
|
55 | |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
56 | /* Columns |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
57 | 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
|
58 | enum |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
59 | { |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
60 | TPM_HOSTNAME_COLUMN, |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
61 | TPM_N_COLUMNS |
|
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 | |
|
18823
da1d1529d4cd
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18822
diff
changeset
|
64 | static void |
|
da1d1529d4cd
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18822
diff
changeset
|
65 | 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
|
66 | { |
|
da1d1529d4cd
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18822
diff
changeset
|
67 | 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
|
68 | "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
|
69 | |
|
18903
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
70 | 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
|
71 | 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
|
72 | 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
|
73 | } |
|
da1d1529d4cd
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18822
diff
changeset
|
74 | |
|
18892
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
75 | 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
|
76 | 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
|
77 | { |
|
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 | GtkTreeView *listview = tpm_dat->listview; |
|
18892
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
79 | GList *idlist, *l; |
|
22368
62b8e2bb96a7
Remove whitespace on empty lions
Mark Doliner <markdoliner@pidgin.im>
parents:
22269
diff
changeset
|
80 | |
|
18892
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
81 | GtkListStore *store = GTK_LIST_STORE( |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
82 | gtk_tree_view_get_model(GTK_TREE_VIEW(listview))); |
|
22368
62b8e2bb96a7
Remove whitespace on empty lions
Mark Doliner <markdoliner@pidgin.im>
parents:
22269
diff
changeset
|
83 | |
|
18892
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
84 | /* First, delete everything in the list */ |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
85 | gtk_list_store_clear(store); |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
86 | |
|
37625
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
87 | /* Grab the available certificates */ |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
88 | idlist = purple_tls_certificate_list_ids(); |
|
18892
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 | /* Populate the listview */ |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
91 | 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
|
92 | GtkTreeIter iter; |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
93 | gtk_list_store_append(store, &iter); |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
94 | |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
95 | 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
|
96 | TPM_HOSTNAME_COLUMN, l->data, |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
97 | -1); |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
98 | } |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
99 | |
|
37625
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
100 | purple_tls_certificate_free_ids(idlist); |
|
18903
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
101 | } |
|
52cde74fd51f
- tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18902
diff
changeset
|
102 | |
|
18904
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
103 | static void |
|
18906
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
104 | tls_peers_mgmt_select_chg_cb(GtkTreeSelection *ignored, gpointer data) |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
105 | { |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
106 | GtkTreeSelection *select = tpm_dat->listselect; |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
107 | GtkTreeIter iter; |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
108 | GtkTreeModel *model; |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
109 | |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
110 | /* See if things are selected */ |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
111 | if (gtk_tree_selection_get_selected(select, &model, &iter)) { |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
112 | /* Enable buttons if something is selected */ |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
113 | gtk_widget_set_sensitive(GTK_WIDGET(tpm_dat->exportbutton), TRUE); |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
114 | gtk_widget_set_sensitive(GTK_WIDGET(tpm_dat->infobutton), TRUE); |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
115 | gtk_widget_set_sensitive(GTK_WIDGET(tpm_dat->deletebutton), TRUE); |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
116 | } else { |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
117 | /* Otherwise, disable them */ |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
118 | gtk_widget_set_sensitive(GTK_WIDGET(tpm_dat->exportbutton), FALSE); |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
119 | gtk_widget_set_sensitive(GTK_WIDGET(tpm_dat->infobutton), FALSE); |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
120 | gtk_widget_set_sensitive(GTK_WIDGET(tpm_dat->deletebutton), FALSE); |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
121 | |
|
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 | } |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
124 | |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
125 | static void |
|
19002
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
126 | 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
|
127 | { |
|
37625
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
128 | GTlsCertificate *crt = data; |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
129 | GError *error = NULL; |
|
19002
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
130 | |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
131 | /* 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
|
132 | |
|
37625
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
133 | /* Trust the certificate */ |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
134 | if (result && *result) { |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
135 | if(!purple_tls_certificate_trust(result, crt, &error)) { |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
136 | purple_debug_error("gtkcertmgr/tls_peers_mgmt", |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
137 | "Error trusting certificate '%s': %s", |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
138 | result, error->message); |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
139 | g_clear_error(&error); |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
140 | } |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
141 | |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
142 | tls_peers_mgmt_repopulate_list(); |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
143 | } |
|
19002
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 | /* And this certificate is not needed any more */ |
|
37625
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
146 | g_object_unref(crt); |
|
19002
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 | |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
149 | static void |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
150 | 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
|
151 | { |
|
37625
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
152 | GTlsCertificate *crt = data; |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
153 | g_object_unref(crt); |
|
19002
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
154 | } |
|
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 | static void |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
157 | 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
|
158 | { |
|
37625
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
159 | GTlsCertificate *crt; |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
160 | GError *error = NULL; |
|
19002
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
161 | |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
162 | /* Now load the certificate from disk */ |
|
37625
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
163 | crt = g_tls_certificate_new_from_file(filename, &error); |
|
19002
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
164 | |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
165 | /* Did it work? */ |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
166 | if (crt != NULL) { |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
167 | gchar *default_hostname; |
|
37625
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
168 | PurpleTlsCertificateInfo *info; |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
169 | |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
170 | /* Get name to add trust as */ |
|
19002
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
171 | /* Make a guess about what the hostname should be */ |
|
37625
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
172 | info = purple_tls_certificate_get_info(crt); |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
173 | default_hostname = purple_tls_certificate_info_get_subject_name(info); |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
174 | purple_tls_certificate_info_free(info); |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
175 | |
|
19002
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
176 | /* 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
|
177 | 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
|
178 | deletion */ |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
179 | /* TODO: Display some more information on the certificate? */ |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
180 | purple_request_input(tpm_dat, |
|
19002
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
181 | _("Certificate Import"), |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
182 | _("Specify a hostname"), |
|
27525
579b9d64b364
A semi-random collection of English spelling and grammatical changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22385
diff
changeset
|
183 | _("Type the host name for this certificate."), |
|
19002
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
184 | default_hostname, |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
185 | FALSE, /* Not multiline */ |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
186 | FALSE, /* Not masked? */ |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
187 | NULL, /* No hints? */ |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
188 | _("OK"), |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
189 | 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
|
190 | _("Cancel"), |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
191 | G_CALLBACK(tls_peers_mgmt_import_cancel2_cb), |
|
34329
ddbc1337332c
Request API refactoring: introduce PurpleRequestCommonParameters and switch purple_request_input to it
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33170
diff
changeset
|
192 | NULL, /* No additional parameters */ |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
193 | crt /* Pass cert instance to callback*/ |
|
19002
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
194 | ); |
|
22368
62b8e2bb96a7
Remove whitespace on empty lions
Mark Doliner <markdoliner@pidgin.im>
parents:
22269
diff
changeset
|
195 | |
|
19002
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
196 | g_free(default_hostname); |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
197 | } else { |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
198 | /* Errors! Oh no! */ |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
199 | /* 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
|
200 | went wrong? */ |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
201 | gchar * secondary; |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
202 | |
|
37625
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
203 | purple_debug_warning("gtkcertmgr/tls_peers_mgmt", |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
204 | "File %s couldn't be imported: %s", |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
205 | filename, error->message); |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
206 | g_clear_error(&error); |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
207 | |
|
19002
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
208 | secondary = g_strdup_printf(_("File %s could not be imported.\nMake sure that the file is readable and in PEM format.\n"), filename); |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
209 | purple_notify_error(NULL, |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
210 | _("Certificate Import Error"), |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
211 | _("X.509 certificate import failed"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34333
diff
changeset
|
212 | secondary, NULL); |
|
19002
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
213 | g_free(secondary); |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
214 | } |
|
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 | static void |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
218 | 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
|
219 | { |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
220 | /* TODO: need to tell the user that we want a .PEM file! */ |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
221 | purple_request_file(tpm_dat, |
|
19002
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
222 | _("Select a PEM certificate"), |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
223 | "certificate.pem", |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
224 | FALSE, /* Not a save dialog */ |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
225 | 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
|
226 | NULL, /* Do nothing if cancelled */ |
|
34333
b92698241603
Request API refactoring: switch purple_request_file to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
227 | NULL, NULL); /* No extra parameters */ |
|
19002
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
228 | } |
|
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 | 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
|
231 | 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
|
232 | { |
|
37625
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
233 | GTlsCertificate *crt = data; |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
234 | gchar *pem = NULL; |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
235 | GError *error = NULL; |
|
19004
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
236 | |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
237 | g_assert(filename); |
|
22368
62b8e2bb96a7
Remove whitespace on empty lions
Mark Doliner <markdoliner@pidgin.im>
parents:
22269
diff
changeset
|
238 | |
|
37625
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
239 | g_object_get(crt, "certificate-pem", &pem, NULL); |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
240 | |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
241 | if (!g_file_set_contents(filename, pem, -1, &error)) { |
|
19004
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
242 | /* 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
|
243 | /* 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
|
244 | went wrong? */ |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
245 | gchar * secondary; |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
246 | |
|
37625
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
247 | purple_debug_warning("gtkcertmgr/tls_peers_mgmt", |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
248 | "File %s couldn't be exported: %s", |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
249 | filename, error->message); |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
250 | g_clear_error(&error); |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
251 | |
|
19004
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
252 | 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
|
253 | 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
|
254 | _("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
|
255 | _("X.509 certificate export failed"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34333
diff
changeset
|
256 | secondary, NULL); |
|
19004
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
257 | g_free(secondary); |
|
37625
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
258 | } else { |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
259 | tls_peers_mgmt_repopulate_list(); |
|
19004
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
260 | } |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
261 | |
|
37625
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
262 | g_free(pem); |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
263 | g_object_unref(crt); |
|
19004
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
264 | } |
|
22368
62b8e2bb96a7
Remove whitespace on empty lions
Mark Doliner <markdoliner@pidgin.im>
parents:
22269
diff
changeset
|
265 | |
|
19004
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
266 | static void |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
267 | 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
|
268 | { |
|
37625
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
269 | GTlsCertificate *crt; |
|
19004
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
270 | 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
|
271 | GtkTreeIter iter; |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
272 | GtkTreeModel *model; |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
273 | gchar *id; |
|
37625
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
274 | GError *error = NULL; |
|
19004
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
275 | |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
276 | /* 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
|
277 | 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
|
278 | 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
|
279 | "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
|
280 | return; |
|
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 | |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
283 | /* 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
|
284 | 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
|
285 | |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
286 | /* 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
|
287 | get deleted out from under us */ |
|
37625
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
288 | crt = purple_tls_certificate_new_from_id(id, &error); |
|
19004
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
289 | |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
290 | 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
|
291 | purple_debug_error("gtkcertmgr/tls_peers_mgmt", |
|
37625
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
292 | "Error fetching trusted cert '%s': %s\n", |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
293 | id, error->message); |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
294 | g_clear_error(&error); |
|
19004
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
295 | 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
|
296 | return; |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
297 | } |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
298 | 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
|
299 | |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
300 | /* TODO: inform user that it will be a PEM? */ |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
301 | purple_request_file(tpm_dat, |
|
19004
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
302 | _("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
|
303 | "certificate.pem", |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
304 | 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
|
305 | G_CALLBACK(tls_peers_mgmt_export_ok_cb), |
|
37625
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
306 | G_CALLBACK(g_object_unref), |
|
34333
b92698241603
Request API refactoring: switch purple_request_file to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
307 | NULL, /* No extra parameters */ |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
308 | crt); /* Pass the certificate on to the callback */ |
|
19004
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
309 | } |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
310 | |
|
19005
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
311 | static void |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
312 | 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
|
313 | { |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
314 | GtkTreeSelection *select = tpm_dat->listselect; |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
315 | GtkTreeIter iter; |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
316 | GtkTreeModel *model; |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
317 | gchar *id; |
|
37625
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
318 | GTlsCertificate *crt; |
|
37658
d6627d91a2d2
Use the GError through the function
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37655
diff
changeset
|
319 | gchar *title; |
|
37625
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
320 | GError *error = NULL; |
|
19005
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
321 | |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
322 | /* See if things are selected */ |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
323 | 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
|
324 | 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
|
325 | "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
|
326 | return; |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
327 | } |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
328 | |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
329 | /* Retrieve the selected hostname */ |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
330 | 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
|
331 | |
|
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
332 | /* Now retrieve the certificate */ |
|
37658
d6627d91a2d2
Use the GError through the function
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37655
diff
changeset
|
333 | crt = purple_tls_certificate_new_from_id(id, &error); |
|
37625
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
334 | |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
335 | if (crt == NULL) { |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
336 | purple_debug_warning("gtkcertmgr/tls_peers_mgmt", |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
337 | "Unable to fetch certificate '%s': %s", |
|
37655
e6fc6614b274
Fix some null pointer deferences
Gary Kramlich <grim@reaperworld.com>
parents:
37632
diff
changeset
|
338 | id, error ? error->message : "unknown error"); |
|
37625
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
339 | g_clear_error(&error); |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
340 | g_free(id); |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
341 | } |
|
22368
62b8e2bb96a7
Remove whitespace on empty lions
Mark Doliner <markdoliner@pidgin.im>
parents:
22269
diff
changeset
|
342 | |
|
32771
681ca041d42b
Optionally show certificates using GCR's widgets. These are much
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32309
diff
changeset
|
343 | /* Fire the notification */ |
|
681ca041d42b
Optionally show certificates using GCR's widgets. These are much
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32309
diff
changeset
|
344 | title = g_strdup_printf(_("Certificate Information for %s"), id); |
|
32891
5f120523520a
Use the new certificate request API in the certificate manager.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32771
diff
changeset
|
345 | purple_request_certificate(tpm_dat, title, NULL, NULL, crt, |
|
37625
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
346 | _("OK"), G_CALLBACK(g_object_unref), |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
347 | _("Cancel"), G_CALLBACK(g_object_unref), |
|
32891
5f120523520a
Use the new certificate request API in the certificate manager.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32771
diff
changeset
|
348 | crt); |
|
22368
62b8e2bb96a7
Remove whitespace on empty lions
Mark Doliner <markdoliner@pidgin.im>
parents:
22269
diff
changeset
|
349 | |
|
19005
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
350 | g_free(id); |
|
32891
5f120523520a
Use the new certificate request API in the certificate manager.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32771
diff
changeset
|
351 | g_free(title); |
|
19005
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
352 | } |
|
19004
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
353 | |
|
ad1241cd8422
- Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19002
diff
changeset
|
354 | static void |
|
32309
329370a63001
Allow double-clicking a certificate to show its info.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32308
diff
changeset
|
355 | tls_peers_mgmt_activated_cb(GtkTreeView *treeview, GtkTreePath *path, GtkTreeViewColumn *column, gpointer data) |
|
329370a63001
Allow double-clicking a certificate to show its info.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32308
diff
changeset
|
356 | { |
|
329370a63001
Allow double-clicking a certificate to show its info.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32308
diff
changeset
|
357 | tls_peers_mgmt_info_cb(NULL, NULL); |
|
329370a63001
Allow double-clicking a certificate to show its info.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32308
diff
changeset
|
358 | } |
|
329370a63001
Allow double-clicking a certificate to show its info.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32308
diff
changeset
|
359 | |
|
329370a63001
Allow double-clicking a certificate to show its info.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32308
diff
changeset
|
360 | 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
|
361 | 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
|
362 | { |
|
37625
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
363 | GError *error = NULL; |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
364 | |
|
19006
ffeab9433f97
- Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19005
diff
changeset
|
365 | if (1 == choice) { |
|
37625
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
366 | /* Yes, distrust was confirmed */ |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
367 | /* Now distrust the thing */ |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
368 | if (!purple_tls_certificate_distrust(id, &error)) { |
|
19483
95243782d176
- Fix some overzealous g_asserts leading to a crash
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19360
diff
changeset
|
369 | purple_debug_warning("gtkcertmgr/tls_peers_mgmt", |
|
37625
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
370 | "Deletion failed on id %s: %s\n", |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
371 | id, error->message); |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
372 | g_clear_error(&error); |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
373 | } else { |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
374 | tls_peers_mgmt_repopulate_list(); |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
375 | } |
|
19006
ffeab9433f97
- Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19005
diff
changeset
|
376 | } |
|
ffeab9433f97
- Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19005
diff
changeset
|
377 | |
|
ffeab9433f97
- Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19005
diff
changeset
|
378 | 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
|
379 | } |
|
22368
62b8e2bb96a7
Remove whitespace on empty lions
Mark Doliner <markdoliner@pidgin.im>
parents:
22269
diff
changeset
|
380 | |
|
19006
ffeab9433f97
- Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19005
diff
changeset
|
381 | static void |
|
18904
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
382 | 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
|
383 | { |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
384 | GtkTreeSelection *select = tpm_dat->listselect; |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
385 | GtkTreeIter iter; |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
386 | GtkTreeModel *model; |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
387 | |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
388 | /* See if things are selected */ |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
389 | 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
|
390 | |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
391 | 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
|
392 | gchar *primary; |
|
18904
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
393 | |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
394 | /* Retrieve the selected hostname */ |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
395 | 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
|
396 | |
|
19006
ffeab9433f97
- Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19005
diff
changeset
|
397 | /* 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
|
398 | 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
|
399 | _("Really delete certificate for %s?"), id ); |
|
22368
62b8e2bb96a7
Remove whitespace on empty lions
Mark Doliner <markdoliner@pidgin.im>
parents:
22269
diff
changeset
|
400 | |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
401 | purple_request_yes_no(tpm_dat, _("Confirm certificate delete"), |
|
19006
ffeab9433f97
- Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19005
diff
changeset
|
402 | primary, NULL, /* Can this be NULL? */ |
|
22385
d14ac3ae2007
The Gnome Human Interface Guidelines say, "if pressing this button by
Mark Doliner <markdoliner@pidgin.im>
parents:
22383
diff
changeset
|
403 | 0, /* "yes" is the default action */ |
|
34331
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
404 | NULL, |
|
19006
ffeab9433f97
- Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19005
diff
changeset
|
405 | 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
|
406 | 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
|
407 | tls_peers_mgmt_delete_confirm_cb ); |
|
22368
62b8e2bb96a7
Remove whitespace on empty lions
Mark Doliner <markdoliner@pidgin.im>
parents:
22269
diff
changeset
|
408 | |
|
19006
ffeab9433f97
- Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19005
diff
changeset
|
409 | g_free(primary); |
|
22368
62b8e2bb96a7
Remove whitespace on empty lions
Mark Doliner <markdoliner@pidgin.im>
parents:
22269
diff
changeset
|
410 | |
|
18904
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
411 | } else { |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
412 | 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
|
413 | "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
|
414 | return; |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
415 | } |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
416 | } |
|
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
417 | |
|
18822
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
418 | static GtkWidget * |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
419 | tls_peers_mgmt_build(void) |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
420 | { |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
421 | 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
|
422 | 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
|
423 | |
|
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
|
424 | /* 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
|
425 | GtkTreeView *listview; |
|
18905
d418c21a441a
- Code cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18904
diff
changeset
|
426 | GtkTreeSelection *select; |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
427 | GtkWidget *importbutton; |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
428 | GtkWidget *exportbutton; |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
429 | GtkWidget *infobutton; |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
430 | GtkWidget *deletebutton; |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
431 | /** 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
|
432 | 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
|
433 | |
|
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
|
434 | /* 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
|
435 | tpm_dat = g_new0(tls_peers_mgmt_data, 1); |
|
22368
62b8e2bb96a7
Remove whitespace on empty lions
Mark Doliner <markdoliner@pidgin.im>
parents:
22269
diff
changeset
|
436 | |
|
35527
707c3c2b2c8a
Fix more gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35454
diff
changeset
|
437 | tpm_dat->mgmt_widget = mgmt_widget = gtk_box_new( |
|
707c3c2b2c8a
Fix more gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35454
diff
changeset
|
438 | GTK_ORIENTATION_HORIZONTAL, PIDGIN_HIG_BOX_SPACE); |
| 22383 | 439 | gtk_container_set_border_width(GTK_CONTAINER(mgmt_widget), |
| 440 | PIDGIN_HIG_BOX_SPACE); | |
|
18823
da1d1529d4cd
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18822
diff
changeset
|
441 | 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
|
442 | |
|
da1d1529d4cd
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18822
diff
changeset
|
443 | /* 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
|
444 | is closed */ |
|
da1d1529d4cd
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18822
diff
changeset
|
445 | 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
|
446 | G_CALLBACK(tls_peers_mgmt_destroy), NULL); |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
447 | |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
448 | /* List view */ |
|
18892
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
449 | store = gtk_list_store_new(TPM_N_COLUMNS, G_TYPE_STRING); |
|
22368
62b8e2bb96a7
Remove whitespace on empty lions
Mark Doliner <markdoliner@pidgin.im>
parents:
22269
diff
changeset
|
450 | |
|
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
|
451 | 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
|
452 | GTK_TREE_VIEW(gtk_tree_view_new_with_model(GTK_TREE_MODEL(store))); |
|
22214
e8a9916cb99e
It turns out the tree-models need to be unref'ed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22098
diff
changeset
|
453 | g_object_unref(G_OBJECT(store)); |
|
22368
62b8e2bb96a7
Remove whitespace on empty lions
Mark Doliner <markdoliner@pidgin.im>
parents:
22269
diff
changeset
|
454 | |
|
18892
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
455 | { |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
456 | GtkCellRenderer *renderer; |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
457 | GtkTreeViewColumn *column; |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
458 | |
|
18893
c3c789b74621
- Specify the selection mode on the tls_peers_mgmt listview (may not be
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18892
diff
changeset
|
459 | /* Set up the display columns */ |
|
18892
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
460 | renderer = gtk_cell_renderer_text_new(); |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
461 | column = gtk_tree_view_column_new_with_attributes( |
|
22098
16144010f03c
Mark a string for translation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22032
diff
changeset
|
462 | _("Hostname"), |
|
18892
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
463 | renderer, |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
464 | "text", TPM_HOSTNAME_COLUMN, |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
465 | NULL); |
|
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
466 | gtk_tree_view_append_column(GTK_TREE_VIEW(listview), column); |
|
19829
d6a65102cd95
Sort the certificates by hostname
Mark Doliner <markdoliner@pidgin.im>
parents:
19683
diff
changeset
|
467 | |
|
d6a65102cd95
Sort the certificates by hostname
Mark Doliner <markdoliner@pidgin.im>
parents:
19683
diff
changeset
|
468 | gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(store), |
|
d6a65102cd95
Sort the certificates by hostname
Mark Doliner <markdoliner@pidgin.im>
parents:
19683
diff
changeset
|
469 | TPM_HOSTNAME_COLUMN, GTK_SORT_ASCENDING); |
|
18892
f6019ee5cd5f
- CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18891
diff
changeset
|
470 | } |
|
22368
62b8e2bb96a7
Remove whitespace on empty lions
Mark Doliner <markdoliner@pidgin.im>
parents:
22269
diff
changeset
|
471 | |
|
18905
d418c21a441a
- Code cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18904
diff
changeset
|
472 | /* Get the treeview selector into the struct */ |
|
d418c21a441a
- Code cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18904
diff
changeset
|
473 | tpm_dat->listselect = select = |
|
d418c21a441a
- Code cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18904
diff
changeset
|
474 | gtk_tree_view_get_selection(GTK_TREE_VIEW(listview)); |
|
22368
62b8e2bb96a7
Remove whitespace on empty lions
Mark Doliner <markdoliner@pidgin.im>
parents:
22269
diff
changeset
|
475 | |
|
18905
d418c21a441a
- Code cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18904
diff
changeset
|
476 | /* Force the selection mode */ |
|
d418c21a441a
- Code cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18904
diff
changeset
|
477 | gtk_tree_selection_set_mode(select, GTK_SELECTION_SINGLE); |
|
18906
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
478 | |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
479 | /* 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
|
480 | something is selected */ |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
481 | g_signal_connect(G_OBJECT(select), "changed", |
|
c6ac8d8ffe43
- Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18905
diff
changeset
|
482 | G_CALLBACK(tls_peers_mgmt_select_chg_cb), NULL); |
|
22368
62b8e2bb96a7
Remove whitespace on empty lions
Mark Doliner <markdoliner@pidgin.im>
parents:
22269
diff
changeset
|
483 | |
|
32309
329370a63001
Allow double-clicking a certificate to show its info.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32308
diff
changeset
|
484 | g_signal_connect(G_OBJECT(listview), "row-activated", |
|
329370a63001
Allow double-clicking a certificate to show its info.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32308
diff
changeset
|
485 | G_CALLBACK(tls_peers_mgmt_activated_cb), NULL); |
|
329370a63001
Allow double-clicking a certificate to show its info.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32308
diff
changeset
|
486 | |
|
31321
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
28981
diff
changeset
|
487 | gtk_box_pack_start(GTK_BOX(mgmt_widget), |
| 31322 | 488 | pidgin_make_scrollable(GTK_WIDGET(listview), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS, GTK_SHADOW_IN, -1, -1), |
|
31321
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
28981
diff
changeset
|
489 | TRUE, TRUE, /* Take up lots of space */ |
|
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
28981
diff
changeset
|
490 | 0); |
|
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
|
491 | 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
|
492 | |
|
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
|
493 | /* 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
|
494 | tls_peers_mgmt_repopulate_list(); |
|
22368
62b8e2bb96a7
Remove whitespace on empty lions
Mark Doliner <markdoliner@pidgin.im>
parents:
22269
diff
changeset
|
495 | |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
496 | /* Right-hand side controls box */ |
|
35528
e04ba70092e9
Fix the rest of [hv] gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35527
diff
changeset
|
497 | bbox = gtk_button_box_new(GTK_ORIENTATION_VERTICAL); |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
498 | gtk_box_pack_end(GTK_BOX(mgmt_widget), bbox, |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
499 | FALSE, FALSE, /* Do not take up space */ |
|
22382
fdbbd650a305
Improve the spacing in Pidgin's certificate manager window
Mark Doliner <markdoliner@pidgin.im>
parents:
22381
diff
changeset
|
500 | 0); |
|
18908
2453c24d2b22
- HIG compliance improved
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18907
diff
changeset
|
501 | 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
|
502 | 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
|
503 | gtk_widget_show(bbox); |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
504 | |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
505 | /* Import 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
|
506 | tpm_dat->importbutton = importbutton = |
|
32308
14dc3cf16b77
Fix Certificate Manager Import/Export icons.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31322
diff
changeset
|
507 | gtk_button_new_from_stock(GTK_STOCK_OPEN); |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
508 | 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
|
509 | gtk_widget_show(importbutton); |
|
19002
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
510 | g_signal_connect(G_OBJECT(importbutton), "clicked", |
|
d9ea65be67b4
- Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19001
diff
changeset
|
511 | 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
|
512 | |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
513 | |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
514 | /* Export 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
|
515 | tpm_dat->exportbutton = exportbutton = |
|
32308
14dc3cf16b77
Fix Certificate Manager Import/Export icons.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31322
diff
changeset
|
516 | gtk_button_new_from_stock(GTK_STOCK_SAVE_AS); |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
517 | 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
|
518 | 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
|
519 | 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
|
520 | 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
|
521 | |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
522 | |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
523 | /* 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
|
524 | 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
|
525 | gtk_button_new_from_stock(PIDGIN_STOCK_INFO); |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
526 | 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
|
527 | gtk_widget_show(infobutton); |
|
19005
13826b25788c
- Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents:
19004
diff
changeset
|
528 | 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
|
529 | 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
|
530 | |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
531 | |
|
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
532 | /* 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
|
533 | 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
|
534 | gtk_button_new_from_stock(GTK_STOCK_DELETE); |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
535 | 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
|
536 | gtk_widget_show(deletebutton); |
|
18904
a1a06b3d75cd
- Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18903
diff
changeset
|
537 | 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
|
538 | G_CALLBACK(tls_peers_mgmt_delete_cb), NULL); |
|
18891
b5ab1227f3d2
- More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18823
diff
changeset
|
539 | |
|
18907
07343a83e67c
- Delegate all button enabling/disabling in tls_peers_mgmt to its "is
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18906
diff
changeset
|
540 | /* 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
|
541 | 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
|
542 | 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
|
543 | |
|
18823
da1d1529d4cd
- Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18822
diff
changeset
|
544 | return mgmt_widget; |
|
18822
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
545 | } |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
546 | |
|
21091
07fe1a99c47b
Patch from Andrew Gaul to constify a bunch of static variables to reduce
Ka-Hing Cheung <khc@pidgin.im>
parents:
20147
diff
changeset
|
547 | const PidginCertificateManager tls_peers_mgmt = { |
|
18822
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
548 | tls_peers_mgmt_build, /* Widget creation function */ |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
549 | N_("SSL Servers") |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
550 | }; |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
551 | |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
552 | /***************************************************************************** |
|
18819
f0114d3a5bb1
- Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18816
diff
changeset
|
553 | * GTK+ main certificate manager * |
|
f0114d3a5bb1
- Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18816
diff
changeset
|
554 | *****************************************************************************/ |
|
18815
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
555 | typedef struct |
|
18650
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
556 | { |
|
18815
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
557 | GtkWidget *window; |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
558 | GtkWidget *notebook; |
|
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 | GtkWidget *closebutton; |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
561 | } CertMgrDialog; |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
562 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
563 | /* 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
|
564 | 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
|
565 | 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
|
566 | |
|
22032
8136dd5eeda3
Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
567 | static gboolean |
|
18815
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
568 | 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
|
569 | { |
|
18819
f0114d3a5bb1
- Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18816
diff
changeset
|
570 | /* TODO: Ignoring the arguments to this function may not be ideal, |
|
f0114d3a5bb1
- Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18816
diff
changeset
|
571 | 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
|
572 | pidgin_certmgr_hide(); |
|
22032
8136dd5eeda3
Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
573 | return FALSE; |
|
18815
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 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
576 | void |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
577 | 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
|
578 | { |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
579 | CertMgrDialog *dlg; |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
580 | GtkWidget *win; |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
581 | GtkWidget *vbox; |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
582 | |
|
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
|
583 | /* 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
|
584 | { |
|
37625
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
585 | GList *idlist; |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
586 | GList *l; |
|
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
|
587 | |
|
37625
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
588 | purple_debug_info("gtkcertmgr", |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
589 | "Enumerating X.509 certificates:\n"); |
|
22368
62b8e2bb96a7
Remove whitespace on empty lions
Mark Doliner <markdoliner@pidgin.im>
parents:
22269
diff
changeset
|
590 | |
|
37625
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
591 | idlist = purple_tls_certificate_list_ids(); |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
592 | |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
593 | for (l=idlist; l; l = l->next) { |
|
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
|
594 | purple_debug_info("gtkcertmgr", |
|
37625
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
595 | "- %s\n", |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
596 | l->data ? (gchar *) l->data : "(null)"); |
|
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
597 | } /* idlist */ |
|
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
|
598 | |
|
37625
7ae437591e5e
Port Pidgin to use TLS Certificate API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
599 | purple_tls_certificate_free_ids(idlist); |
|
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
|
600 | } |
|
18815
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
601 | |
|
22368
62b8e2bb96a7
Remove whitespace on empty lions
Mark Doliner <markdoliner@pidgin.im>
parents:
22269
diff
changeset
|
602 | |
|
18815
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
603 | /* 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
|
604 | 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
|
605 | 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
|
606 | return; |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
607 | } |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
608 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
609 | /* 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
|
610 | 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
|
611 | 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
|
612 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
613 | win = dlg->window = |
|
22000
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
614 | pidgin_create_dialog(_("Certificate Manager"),/* Title */ |
|
33141
2001ba1d6827
Remove extra padding that makes things look not-so-good.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32891
diff
changeset
|
615 | 0, /*Window border*/ |
|
18815
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
616 | "certmgr", /* Role */ |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
617 | TRUE); /* Allow resizing */ |
|
18816
a6a20fabe100
- CertMgr window responds properly to delete_event
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18815
diff
changeset
|
618 | 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
|
619 | G_CALLBACK(certmgr_close_cb), dlg); |
|
a6a20fabe100
- CertMgr window responds properly to delete_event
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18815
diff
changeset
|
620 | |
|
22368
62b8e2bb96a7
Remove whitespace on empty lions
Mark Doliner <markdoliner@pidgin.im>
parents:
22269
diff
changeset
|
621 | |
|
18815
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
622 | /* 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
|
623 | 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
|
624 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
625 | /* Main vbox */ |
|
22000
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
626 | vbox = pidgin_dialog_get_vbox_with_properties(GTK_DIALOG(win), FALSE, PIDGIN_HIG_BORDER); |
|
18815
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
627 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
628 | /* 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
|
629 | 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
|
630 | 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
|
631 | 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
|
632 | 0); |
|
18822
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
633 | 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
|
634 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
635 | /* Close button */ |
|
22005
0183020ba2cc
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22000
diff
changeset
|
636 | dlg->closebutton = pidgin_dialog_add_button(GTK_DIALOG(win), GTK_STOCK_CLOSE, |
|
0183020ba2cc
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22000
diff
changeset
|
637 | G_CALLBACK(certmgr_close_cb), dlg); |
|
18815
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
638 | |
|
18822
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
639 | /* Add the defined certificate managers */ |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
640 | /* 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
|
641 | /* TODO: Implement this correctly */ |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
642 | gtk_notebook_append_page(GTK_NOTEBOOK (dlg->notebook), |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
643 | (tls_peers_mgmt.build)(), |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
644 | gtk_label_new(_(tls_peers_mgmt.label)) ); |
|
25966b358d3f
- Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18819
diff
changeset
|
645 | |
|
18815
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(win); |
|
18650
8a34ac83df75
- Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
647 | } |
|
18815
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
648 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
649 | void |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
650 | 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
|
651 | { |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
652 | /* 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
|
653 | 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
|
654 | return; |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
655 | } |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
656 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
657 | 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
|
658 | 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
|
659 | |
|
a3d656beadcf
- Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18664
diff
changeset
|
660 | 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
|
661 | 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
|
662 | 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
|
663 | } |