diff options
author | Jonny Lamb <jonnylamb@gnome.org> | 2010-12-15 16:56:03 +0800 |
---|---|---|
committer | Jonny Lamb <jonnylamb@gnome.org> | 2010-12-15 16:56:03 +0800 |
commit | 2ec9b6e89141999f919f8a3bd4a44fd8abad86ff (patch) | |
tree | 10f81107c111564ec160d173db3b265a9573c4ff /libempathy-gtk | |
parent | 2e38a9c56cdac919f424107928dbbf35d69a41ed (diff) | |
parent | 225ca2e12b053a6c8ece18179d470f01ed1d6fb7 (diff) | |
download | gsoc2013-empathy-2ec9b6e89141999f919f8a3bd4a44fd8abad86ff.tar gsoc2013-empathy-2ec9b6e89141999f919f8a3bd4a44fd8abad86ff.tar.gz gsoc2013-empathy-2ec9b6e89141999f919f8a3bd4a44fd8abad86ff.tar.bz2 gsoc2013-empathy-2ec9b6e89141999f919f8a3bd4a44fd8abad86ff.tar.lz gsoc2013-empathy-2ec9b6e89141999f919f8a3bd4a44fd8abad86ff.tar.xz gsoc2013-empathy-2ec9b6e89141999f919f8a3bd4a44fd8abad86ff.tar.zst gsoc2013-empathy-2ec9b6e89141999f919f8a3bd4a44fd8abad86ff.zip |
Merge branch 'sasl-gui'
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-account-widget-aim.ui | 34 | ||||
-rw-r--r-- | libempathy-gtk/empathy-account-widget-groupwise.ui | 40 | ||||
-rw-r--r-- | libempathy-gtk/empathy-account-widget-icq.ui | 34 | ||||
-rw-r--r-- | libempathy-gtk/empathy-account-widget-jabber.ui | 70 | ||||
-rw-r--r-- | libempathy-gtk/empathy-account-widget-msn.ui | 40 | ||||
-rw-r--r-- | libempathy-gtk/empathy-account-widget-sip.ui | 40 | ||||
-rw-r--r-- | libempathy-gtk/empathy-account-widget-yahoo.ui | 34 | ||||
-rw-r--r-- | libempathy-gtk/empathy-account-widget.c | 139 | ||||
-rw-r--r-- | libempathy-gtk/empathy-password-dialog.c | 7 |
9 files changed, 406 insertions, 32 deletions
diff --git a/libempathy-gtk/empathy-account-widget-aim.ui b/libempathy-gtk/empathy-account-widget-aim.ui index b590eea99..fb2e5181d 100644 --- a/libempathy-gtk/empathy-account-widget-aim.ui +++ b/libempathy-gtk/empathy-account-widget-aim.ui @@ -15,7 +15,7 @@ <child> <object class="GtkTable" id="table_common_settings"> <property name="visible">True</property> - <property name="n_rows">3</property> + <property name="n_rows">4</property> <property name="n_columns">2</property> <property name="column_spacing">12</property> <property name="row_spacing">6</property> @@ -91,6 +91,25 @@ </packing> </child> <child> + <object class="GtkCheckButton" id="remember_password"> + <property name="label" translatable="yes">Remember Password</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child> <placeholder/> </child> </object> @@ -273,5 +292,18 @@ <property name="position">3</property> </packing> </child> + <child> + <object class="GtkCheckButton" id="remember_password_simple"> + <property name="label" translatable="yes">Remember Password</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="position">4</property> + </packing> + </child> </object> </interface> diff --git a/libempathy-gtk/empathy-account-widget-groupwise.ui b/libempathy-gtk/empathy-account-widget-groupwise.ui index 1629a0175..1cf2ea790 100644 --- a/libempathy-gtk/empathy-account-widget-groupwise.ui +++ b/libempathy-gtk/empathy-account-widget-groupwise.ui @@ -14,7 +14,7 @@ <child> <object class="GtkTable" id="table_common_groupwise_settings"> <property name="visible">True</property> - <property name="n_rows">3</property> + <property name="n_rows">4</property> <property name="n_columns">2</property> <property name="column_spacing">12</property> <property name="row_spacing">6</property> @@ -75,9 +75,6 @@ </packing> </child> <child> - <placeholder/> - </child> - <child> <object class="GtkEntry" id="entry_password"> <property name="visible">True</property> <property name="can_focus">True</property> @@ -90,6 +87,28 @@ <property name="bottom_attach">3</property> </packing> </child> + <child> + <object class="GtkCheckButton" id="remember_password"> + <property name="label" translatable="yes">Remember Password</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="expand">False</property> @@ -270,5 +289,18 @@ <property name="position">3</property> </packing> </child> + <child> + <object class="GtkCheckButton" id="remember_password_simple"> + <property name="label" translatable="yes">Remember Password</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="position">4</property> + </packing> + </child> </object> </interface> diff --git a/libempathy-gtk/empathy-account-widget-icq.ui b/libempathy-gtk/empathy-account-widget-icq.ui index 654174f8e..4d9597886 100644 --- a/libempathy-gtk/empathy-account-widget-icq.ui +++ b/libempathy-gtk/empathy-account-widget-icq.ui @@ -15,7 +15,7 @@ <child> <object class="GtkTable" id="table_common_settings"> <property name="visible">True</property> - <property name="n_rows">3</property> + <property name="n_rows">4</property> <property name="n_columns">2</property> <property name="column_spacing">12</property> <property name="row_spacing">6</property> @@ -91,6 +91,25 @@ </packing> </child> <child> + <object class="GtkCheckButton" id="remember_password"> + <property name="label" translatable="yes">Remember Password</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child> <placeholder/> </child> </object> @@ -301,5 +320,18 @@ <property name="position">3</property> </packing> </child> + <child> + <object class="GtkCheckButton" id="remember_password_simple"> + <property name="label" translatable="yes">Remember Password</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="position">4</property> + </packing> + </child> </object> </interface> diff --git a/libempathy-gtk/empathy-account-widget-jabber.ui b/libempathy-gtk/empathy-account-widget-jabber.ui index 3136f51b4..ca476e536 100644 --- a/libempathy-gtk/empathy-account-widget-jabber.ui +++ b/libempathy-gtk/empathy-account-widget-jabber.ui @@ -21,7 +21,7 @@ <child> <object class="GtkTable" id="table_common_settings"> <property name="visible">True</property> - <property name="n_rows">3</property> + <property name="n_rows">4</property> <property name="n_columns">2</property> <property name="column_spacing">12</property> <property name="row_spacing">6</property> @@ -46,8 +46,6 @@ <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> </packing> </child> <child> @@ -60,10 +58,6 @@ </object> <packing> <property name="x_options">GTK_FILL</property> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> </packing> </child> <child> @@ -76,11 +70,9 @@ <property name="mnemonic_widget">entry_password</property> </object> <packing> - <property name="x_options">GTK_FILL</property> - <property name="left_attach">0</property> - <property name="right_attach">1</property> <property name="top_attach">2</property> <property name="bottom_attach">3</property> + <property name="x_options">GTK_FILL</property> </packing> </child> <child> @@ -141,6 +133,25 @@ Use <a href="http://www.facebook.com/username/">this page</a> to cho </packing> </child> <child> + <object class="GtkCheckButton" id="remember_password"> + <property name="label" translatable="yes">Remember Password</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child> <placeholder/> </child> </object> @@ -508,6 +519,19 @@ Use <a href="http://www.facebook.com/username/">this page</a> to cho <property name="position">5</property> </packing> </child> + <child> + <object class="GtkCheckButton" id="remember_password_simple"> + <property name="label" translatable="yes">Remember Password</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="position">6</property> + </packing> + </child> </object> <object class="GtkVBox" id="vbox_gtalk_simple"> <property name="visible">True</property> @@ -598,6 +622,19 @@ Use <a href="http://www.facebook.com/username/">this page</a> to cho <property name="position">3</property> </packing> </child> + <child> + <object class="GtkCheckButton" id="remember_password_g_simple"> + <property name="label" translatable="yes">Remember Password</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="position">4</property> + </packing> + </child> </object> <object class="GtkVBox" id="vbox_fb_simple"> <property name="visible">True</property> @@ -690,5 +727,18 @@ Use <a href="http://www.facebook.com/username/">this page</a> to cho <property name="position">3</property> </packing> </child> + <child> + <object class="GtkCheckButton" id="remember_password_fb_simple"> + <property name="label" translatable="yes">Remember Password</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="position">4</property> + </packing> + </child> </object> </interface> diff --git a/libempathy-gtk/empathy-account-widget-msn.ui b/libempathy-gtk/empathy-account-widget-msn.ui index 133ce487d..6665133f4 100644 --- a/libempathy-gtk/empathy-account-widget-msn.ui +++ b/libempathy-gtk/empathy-account-widget-msn.ui @@ -14,7 +14,7 @@ <child> <object class="GtkTable" id="table_common_msn_settings"> <property name="visible">True</property> - <property name="n_rows">3</property> + <property name="n_rows">4</property> <property name="n_columns">2</property> <property name="column_spacing">12</property> <property name="row_spacing">6</property> @@ -75,9 +75,6 @@ </packing> </child> <child> - <placeholder/> - </child> - <child> <object class="GtkEntry" id="entry_password"> <property name="visible">True</property> <property name="can_focus">True</property> @@ -90,6 +87,28 @@ <property name="bottom_attach">3</property> </packing> </child> + <child> + <object class="GtkCheckButton" id="remember_password"> + <property name="label" translatable="yes">Remember Password</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="expand">False</property> @@ -270,5 +289,18 @@ <property name="position">3</property> </packing> </child> + <child> + <object class="GtkCheckButton" id="remember_password_simple"> + <property name="label" translatable="yes">Remember Password</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="position">4</property> + </packing> + </child> </object> </interface> diff --git a/libempathy-gtk/empathy-account-widget-sip.ui b/libempathy-gtk/empathy-account-widget-sip.ui index b00eda944..98a8f2c17 100644 --- a/libempathy-gtk/empathy-account-widget-sip.ui +++ b/libempathy-gtk/empathy-account-widget-sip.ui @@ -13,7 +13,7 @@ <child> <object class="GtkTable" id="table_common_settings"> <property name="visible">True</property> - <property name="n_rows">3</property> + <property name="n_rows">4</property> <property name="n_columns">2</property> <property name="column_spacing">12</property> <property name="row_spacing">6</property> @@ -75,9 +75,6 @@ </packing> </child> <child> - <placeholder/> - </child> - <child> <object class="GtkEntry" id="entry_password"> <property name="visible">True</property> <property name="can_focus">True</property> @@ -89,6 +86,28 @@ <property name="bottom_attach">3</property> </packing> </child> + <child> + <object class="GtkCheckButton" id="remember_password"> + <property name="label" translatable="yes">Remember Password</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="expand">False</property> @@ -583,6 +602,19 @@ <property name="position">3</property> </packing> </child> + <child> + <object class="GtkCheckButton" id="remember_password_simple"> + <property name="label" translatable="yes">Remember Password</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="position">4</property> + </packing> + </child> </object> <object class="GtkAdjustment" id="adjustment2"> <property name="upper">65535</property> diff --git a/libempathy-gtk/empathy-account-widget-yahoo.ui b/libempathy-gtk/empathy-account-widget-yahoo.ui index acc60de74..16044f3c8 100644 --- a/libempathy-gtk/empathy-account-widget-yahoo.ui +++ b/libempathy-gtk/empathy-account-widget-yahoo.ui @@ -16,7 +16,7 @@ <child> <object class="GtkTable" id="table_common_settings"> <property name="visible">True</property> - <property name="n_rows">3</property> + <property name="n_rows">4</property> <property name="n_columns">2</property> <property name="column_spacing">12</property> <property name="row_spacing">6</property> @@ -92,6 +92,25 @@ </packing> </child> <child> + <object class="GtkCheckButton" id="remember_password"> + <property name="label" translatable="yes">Remember Password</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child> <placeholder/> </child> </object> @@ -357,5 +376,18 @@ <property name="position">3</property> </packing> </child> + <child> + <object class="GtkCheckButton" id="remember_password_simple"> + <property name="label" translatable="yes">Remember password</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="position">4</property> + </packing> + </child> </object> </interface> diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index d96de2b34..d2a1c56f4 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -109,6 +109,9 @@ typedef struct { GtkWidget *param_account_widget; GtkWidget *param_password_widget; + gboolean automatic_change; + GtkWidget *remember_password_widget; + /* Used only for IRC accounts */ EmpathyIrcNetworkChooser *irc_network_chooser; @@ -311,6 +314,11 @@ static void account_widget_entry_changed_cb (GtkEditable *entry, EmpathyAccountWidget *self) { + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); + + if (priv->automatic_change) + return; + account_widget_entry_changed_common (self, GTK_ENTRY (entry), FALSE); empathy_account_widget_changed (self); } @@ -1220,6 +1228,17 @@ account_widget_build_sip (EmpathyAccountWidget *self, EmpathyAccountWidgetPriv *priv = GET_PRIV (self); empathy_account_widget_sip_build (self, filename, &priv->table_common_settings); + + if (priv->simple) + { + priv->remember_password_widget = GTK_WIDGET (gtk_builder_get_object ( + self->ui_details->gui, "remember_password_simple")); + } + else + { + priv->remember_password_widget = GTK_WIDGET (gtk_builder_get_object ( + self->ui_details->gui, "remember_password")); + } } static void @@ -1243,6 +1262,9 @@ account_widget_build_msn (EmpathyAccountWidget *self, NULL); self->ui_details->default_focus = g_strdup ("entry_id_simple"); + + priv->remember_password_widget = GTK_WIDGET (gtk_builder_get_object ( + self->ui_details->gui, "remember_password_simple")); } else { @@ -1259,6 +1281,9 @@ account_widget_build_msn (EmpathyAccountWidget *self, NULL); self->ui_details->default_focus = g_strdup ("entry_id"); + + priv->remember_password_widget = GTK_WIDGET (gtk_builder_get_object ( + self->ui_details->gui, "remember_password")); } } @@ -1401,6 +1426,9 @@ account_widget_build_jabber (EmpathyAccountWidget *self, NULL); self->ui_details->default_focus = g_strdup ("entry_id_simple"); + + priv->remember_password_widget = GTK_WIDGET (gtk_builder_get_object ( + self->ui_details->gui, "remember_password_simple")); } else if (priv->simple && service == GTALK_SERVICE) { @@ -1415,6 +1443,9 @@ account_widget_build_jabber (EmpathyAccountWidget *self, NULL); self->ui_details->default_focus = g_strdup ("entry_id_g_simple"); + + priv->remember_password_widget = GTK_WIDGET (gtk_builder_get_object ( + self->ui_details->gui, "remember_password_g_simple")); } else if (priv->simple && service == FACEBOOK_SERVICE) { @@ -1431,6 +1462,9 @@ account_widget_build_jabber (EmpathyAccountWidget *self, setup_id_widget_with_suffix (self, entry_id, "@chat.facebook.com"); self->ui_details->default_focus = g_strdup ("entry_id_fb_simple"); + + priv->remember_password_widget = GTK_WIDGET (gtk_builder_get_object ( + self->ui_details->gui, "remember_password_fb_simple")); } else { @@ -1476,6 +1510,9 @@ account_widget_build_jabber (EmpathyAccountWidget *self, self->ui_details->default_focus = g_strdup ("entry_id"); priv->spinbutton_port = spinbutton_port; + priv->remember_password_widget = GTK_WIDGET (gtk_builder_get_object ( + self->ui_details->gui, "remember_password")); + g_signal_connect (checkbutton_ssl, "toggled", G_CALLBACK (account_widget_jabber_ssl_toggled_cb), self); @@ -1522,6 +1559,9 @@ account_widget_build_icq (EmpathyAccountWidget *self, NULL); self->ui_details->default_focus = g_strdup ("entry_uin_simple"); + + priv->remember_password_widget = GTK_WIDGET (gtk_builder_get_object ( + self->ui_details->gui, "remember_password_simple")); } else { @@ -1540,6 +1580,9 @@ account_widget_build_icq (EmpathyAccountWidget *self, NULL); self->ui_details->default_focus = g_strdup ("entry_uin"); + + priv->remember_password_widget = GTK_WIDGET (gtk_builder_get_object ( + self->ui_details->gui, "remember_password")); } } @@ -1562,6 +1605,9 @@ account_widget_build_aim (EmpathyAccountWidget *self, NULL); self->ui_details->default_focus = g_strdup ("entry_screenname_simple"); + + priv->remember_password_widget = GTK_WIDGET (gtk_builder_get_object ( + self->ui_details->gui, "remember_password_simple")); } else { @@ -1579,6 +1625,9 @@ account_widget_build_aim (EmpathyAccountWidget *self, NULL); self->ui_details->default_focus = g_strdup ("entry_screenname"); + + priv->remember_password_widget = GTK_WIDGET (gtk_builder_get_object ( + self->ui_details->gui, "remember_password")); } } @@ -1603,6 +1652,9 @@ account_widget_build_yahoo (EmpathyAccountWidget *self, NULL); self->ui_details->default_focus = g_strdup ("entry_id_simple"); + + priv->remember_password_widget = GTK_WIDGET (gtk_builder_get_object ( + self->ui_details->gui, "remember_password_simple")); } else { @@ -1622,6 +1674,9 @@ account_widget_build_yahoo (EmpathyAccountWidget *self, NULL); self->ui_details->default_focus = g_strdup ("entry_id"); + + priv->remember_password_widget = GTK_WIDGET (gtk_builder_get_object ( + self->ui_details->gui, "remember_password")); } } @@ -1643,6 +1698,9 @@ account_widget_build_groupwise (EmpathyAccountWidget *self, NULL); self->ui_details->default_focus = g_strdup ("entry_id_simple"); + + priv->remember_password_widget = GTK_WIDGET (gtk_builder_get_object ( + self->ui_details->gui, "remember_password_simple")); } else { @@ -1659,6 +1717,9 @@ account_widget_build_groupwise (EmpathyAccountWidget *self, NULL); self->ui_details->default_focus = g_strdup ("entry_id"); + + priv->remember_password_widget = GTK_WIDGET (gtk_builder_get_object ( + self->ui_details->gui, "remember_password")); } } @@ -1990,6 +2051,48 @@ 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 +account_settings_password_retrieved_cb (GObject *object, + gpointer user_data) +{ + EmpathyAccountWidget *self = user_data; + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); + const gchar *password = empathy_account_settings_get_string ( + priv->settings, "password"); + + if (password != NULL) + { + /* We have to do this so that when we call gtk_entry_set_text, + * the ::changed callback doesn't think the user made the + * change. */ + priv->automatic_change = TRUE; + gtk_entry_set_text (GTK_ENTRY (priv->param_password_widget), password); + priv->automatic_change = FALSE; + } + + gtk_toggle_button_set_active ( + GTK_TOGGLE_BUTTON (priv->remember_password_widget), + !EMP_STR_EMPTY (password)); +} + +static void do_constructed (GObject *obj) { EmpathyAccountWidget *self = EMPATHY_ACCOUNT_WIDGET (obj); @@ -2074,6 +2177,42 @@ do_constructed (GObject *obj) NULL); } + /* remember password */ + if (priv->param_password_widget != NULL + && priv->remember_password_widget != NULL + && empathy_account_settings_supports_sasl (priv->settings)) + { + if (priv->simple) + { + gtk_toggle_button_set_active ( + GTK_TOGGLE_BUTTON (priv->remember_password_widget), TRUE); + } + else + { + gtk_toggle_button_set_active ( + GTK_TOGGLE_BUTTON (priv->remember_password_widget), + !EMP_STR_EMPTY (empathy_account_settings_get_string ( + priv->settings, "password"))); + + /* The password might not have been retrieved from the + * keyring yet. We should update the remember password + * toggle button and the password entry when/if it is. */ + g_signal_connect (priv->settings, "password-retrieved", + G_CALLBACK (account_settings_password_retrieved_cb), self); + } + + g_signal_connect (priv->remember_password_widget, "toggled", + G_CALLBACK (remember_password_toggled_cb), self); + + remember_password_toggled_cb ( + GTK_TOGGLE_BUTTON (priv->remember_password_widget), self); + } + else if (priv->remember_password_widget != NULL + && !empathy_account_settings_supports_sasl (priv->settings)) + { + gtk_widget_set_visible (priv->remember_password_widget, FALSE); + } + /* dup and init the account-manager */ priv->account_manager = tp_account_manager_dup (); diff --git a/libempathy-gtk/empathy-password-dialog.c b/libempathy-gtk/empathy-password-dialog.c index 3c514ee82..5608bb035 100644 --- a/libempathy-gtk/empathy-password-dialog.c +++ b/libempathy-gtk/empathy-password-dialog.c @@ -264,15 +264,8 @@ empathy_password_dialog_constructed (GObject *object) /* remember password ticky box */ priv->ticky = gtk_check_button_new_with_label (_("Remember password")); - /* Don't add this to the dialog yet because we haven't set up - * everything in the UI properly yet and the MC transition isn't - * ready etc. so we'll just force it to never remember a - * password. */ - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->ticky), FALSE); - /* gtk_box_pack_start (box, priv->ticky, FALSE, FALSE, 0); gtk_widget_show (priv->ticky); - */ g_signal_connect (dialog, "response", G_CALLBACK (password_dialog_response_cb), dialog); |