[evolution] Enable "delete" action for remote-deletable sources.



commit 4fedf14c7b90d1bab1906d0e1ffd676af620c15c
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu Jul 26 07:54:33 2012 -0400

    Enable "delete" action for remote-deletable sources.

 modules/addressbook/e-book-shell-sidebar.c |    8 ++++++++
 modules/addressbook/e-book-shell-sidebar.h |    4 +++-
 modules/addressbook/e-book-shell-view.c    |    7 ++++++-
 modules/calendar/e-cal-shell-sidebar.c     |    8 ++++++++
 modules/calendar/e-cal-shell-sidebar.h     |    6 ++++--
 modules/calendar/e-cal-shell-view.c        |    7 ++++++-
 modules/calendar/e-memo-shell-sidebar.c    |    8 ++++++++
 modules/calendar/e-memo-shell-sidebar.h    |    6 ++++--
 modules/calendar/e-memo-shell-view.c       |    7 ++++++-
 modules/calendar/e-task-shell-sidebar.c    |    8 ++++++++
 modules/calendar/e-task-shell-sidebar.h    |    6 ++++--
 modules/calendar/e-task-shell-view.c       |    7 ++++++-
 12 files changed, 71 insertions(+), 11 deletions(-)
---
diff --git a/modules/addressbook/e-book-shell-sidebar.c b/modules/addressbook/e-book-shell-sidebar.c
index 2f2d939..6e9e348 100644
--- a/modules/addressbook/e-book-shell-sidebar.c
+++ b/modules/addressbook/e-book-shell-sidebar.c
@@ -149,6 +149,8 @@ book_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
 	ESource *source;
 	gboolean is_writable = FALSE;
 	gboolean is_removable = FALSE;
+	gboolean is_remote_creatable = FALSE;
+	gboolean is_remote_deletable = FALSE;
 	gboolean in_collection = FALSE;
 	gboolean has_primary_source = FALSE;
 	guint32 state = 0;
@@ -164,6 +166,8 @@ book_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
 		has_primary_source = TRUE;
 		is_writable = e_source_get_writable (source);
 		is_removable = e_source_get_removable (source);
+		is_remote_creatable = e_source_get_remote_creatable (source);
+		is_remote_deletable = e_source_get_remote_deletable (source);
 
 		collection = e_source_registry_find_extension (
 			registry, source, E_SOURCE_EXTENSION_COLLECTION);
@@ -181,6 +185,10 @@ book_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
 		state |= E_BOOK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_WRITABLE;
 	if (is_removable)
 		state |= E_BOOK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOVABLE;
+	if (is_remote_creatable)
+		state |= E_BOOK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOTE_CREATABLE;
+	if (is_remote_deletable)
+		state |= E_BOOK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOTE_DELETABLE;
 	if (in_collection)
 		state |= E_BOOK_SHELL_SIDEBAR_PRIMARY_SOURCE_IN_COLLECTION;
 
diff --git a/modules/addressbook/e-book-shell-sidebar.h b/modules/addressbook/e-book-shell-sidebar.h
index 9507681..d2bac8c 100644
--- a/modules/addressbook/e-book-shell-sidebar.h
+++ b/modules/addressbook/e-book-shell-sidebar.h
@@ -56,7 +56,9 @@ enum {
 	E_BOOK_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE			= 1 << 0,
 	E_BOOK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_WRITABLE		= 1 << 1,
 	E_BOOK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOVABLE	= 1 << 2,
-	E_BOOK_SHELL_SIDEBAR_PRIMARY_SOURCE_IN_COLLECTION	= 1 << 3
+	E_BOOK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOTE_CREATABLE	= 1 << 3,
+	E_BOOK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOTE_DELETABLE	= 1 << 4,
+	E_BOOK_SHELL_SIDEBAR_PRIMARY_SOURCE_IN_COLLECTION	= 1 << 5
 };
 
 struct _EBookShellSidebar {
diff --git a/modules/addressbook/e-book-shell-view.c b/modules/addressbook/e-book-shell-view.c
index c8ef074..f2c06bb 100644
--- a/modules/addressbook/e-book-shell-view.c
+++ b/modules/addressbook/e-book-shell-view.c
@@ -203,6 +203,7 @@ book_shell_view_update_actions (EShellView *shell_view)
 	gboolean multiple_contacts_selected;
 	gboolean primary_source_is_writable;
 	gboolean primary_source_is_removable;
+	gboolean primary_source_is_remote_deletable;
 	gboolean primary_source_in_collection;
 	gboolean single_contact_selected;
 	gboolean selection_is_contact_list;
@@ -240,6 +241,8 @@ book_shell_view_update_actions (EShellView *shell_view)
 		(state & E_BOOK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_WRITABLE);
 	primary_source_is_removable =
 		(state & E_BOOK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOVABLE);
+	primary_source_is_remote_deletable =
+		(state & E_BOOK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOTE_DELETABLE);
 	primary_source_in_collection =
 		(state & E_BOOK_SHELL_SIDEBAR_PRIMARY_SOURCE_IN_COLLECTION);
 
@@ -251,7 +254,9 @@ book_shell_view_update_actions (EShellView *shell_view)
 	gtk_action_set_sensitive (action, sensitive);
 
 	action = ACTION (ADDRESS_BOOK_DELETE);
-	sensitive = primary_source_is_removable;
+	sensitive =
+		primary_source_is_removable ||
+		primary_source_is_remote_deletable;
 	gtk_action_set_sensitive (action, sensitive);
 
 	action = ACTION (ADDRESS_BOOK_PRINT);
diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c
index fa58514..1f4ab02 100644
--- a/modules/calendar/e-cal-shell-sidebar.c
+++ b/modules/calendar/e-cal-shell-sidebar.c
@@ -753,6 +753,8 @@ cal_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
 	ESource *source;
 	gboolean is_writable = FALSE;
 	gboolean is_removable = FALSE;
+	gboolean is_remote_creatable = FALSE;
+	gboolean is_remote_deletable = FALSE;
 	gboolean in_collection = FALSE;
 	gboolean refresh_supported = FALSE;
 	gboolean has_primary_source = FALSE;
@@ -771,6 +773,8 @@ cal_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
 		has_primary_source = TRUE;
 		is_writable = e_source_get_writable (source);
 		is_removable = e_source_get_removable (source);
+		is_remote_creatable = e_source_get_remote_creatable (source);
+		is_remote_deletable = e_source_get_remote_deletable (source);
 
 		collection = e_source_registry_find_extension (
 			registry, source, E_SOURCE_EXTENSION_COLLECTION);
@@ -795,6 +799,10 @@ cal_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
 		state |= E_CAL_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_WRITABLE;
 	if (is_removable)
 		state |= E_CAL_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOVABLE;
+	if (is_remote_creatable)
+		state |= E_CAL_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOTE_CREATABLE;
+	if (is_remote_deletable)
+		state |= E_CAL_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOTE_DELETABLE;
 	if (in_collection)
 		state |= E_CAL_SHELL_SIDEBAR_PRIMARY_SOURCE_IN_COLLECTION;
 	if (refresh_supported)
diff --git a/modules/calendar/e-cal-shell-sidebar.h b/modules/calendar/e-cal-shell-sidebar.h
index 06eece9..4a4ab6d 100644
--- a/modules/calendar/e-cal-shell-sidebar.h
+++ b/modules/calendar/e-cal-shell-sidebar.h
@@ -58,8 +58,10 @@ enum {
 	E_CAL_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE			= 1 << 0,
 	E_CAL_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_WRITABLE		= 1 << 1,
 	E_CAL_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOVABLE		= 1 << 2,
-	E_CAL_SHELL_SIDEBAR_PRIMARY_SOURCE_IN_COLLECTION	= 1 << 3,
-	E_CAL_SHELL_SIDEBAR_SOURCE_SUPPORTS_REFRESH		= 1 << 4
+	E_CAL_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOTE_CREATABLE	= 1 << 3,
+	E_CAL_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOTE_DELETABLE	= 1 << 4,
+	E_CAL_SHELL_SIDEBAR_PRIMARY_SOURCE_IN_COLLECTION	= 1 << 5,
+	E_CAL_SHELL_SIDEBAR_SOURCE_SUPPORTS_REFRESH		= 1 << 6
 };
 
 struct _ECalShellSidebar {
diff --git a/modules/calendar/e-cal-shell-view.c b/modules/calendar/e-cal-shell-view.c
index 39386bd..7b90948 100644
--- a/modules/calendar/e-cal-shell-view.c
+++ b/modules/calendar/e-cal-shell-view.c
@@ -397,6 +397,7 @@ cal_shell_view_update_actions (EShellView *shell_view)
 	gboolean has_primary_source;
 	gboolean primary_source_is_writable;
 	gboolean primary_source_is_removable;
+	gboolean primary_source_is_remote_deletable;
 	gboolean primary_source_in_collection;
 	gboolean recurring = FALSE;
 	gboolean is_instance = FALSE;
@@ -514,6 +515,8 @@ cal_shell_view_update_actions (EShellView *shell_view)
 		(state & E_CAL_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_WRITABLE);
 	primary_source_is_removable =
 		(state & E_CAL_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOVABLE);
+	primary_source_is_remote_deletable =
+		(state & E_CAL_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOTE_DELETABLE);
 	primary_source_in_collection =
 		(state & E_CAL_SHELL_SIDEBAR_PRIMARY_SOURCE_IN_COLLECTION);
 	refresh_supported =
@@ -524,7 +527,9 @@ cal_shell_view_update_actions (EShellView *shell_view)
 	gtk_action_set_sensitive (action, sensitive);
 
 	action = ACTION (CALENDAR_DELETE);
-	sensitive = primary_source_is_removable;
+	sensitive =
+		primary_source_is_removable ||
+		primary_source_is_remote_deletable;
 	gtk_action_set_sensitive (action, sensitive);
 
 	action = ACTION (CALENDAR_PROPERTIES);
diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c
index d2cf143..f7cbea9 100644
--- a/modules/calendar/e-memo-shell-sidebar.c
+++ b/modules/calendar/e-memo-shell-sidebar.c
@@ -665,6 +665,8 @@ memo_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
 	ESource *source;
 	gboolean is_writable = FALSE;
 	gboolean is_removable = FALSE;
+	gboolean is_remote_creatable = FALSE;
+	gboolean is_remote_deletable = FALSE;
 	gboolean in_collection = FALSE;
 	gboolean refresh_supported = FALSE;
 	gboolean has_primary_source = FALSE;
@@ -683,6 +685,8 @@ memo_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
 		has_primary_source = TRUE;
 		is_writable = e_source_get_writable (source);
 		is_removable = e_source_get_removable (source);
+		is_remote_creatable = e_source_get_remote_creatable (source);
+		is_remote_deletable = e_source_get_remote_deletable (source);
 
 		collection = e_source_registry_find_extension (
 			registry, source, E_SOURCE_EXTENSION_COLLECTION);
@@ -707,6 +711,10 @@ memo_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
 		state |= E_MEMO_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_WRITABLE;
 	if (is_removable)
 		state |= E_MEMO_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOVABLE;
+	if (is_remote_creatable)
+		state |= E_MEMO_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOTE_CREATABLE;
+	if (is_remote_deletable)
+		state |= E_MEMO_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOTE_DELETABLE;
 	if (in_collection)
 		state |= E_MEMO_SHELL_SIDEBAR_PRIMARY_SOURCE_IN_COLLECTION;
 	if (refresh_supported)
diff --git a/modules/calendar/e-memo-shell-sidebar.h b/modules/calendar/e-memo-shell-sidebar.h
index c30073e..ed9e051 100644
--- a/modules/calendar/e-memo-shell-sidebar.h
+++ b/modules/calendar/e-memo-shell-sidebar.h
@@ -57,8 +57,10 @@ enum {
 	E_MEMO_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE			= 1 << 0,
 	E_MEMO_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_WRITABLE		= 1 << 1,
 	E_MEMO_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOVABLE	= 1 << 2,
-	E_MEMO_SHELL_SIDEBAR_PRIMARY_SOURCE_IN_COLLECTION	= 1 << 3,
-	E_MEMO_SHELL_SIDEBAR_SOURCE_SUPPORTS_REFRESH		= 1 << 4
+	E_MEMO_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOTE_CREATABLE	= 1 << 3,
+	E_MEMO_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOTE_DELETABLE	= 1 << 4,
+	E_MEMO_SHELL_SIDEBAR_PRIMARY_SOURCE_IN_COLLECTION	= 1 << 5,
+	E_MEMO_SHELL_SIDEBAR_SOURCE_SUPPORTS_REFRESH		= 1 << 6
 };
 
 struct _EMemoShellSidebar {
diff --git a/modules/calendar/e-memo-shell-view.c b/modules/calendar/e-memo-shell-view.c
index 34c9704..c271f9b 100644
--- a/modules/calendar/e-memo-shell-view.c
+++ b/modules/calendar/e-memo-shell-view.c
@@ -186,6 +186,7 @@ memo_shell_view_update_actions (EShellView *shell_view)
 	gboolean multiple_memos_selected;
 	gboolean primary_source_is_writable;
 	gboolean primary_source_is_removable;
+	gboolean primary_source_is_remote_deletable;
 	gboolean primary_source_in_collection;
 	gboolean selection_has_url;
 	gboolean single_memo_selected;
@@ -218,6 +219,8 @@ memo_shell_view_update_actions (EShellView *shell_view)
 		(state & E_MEMO_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_WRITABLE);
 	primary_source_is_removable =
 		(state & E_MEMO_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOVABLE);
+	primary_source_is_remote_deletable =
+		(state & E_MEMO_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOTE_DELETABLE);
 	primary_source_in_collection =
 		(state & E_MEMO_SHELL_SIDEBAR_PRIMARY_SOURCE_IN_COLLECTION);
 	refresh_supported =
@@ -248,7 +251,9 @@ memo_shell_view_update_actions (EShellView *shell_view)
 	gtk_action_set_sensitive (action, sensitive);
 
 	action = ACTION (MEMO_LIST_DELETE);
-	sensitive = primary_source_is_removable;
+	sensitive =
+		primary_source_is_removable ||
+		primary_source_is_remote_deletable;
 	gtk_action_set_sensitive (action, sensitive);
 
 	action = ACTION (MEMO_LIST_PROPERTIES);
diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c
index 304e537..1be397e 100644
--- a/modules/calendar/e-task-shell-sidebar.c
+++ b/modules/calendar/e-task-shell-sidebar.c
@@ -665,6 +665,8 @@ task_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
 	ESource *source;
 	gboolean is_writable = FALSE;
 	gboolean is_removable = FALSE;
+	gboolean is_remote_creatable = FALSE;
+	gboolean is_remote_deletable = FALSE;
 	gboolean in_collection = FALSE;
 	gboolean refresh_supported = FALSE;
 	gboolean has_primary_source = FALSE;
@@ -683,6 +685,8 @@ task_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
 		has_primary_source = TRUE;
 		is_writable = e_source_get_writable (source);
 		is_removable = e_source_get_removable (source);
+		is_remote_creatable = e_source_get_remote_creatable (source);
+		is_remote_deletable = e_source_get_remote_deletable (source);
 
 		collection = e_source_registry_find_extension (
 			registry, source, E_SOURCE_EXTENSION_COLLECTION);
@@ -707,6 +711,10 @@ task_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
 		state |= E_TASK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_WRITABLE;
 	if (is_removable)
 		state |= E_TASK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOVABLE;
+	if (is_remote_creatable)
+		state |= E_TASK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOTE_CREATABLE;
+	if (is_remote_deletable)
+		state |= E_TASK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOTE_DELETABLE;
 	if (in_collection)
 		state |= E_TASK_SHELL_SIDEBAR_PRIMARY_SOURCE_IN_COLLECTION;
 	if (refresh_supported)
diff --git a/modules/calendar/e-task-shell-sidebar.h b/modules/calendar/e-task-shell-sidebar.h
index e0754f4..d3c5358 100644
--- a/modules/calendar/e-task-shell-sidebar.h
+++ b/modules/calendar/e-task-shell-sidebar.h
@@ -57,8 +57,10 @@ enum {
 	E_TASK_SHELL_SIDEBAR_HAS_PRIMARY_SOURCE			= 1 << 0,
 	E_TASK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_WRITABLE		= 1 << 1,
 	E_TASK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOVABLE	= 1 << 2,
-	E_TASK_SHELL_SIDEBAR_PRIMARY_SOURCE_IN_COLLECTION	= 1 << 3,
-	E_TASK_SHELL_SIDEBAR_SOURCE_SUPPORTS_REFRESH		= 1 << 4
+	E_TASK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOTE_CREATABLE	= 1 << 3,
+	E_TASK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOTE_DELETABLE = 1 << 4,
+	E_TASK_SHELL_SIDEBAR_PRIMARY_SOURCE_IN_COLLECTION	= 1 << 5,
+	E_TASK_SHELL_SIDEBAR_SOURCE_SUPPORTS_REFRESH		= 1 << 6
 };
 
 struct _ETaskShellSidebar {
diff --git a/modules/calendar/e-task-shell-view.c b/modules/calendar/e-task-shell-view.c
index 4a466b7..f8e8323 100644
--- a/modules/calendar/e-task-shell-view.c
+++ b/modules/calendar/e-task-shell-view.c
@@ -306,6 +306,7 @@ task_shell_view_update_actions (EShellView *shell_view)
 	gboolean multiple_tasks_selected;
 	gboolean primary_source_is_writable;
 	gboolean primary_source_is_removable;
+	gboolean primary_source_is_remote_deletable;
 	gboolean primary_source_in_collection;
 	gboolean selection_has_url;
 	gboolean selection_is_assignable;
@@ -347,6 +348,8 @@ task_shell_view_update_actions (EShellView *shell_view)
 		(state & E_TASK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_WRITABLE);
 	primary_source_is_removable =
 		(state & E_TASK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOVABLE);
+	primary_source_is_remote_deletable =
+		(state & E_TASK_SHELL_SIDEBAR_PRIMARY_SOURCE_IS_REMOTE_DELETABLE);
 	primary_source_in_collection =
 		(state & E_TASK_SHELL_SIDEBAR_PRIMARY_SOURCE_IN_COLLECTION);
 	refresh_supported =
@@ -383,7 +386,9 @@ task_shell_view_update_actions (EShellView *shell_view)
 	gtk_action_set_sensitive (action, sensitive);
 
 	action = ACTION (TASK_LIST_DELETE);
-	sensitive = primary_source_is_removable;
+	sensitive =
+		primary_source_is_removable ||
+		primary_source_is_remote_deletable;
 	gtk_action_set_sensitive (action, sensitive);
 
 	action = ACTION (TASK_LIST_PROPERTIES);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]