EmpathyAccountChooserFilterFunc filter;
gpointer filter_data;
gboolean ready;
+
+ TpAccount *select_when_ready;
};
typedef struct
{
FilterResultCallbackData *data;
+ g_return_val_if_fail (self != NULL, NULL);
+ g_return_val_if_fail (account != NULL, NULL);
+ g_return_val_if_fail (iter != NULL, NULL);
+
data = g_slice_new0 (FilterResultCallbackData);
data->self = g_object_ref (self);
data->account = g_object_ref (account);
TpAccount *account,
EmpathyAccountChooser *self);
static void account_chooser_account_remove_foreach (TpAccount *account,
- EmpathyAccountChooser*self);
+ EmpathyAccountChooser *self);
static void account_chooser_update_iter (EmpathyAccountChooser *self,
GtkTreeIter *iter);
static void account_chooser_status_changed_cb (TpAccount *account,
SetAccountData *data);
static void update_account (EmpathyAccountChooser *self,
TpAccount *account);
+static gboolean select_account (EmpathyAccountChooser *self,
+ TpAccount *account);
enum {
PROP_0,
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);
}
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);
}
return connection;
}
-/**
- * empathy_account_chooser_set_account:
- * @self: an #EmpathyAccountChooser
- * @account: a #TpAccount
- *
- * Sets the currently selected account to @account, if it exists in the list.
- *
- * Return value: whether the chooser was set to @account.
- */
-gboolean
-empathy_account_chooser_set_account (EmpathyAccountChooser *self,
+static gboolean
+select_account (EmpathyAccountChooser *self,
TpAccount *account)
{
GtkComboBox *combobox;
return data.set;
}
+/**
+ * empathy_account_chooser_set_account:
+ * @self: an #EmpathyAccountChooser
+ * @account: a #TpAccount
+ *
+ * Sets the currently selected account to @account, if it exists in the list.
+ *
+ * Return value: whether the chooser was set to @account.
+ */
+gboolean
+empathy_account_chooser_set_account (EmpathyAccountChooser *self,
+ TpAccount *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
empathy_account_chooser_set_all (EmpathyAccountChooser *self)
{
static gboolean
account_chooser_find_account (EmpathyAccountChooser *self,
TpAccount *account,
- GtkTreeIter*iter)
+ GtkTreeIter *iter)
{
GtkListStore *store;
GtkComboBox *combobox;