pidgin: 1d08fdd7: Use the new certificate request API in t...

qulogic at pidgin.im qulogic at pidgin.im
Mon Feb 27 18:11:35 EST 2012


----------------------------------------------------------------------
Revision: 1d08fdd763eb705aeb351d2d45782256bba2868d
Parent:   5238ab7cce0cd9fafdabc6c4e01eb29282b40acf
Author:   qulogic at pidgin.im
Date:     02/26/12 00:33:00
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/1d08fdd763eb705aeb351d2d45782256bba2868d

Changelog: 

Use the new certificate request API in the certificate manager.

I think I also fixed a few leaks from my previous changes.

Changes against parent 5238ab7cce0cd9fafdabc6c4e01eb29282b40acf

  patched  pidgin/gtkcertmgr.c

-------------- next part --------------
============================================================
--- pidgin/gtkcertmgr.c	602d3840590d2f5907757b9b24235487fd601dc5
+++ pidgin/gtkcertmgr.c	ba29f5c1ed73be9eeef44e5c1de45abb1e45cf11
@@ -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 @@ tls_peers_mgmt_info_cb(GtkWidget *button
 	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 @@ tls_peers_mgmt_info_cb(GtkWidget *button
 	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);
+	purple_request_certificate(tpm_dat, title, NULL, NULL, crt,
+	                           _("OK"), G_CALLBACK(purple_certificate_destroy),
+	                           _("Cancel"), G_CALLBACK(purple_certificate_destroy),
+	                           crt);
 
-	g_byte_array_free(der, TRUE);
-	g_object_unref(G_OBJECT(gcrt));
-#else
-	/* Fire the notification */
-	purple_certificate_display_x509(crt);
-
 	g_free(id);
-	purple_certificate_destroy(crt);
-#endif
+	g_free(title);
 }
 
 static void


More information about the Commits mailing list