[empathy/gnome-2-34: 29/60] account-widget: hook up the remember password toggle button



commit bdfa8609af4d7f2bc7cbf8e3b4e762e770fee192
Author: Jonny Lamb <jonnylamb gnome org>
Date:   Wed Dec 8 12:42:36 2010 +0000

    account-widget: hook up the remember password toggle button
    
    Signed-off-by: Jonny Lamb <jonnylamb gnome org>

 libempathy-gtk/empathy-account-widget.c |   38 +++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)
---
diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c
index a326663..28bedd3 100644
--- a/libempathy-gtk/empathy-account-widget.c
+++ b/libempathy-gtk/empathy-account-widget.c
@@ -1705,6 +1705,24 @@ add_register_buttons (EmpathyAccountWidget *self,
 #endif /* HAVE_MEEGO */
 
 static void
+remember_password_toggled_cb (GtkToggleButton *button,
+    EmpathyAccountWidget *self)
+{
+  EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
+
+  if (gtk_toggle_button_get_active (button))
+    {
+      gtk_widget_set_sensitive (priv->param_password_widget, TRUE);
+    }
+  else
+    {
+      gtk_widget_set_sensitive (priv->param_password_widget, FALSE);
+      gtk_entry_set_text (GTK_ENTRY (priv->param_password_widget), "");
+      empathy_account_settings_unset (priv->settings, "password");
+    }
+}
+
+static void
 do_constructed (GObject *obj)
 {
   EmpathyAccountWidget *self = EMPATHY_ACCOUNT_WIDGET (obj);
@@ -1770,6 +1788,26 @@ do_constructed (GObject *obj)
           NULL);
     }
 
+  /* remember password */
+  if (priv->param_password_widget != NULL)
+    {
+      GObject *button;
+
+      button = gtk_builder_get_object (
+          self->ui_details->gui, "remember_password");
+
+      if (button != NULL)
+        {
+          gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
+              !EMP_STR_EMPTY (empathy_account_settings_get_string (
+                      priv->settings, "password")));
+
+          g_signal_connect (button, "toggled",
+              G_CALLBACK (remember_password_toggled_cb), self);
+          remember_password_toggled_cb (GTK_TOGGLE_BUTTON (button), self);
+        }
+    }
+
   /* dup and init the account-manager */
   priv->account_manager = tp_account_manager_dup ();
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]