diff options
author | Jonny Lamb <jonnylamb@gnome.org> | 2010-12-10 20:02:17 +0800 |
---|---|---|
committer | Jonny Lamb <jonnylamb@gnome.org> | 2010-12-10 20:02:17 +0800 |
commit | e52ae339c601c4173b011ad28bcdca816649fd4c (patch) | |
tree | ccda71d347be3ca1b546d81076c7cd46c74b6cd5 /libempathy-gtk | |
parent | 41dd635842b27268454435c557b74ea32245c7ae (diff) | |
download | gsoc2013-empathy-e52ae339c601c4173b011ad28bcdca816649fd4c.tar gsoc2013-empathy-e52ae339c601c4173b011ad28bcdca816649fd4c.tar.gz gsoc2013-empathy-e52ae339c601c4173b011ad28bcdca816649fd4c.tar.bz2 gsoc2013-empathy-e52ae339c601c4173b011ad28bcdca816649fd4c.tar.lz gsoc2013-empathy-e52ae339c601c4173b011ad28bcdca816649fd4c.tar.xz gsoc2013-empathy-e52ae339c601c4173b011ad28bcdca816649fd4c.tar.zst gsoc2013-empathy-e52ae339c601c4173b011ad28bcdca816649fd4c.zip |
account-settings: don't block notify::ready on getting a password
The account widget acts a little more synchronously, so we can't wait
for the keyring to give us the password. We can signal later about it
though.
Signed-off-by: Jonny Lamb <jonnylamb@gnome.org>
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-account-widget.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index 27cb882bb..9cbddd316 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -109,6 +109,7 @@ typedef struct { GtkWidget *param_account_widget; GtkWidget *param_password_widget; + gboolean automatic_change; GtkWidget *remember_password_widget; /* Used only for IRC accounts */ @@ -313,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); } @@ -2016,6 +2022,30 @@ remember_password_toggled_cb (GtkToggleButton *button, } 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); @@ -2115,6 +2145,12 @@ do_constructed (GObject *obj) 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", |