aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-03-30 18:47:30 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-03-30 19:08:51 +0800
commita3c14d3f22f4f1a07cf72e3200ac5f1f3b4c843d (patch)
tree81d67581ecf7f3dde0c1e142009f9e2e2626205c /src
parente4be0d293f072f7b79720057aced81d8005bf0b2 (diff)
downloadgsoc2013-empathy-a3c14d3f22f4f1a07cf72e3200ac5f1f3b4c843d.tar
gsoc2013-empathy-a3c14d3f22f4f1a07cf72e3200ac5f1f3b4c843d.tar.gz
gsoc2013-empathy-a3c14d3f22f4f1a07cf72e3200ac5f1f3b4c843d.tar.bz2
gsoc2013-empathy-a3c14d3f22f4f1a07cf72e3200ac5f1f3b4c843d.tar.lz
gsoc2013-empathy-a3c14d3f22f4f1a07cf72e3200ac5f1f3b4c843d.tar.xz
gsoc2013-empathy-a3c14d3f22f4f1a07cf72e3200ac5f1f3b4c843d.tar.zst
gsoc2013-empathy-a3c14d3f22f4f1a07cf72e3200ac5f1f3b4c843d.zip
factor out account_can_be_enabled()
https://bugzilla.gnome.org/show_bug.cgi?id=673141
Diffstat (limited to 'src')
-rw-r--r--src/empathy-accounts-dialog.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c
index bab9dac29..c21db2bc7 100644
--- a/src/empathy-accounts-dialog.c
+++ b/src/empathy-accounts-dialog.c
@@ -303,6 +303,23 @@ account_is_selected (EmpathyAccountsDialog *dialog,
return account == selected_account;
}
+static gboolean
+account_can_be_enabled (TpAccount *account)
+{
+ TpStorageRestrictionFlags storage_restrictions;
+
+ storage_restrictions = tp_account_get_storage_restrictions (account);
+ if (storage_restrictions & TP_STORAGE_RESTRICTION_FLAG_CANNOT_SET_ENABLED)
+ return FALSE;
+
+ /* Butterfly accounts shouldn't be used any more */
+ if (!tp_strdiff (tp_account_get_connection_manager (account),
+ "butterfly"))
+ return FALSE;
+
+ return TRUE;
+}
+
static void
accounts_dialog_update_status_infobar (EmpathyAccountsDialog *dialog,
TpAccount *account)
@@ -314,7 +331,6 @@ accounts_dialog_update_status_infobar (EmpathyAccountsDialog *dialog,
guint presence;
gboolean account_enabled;
gboolean creating_account;
- TpStorageRestrictionFlags storage_restrictions = 0;
gboolean display_switch = TRUE;
/* do not update the infobar when the account is not selected */
@@ -341,14 +357,7 @@ accounts_dialog_update_status_infobar (EmpathyAccountsDialog *dialog,
if (!account_enabled)
presence = TP_CONNECTION_PRESENCE_TYPE_OFFLINE;
- storage_restrictions = tp_account_get_storage_restrictions (account);
- if (storage_restrictions & TP_STORAGE_RESTRICTION_FLAG_CANNOT_SET_ENABLED)
- display_switch = FALSE;
-
- /* Butterfly accounts shouldn't be used any more */
- if (!tp_strdiff (tp_account_get_connection_manager (account),
- "butterfly"))
- display_switch = FALSE;
+ display_switch = account_can_be_enabled (account);
}
else
{