annotate pidgin/gtkcertmgr.c @ 19038:5040616cace9

- Mock tls_peers mgmt interface
author William Ehlhardt <williamehlhardt@gmail.com>
date Thu, 19 Jul 2007 08:56:21 +0000
parents 284199d26040
children 3054f7c6b30d
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 *****************************************************************************/
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
45 static GtkWidget *
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
46 tls_peers_mgmt_build(void)
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
47 {
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
48 GtkWidget *label = gtk_label_new("TLS PEEERSSSSS!!!");
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
49 gtk_widget_show(label);
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
50 return label;
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
51 }
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
52
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
53 PidginCertificateManager tls_peers_mgmt = {
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
54 tls_peers_mgmt_build, /* Widget creation function */
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
55 N_("SSL Servers")
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
56 };
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
57
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
58 /*****************************************************************************
19035
284199d26040 - Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19032
diff changeset
59 * GTK+ main certificate manager *
284199d26040 - Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19032
diff changeset
60 *****************************************************************************/
19031
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
61 typedef struct
19015
720c61141f4b - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
62 {
19031
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
63 GtkWidget *window;
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
64 GtkWidget *notebook;
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
65
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
66 GtkWidget *closebutton;
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
67 } CertMgrDialog;
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
68
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
69 /* 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
70 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
71 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
72
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
73 static void
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
74 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
75 {
19035
284199d26040 - Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19032
diff changeset
76 /* TODO: Ignoring the arguments to this function may not be ideal,
284199d26040 - Comment cosmetics
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19032
diff changeset
77 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
78 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
79 }
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
80
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
81 void
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
82 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
83 {
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
84 CertMgrDialog *dlg;
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
85 GtkWidget *win;
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
86 GtkWidget *vbox;
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
87 GtkWidget *bbox;
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
88
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
89 /* 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
90 {
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
91 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
92
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
93 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
94 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
95 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
96 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
97 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
98
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
99 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
100 "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
101 "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
102 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
103
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
104 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
105
3f929a770f1b - Add debug code to spit a list of all certificates in all pools when
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19015
diff changeset
106 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
107 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
108 "- %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
109 (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
110 } /* 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
111 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
112 } /* 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
113 }
19031
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
114
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
115
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
116 /* 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
117 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
118 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
119 return;
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
120 }
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
121
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
122 /* 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
123 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
124 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
125
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
126 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
127 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
128 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
129 "certmgr", /* Role */
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
130 TRUE); /* Allow resizing */
19032
73172682eefd - CertMgr window responds properly to delete_event
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19031
diff changeset
131 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
132 G_CALLBACK(certmgr_close_cb), dlg);
73172682eefd - CertMgr window responds properly to delete_event
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19031
diff changeset
133
19031
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
134
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
135 /* 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
136 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
137
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
138 /* Main vbox */
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
139 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
140 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
141 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
142
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
143 /* 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
144 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
145 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
146 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
147 0);
19038
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
148 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
149
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
150 /* 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
151 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
152 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
153 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
154 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
155 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
156
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
157 /* Close button */
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
158 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
159 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
160 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
161 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
162 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
163
19038
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
164 /* Add the defined certificate managers */
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
165 /* 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
166 /* TODO: Implement this correctly */
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
167 gtk_notebook_append_page(GTK_NOTEBOOK (dlg->notebook),
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
168 (tls_peers_mgmt.build)(),
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
169 gtk_label_new(_(tls_peers_mgmt.label)) );
5040616cace9 - Mock tls_peers mgmt interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19035
diff changeset
170
19031
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
171 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
172 }
19031
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
173
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
174 void
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
175 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
176 {
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
177 /* 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
178 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
179 return;
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
180 }
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
181
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
182 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
183 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
184
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
185 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
186 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
187 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
188
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
189 /* 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
190 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
191 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
192
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
193 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
194 }
8c3fecc32451 - Make a real Certificate Manager dialog instead of a stupid popup. It
William Ehlhardt <williamehlhardt@gmail.com>
parents: 19029
diff changeset
195 }