annotate pidgin/gtkcertmgr.c @ 22770:cc8903c59d6b

Change the string "screen name" to "username" everywhere. I think most of us agree that "username" is a better term. Also changing the accelerator key for "Username" in the add account dialog from 'n' to 'u', which I think makes more sense.
author Mark Doliner <mark@kingant.net>
date Wed, 30 Apr 2008 08:46:51 +0000
parents 8233bbcf3e86
children aaaff38e144f 73c8e1964eef
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19015
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
1 /*
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
2 * @file gtkcertmgr.c GTK+ Certificate Manager API
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
3 * @ingroup pidgin
20074
6bf32c9e15a7 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents: 19986
diff changeset
4 */
6bf32c9e15a7 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents: 19986
diff changeset
5
6bf32c9e15a7 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents: 19986
diff changeset
6 /* pidgin
19015
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
7 *
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
8 * Pidgin is the legal property of its developers, whose names are too numerous
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
10 * source distribution.
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
11 *
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or modify
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
15 * (at your option) any later version.
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
16 *
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
20 * GNU General Public License for more details.
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
21 *
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
19680
44b4e8bd759b The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19650
diff changeset
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
19015
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
25 *
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
26 */
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
27
19031
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
28 #include <glib.h>
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
29
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
30 #include "core.h"
19015
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
31 #include "internal.h"
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
32 #include "pidgin.h"
19503
2f0960548c1d Make the gtkcert stuff compile on GTK+ older than 2.8
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19270
diff changeset
33 #include "pidginstock.h"
19015
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
34
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
35 #include "certificate.h"
19029
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
36 #include "debug.h"
19015
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
37 #include "notify.h"
19062
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
38 #include "request.h"
19015
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
39
19031
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
40 #include "gtkblist.h"
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
41 #include "gtkutils.h"
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
42
19015
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
43 #include "gtkcertmgr.h"
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
44
19035
284199d26040 - Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19032
diff changeset
45 /*****************************************************************************
19038
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
46 * X.509 tls_peers management interface *
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
47 *****************************************************************************/
19039
3054f7c6b30d - Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19038
diff changeset
48
19052
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
49 typedef struct {
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
50 GtkWidget *mgmt_widget;
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
51 GtkTreeView *listview;
19054
ffeb39523eb6 - Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19053
diff changeset
52 GtkTreeSelection *listselect;
19052
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
53 GtkWidget *importbutton;
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
54 GtkWidget *exportbutton;
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
55 GtkWidget *infobutton;
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
56 GtkWidget *deletebutton;
19053
95a8469cd1e3 - tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19052
diff changeset
57 PurpleCertificatePool *tls_peers;
19052
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
58 } tls_peers_mgmt_data;
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
59
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
60 tls_peers_mgmt_data *tpm_dat = NULL;
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
61
19041
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
62 /* Columns
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
63 See http://developer.gnome.org/doc/API/2.0/gtk/TreeWidget.html */
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
64 enum
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
65 {
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
66 TPM_HOSTNAME_COLUMN,
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
67 TPM_N_COLUMNS
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
68 };
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
69
19039
3054f7c6b30d - Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19038
diff changeset
70 static void
3054f7c6b30d - Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19038
diff changeset
71 tls_peers_mgmt_destroy(GtkWidget *mgmt_widget, gpointer data)
3054f7c6b30d - Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19038
diff changeset
72 {
3054f7c6b30d - Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19038
diff changeset
73 purple_debug_info("certmgr",
3054f7c6b30d - Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19038
diff changeset
74 "tls peers self-destructs\n");
19052
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
75
19053
95a8469cd1e3 - tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19052
diff changeset
76 purple_signals_disconnect_by_handle(tpm_dat);
19062
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
77 purple_request_close_with_handle(tpm_dat);
19052
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
78 g_free(tpm_dat); tpm_dat = NULL;
19039
3054f7c6b30d - Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19038
diff changeset
79 }
3054f7c6b30d - Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19038
diff changeset
80
19042
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
81 static void
19052
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
82 tls_peers_mgmt_repopulate_list(void)
19042
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
83 {
19052
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
84 GtkTreeView *listview = tpm_dat->listview;
19042
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
85 PurpleCertificatePool *tls_peers;
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
86 GList *idlist, *l;
22240
71e27bc2e82b Remove whitespace on empty lions
Mark Doliner <mark@kingant.net>
parents: 22143
diff changeset
87
19042
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
88 GtkListStore *store = GTK_LIST_STORE(
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
89 gtk_tree_view_get_model(GTK_TREE_VIEW(listview)));
22240
71e27bc2e82b Remove whitespace on empty lions
Mark Doliner <mark@kingant.net>
parents: 22143
diff changeset
90
19042
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
91 /* First, delete everything in the list */
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
92 gtk_list_store_clear(store);
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
93
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
94 /* Locate the "tls_peers" pool */
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
95 tls_peers = purple_certificate_find_pool("x509", "tls_peers");
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
96 g_return_if_fail(tls_peers);
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
97
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
98 /* Grab the loaded certificates */
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
99 idlist = purple_certificate_pool_get_idlist(tls_peers);
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
100
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
101 /* Populate the listview */
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
102 for (l = idlist; l; l = l->next) {
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
103 GtkTreeIter iter;
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
104 gtk_list_store_append(store, &iter);
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
105
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
106 gtk_list_store_set(GTK_LIST_STORE(store), &iter,
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
107 TPM_HOSTNAME_COLUMN, l->data,
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
108 -1);
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
109 }
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
110 purple_certificate_pool_destroy_idlist(idlist);
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
111 }
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
112
19053
95a8469cd1e3 - tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19052
diff changeset
113 static void
95a8469cd1e3 - tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19052
diff changeset
114 tls_peers_mgmt_mod_cb(PurpleCertificatePool *pool, const gchar *id, gpointer data)
95a8469cd1e3 - tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19052
diff changeset
115 {
95a8469cd1e3 - tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19052
diff changeset
116 g_assert (pool == tpm_dat->tls_peers);
95a8469cd1e3 - tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19052
diff changeset
117
95a8469cd1e3 - tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19052
diff changeset
118 tls_peers_mgmt_repopulate_list();
95a8469cd1e3 - tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19052
diff changeset
119 }
95a8469cd1e3 - tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19052
diff changeset
120
19054
ffeb39523eb6 - Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19053
diff changeset
121 static void
19056
9e747806bb07 - Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19055
diff changeset
122 tls_peers_mgmt_select_chg_cb(GtkTreeSelection *ignored, gpointer data)
9e747806bb07 - Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19055
diff changeset
123 {
9e747806bb07 - Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19055
diff changeset
124 GtkTreeSelection *select = tpm_dat->listselect;
9e747806bb07 - Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19055
diff changeset
125 GtkTreeIter iter;
9e747806bb07 - Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19055
diff changeset
126 GtkTreeModel *model;
9e747806bb07 - Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19055
diff changeset
127
9e747806bb07 - Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19055
diff changeset
128 /* See if things are selected */
9e747806bb07 - Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19055
diff changeset
129 if (gtk_tree_selection_get_selected(select, &model, &iter)) {
9e747806bb07 - Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19055
diff changeset
130 /* Enable buttons if something is selected */
9e747806bb07 - Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19055
diff changeset
131 gtk_widget_set_sensitive(GTK_WIDGET(tpm_dat->exportbutton), TRUE);
9e747806bb07 - Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19055
diff changeset
132 gtk_widget_set_sensitive(GTK_WIDGET(tpm_dat->infobutton), TRUE);
9e747806bb07 - Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19055
diff changeset
133 gtk_widget_set_sensitive(GTK_WIDGET(tpm_dat->deletebutton), TRUE);
9e747806bb07 - Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19055
diff changeset
134 } else {
9e747806bb07 - Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19055
diff changeset
135 /* Otherwise, disable them */
9e747806bb07 - Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19055
diff changeset
136 gtk_widget_set_sensitive(GTK_WIDGET(tpm_dat->exportbutton), FALSE);
9e747806bb07 - Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19055
diff changeset
137 gtk_widget_set_sensitive(GTK_WIDGET(tpm_dat->infobutton), FALSE);
9e747806bb07 - Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19055
diff changeset
138 gtk_widget_set_sensitive(GTK_WIDGET(tpm_dat->deletebutton), FALSE);
9e747806bb07 - Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19055
diff changeset
139
9e747806bb07 - Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19055
diff changeset
140 }
9e747806bb07 - Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19055
diff changeset
141 }
9e747806bb07 - Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19055
diff changeset
142
9e747806bb07 - Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19055
diff changeset
143 static void
19062
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
144 tls_peers_mgmt_import_ok2_cb(gpointer data, const char *result)
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
145 {
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
146 PurpleCertificate *crt = (PurpleCertificate *) data;
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
147 const char *id = result;
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
148
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
149 /* TODO: Perhaps prompt if you're overwriting a cert? */
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
150
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
151 /* Drop the certificate into the pool */
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
152 purple_certificate_pool_store(tpm_dat->tls_peers, id, crt);
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
153
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
154 /* And this certificate is not needed any more */
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
155 purple_certificate_destroy(crt);
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
156 }
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
157
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
158 static void
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
159 tls_peers_mgmt_import_cancel2_cb(gpointer data, const char *result)
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
160 {
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
161 PurpleCertificate *crt = (PurpleCertificate *) data;
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
162 purple_certificate_destroy(crt);
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
163 }
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
164
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
165 static void
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
166 tls_peers_mgmt_import_ok_cb(gpointer data, const char *filename)
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
167 {
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
168 PurpleCertificateScheme *x509;
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
169 PurpleCertificate *crt;
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
170
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
171 /* Load the scheme of our tls_peers pool (ought to be x509) */
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
172 x509 = purple_certificate_pool_get_scheme(tpm_dat->tls_peers);
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
173
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
174 /* Now load the certificate from disk */
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
175 crt = purple_certificate_import(x509, filename);
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
176
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
177 /* Did it work? */
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
178 if (crt != NULL) {
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
179 gchar *default_hostname;
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
180 /* Get name to add to pool as */
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
181 /* Make a guess about what the hostname should be */
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
182 default_hostname = purple_certificate_get_subject_name(crt);
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
183 /* TODO: Find a way to make sure that crt gets destroyed
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
184 if the window gets closed unusually, such as by handle
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
185 deletion */
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
186 /* TODO: Display some more information on the certificate? */
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
187 purple_request_input(tpm_dat,
19062
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
188 _("Certificate Import"),
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
189 _("Specify a hostname"),
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
190 _("Type the host name this certificate is for."),
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
191 default_hostname,
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
192 FALSE, /* Not multiline */
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
193 FALSE, /* Not masked? */
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
194 NULL, /* No hints? */
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
195 _("OK"),
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
196 G_CALLBACK(tls_peers_mgmt_import_ok2_cb),
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
197 _("Cancel"),
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
198 G_CALLBACK(tls_peers_mgmt_import_cancel2_cb),
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
199 NULL, NULL, NULL, /* No account/who/conv*/
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
200 crt /* Pass cert instance to callback*/
19062
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
201 );
22240
71e27bc2e82b Remove whitespace on empty lions
Mark Doliner <mark@kingant.net>
parents: 22143
diff changeset
202
19062
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
203 g_free(default_hostname);
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
204 } else {
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
205 /* Errors! Oh no! */
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
206 /* TODO: Perhaps find a way to be specific about what just
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
207 went wrong? */
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
208 gchar * secondary;
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
209
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
210 secondary = g_strdup_printf(_("File %s could not be imported.\nMake sure that the file is readable and in PEM format.\n"), filename);
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
211 purple_notify_error(NULL,
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
212 _("Certificate Import Error"),
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
213 _("X.509 certificate import failed"),
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
214 secondary);
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
215 g_free(secondary);
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
216 }
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
217 }
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
218
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
219 static void
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
220 tls_peers_mgmt_import_cb(GtkWidget *button, gpointer data)
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
221 {
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
222 /* TODO: need to tell the user that we want a .PEM file! */
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
223 purple_request_file(tpm_dat,
19062
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
224 _("Select a PEM certificate"),
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
225 "certificate.pem",
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
226 FALSE, /* Not a save dialog */
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
227 G_CALLBACK(tls_peers_mgmt_import_ok_cb),
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
228 NULL, /* Do nothing if cancelled */
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
229 NULL, NULL, NULL, NULL );/* No account,conv,etc. */
19062
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
230 }
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
231
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
232 static void
19064
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
233 tls_peers_mgmt_export_ok_cb(gpointer data, const char *filename)
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
234 {
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
235 PurpleCertificate *crt = (PurpleCertificate *) data;
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
236
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
237 g_assert(filename);
22240
71e27bc2e82b Remove whitespace on empty lions
Mark Doliner <mark@kingant.net>
parents: 22143
diff changeset
238
19064
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
239 if (!purple_certificate_export(filename, crt)) {
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
240 /* Errors! Oh no! */
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
241 /* TODO: Perhaps find a way to be specific about what just
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
242 went wrong? */
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
243 gchar * secondary;
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
244
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
245 secondary = g_strdup_printf(_("Export to file %s failed.\nCheck that you have write permission to the target path\n"), filename);
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
246 purple_notify_error(NULL,
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
247 _("Certificate Export Error"),
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
248 _("X.509 certificate export failed"),
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
249 secondary);
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
250 g_free(secondary);
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
251 }
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
252
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
253 purple_certificate_destroy(crt);
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
254 }
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
255
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
256 static void
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
257 tls_peers_mgmt_export_cancel_cb(gpointer data, const char *filename)
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
258 {
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
259 PurpleCertificate *crt = (PurpleCertificate *) data;
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
260 /* Pressing cancel just frees the duplicated certificate */
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
261 purple_certificate_destroy(crt);
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
262 }
22240
71e27bc2e82b Remove whitespace on empty lions
Mark Doliner <mark@kingant.net>
parents: 22143
diff changeset
263
19064
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
264 static void
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
265 tls_peers_mgmt_export_cb(GtkWidget *button, gpointer data)
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
266 {
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
267 PurpleCertificate *crt;
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
268 GtkTreeSelection *select = tpm_dat->listselect;
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
269 GtkTreeIter iter;
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
270 GtkTreeModel *model;
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
271 gchar *id;
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
272
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
273 /* See if things are selected */
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
274 if (!gtk_tree_selection_get_selected(select, &model, &iter)) {
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
275 purple_debug_warning("gtkcertmgr/tls_peers_mgmt",
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
276 "Export clicked with no selection?\n");
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
277 return;
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
278 }
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
279
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
280 /* Retrieve the selected hostname */
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
281 gtk_tree_model_get(model, &iter, TPM_HOSTNAME_COLUMN, &id, -1);
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
282
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
283 /* Extract the certificate from the pool now to make sure it doesn't
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
284 get deleted out from under us */
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
285 crt = purple_certificate_pool_retrieve(tpm_dat->tls_peers, id);
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
286
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
287 if (NULL == crt) {
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
288 purple_debug_error("gtkcertmgr/tls_peers_mgmt",
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
289 "Id %s was not in the peers cache?!\n",
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
290 id);
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
291 g_free(id);
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
292 return;
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
293 }
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
294 g_free(id);
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
295
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
296 /* TODO: inform user that it will be a PEM? */
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
297 purple_request_file(tpm_dat,
19064
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
298 _("PEM X.509 Certificate Export"),
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
299 "certificate.pem",
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
300 TRUE, /* Is a save dialog */
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
301 G_CALLBACK(tls_peers_mgmt_export_ok_cb),
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
302 G_CALLBACK(tls_peers_mgmt_export_cancel_cb),
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
303 NULL, NULL, NULL, /* No account,conv,etc. */
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
304 crt); /* Pass the certificate on to the callback */
19064
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
305 }
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
306
19065
ebae00bbb57e - Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19064
diff changeset
307 static void
ebae00bbb57e - Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19064
diff changeset
308 tls_peers_mgmt_info_cb(GtkWidget *button, gpointer data)
ebae00bbb57e - Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19064
diff changeset
309 {
ebae00bbb57e - Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19064
diff changeset
310 GtkTreeSelection *select = tpm_dat->listselect;
ebae00bbb57e - Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19064
diff changeset
311 GtkTreeIter iter;
ebae00bbb57e - Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19064
diff changeset
312 GtkTreeModel *model;
ebae00bbb57e - Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19064
diff changeset
313 gchar *id;
ebae00bbb57e - Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19064
diff changeset
314 PurpleCertificate *crt;
ebae00bbb57e - Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19064
diff changeset
315
ebae00bbb57e - Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19064
diff changeset
316 /* See if things are selected */
ebae00bbb57e - Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19064
diff changeset
317 if (!gtk_tree_selection_get_selected(select, &model, &iter)) {
ebae00bbb57e - Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19064
diff changeset
318 purple_debug_warning("gtkcertmgr/tls_peers_mgmt",
ebae00bbb57e - Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19064
diff changeset
319 "Info clicked with no selection?\n");
ebae00bbb57e - Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19064
diff changeset
320 return;
ebae00bbb57e - Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19064
diff changeset
321 }
ebae00bbb57e - Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19064
diff changeset
322
ebae00bbb57e - Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19064
diff changeset
323 /* Retrieve the selected hostname */
ebae00bbb57e - Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19064
diff changeset
324 gtk_tree_model_get(model, &iter, TPM_HOSTNAME_COLUMN, &id, -1);
ebae00bbb57e - Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19064
diff changeset
325
ebae00bbb57e - Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19064
diff changeset
326 /* Now retrieve the certificate */
ebae00bbb57e - Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19064
diff changeset
327 crt = purple_certificate_pool_retrieve(tpm_dat->tls_peers, id);
ebae00bbb57e - Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19064
diff changeset
328 g_return_if_fail(crt);
22240
71e27bc2e82b Remove whitespace on empty lions
Mark Doliner <mark@kingant.net>
parents: 22143
diff changeset
329
19986
4840b100e14f - GTKCertMgr X.509 infothing now uses the
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19680
diff changeset
330 /* Fire the notification */
4840b100e14f - GTKCertMgr X.509 infothing now uses the
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19680
diff changeset
331 purple_certificate_display_x509(crt);
22240
71e27bc2e82b Remove whitespace on empty lions
Mark Doliner <mark@kingant.net>
parents: 22143
diff changeset
332
19065
ebae00bbb57e - Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19064
diff changeset
333 g_free(id);
19219
8828d7aec7b6 - Fix a memleak
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19066
diff changeset
334 purple_certificate_destroy(crt);
19065
ebae00bbb57e - Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19064
diff changeset
335 }
19064
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
336
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
337 static void
19066
b631b409a515 - Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19065
diff changeset
338 tls_peers_mgmt_delete_confirm_cb(gchar *id, gint choice)
b631b409a515 - Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19065
diff changeset
339 {
b631b409a515 - Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19065
diff changeset
340 if (1 == choice) {
b631b409a515 - Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19065
diff changeset
341 /* Yes, delete was confirmed */
b631b409a515 - Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19065
diff changeset
342 /* Now delete the thing */
19270
fb4a1fb9ce8a - Fix some overzealous g_asserts leading to a crash
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19219
diff changeset
343 if (!purple_certificate_pool_delete(tpm_dat->tls_peers, id)) {
fb4a1fb9ce8a - Fix some overzealous g_asserts leading to a crash
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19219
diff changeset
344 purple_debug_warning("gtkcertmgr/tls_peers_mgmt",
fb4a1fb9ce8a - Fix some overzealous g_asserts leading to a crash
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19219
diff changeset
345 "Deletion failed on id %s\n",
fb4a1fb9ce8a - Fix some overzealous g_asserts leading to a crash
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19219
diff changeset
346 id);
fb4a1fb9ce8a - Fix some overzealous g_asserts leading to a crash
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19219
diff changeset
347 };
19066
b631b409a515 - Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19065
diff changeset
348 }
b631b409a515 - Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19065
diff changeset
349
b631b409a515 - Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19065
diff changeset
350 g_free(id);
b631b409a515 - Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19065
diff changeset
351 }
22240
71e27bc2e82b Remove whitespace on empty lions
Mark Doliner <mark@kingant.net>
parents: 22143
diff changeset
352
19066
b631b409a515 - Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19065
diff changeset
353 static void
19054
ffeb39523eb6 - Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19053
diff changeset
354 tls_peers_mgmt_delete_cb(GtkWidget *button, gpointer data)
ffeb39523eb6 - Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19053
diff changeset
355 {
ffeb39523eb6 - Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19053
diff changeset
356 GtkTreeSelection *select = tpm_dat->listselect;
ffeb39523eb6 - Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19053
diff changeset
357 GtkTreeIter iter;
ffeb39523eb6 - Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19053
diff changeset
358 GtkTreeModel *model;
ffeb39523eb6 - Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19053
diff changeset
359
ffeb39523eb6 - Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19053
diff changeset
360 /* See if things are selected */
ffeb39523eb6 - Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19053
diff changeset
361 if (gtk_tree_selection_get_selected(select, &model, &iter)) {
ffeb39523eb6 - Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19053
diff changeset
362
ffeb39523eb6 - Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19053
diff changeset
363 gchar *id;
19066
b631b409a515 - Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19065
diff changeset
364 gchar *primary;
19054
ffeb39523eb6 - Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19053
diff changeset
365
ffeb39523eb6 - Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19053
diff changeset
366 /* Retrieve the selected hostname */
ffeb39523eb6 - Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19053
diff changeset
367 gtk_tree_model_get(model, &iter, TPM_HOSTNAME_COLUMN, &id, -1);
ffeb39523eb6 - Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19053
diff changeset
368
19066
b631b409a515 - Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19065
diff changeset
369 /* Prompt to confirm deletion */
b631b409a515 - Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19065
diff changeset
370 primary = g_strdup_printf(
b631b409a515 - Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19065
diff changeset
371 _("Really delete certificate for %s?"), id );
22240
71e27bc2e82b Remove whitespace on empty lions
Mark Doliner <mark@kingant.net>
parents: 22143
diff changeset
372
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
373 purple_request_yes_no(tpm_dat, _("Confirm certificate delete"),
19066
b631b409a515 - Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19065
diff changeset
374 primary, NULL, /* Can this be NULL? */
22257
8233bbcf3e86 The Gnome Human Interface Guidelines say, "if pressing this button by
Mark Doliner <mark@kingant.net>
parents: 22255
diff changeset
375 0, /* "yes" is the default action */
19066
b631b409a515 - Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19065
diff changeset
376 NULL, NULL, NULL,
b631b409a515 - Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19065
diff changeset
377 id, /* id ownership passed to callback */
b631b409a515 - Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19065
diff changeset
378 tls_peers_mgmt_delete_confirm_cb,
b631b409a515 - Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19065
diff changeset
379 tls_peers_mgmt_delete_confirm_cb );
22240
71e27bc2e82b Remove whitespace on empty lions
Mark Doliner <mark@kingant.net>
parents: 22143
diff changeset
380
19066
b631b409a515 - Make tls_peers_mgmt delete button prompt for yes/no before removing
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19065
diff changeset
381 g_free(primary);
22240
71e27bc2e82b Remove whitespace on empty lions
Mark Doliner <mark@kingant.net>
parents: 22143
diff changeset
382
19054
ffeb39523eb6 - Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19053
diff changeset
383 } else {
ffeb39523eb6 - Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19053
diff changeset
384 purple_debug_warning("gtkcertmgr/tls_peers_mgmt",
ffeb39523eb6 - Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19053
diff changeset
385 "Delete clicked with no selection?\n");
ffeb39523eb6 - Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19053
diff changeset
386 return;
ffeb39523eb6 - Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19053
diff changeset
387 }
ffeb39523eb6 - Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19053
diff changeset
388 }
ffeb39523eb6 - Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19053
diff changeset
389
19038
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
390 static GtkWidget *
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
391 tls_peers_mgmt_build(void)
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
392 {
19041
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
393 GtkWidget *bbox;
19052
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
394 GtkListStore *store;
22253
f5d132f52f2a Add the list of certificates in Pidgin's certificate manager to a
Mark Doliner <mark@kingant.net>
parents: 22240
diff changeset
395 GtkWidget *sw;
19052
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
396
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
397 /* This block of variables will end up in tpm_dat */
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
398 GtkTreeView *listview;
19055
e5981fc8733f - Code cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19054
diff changeset
399 GtkTreeSelection *select;
19041
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
400 GtkWidget *importbutton;
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
401 GtkWidget *exportbutton;
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
402 GtkWidget *infobutton;
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
403 GtkWidget *deletebutton;
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
404 /** Element to return to the Certmgr window to put in the Notebook */
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
405 GtkWidget *mgmt_widget;
19052
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
406
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
407 /* Create a struct to store context information about this window */
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
408 tpm_dat = g_new0(tls_peers_mgmt_data, 1);
22240
71e27bc2e82b Remove whitespace on empty lions
Mark Doliner <mark@kingant.net>
parents: 22143
diff changeset
409
19052
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
410 tpm_dat->mgmt_widget = mgmt_widget =
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
411 gtk_hbox_new(FALSE, /* Non-homogeneous */
22255
c55f695ecae4 Slightly cleaner
Mark Doliner <mark@kingant.net>
parents: 22254
diff changeset
412 PIDGIN_HIG_BOX_SPACE);
c55f695ecae4 Slightly cleaner
Mark Doliner <mark@kingant.net>
parents: 22254
diff changeset
413 gtk_container_set_border_width(GTK_CONTAINER(mgmt_widget),
c55f695ecae4 Slightly cleaner
Mark Doliner <mark@kingant.net>
parents: 22254
diff changeset
414 PIDGIN_HIG_BOX_SPACE);
19039
3054f7c6b30d - Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19038
diff changeset
415 gtk_widget_show(mgmt_widget);
3054f7c6b30d - Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19038
diff changeset
416
3054f7c6b30d - Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19038
diff changeset
417 /* Ensure that everything gets cleaned up when the dialog box
3054f7c6b30d - Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19038
diff changeset
418 is closed */
3054f7c6b30d - Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19038
diff changeset
419 g_signal_connect(G_OBJECT(mgmt_widget), "destroy",
3054f7c6b30d - Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19038
diff changeset
420 G_CALLBACK(tls_peers_mgmt_destroy), NULL);
19041
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
421
22253
f5d132f52f2a Add the list of certificates in Pidgin's certificate manager to a
Mark Doliner <mark@kingant.net>
parents: 22240
diff changeset
422 /* Scrolled window */
f5d132f52f2a Add the list of certificates in Pidgin's certificate manager to a
Mark Doliner <mark@kingant.net>
parents: 22240
diff changeset
423 sw = gtk_scrolled_window_new(NULL,NULL);
f5d132f52f2a Add the list of certificates in Pidgin's certificate manager to a
Mark Doliner <mark@kingant.net>
parents: 22240
diff changeset
424 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
f5d132f52f2a Add the list of certificates in Pidgin's certificate manager to a
Mark Doliner <mark@kingant.net>
parents: 22240
diff changeset
425 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
f5d132f52f2a Add the list of certificates in Pidgin's certificate manager to a
Mark Doliner <mark@kingant.net>
parents: 22240
diff changeset
426 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN);
f5d132f52f2a Add the list of certificates in Pidgin's certificate manager to a
Mark Doliner <mark@kingant.net>
parents: 22240
diff changeset
427 gtk_box_pack_start(GTK_BOX(mgmt_widget), GTK_WIDGET(sw),
f5d132f52f2a Add the list of certificates in Pidgin's certificate manager to a
Mark Doliner <mark@kingant.net>
parents: 22240
diff changeset
428 TRUE, TRUE, /* Take up lots of space */
22254
f60df7e0450b Improve the spacing in Pidgin's certificate manager window
Mark Doliner <mark@kingant.net>
parents: 22253
diff changeset
429 0);
22253
f5d132f52f2a Add the list of certificates in Pidgin's certificate manager to a
Mark Doliner <mark@kingant.net>
parents: 22240
diff changeset
430 gtk_widget_show(GTK_WIDGET(sw));
f5d132f52f2a Add the list of certificates in Pidgin's certificate manager to a
Mark Doliner <mark@kingant.net>
parents: 22240
diff changeset
431
19041
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
432 /* List view */
19042
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
433 store = gtk_list_store_new(TPM_N_COLUMNS, G_TYPE_STRING);
22240
71e27bc2e82b Remove whitespace on empty lions
Mark Doliner <mark@kingant.net>
parents: 22143
diff changeset
434
19052
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
435 tpm_dat->listview = listview =
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
436 GTK_TREE_VIEW(gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)));
22087
d943df776c09 It turns out the tree-models need to be unref'ed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21970
diff changeset
437 g_object_unref(G_OBJECT(store));
22240
71e27bc2e82b Remove whitespace on empty lions
Mark Doliner <mark@kingant.net>
parents: 22143
diff changeset
438
19042
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
439 {
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
440 GtkCellRenderer *renderer;
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
441 GtkTreeViewColumn *column;
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
442
19043
8026af6fbb3b - Specify the selection mode on the tls_peers_mgmt listview (may not be
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19042
diff changeset
443 /* Set up the display columns */
19042
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
444 renderer = gtk_cell_renderer_text_new();
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
445 column = gtk_tree_view_column_new_with_attributes(
21970
a83a70314f8a Mark a string for translation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21913
diff changeset
446 _("Hostname"),
19042
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
447 renderer,
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
448 "text", TPM_HOSTNAME_COLUMN,
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
449 NULL);
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
450 gtk_tree_view_append_column(GTK_TREE_VIEW(listview), column);
19650
2604ae7c227b Sort the certificates by hostname
Mark Doliner <mark@kingant.net>
parents: 19522
diff changeset
451
2604ae7c227b Sort the certificates by hostname
Mark Doliner <mark@kingant.net>
parents: 19522
diff changeset
452 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(store),
2604ae7c227b Sort the certificates by hostname
Mark Doliner <mark@kingant.net>
parents: 19522
diff changeset
453 TPM_HOSTNAME_COLUMN, GTK_SORT_ASCENDING);
19042
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
454 }
22240
71e27bc2e82b Remove whitespace on empty lions
Mark Doliner <mark@kingant.net>
parents: 22143
diff changeset
455
19055
e5981fc8733f - Code cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19054
diff changeset
456 /* Get the treeview selector into the struct */
e5981fc8733f - Code cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19054
diff changeset
457 tpm_dat->listselect = select =
e5981fc8733f - Code cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19054
diff changeset
458 gtk_tree_view_get_selection(GTK_TREE_VIEW(listview));
22240
71e27bc2e82b Remove whitespace on empty lions
Mark Doliner <mark@kingant.net>
parents: 22143
diff changeset
459
19055
e5981fc8733f - Code cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19054
diff changeset
460 /* Force the selection mode */
e5981fc8733f - Code cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19054
diff changeset
461 gtk_tree_selection_set_mode(select, GTK_SELECTION_SINGLE);
19056
9e747806bb07 - Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19055
diff changeset
462
9e747806bb07 - Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19055
diff changeset
463 /* Use a callback to enable/disable the buttons based on whether
9e747806bb07 - Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19055
diff changeset
464 something is selected */
9e747806bb07 - Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19055
diff changeset
465 g_signal_connect(G_OBJECT(select), "changed",
9e747806bb07 - Delete button now usable!
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19055
diff changeset
466 G_CALLBACK(tls_peers_mgmt_select_chg_cb), NULL);
22240
71e27bc2e82b Remove whitespace on empty lions
Mark Doliner <mark@kingant.net>
parents: 22143
diff changeset
467
22253
f5d132f52f2a Add the list of certificates in Pidgin's certificate manager to a
Mark Doliner <mark@kingant.net>
parents: 22240
diff changeset
468 gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(listview));
19052
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
469 gtk_widget_show(GTK_WIDGET(listview));
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
470
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
471 /* Fill the list for the first time */
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
472 tls_peers_mgmt_repopulate_list();
22240
71e27bc2e82b Remove whitespace on empty lions
Mark Doliner <mark@kingant.net>
parents: 22143
diff changeset
473
19041
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
474 /* Right-hand side controls box */
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
475 bbox = gtk_vbutton_box_new();
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
476 gtk_box_pack_end(GTK_BOX(mgmt_widget), bbox,
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
477 FALSE, FALSE, /* Do not take up space */
22254
f60df7e0450b Improve the spacing in Pidgin's certificate manager window
Mark Doliner <mark@kingant.net>
parents: 22253
diff changeset
478 0);
19058
ba99c1100e98 - HIG compliance improved
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19057
diff changeset
479 gtk_box_set_spacing(GTK_BOX(bbox), PIDGIN_HIG_BOX_SPACE);
19041
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
480 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_START);
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
481 gtk_widget_show(bbox);
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
482
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
483 /* Import button */
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
484 /* TODO: This is the wrong stock button */
19052
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
485 tpm_dat->importbutton = importbutton =
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
486 gtk_button_new_from_stock(GTK_STOCK_ADD);
19041
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
487 gtk_box_pack_start(GTK_BOX(bbox), importbutton, FALSE, FALSE, 0);
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
488 gtk_widget_show(importbutton);
19062
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
489 g_signal_connect(G_OBJECT(importbutton), "clicked",
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
490 G_CALLBACK(tls_peers_mgmt_import_cb), NULL);
da88aa8f83ad - Import button now (more or less) functional
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19061
diff changeset
491
19041
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
492
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
493 /* Export button */
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
494 /* TODO: This is the wrong stock button */
19052
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
495 tpm_dat->exportbutton = exportbutton =
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
496 gtk_button_new_from_stock(GTK_STOCK_SAVE);
19041
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
497 gtk_box_pack_start(GTK_BOX(bbox), exportbutton, FALSE, FALSE, 0);
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
498 gtk_widget_show(exportbutton);
19064
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
499 g_signal_connect(G_OBJECT(exportbutton), "clicked",
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
500 G_CALLBACK(tls_peers_mgmt_export_cb), NULL);
f407244c4e57 - Export button now functional due to the magic of copy-paste coding
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19062
diff changeset
501
19041
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
502
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
503 /* Info button */
19052
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
504 tpm_dat->infobutton = infobutton =
19503
2f0960548c1d Make the gtkcert stuff compile on GTK+ older than 2.8
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19270
diff changeset
505 gtk_button_new_from_stock(PIDGIN_STOCK_INFO);
19041
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
506 gtk_box_pack_start(GTK_BOX(bbox), infobutton, FALSE, FALSE, 0);
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
507 gtk_widget_show(infobutton);
19065
ebae00bbb57e - Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19064
diff changeset
508 g_signal_connect(G_OBJECT(infobutton), "clicked",
ebae00bbb57e - Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19064
diff changeset
509 G_CALLBACK(tls_peers_mgmt_info_cb), NULL);
ebae00bbb57e - Make a rudimentary information button in tls_peers_mgmt
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19064
diff changeset
510
19041
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
511
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
512 /* Delete button */
19052
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
513 tpm_dat->deletebutton = deletebutton =
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
514 gtk_button_new_from_stock(GTK_STOCK_DELETE);
19041
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
515 gtk_box_pack_start(GTK_BOX(bbox), deletebutton, FALSE, FALSE, 0);
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
516 gtk_widget_show(deletebutton);
19054
ffeb39523eb6 - Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19053
diff changeset
517 g_signal_connect(G_OBJECT(deletebutton), "clicked",
ffeb39523eb6 - Make the tls_peers certmgr delete button do something
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19053
diff changeset
518 G_CALLBACK(tls_peers_mgmt_delete_cb), NULL);
19041
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
519
19057
3cc03c2801ed - Delegate all button enabling/disabling in tls_peers_mgmt to its "is
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19056
diff changeset
520 /* Call the "selection changed" callback, which will probably disable
3cc03c2801ed - Delegate all button enabling/disabling in tls_peers_mgmt to its "is
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19056
diff changeset
521 all the buttons since nothing is selected yet */
3cc03c2801ed - Delegate all button enabling/disabling in tls_peers_mgmt to its "is
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19056
diff changeset
522 tls_peers_mgmt_select_chg_cb(select, NULL);
19052
78f185af7952 - Add a struct to hold various pieces of data for the tls_peers mgmt UI
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19043
diff changeset
523
19053
95a8469cd1e3 - tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19052
diff changeset
524 /* Bind us to the tls_peers pool */
95a8469cd1e3 - tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19052
diff changeset
525 tpm_dat->tls_peers = purple_certificate_find_pool("x509", "tls_peers");
22240
71e27bc2e82b Remove whitespace on empty lions
Mark Doliner <mark@kingant.net>
parents: 22143
diff changeset
526
19053
95a8469cd1e3 - tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19052
diff changeset
527 /**** libpurple signals ****/
95a8469cd1e3 - tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19052
diff changeset
528 /* Respond to certificate add/remove by just reloading everything */
95a8469cd1e3 - tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19052
diff changeset
529 purple_signal_connect(tpm_dat->tls_peers, "certificate-stored",
95a8469cd1e3 - tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19052
diff changeset
530 tpm_dat, PURPLE_CALLBACK(tls_peers_mgmt_mod_cb),
95a8469cd1e3 - tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19052
diff changeset
531 NULL);
95a8469cd1e3 - tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19052
diff changeset
532 purple_signal_connect(tpm_dat->tls_peers, "certificate-deleted",
95a8469cd1e3 - tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19052
diff changeset
533 tpm_dat, PURPLE_CALLBACK(tls_peers_mgmt_mod_cb),
95a8469cd1e3 - tls_peers certmgr now responds to certificate-stored,
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19052
diff changeset
534 NULL);
22240
71e27bc2e82b Remove whitespace on empty lions
Mark Doliner <mark@kingant.net>
parents: 22143
diff changeset
535
19039
3054f7c6b30d - Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19038
diff changeset
536 return mgmt_widget;
19038
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
537 }
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
538
21015
787b3897ba9f Patch from Andrew Gaul to constify a bunch of static variables to reduce
Ka-Hing Cheung <khc@hxbc.us>
parents: 20074
diff changeset
539 const PidginCertificateManager tls_peers_mgmt = {
19038
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
540 tls_peers_mgmt_build, /* Widget creation function */
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
541 N_("SSL Servers")
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
542 };
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
543
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
544 /*****************************************************************************
19035
284199d26040 - Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19032
diff changeset
545 * GTK+ main certificate manager *
284199d26040 - Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19032
diff changeset
546 *****************************************************************************/
19031
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
547 typedef struct
19015
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
548 {
19031
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
549 GtkWidget *window;
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
550 GtkWidget *notebook;
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
551
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
552 GtkWidget *closebutton;
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
553 } CertMgrDialog;
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
554
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
555 /* If a certificate manager window is open, this will point to it.
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
556 So if it is set, don't open another one! */
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
557 CertMgrDialog *certmgr_dialog = NULL;
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
558
21913
2a591a5b3322 Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21652
diff changeset
559 static gboolean
19031
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
560 certmgr_close_cb(GtkWidget *w, CertMgrDialog *dlg)
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
561 {
19035
284199d26040 - Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19032
diff changeset
562 /* TODO: Ignoring the arguments to this function may not be ideal,
284199d26040 - Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19032
diff changeset
563 but there *should* only be "one dialog to rule them all" at a time*/
19031
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
564 pidgin_certmgr_hide();
21913
2a591a5b3322 Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21652
diff changeset
565 return FALSE;
19031
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
566 }
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
567
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
568 void
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
569 pidgin_certmgr_show(void)
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
570 {
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
571 CertMgrDialog *dlg;
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
572 GtkWidget *win;
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
573 GtkWidget *vbox;
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
574
19029
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
575 /* Enumerate all the certificates on file */
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
576 {
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
577 GList *idlist, *poollist;
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
578
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
579 for ( poollist = purple_certificate_get_pools();
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
580 poollist;
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
581 poollist = poollist->next ) {
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
582 PurpleCertificatePool *pool = poollist->data;
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
583 GList *l;
22240
71e27bc2e82b Remove whitespace on empty lions
Mark Doliner <mark@kingant.net>
parents: 22143
diff changeset
584
19029
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
585 purple_debug_info("gtkcertmgr",
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
586 "Pool %s found for scheme %s -"
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
587 "Enumerating certificates:\n",
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
588 pool->name, pool->scheme_name);
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
589
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
590 idlist = purple_certificate_pool_get_idlist(pool);
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
591
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
592 for (l=idlist; l; l = l->next) {
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
593 purple_debug_info("gtkcertmgr",
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
594 "- %s\n",
19513
8c59bb6dfc7e Fix printf(%s, NULL).
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19503
diff changeset
595 l->data ? (gchar *) l->data : "(null)");
19029
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
596 } /* idlist */
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
597 purple_certificate_pool_destroy_idlist(idlist);
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
598 } /* poollist */
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
599 }
19031
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
600
22240
71e27bc2e82b Remove whitespace on empty lions
Mark Doliner <mark@kingant.net>
parents: 22143
diff changeset
601
19031
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
602 /* If the manager is already open, bring it to the front */
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
603 if (certmgr_dialog != NULL) {
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
604 gtk_window_present(GTK_WINDOW(certmgr_dialog->window));
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
605 return;
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
606 }
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
607
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
608 /* Create the dialog, and set certmgr_dialog so we never create
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
609 more than one at a time */
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
610 dlg = certmgr_dialog = g_new0(CertMgrDialog, 1);
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
611
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
612 win = dlg->window =
21646
2a2496044eef Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
613 pidgin_create_dialog(_("Certificate Manager"),/* Title */
19031
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
614 PIDGIN_HIG_BORDER, /*Window border*/
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
615 "certmgr", /* Role */
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
616 TRUE); /* Allow resizing */
19032
73172682eefd - CertMgr window responds properly to delete_event
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19031
diff changeset
617 g_signal_connect(G_OBJECT(win), "delete_event",
73172682eefd - CertMgr window responds properly to delete_event
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19031
diff changeset
618 G_CALLBACK(certmgr_close_cb), dlg);
73172682eefd - CertMgr window responds properly to delete_event
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19031
diff changeset
619
22240
71e27bc2e82b Remove whitespace on empty lions
Mark Doliner <mark@kingant.net>
parents: 22143
diff changeset
620
19031
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
621 /* TODO: Retrieve the user-set window size and use it */
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
622 gtk_window_set_default_size(GTK_WINDOW(win), 400, 400);
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
623
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
624 /* Main vbox */
21646
2a2496044eef Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
625 vbox = pidgin_dialog_get_vbox_with_properties(GTK_DIALOG(win), FALSE, PIDGIN_HIG_BORDER);
19031
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
626
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
627 /* Notebook of various certificate managers */
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
628 dlg->notebook = gtk_notebook_new();
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
629 gtk_box_pack_start(GTK_BOX(vbox), dlg->notebook,
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
630 TRUE, TRUE, /* Notebook should take extra space */
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
631 0);
19038
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
632 gtk_widget_show(dlg->notebook);
19031
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
633
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
634 /* Close button */
21652
eb2d5ba2a50d Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21646
diff changeset
635 dlg->closebutton = pidgin_dialog_add_button(GTK_DIALOG(win), GTK_STOCK_CLOSE,
eb2d5ba2a50d Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21646
diff changeset
636 G_CALLBACK(certmgr_close_cb), dlg);
19031
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
637
19038
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
638 /* Add the defined certificate managers */
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
639 /* TODO: Find a way of determining whether each is shown or not */
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
640 /* TODO: Implement this correctly */
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
641 gtk_notebook_append_page(GTK_NOTEBOOK (dlg->notebook),
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
642 (tls_peers_mgmt.build)(),
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
643 gtk_label_new(_(tls_peers_mgmt.label)) );
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
644
19031
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
645 gtk_widget_show(win);
19015
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
646 }
19031
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
647
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
648 void
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
649 pidgin_certmgr_hide(void)
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
650 {
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
651 /* If it isn't open, do nothing */
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
652 if (certmgr_dialog == NULL) {
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
653 return;
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
654 }
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
655
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
656 purple_signals_disconnect_by_handle(certmgr_dialog);
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
657 purple_prefs_disconnect_by_handle(certmgr_dialog);
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
658
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
659 gtk_widget_destroy(certmgr_dialog->window);
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
660 g_free(certmgr_dialog);
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
661 certmgr_dialog = NULL;
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
662 }