aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/e-mail-sidebar.c26
-rw-r--r--mail/e-mail-sidebar.h3
-rw-r--r--modules/mail/e-mail-shell-view.c5
3 files changed, 32 insertions, 2 deletions
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 {
diff --git a/modules/mail/e-mail-shell-view.c b/modules/mail/e-mail-shell-view.c
index 801362d331..4cd97c71cc 100644
--- a/modules/mail/e-mail-shell-view.c
+++ b/modules/mail/e-mail-shell-view.c
@@ -842,6 +842,7 @@ mail_shell_view_update_actions (EShellView *shell_view)
gboolean folder_tree_and_message_list_agree = TRUE;
gboolean store_is_builtin;
gboolean store_is_subscribable;
+ gboolean store_can_be_disabled;
gboolean any_store_is_subscribable = FALSE;
/* Chain up to parent's update_actions() method. */
@@ -883,6 +884,8 @@ mail_shell_view_update_actions (EShellView *shell_view)
(state & E_MAIL_SIDEBAR_STORE_IS_BUILTIN);
store_is_subscribable =
(state & E_MAIL_SIDEBAR_STORE_IS_SUBSCRIBABLE);
+ store_can_be_disabled =
+ (state & E_MAIL_SIDEBAR_STORE_CAN_BE_DISABLED);
uri = em_folder_tree_get_selected_uri (folder_tree);
store = em_folder_tree_get_selected_store (folder_tree);
@@ -968,7 +971,7 @@ mail_shell_view_update_actions (EShellView *shell_view)
g_list_free (list);
action = ACTION (MAIL_ACCOUNT_DISABLE);
- sensitive = (store != NULL) && folder_is_store;
+ sensitive = folder_is_store && store_can_be_disabled;
if (account_is_groupwise)
label = _("Proxy _Logout");
else