[evolution] e-task-shell-view-actions.c: Support deleting remote resources.



commit bb8597fa1b24fe4865cfa413a53ebee1cdcebcda
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu Jul 26 11:38:27 2012 -0400

    e-task-shell-view-actions.c: Support deleting remote resources.

 calendar/calendar.error.xml                  |    7 +++++
 modules/calendar/e-task-shell-view-actions.c |   33 +++++++++++++------------
 2 files changed, 24 insertions(+), 16 deletions(-)
---
diff --git a/calendar/calendar.error.xml b/calendar/calendar.error.xml
index 5f3e225..3d5140d 100644
--- a/calendar/calendar.error.xml
+++ b/calendar/calendar.error.xml
@@ -226,6 +226,13 @@
     <button _label="_Delete From Server" response="GTK_RESPONSE_YES"/>
   </error>
 
+  <error id="prompt-delete-remote-task-list" type="question" default="GTK_RESPONSE_CANCEL">
+    <_primary>Delete remote task list &quot;{0}&quot;?</_primary>
+    <_secondary>This will permanently remove the task list &quot;{0}&quot; from the server.  Are you sure you want to proceed?</_secondary>
+    <button _label="Do _Not Delete" response="GTK_RESPONSE_CANCEL"/>
+    <button _label="_Delete From Server" response="GTK_RESPONSE_YES"/>
+  </error>
+
   <error id="prompt-save-no-subject-calendar" type="question" default="GTK_RESPONSE_YES">
     <_primary>Are you sure you want to save the appointment without a summary?</_primary>
     <_secondary>Adding a meaningful summary to your appointment will give you an idea of what your appointment is about.</_secondary>
diff --git a/modules/calendar/e-task-shell-view-actions.c b/modules/calendar/e-task-shell-view-actions.c
index e29db39..e9898fe 100644
--- a/modules/calendar/e-task-shell-view-actions.c
+++ b/modules/calendar/e-task-shell-view-actions.c
@@ -173,8 +173,8 @@ action_task_list_delete_cb (GtkAction *action,
 	ETaskShellSidebar *task_shell_sidebar;
 	EShellWindow *shell_window;
 	EShellView *shell_view;
-	ESourceSelector *selector;
 	ESource *source;
+	ESourceSelector *selector;
 	gint response;
 
 	shell_view = E_SHELL_VIEW (task_shell_view);
@@ -182,27 +182,28 @@ action_task_list_delete_cb (GtkAction *action,
 
 	task_shell_sidebar = task_shell_view->priv->task_shell_sidebar;
 	selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
+
 	source = e_source_selector_ref_primary_selection (selector);
 	g_return_if_fail (source != NULL);
 
-	/* Ask for confirmation. */
-	response = e_alert_run_dialog_for_args (
-		GTK_WINDOW (shell_window),
-		"calendar:prompt-delete-task-list",
-		e_source_get_display_name (source), NULL);
+	if (e_source_get_remote_deletable (source)) {
+		response = e_alert_run_dialog_for_args (
+			GTK_WINDOW (shell_window),
+			"calendar:prompt-delete-remote-task-list",
+			e_source_get_display_name (source), NULL);
 
-	if (response != GTK_RESPONSE_YES) {
-		g_object_unref (source);
-		return;
-	}
+		if (response == GTK_RESPONSE_YES)
+			e_shell_view_remote_delete_source (shell_view, source);
 
-	if (e_source_selector_source_is_selected (selector, source)) {
-		e_task_shell_sidebar_remove_source (
-			task_shell_sidebar, source);
-		e_source_selector_unselect_source (selector, source);
-	}
+	} else {
+		response = e_alert_run_dialog_for_args (
+			GTK_WINDOW (shell_window),
+			"calendar:prompt-delete-task-list",
+			e_source_get_display_name (source), NULL);
 
-	e_shell_view_remove_source (shell_view, source);
+		if (response == GTK_RESPONSE_YES)
+			e_shell_view_remove_source (shell_view, source);
+	}
 
 	g_object_unref (source);
 }



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