From 32ca78553b735dcb1a05f62a351a56c1289dc8ce Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 19 Oct 2012 08:41:17 -0400 Subject: Remove "Disable Account" menu item for GOA-based accounts. GOA-based accounts must only be disabled from gnome-control-center. --- mail/e-mail-sidebar.c | 26 ++++++++++++++++++++++++++ mail/e-mail-sidebar.h | 3 ++- 2 files changed, 28 insertions(+), 1 deletion(-) (limited to 'mail') diff --git a/mail/e-mail-sidebar.c b/mail/e-mail-sidebar.c index 2831ac0711..aafa6cd302 100644 --- a/mail/e-mail-sidebar.c +++ b/mail/e-mail-sidebar.c @@ -423,6 +423,7 @@ mail_sidebar_check_state (EMailSidebar *sidebar) gboolean store_is_vfolder; gboolean allows_children = TRUE; gboolean can_delete = TRUE; + gboolean can_disable = TRUE; gboolean is_junk = FALSE; gboolean is_outbox = FALSE; gboolean is_store; @@ -484,6 +485,29 @@ mail_sidebar_check_state (EMailSidebar *sidebar) can_delete &= !(folder_flags & CAMEL_FOLDER_SYSTEM); } + /* GOA-based accounts cannot be disabled from Evolution. */ + if (is_store && !store_is_local && !store_is_vfolder) { + EMFolderTree *folder_tree; + EMailSession *session; + ESourceRegistry *registry; + ESource *source; + ESource *ancestor; + + folder_tree = EM_FOLDER_TREE (sidebar); + session = em_folder_tree_get_session (folder_tree); + registry = e_mail_session_get_registry (session); + source = e_source_registry_ref_source (registry, uid); + + ancestor = e_source_registry_find_extension ( + registry, source, E_SOURCE_EXTENSION_GOA); + if (ancestor != NULL) { + can_disable = FALSE; + g_object_unref (ancestor); + } + + g_object_unref (source); + } + if (allows_children) state |= E_MAIL_SIDEBAR_FOLDER_ALLOWS_CHILDREN; if (can_delete) @@ -502,6 +526,8 @@ mail_sidebar_check_state (EMailSidebar *sidebar) state |= E_MAIL_SIDEBAR_STORE_IS_BUILTIN; if (CAMEL_IS_SUBSCRIBABLE (store)) state |= E_MAIL_SIDEBAR_STORE_IS_SUBSCRIBABLE; + if (can_disable) + state |= E_MAIL_SIDEBAR_STORE_CAN_BE_DISABLED; g_free (full_name); diff --git a/mail/e-mail-sidebar.h b/mail/e-mail-sidebar.h index 76602c6619..a57b6d45f8 100644 --- a/mail/e-mail-sidebar.h +++ b/mail/e-mail-sidebar.h @@ -60,7 +60,8 @@ enum { E_MAIL_SIDEBAR_FOLDER_IS_TRASH = 1 << 5, E_MAIL_SIDEBAR_FOLDER_IS_VIRTUAL = 1 << 6, E_MAIL_SIDEBAR_STORE_IS_BUILTIN = 1 << 7, - E_MAIL_SIDEBAR_STORE_IS_SUBSCRIBABLE = 1 << 8 + E_MAIL_SIDEBAR_STORE_IS_SUBSCRIBABLE = 1 << 8, + E_MAIL_SIDEBAR_STORE_CAN_BE_DISABLED = 1 << 9 }; struct _EMailSidebar { -- cgit v1.2.3