pidgin: 5238ab7c: Use GCR widgets for the certificate requ...
qulogic at pidgin.im
qulogic at pidgin.im
Mon Feb 27 18:11:57 EST 2012
----------------------------------------------------------------------
Revision: 5238ab7cce0cd9fafdabc6c4e01eb29282b40acf
Parent: c5c34f7de4bee6c41506f14f8d54ab62be024b71
Author: qulogic at pidgin.im
Date: 02/26/12 00:23:21
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/5238ab7cce0cd9fafdabc6c4e01eb29282b40acf
Changelog:
Use GCR widgets for the certificate request field when available.
Changes against parent c5c34f7de4bee6c41506f14f8d54ab62be024b71
patched pidgin/gtkrequest.c
-------------- next part --------------
============================================================
--- pidgin/gtkrequest.c 4e4dd8a2de2d1d2ce76e10250212fd2b29b2cdcb
+++ pidgin/gtkrequest.c 44ba26e221c280b8edba49212636bb325d331d1d
@@ -39,6 +39,12 @@
#include <gdk/gdkkeysyms.h>
+#ifdef ENABLE_GCR
+#define GCR_API_SUBJECT_TO_CHANGE
+#include <gcr/gcr.h>
+#include <gcr/gcr-simple-certificate.h>
+#endif
+
static GtkWidget * create_account_field(PurpleRequestField *field);
typedef struct
@@ -1194,12 +1200,33 @@ create_certificate_field(PurpleRequestFi
static GtkWidget *
create_certificate_field(PurpleRequestField *field)
{
- GtkWidget *cert_label;
PurpleCertificate *cert;
+#ifdef ENABLE_GCR
+ GcrCertificateBasicsWidget *cert_widget;
+ GByteArray *der;
+ GcrCertificate *gcrt;
+#else
+ GtkWidget *cert_label;
char *str;
char *escaped;
+#endif
cert = purple_request_field_certificate_get_value(field);
+
+#ifdef ENABLE_GCR
+ der = purple_certificate_get_der_data(crt);
+ g_return_val_if_fail(der, NULL);
+
+ gcrt = gcr_simple_certificate_new(der->data, der->len);
+ g_return_val_if_fail(gcrt, NULL);
+
+ cert_widget = gcr_certificate_basics_widget_new(gcrt);
+
+ g_byte_array_free(der, TRUE);
+ g_object_unref(G_OBJECT(gcrt));
+
+ return cert_widget;
+#else
str = purple_certificate_get_display_string(cert);
escaped = g_markup_escape_text(str, -1);
@@ -1212,6 +1239,7 @@ create_certificate_field(PurpleRequestFi
g_free(escaped);
return cert_label;
+#endif
}
static void *
More information about the Commits
mailing list