diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-10-26 18:23:45 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-10-28 21:52:18 +0800 |
commit | 8bb2b53dad076cbc9fc92ab11e11f1ba6fcbfd92 (patch) | |
tree | faeb6420e4635e727b0a361c233c90934b789358 /libempathy-gtk/empathy-account-chooser.c | |
parent | 0ae11712afc8dfc1231531fe097ee1debc8b0ece (diff) | |
download | gsoc2013-empathy-8bb2b53dad076cbc9fc92ab11e11f1ba6fcbfd92.tar gsoc2013-empathy-8bb2b53dad076cbc9fc92ab11e11f1ba6fcbfd92.tar.gz gsoc2013-empathy-8bb2b53dad076cbc9fc92ab11e11f1ba6fcbfd92.tar.bz2 gsoc2013-empathy-8bb2b53dad076cbc9fc92ab11e11f1ba6fcbfd92.tar.lz gsoc2013-empathy-8bb2b53dad076cbc9fc92ab11e11f1ba6fcbfd92.tar.xz gsoc2013-empathy-8bb2b53dad076cbc9fc92ab11e11f1ba6fcbfd92.tar.zst gsoc2013-empathy-8bb2b53dad076cbc9fc92ab11e11f1ba6fcbfd92.zip |
empathy_account_chooser_set_account: select account later if not ready yet
It's stupid to have to ask to any user of this widget to do this itself.
https://bugzilla.gnome.org/show_bug.cgi?id=662604
Diffstat (limited to 'libempathy-gtk/empathy-account-chooser.c')
-rw-r--r-- | libempathy-gtk/empathy-account-chooser.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/libempathy-gtk/empathy-account-chooser.c b/libempathy-gtk/empathy-account-chooser.c index 3f7d70b5d..87fdbbfe8 100644 --- a/libempathy-gtk/empathy-account-chooser.c +++ b/libempathy-gtk/empathy-account-chooser.c @@ -65,6 +65,8 @@ struct _EmpathyAccountChooserPriv EmpathyAccountChooserFilterFunc filter; gpointer filter_data; gboolean ready; + + TpAccount *select_when_ready; }; typedef struct @@ -154,6 +156,8 @@ static gboolean account_chooser_set_account_foreach (GtkTreeModel *model, SetAccountData *data); static void update_account (EmpathyAccountChooser *self, TpAccount *account); +static gboolean select_account (EmpathyAccountChooser *self, + TpAccount *account); enum { PROP_0, @@ -295,6 +299,13 @@ account_manager_prepared_cb (GObject *source_object, g_list_free (accounts); + if (self->priv->select_when_ready != NULL) + { + select_account (self, self->priv->select_when_ready); + + g_clear_object (&self->priv->select_when_ready); + } + self->priv->ready = TRUE; g_signal_emit (self, signals[READY], 0); } @@ -354,6 +365,7 @@ account_chooser_dispose (GObject *object) EmpathyAccountChooser *self = EMPATHY_ACCOUNT_CHOOSER (object); g_clear_object (&self->priv->manager); + g_clear_object (&self->priv->select_when_ready); G_OBJECT_CLASS (empathy_account_chooser_parent_class)->dispose (object); } @@ -570,7 +582,17 @@ gboolean empathy_account_chooser_set_account (EmpathyAccountChooser *self, TpAccount *account) { - return select_account (self, account); + if (self->priv->ready) + return select_account (self, account); + + /* Account chooser is not ready yet, we'll try selecting the account once it + * is */ + g_clear_object (&self->priv->select_when_ready); + + if (account != NULL) + self->priv->select_when_ready = g_object_ref (account); + + return FALSE; } void |