annotate pidgin/gtkcertmgr.c @ 19043:8026af6fbb3b

- Specify the selection mode on the tls_peers_mgmt listview (may not be necessary, but I can't find any guarantees of what the default is in the documentation)
author William Ehlhardt <williamehlhardt@gmail.com>
date Fri, 27 Jul 2007 04:38:56 +0000
parents 276c4b70d9cb
children 78f185af7952
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
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
4 *
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
5 * pidgin
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
6 *
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
7 * Pidgin is the legal property of its developers, whose names are too numerous
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
8 * to list here. Please refer to the COPYRIGHT file distributed with this
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
9 * source distribution.
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
10 *
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
14 * (at your option) any later version.
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
15 *
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
19 * GNU General Public License for more details.
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
20 *
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
24 *
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
25 */
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
26
19031
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
27 #include <glib.h>
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
28
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
29 #include "core.h"
19015
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
30 #include "internal.h"
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
31 #include "pidgin.h"
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
32
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
33 #include "certificate.h"
19029
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
34 #include "debug.h"
19015
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
35 #include "notify.h"
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
36
19031
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
37 #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
38 #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
39
19015
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
40 #include "gtkcertmgr.h"
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
41
19035
284199d26040 - Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19032
diff changeset
42 /*****************************************************************************
19038
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
43 * X.509 tls_peers management interface *
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
44 *****************************************************************************/
19039
3054f7c6b30d - Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19038
diff changeset
45
19041
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
46 /* Columns
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
47 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
48 enum
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
49 {
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
50 TPM_HOSTNAME_COLUMN,
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
51 TPM_N_COLUMNS
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
52 };
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
53
19039
3054f7c6b30d - Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19038
diff changeset
54 static void
3054f7c6b30d - Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19038
diff changeset
55 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
56 {
3054f7c6b30d - Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19038
diff changeset
57 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
58 "tls peers self-destructs\n");
3054f7c6b30d - Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19038
diff changeset
59 }
3054f7c6b30d - Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19038
diff changeset
60
19042
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
61 static void
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
62 tls_peers_mgmt_populate_list(GtkTreeView *listview)
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
63 {
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
64 PurpleCertificatePool *tls_peers;
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
65 GList *idlist, *l;
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
66
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
67 GtkListStore *store = GTK_LIST_STORE(
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
68 gtk_tree_view_get_model(GTK_TREE_VIEW(listview)));
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
69
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
70 /* First, delete everything in the list */
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
71 gtk_list_store_clear(store);
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
72
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
73 /* Locate the "tls_peers" pool */
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
74 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
75 g_return_if_fail(tls_peers);
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
76
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
77 /* Grab the loaded certificates */
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
78 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
79
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
80 /* Populate the listview */
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
81 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
82 GtkTreeIter iter;
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
83 gtk_list_store_append(store, &iter);
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
84
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
85 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
86 TPM_HOSTNAME_COLUMN, l->data,
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
87 -1);
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
88 }
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
89 purple_certificate_pool_destroy_idlist(idlist);
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
90 }
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
91
19038
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
92 static GtkWidget *
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
93 tls_peers_mgmt_build(void)
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
94 {
19042
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
95 GtkWidget *listview;
19041
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
96 GtkWidget *bbox;
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
97 GtkWidget *importbutton;
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
98 GtkWidget *exportbutton;
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
99 GtkWidget *infobutton;
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
100 GtkWidget *deletebutton;
19042
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
101
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
102 GtkListStore *store;
19041
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
103
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
104 /** 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
105 GtkWidget *mgmt_widget;
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
106 mgmt_widget = gtk_hbox_new(FALSE, /* Non-homogeneous */
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
107 0); /* No spacing */
19039
3054f7c6b30d - Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19038
diff changeset
108 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
109
3054f7c6b30d - Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19038
diff changeset
110 /* 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
111 is closed */
3054f7c6b30d - Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19038
diff changeset
112 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
113 G_CALLBACK(tls_peers_mgmt_destroy), NULL);
19041
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
114
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
115 /* List view */
19042
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
116 store = gtk_list_store_new(TPM_N_COLUMNS, G_TYPE_STRING);
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
117
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
118 listview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
119 {
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
120 GtkCellRenderer *renderer;
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
121 GtkTreeViewColumn *column;
19043
8026af6fbb3b - Specify the selection mode on the tls_peers_mgmt listview (may not be
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19042
diff changeset
122 GtkTreeSelection *select;
19042
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
123
19043
8026af6fbb3b - Specify the selection mode on the tls_peers_mgmt listview (may not be
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19042
diff changeset
124 /* Set up the display columns */
19042
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
125 renderer = gtk_cell_renderer_text_new();
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
126 column = gtk_tree_view_column_new_with_attributes(
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
127 "Hostname",
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
128 renderer,
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
129 "text", TPM_HOSTNAME_COLUMN,
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
130 NULL);
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
131 gtk_tree_view_append_column(GTK_TREE_VIEW(listview), column);
19043
8026af6fbb3b - Specify the selection mode on the tls_peers_mgmt listview (may not be
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19042
diff changeset
132
8026af6fbb3b - Specify the selection mode on the tls_peers_mgmt listview (may not be
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19042
diff changeset
133 /* Force the selection mode */
8026af6fbb3b - Specify the selection mode on the tls_peers_mgmt listview (may not be
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19042
diff changeset
134 select = gtk_tree_view_get_selection(GTK_TREE_VIEW(listview));
8026af6fbb3b - Specify the selection mode on the tls_peers_mgmt listview (may not be
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19042
diff changeset
135 gtk_tree_selection_set_mode(select, GTK_SELECTION_SINGLE);
19042
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
136 }
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
137
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
138 gtk_box_pack_start(GTK_BOX(mgmt_widget), listview,
19041
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
139 TRUE, TRUE, /* Take up lots of space */
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
140 0); /* TODO: this padding is wrong */
19042
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
141 gtk_widget_show(listview);
276c4b70d9cb - CertMgr now lists the certificates in the pool
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19041
diff changeset
142 tls_peers_mgmt_populate_list(GTK_TREE_VIEW(listview));
19041
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
143
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
144 /* Right-hand side controls box */
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
145 bbox = gtk_vbutton_box_new();
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
146 gtk_box_pack_end(GTK_BOX(mgmt_widget), bbox,
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
147 FALSE, FALSE, /* Do not take up space */
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
148 0); /* TODO: this padding is probably wrong */
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
149 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
150 gtk_widget_show(bbox);
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
151
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
152 /* Import button */
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
153 /* TODO: This is the wrong stock button */
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
154 importbutton = gtk_button_new_from_stock(GTK_STOCK_ADD);
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
155 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
156 gtk_widget_show(importbutton);
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
157
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
158 /* Export button */
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
159 /* TODO: This is the wrong stock button */
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
160 exportbutton = gtk_button_new_from_stock(GTK_STOCK_SAVE);
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
161 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
162 gtk_widget_show(exportbutton);
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
163
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
164 /* Info button */
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
165 infobutton = gtk_button_new_from_stock(GTK_STOCK_INFO);
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
166 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
167 gtk_widget_show(infobutton);
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
168
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
169 /* Delete button */
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
170 deletebutton = gtk_button_new_from_stock(GTK_STOCK_DELETE);
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
171 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
172 gtk_widget_show(deletebutton);
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
173
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
174 /* Disable all the buttons */
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
175 gtk_widget_set_sensitive(importbutton, FALSE);
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
176 gtk_widget_set_sensitive(exportbutton, FALSE);
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
177 gtk_widget_set_sensitive(infobutton, FALSE);
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
178 gtk_widget_set_sensitive(deletebutton, FALSE);
dd4444be5e26 - More pretty (useless) GUI sugar
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19039
diff changeset
179
19039
3054f7c6b30d - Add logic to allow tls_peers manager to properly uninit itself when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19038
diff changeset
180 return mgmt_widget;
19038
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
181 }
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
182
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
183 PidginCertificateManager tls_peers_mgmt = {
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
184 tls_peers_mgmt_build, /* Widget creation function */
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
185 N_("SSL Servers")
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
186 };
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
187
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
188 /*****************************************************************************
19035
284199d26040 - Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19032
diff changeset
189 * GTK+ main certificate manager *
284199d26040 - Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19032
diff changeset
190 *****************************************************************************/
19031
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
191 typedef struct
19015
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
192 {
19031
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
193 GtkWidget *window;
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
194 GtkWidget *notebook;
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
195
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
196 GtkWidget *closebutton;
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
197 } CertMgrDialog;
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
198
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
199 /* 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
200 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
201 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
202
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
203 static void
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
204 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
205 {
19035
284199d26040 - Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19032
diff changeset
206 /* TODO: Ignoring the arguments to this function may not be ideal,
284199d26040 - Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19032
diff changeset
207 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
208 pidgin_certmgr_hide();
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
209 }
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
210
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
211 void
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
212 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
213 {
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
214 CertMgrDialog *dlg;
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
215 GtkWidget *win;
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
216 GtkWidget *vbox;
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
217 GtkWidget *bbox;
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
218
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
219 /* 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
220 {
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
221 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
222
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
223 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
224 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
225 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
226 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
227 GList *l;
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
228
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
229 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
230 "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
231 "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
232 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
233
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
234 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
235
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
236 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
237 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
238 "- %s\n",
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
239 (gchar *) l->data);
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
240 } /* 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
241 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
242 } /* 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
243 }
19031
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
244
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
245
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
246 /* 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
247 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
248 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
249 return;
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
250 }
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
251
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
252 /* 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
253 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
254 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
255
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
256 win = dlg->window =
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
257 pidgin_create_window(_("Certificate Manager"),/* Title */
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
258 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
259 "certmgr", /* Role */
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
260 TRUE); /* Allow resizing */
19032
73172682eefd - CertMgr window responds properly to delete_event
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19031
diff changeset
261 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
262 G_CALLBACK(certmgr_close_cb), dlg);
73172682eefd - CertMgr window responds properly to delete_event
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19031
diff changeset
263
19031
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
264
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
265 /* 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
266 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
267
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
268 /* Main vbox */
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
269 vbox = gtk_vbox_new( FALSE, PIDGIN_HIG_BORDER );
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
270 gtk_container_add(GTK_CONTAINER(win), vbox);
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
271 gtk_widget_show(vbox);
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
272
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
273 /* 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
274 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
275 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
276 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
277 0);
19038
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
278 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
279
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
280 /* Box for the close button */
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
281 bbox = gtk_hbutton_box_new();
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
282 gtk_box_set_spacing(GTK_BOX(bbox), PIDGIN_HIG_BOX_SPACE);
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
283 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
284 gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, TRUE, 0);
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
285 gtk_widget_show(bbox);
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
286
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
287 /* Close button */
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
288 dlg->closebutton = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
289 gtk_box_pack_start(GTK_BOX(bbox), dlg->closebutton, FALSE, FALSE, 0);
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
290 gtk_widget_show(dlg->closebutton);
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
291 g_signal_connect(G_OBJECT(dlg->closebutton), "clicked",
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
292 G_CALLBACK(certmgr_close_cb), dlg);
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
293
19038
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
294 /* Add the defined certificate managers */
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
295 /* 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
296 /* TODO: Implement this correctly */
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
297 gtk_notebook_append_page(GTK_NOTEBOOK (dlg->notebook),
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
298 (tls_peers_mgmt.build)(),
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
299 gtk_label_new(_(tls_peers_mgmt.label)) );
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
300
19031
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
301 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
302 }
19031
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
303
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
304 void
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
305 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
306 {
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
307 /* 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
308 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
309 return;
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
310 }
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
311
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
312 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
313 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
314
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
315 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
316 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
317 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
318
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
319 /* If this was the only window left, quit */
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
320 if (PIDGIN_BLIST(purple_get_blist())->window == NULL &&
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
321 purple_connections_get_all() == NULL) {
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
322
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
323 purple_core_quit();
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
324 }
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
325 }