diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2012-06-15 23:28:46 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-06-15 23:32:27 +0800 |
commit | 1489dc4fd85172be1604b03666a5538ef8015bc7 (patch) | |
tree | 73aab65e641c1e264a5df9bd87a54bf223f41980 /modules/calendar/e-task-shell-sidebar.c | |
parent | a3048b477f44f3d854c32cb12cbf3022c2ca7336 (diff) | |
download | gsoc2013-evolution-1489dc4fd85172be1604b03666a5538ef8015bc7.tar.gz gsoc2013-evolution-1489dc4fd85172be1604b03666a5538ef8015bc7.tar.zst gsoc2013-evolution-1489dc4fd85172be1604b03666a5538ef8015bc7.zip |
Disable 'Rename' if source is a collection member.
For consistency with the Preferences window. We assume the display
names are server-assigned and not user-assigned, at least not assigned
through Evolution.
Diffstat (limited to 'modules/calendar/e-task-shell-sidebar.c')
-rw-r--r-- | modules/calendar/e-task-shell-sidebar.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c index 9e28af2411..304e537166 100644 --- a/modules/calendar/e-task-shell-sidebar.c +++ b/modules/calendar/e-task-shell-sidebar.c @@ -661,9 +661,11 @@ task_shell_sidebar_check_state (EShellSidebar *shell_sidebar) { ETaskShellSidebar *task_shell_sidebar; ESourceSelector *selector; + ESourceRegistry *registry; ESource *source; - gboolean removable = FALSE; - gboolean writable = FALSE; + gboolean is_writable = FALSE; + gboolean is_removable = FALSE; + gboolean in_collection = FALSE; gboolean refresh_supported = FALSE; gboolean has_primary_source = FALSE; guint32 state = 0; @@ -671,17 +673,25 @@ task_shell_sidebar_check_state (EShellSidebar *shell_sidebar) task_shell_sidebar = E_TASK_SHELL_SIDEBAR (shell_sidebar); selector = e_task_shell_sidebar_get_selector (task_shell_sidebar); source = e_source_selector_ref_primary_selection (selector); + registry = e_source_selector_get_registry (selector); if (source != NULL) { EClient *client; + ESource *collection; const gchar *uid; has_primary_source = TRUE; + is_writable = e_source_get_writable (source); + is_removable = e_source_get_removable (source); - uid = e_source_get_uid (source); - removable = e_source_get_removable (source); - writable = e_source_get_writable (source); + collection = e_source_registry_find_extension ( + registry, source, E_SOURCE_EXTENSION_COLLECTION); + if (collection != NULL) { + in_collection = TRUE; + g_object_unref (collection); + } + uid = e_source_get_uid (source); client = g_hash_table_lookup ( task_shell_sidebar->priv->client_table, uid); refresh_supported = @@ -693,10 +703,12 @@ task_shell_sidebar_check_state (EShellSidebar *shell_sidebar) if (has_primary_source) state |= E_TASK_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE; - if (removable) - state |= E_TASK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOVABLE; - if (writable) + if (is_writable) state |= E_TASK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_WRITABLE; + if (is_removable) + state |= E_TASK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOVABLE; + if (in_collection) + state |= E_TASK_SHELL_SIDEBAR_PRIMARY_SOURCE_IN_COLLECTION; if (refresh_supported) state |= E_TASK_SHELL_SIDEBAR_SOURCE_SUPPORTS_REFRESH; |