aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2010-08-13 22:14:28 +0800
committerCosimo Cecchi <cosimoc@gnome.org>2010-08-13 22:22:25 +0800
commit48973a29e5016c9e88b3b19fdfe8e31856ce9cf5 (patch)
treea62eac58b172a3cd5071b9f85a0aa3d25c6f575c
parentdd57dd21018ac62e2cc89f5aa5e24d682d4c9886 (diff)
downloadgsoc2013-empathy-48973a29e5016c9e88b3b19fdfe8e31856ce9cf5.tar
gsoc2013-empathy-48973a29e5016c9e88b3b19fdfe8e31856ce9cf5.tar.gz
gsoc2013-empathy-48973a29e5016c9e88b3b19fdfe8e31856ce9cf5.tar.bz2
gsoc2013-empathy-48973a29e5016c9e88b3b19fdfe8e31856ce9cf5.tar.lz
gsoc2013-empathy-48973a29e5016c9e88b3b19fdfe8e31856ce9cf5.tar.xz
gsoc2013-empathy-48973a29e5016c9e88b3b19fdfe8e31856ce9cf5.tar.zst
gsoc2013-empathy-48973a29e5016c9e88b3b19fdfe8e31856ce9cf5.zip
Add a 'remember' checkbox and property to the dialog
-rw-r--r--libempathy-gtk/empathy-tls-dialog.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/libempathy-gtk/empathy-tls-dialog.c b/libempathy-gtk/empathy-tls-dialog.c
index d149dedbf..0fe0093b6 100644
--- a/libempathy-gtk/empathy-tls-dialog.c
+++ b/libempathy-gtk/empathy-tls-dialog.c
@@ -40,6 +40,7 @@ G_DEFINE_TYPE (EmpathyTLSDialog, empathy_tls_dialog,
enum {
PROP_TLS_CERTIFICATE = 1,
PROP_REASON,
+ PROP_REMEMBER,
LAST_PROPERTY,
};
@@ -48,6 +49,8 @@ typedef struct {
EmpathyTLSCertificate *certificate;
EmpTLSCertificateRejectReason reason;
+ gboolean remember;
+
gboolean dispose_run;
} EmpathyTLSDialogPriv;
@@ -67,6 +70,9 @@ empathy_tls_dialog_get_property (GObject *object,
case PROP_REASON:
g_value_set_uint (value, priv->reason);
break;
+ case PROP_REMEMBER:
+ g_value_set_boolean (value, priv->remember);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -189,9 +195,20 @@ build_gcr_widget (EmpathyTLSDialog *self)
}
static void
+checkbox_toggled_cb (GtkToggleButton *checkbox,
+ gpointer user_data)
+{
+ EmpathyTLSDialog *self = user_data;
+ EmpathyTLSDialogPriv *priv = GET_PRIV (self);
+
+ priv->remember = gtk_toggle_button_get_active (checkbox);
+ g_object_notify (G_OBJECT (self), "remember");
+}
+
+static void
empathy_tls_dialog_constructed (GObject *object)
{
- GtkWidget *content_area, *expander, *details;
+ GtkWidget *content_area, *expander, *details, *checkbox;
gchar *text;
EmpathyTLSDialog *self = EMPATHY_TLS_DIALOG (object);
GtkMessageDialog *message_dialog = GTK_MESSAGE_DIALOG (self);
@@ -214,10 +231,18 @@ empathy_tls_dialog_constructed (GObject *object)
g_free (text);
content_area = gtk_dialog_get_content_area (dialog);
+
+ checkbox = gtk_check_button_new_with_label (_("Remember this choice"));
+ gtk_box_pack_end (GTK_BOX (content_area), checkbox, FALSE, FALSE, 0);
+ gtk_widget_show (checkbox);
+
+ g_signal_connect (checkbox, "toggled",
+ G_CALLBACK (checkbox_toggled_cb), self);
+
text = g_strdup_printf ("<b>%s</b>", _("Certificate Details"));
expander = gtk_expander_new (text);
gtk_expander_set_use_markup (GTK_EXPANDER (expander), TRUE);
- gtk_box_pack_end (GTK_BOX (content_area), expander, TRUE, TRUE, 6);
+ gtk_box_pack_end (GTK_BOX (content_area), expander, TRUE, TRUE, 0);
gtk_widget_show (expander);
g_free (text);
@@ -259,6 +284,12 @@ empathy_tls_dialog_class_init (EmpathyTLSDialogClass *klass)
EMP_TLS_CERTIFICATE_REJECT_REASON_UNKNOWN,
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (oclass, PROP_REASON, pspec);
+
+ pspec = g_param_spec_boolean ("remember", "Whether to remember the decision",
+ "Whether we should remember the decision for this certificate.",
+ FALSE,
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property (oclass, PROP_REMEMBER, pspec);
}
GtkWidget *