diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2012-10-19 20:41:17 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-10-19 20:42:42 +0800 |
commit | 32ca78553b735dcb1a05f62a351a56c1289dc8ce (patch) | |
tree | c23071c88b374f652bc83bae30b4b3318a498043 /mail | |
parent | 012a34614326e676168581ae69b605fd167363af (diff) | |
download | gsoc2013-evolution-32ca78553b735dcb1a05f62a351a56c1289dc8ce.tar.gz gsoc2013-evolution-32ca78553b735dcb1a05f62a351a56c1289dc8ce.tar.zst gsoc2013-evolution-32ca78553b735dcb1a05f62a351a56c1289dc8ce.zip |
Remove "Disable Account" menu item for GOA-based accounts.
GOA-based accounts must only be disabled from gnome-control-center.
Diffstat (limited to 'mail')
-rw-r--r-- | mail/e-mail-sidebar.c | 26 | ||||
-rw-r--r-- | mail/e-mail-sidebar.h | 3 |
2 files changed, 28 insertions, 1 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 { |