From 86eac228724f7a4c45b8bc58254af77bdad1e766 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Wed, 18 Aug 2010 16:40:50 +0200 Subject: Add a details hash table to the dialog properties --- libempathy-gtk/empathy-tls-dialog.c | 29 ++++++++++++++++++++++++++++- libempathy-gtk/empathy-tls-dialog.h | 3 ++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/libempathy-gtk/empathy-tls-dialog.c b/libempathy-gtk/empathy-tls-dialog.c index b61d5cacc..9a2dfd6fc 100644 --- a/libempathy-gtk/empathy-tls-dialog.c +++ b/libempathy-gtk/empathy-tls-dialog.c @@ -41,6 +41,7 @@ enum { PROP_TLS_CERTIFICATE = 1, PROP_REASON, PROP_REMEMBER, + PROP_DETAILS, LAST_PROPERTY, }; @@ -48,6 +49,7 @@ enum { typedef struct { EmpathyTLSCertificate *certificate; EmpTLSCertificateRejectReason reason; + GHashTable *details; gboolean remember; @@ -73,6 +75,9 @@ empathy_tls_dialog_get_property (GObject *object, case PROP_REMEMBER: g_value_set_boolean (value, priv->remember); break; + case PROP_DETAILS: + g_value_set_boxed (value, priv->details); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; @@ -95,6 +100,9 @@ empathy_tls_dialog_set_property (GObject *object, case PROP_REASON: priv->reason = g_value_get_uint (value); break; + case PROP_DETAILS: + priv->details = g_value_dup_boxed (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; @@ -116,6 +124,16 @@ empathy_tls_dialog_dispose (GObject *object) G_OBJECT_CLASS (empathy_tls_dialog_parent_class)->dispose (object); } +static void +empathy_tls_dialog_finalize (GObject *object) +{ + EmpathyTLSDialogPriv *priv = GET_PRIV (object); + + tp_clear_boxed (G_TYPE_HASH_TABLE, &priv->details); + + G_OBJECT_CLASS (empathy_tls_dialog_parent_class)->finalize (object); +} + static gchar * reason_to_string (EmpTLSCertificateRejectReason reason) { @@ -279,6 +297,7 @@ empathy_tls_dialog_class_init (EmpathyTLSDialogClass *klass) oclass->set_property = empathy_tls_dialog_set_property; oclass->get_property = empathy_tls_dialog_get_property; oclass->dispose = empathy_tls_dialog_dispose; + oclass->finalize = empathy_tls_dialog_finalize; oclass->constructed = empathy_tls_dialog_constructed; pspec = g_param_spec_object ("certificate", "The EmpathyTLSCertificate", @@ -299,11 +318,18 @@ empathy_tls_dialog_class_init (EmpathyTLSDialogClass *klass) FALSE, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); g_object_class_install_property (oclass, PROP_REMEMBER, pspec); + + pspec = g_param_spec_boxed ("details", "Rejection details", + "Additional details about the rejection of this certificate.", + G_TYPE_HASH_TABLE, + G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property (oclass, PROP_DETAILS, pspec); } GtkWidget * empathy_tls_dialog_new (EmpathyTLSCertificate *certificate, - EmpTLSCertificateRejectReason reason) + EmpTLSCertificateRejectReason reason, + GHashTable *details) { g_assert (EMPATHY_IS_TLS_CERTIFICATE (certificate)); @@ -311,5 +337,6 @@ empathy_tls_dialog_new (EmpathyTLSCertificate *certificate, "message-type", GTK_MESSAGE_WARNING, "certificate", certificate, "reason", reason, + "details", details, NULL); } diff --git a/libempathy-gtk/empathy-tls-dialog.h b/libempathy-gtk/empathy-tls-dialog.h index c8e5e7662..fcf72fe9b 100644 --- a/libempathy-gtk/empathy-tls-dialog.h +++ b/libempathy-gtk/empathy-tls-dialog.h @@ -61,7 +61,8 @@ GType empathy_tls_dialog_get_type (void); EmpathyTLSDialogClass)) GtkWidget * empathy_tls_dialog_new (EmpathyTLSCertificate *certificate, - EmpTLSCertificateRejectReason reason); + EmpTLSCertificateRejectReason reason, + GHashTable *details); G_END_DECLS -- cgit v1.2.3