aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-03-15 21:55:39 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-03-15 23:14:31 +0800
commit500ef8529e04b2e1606f35d9c0697ef96423a828 (patch)
tree88cdc28057d769df3abad5c26a83e1ae82e15a74
parentc8deddf06929e68ef34b6354aa10cf5c04dbd137 (diff)
downloadgsoc2013-empathy-500ef8529e04b2e1606f35d9c0697ef96423a828.tar
gsoc2013-empathy-500ef8529e04b2e1606f35d9c0697ef96423a828.tar.gz
gsoc2013-empathy-500ef8529e04b2e1606f35d9c0697ef96423a828.tar.bz2
gsoc2013-empathy-500ef8529e04b2e1606f35d9c0697ef96423a828.tar.lz
gsoc2013-empathy-500ef8529e04b2e1606f35d9c0697ef96423a828.tar.xz
gsoc2013-empathy-500ef8529e04b2e1606f35d9c0697ef96423a828.tar.zst
gsoc2013-empathy-500ef8529e04b2e1606f35d9c0697ef96423a828.zip
factor out account_is_selected()
https://bugzilla.gnome.org/show_bug.cgi?id=671035
-rw-r--r--src/empathy-accounts-dialog.c43
1 files changed, 27 insertions, 16 deletions
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c
index 189f22b58..847e1a55e 100644
--- a/src/empathy-accounts-dialog.c
+++ b/src/empathy-accounts-dialog.c
@@ -277,6 +277,32 @@ install_haze_cb (GObject *source,
}
}
+static gboolean
+account_is_selected (EmpathyAccountsDialog *dialog,
+ TpAccount *account)
+{
+ EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
+ GtkTreeSelection *selection;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ TpAccount *selected_account;
+
+ if (account == NULL)
+ return FALSE;
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->treeview));
+
+ if (!gtk_tree_selection_get_selected (selection, &model, &iter))
+ return FALSE;
+
+ gtk_tree_model_get (model, &iter, COL_ACCOUNT, &selected_account, -1);
+
+ if (selected_account != NULL)
+ g_object_unref (selected_account);
+
+ return account == selected_account;
+}
+
static void
accounts_dialog_update_status_infobar (EmpathyAccountsDialog *dialog,
TpAccount *account)
@@ -286,28 +312,13 @@ accounts_dialog_update_status_infobar (EmpathyAccountsDialog *dialog,
guint status;
guint reason;
guint presence;
- GtkTreeView *view;
- GtkTreeModel *model;
- GtkTreeSelection *selection;
- GtkTreeIter iter;
- TpAccount *selected_account;
gboolean account_enabled;
gboolean creating_account;
TpStorageRestrictionFlags storage_restrictions = 0;
gboolean display_switch = TRUE;
- view = GTK_TREE_VIEW (priv->treeview);
- selection = gtk_tree_view_get_selection (view);
-
- if (!gtk_tree_selection_get_selected (selection, &model, &iter))
- return;
-
- gtk_tree_model_get (model, &iter, COL_ACCOUNT, &selected_account, -1);
- if (selected_account != NULL)
- g_object_unref (selected_account);
-
/* do not update the infobar when the account is not selected */
- if (account != selected_account)
+ if (!account_is_selected (dialog, account))
return;
if (account != NULL)