[empathy] factor out account_can_be_enabled()
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] factor out account_can_be_enabled()
- Date: Fri, 30 Mar 2012 11:18:29 +0000 (UTC)
commit a3c14d3f22f4f1a07cf72e3200ac5f1f3b4c843d
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Fri Mar 30 12:47:30 2012 +0200
factor out account_can_be_enabled()
https://bugzilla.gnome.org/show_bug.cgi?id=673141
src/empathy-accounts-dialog.c | 27 ++++++++++++++++++---------
1 files changed, 18 insertions(+), 9 deletions(-)
---
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c
index bab9dac..c21db2b 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
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]