changeset 32558:192691546590

Use the new certificate request API in the certificate manager. I think I also fixed a few leaks from my previous changes.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sun, 26 Feb 2012 05:33:00 +0000
parents c7dfb2a13206
children 32642aa8dbe5
files pidgin/gtkcertmgr.c
diffstat 1 files changed, 5 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkcertmgr.c	Sun Feb 26 05:23:21 2012 +0000
+++ b/pidgin/gtkcertmgr.c	Sun Feb 26 05:33:00 2012 +0000
@@ -40,12 +40,6 @@
 
 #include "gtkcertmgr.h"
 
-#ifdef ENABLE_GCR
-#define GCR_API_SUBJECT_TO_CHANGE
-#include <gcr/gcr.h>
-#include <gcr/gcr-simple-certificate.h>
-#endif
-
 /*****************************************************************************
  * X.509 tls_peers management interface                                      *
  *****************************************************************************/
@@ -316,13 +310,7 @@
 	GtkTreeModel *model;
 	gchar *id;
 	PurpleCertificate *crt;
-#ifdef ENABLE_GCR
-	GByteArray *der;
-	GcrCertificate *gcrt;
 	char *title;
-	GtkWidget *dialog;
-	GcrCertificateBasicsWidget *cert_widget;
-#endif
 
 	/* See if things are selected */
 	if (!gtk_tree_selection_get_selected(select, &model, &iter)) {
@@ -338,38 +326,15 @@
 	crt = purple_certificate_pool_retrieve(tpm_dat->tls_peers, id);
 	g_return_if_fail(crt);
 
-#ifdef ENABLE_GCR
-	der = purple_certificate_get_der_data(crt);
-	g_return_if_fail(der);
-
-	gcrt = gcr_simple_certificate_new(der->data, der->len);
-	g_return_if_fail(gcrt);
-
 	/* Fire the notification */
 	title = g_strdup_printf(_("Certificate Information for %s"), id);
-	dialog = gtk_dialog_new_with_buttons(title,
-	                                     NULL,
-	                                     0,
-	                                     GTK_STOCK_OK,
-	                                     GTK_RESPONSE_ACCEPT,
-	                                     NULL);
-	cert_widget = gcr_certificate_basics_widget_new(gcrt);
-	gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),
-	                   GTK_WIDGET(cert_widget), TRUE, TRUE, 0);
-	g_signal_connect_swapped(dialog, "response",
-	                         G_CALLBACK(gtk_widget_destroy),
-	                         dialog);
-	gtk_widget_show_all(dialog);
-
-	g_byte_array_free(der, TRUE);
-	g_object_unref(G_OBJECT(gcrt));
-#else
-	/* Fire the notification */
-	purple_certificate_display_x509(crt);
+	purple_request_certificate(tpm_dat, title, NULL, NULL, crt,
+	                           _("OK"), G_CALLBACK(purple_certificate_destroy),
+	                           _("Cancel"), G_CALLBACK(purple_certificate_destroy),
+	                           crt);
 
 	g_free(id);
-	purple_certificate_destroy(crt);
-#endif
+	g_free(title);
 }
 
 static void