changeset 19053:95a8469cd1e3

- tls_peers certmgr now responds to certificate-stored, certificate-deleted signals
author William Ehlhardt <williamehlhardt@gmail.com>
date Fri, 27 Jul 2007 08:34:40 +0000
parents 78f185af7952
children ffeb39523eb6
files pidgin/gtkcertmgr.c
diffstat 1 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkcertmgr.c	Fri Jul 27 08:24:25 2007 +0000
+++ b/pidgin/gtkcertmgr.c	Fri Jul 27 08:34:40 2007 +0000
@@ -50,6 +50,7 @@
 	GtkWidget *exportbutton;
 	GtkWidget *infobutton;
 	GtkWidget *deletebutton;
+	PurpleCertificatePool *tls_peers;
 } tls_peers_mgmt_data;
 
 tls_peers_mgmt_data *tpm_dat = NULL;
@@ -68,6 +69,7 @@
 	purple_debug_info("certmgr",
 			  "tls peers self-destructs\n");
 
+	purple_signals_disconnect_by_handle(tpm_dat);
 	g_free(tpm_dat); tpm_dat = NULL;
 }
 
@@ -103,6 +105,14 @@
 	purple_certificate_pool_destroy_idlist(idlist);
 }
 
+static void
+tls_peers_mgmt_mod_cb(PurpleCertificatePool *pool, const gchar *id, gpointer data)
+{
+	g_assert (pool == tpm_dat->tls_peers);
+
+	tls_peers_mgmt_repopulate_list();
+}
+
 static GtkWidget *
 tls_peers_mgmt_build(void)
 {
@@ -204,6 +214,18 @@
 	gtk_widget_set_sensitive(infobutton, FALSE);
 	gtk_widget_set_sensitive(deletebutton, FALSE);
 
+	/* Bind us to the tls_peers pool */
+	tpm_dat->tls_peers = purple_certificate_find_pool("x509", "tls_peers");
+	
+	/**** libpurple signals ****/
+	/* Respond to certificate add/remove by just reloading everything */
+	purple_signal_connect(tpm_dat->tls_peers, "certificate-stored",
+			      tpm_dat, PURPLE_CALLBACK(tls_peers_mgmt_mod_cb),
+			      NULL);
+	purple_signal_connect(tpm_dat->tls_peers, "certificate-deleted",
+			      tpm_dat, PURPLE_CALLBACK(tls_peers_mgmt_mod_cb),
+			      NULL);
+	
 	return mgmt_widget;
 }