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



commit 53aa02a92369bd04eae2b1cf1e31dfc8f32044a8
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu Jul 26 10:42:41 2012 -0400

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

 addressbook/addressbook.error.xml               |    7 ++++++
 modules/addressbook/e-book-shell-view-actions.c |   24 +++++++++++++++++-----
 2 files changed, 25 insertions(+), 6 deletions(-)
---
diff --git a/addressbook/addressbook.error.xml b/addressbook/addressbook.error.xml
index a616e5f..8515115 100644
--- a/addressbook/addressbook.error.xml
+++ b/addressbook/addressbook.error.xml
@@ -39,6 +39,13 @@
     <button stock="gtk-delete" response="GTK_RESPONSE_YES"/>
   </error>
 
+ <error id="ask-delete-remote-addressbook" type="question" default="GTK_RESPONSE_CANCEL">
+   <_primary>Delete remote address book &quot;{0}&quot;?</_primary>
+   <_secondary>This will permanently remove the address book &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="edit-categories" type="error">
     <_primary>Category editor not available.</_primary>
   </error>
diff --git a/modules/addressbook/e-book-shell-view-actions.c b/modules/addressbook/e-book-shell-view-actions.c
index 8a319d5..54865b7 100644
--- a/modules/addressbook/e-book-shell-view-actions.c
+++ b/modules/addressbook/e-book-shell-view-actions.c
@@ -63,16 +63,28 @@ action_address_book_delete_cb (GtkAction *action,
 
 	book_shell_sidebar = book_shell_view->priv->book_shell_sidebar;
 	selector = e_book_shell_sidebar_get_selector (book_shell_sidebar);
+
 	source = e_source_selector_ref_primary_selection (selector);
 	g_return_if_fail (source != NULL);
 
-	response = e_alert_run_dialog_for_args (
-		GTK_WINDOW (shell_window),
-		"addressbook:ask-delete-addressbook",
-		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),
+			"addressbook:ask-delete-remote-addressbook",
+			e_source_get_display_name (source), NULL);
+
+		if (response == GTK_RESPONSE_YES)
+			e_shell_view_remote_delete_source (shell_view, source);
 
-	if (response == GTK_RESPONSE_YES)
-		e_shell_view_remove_source (shell_view, source);
+	} else {
+		response = e_alert_run_dialog_for_args (
+			GTK_WINDOW (shell_window),
+			"addressbook:ask-delete-addressbook",
+			e_source_get_display_name (source), NULL);
+
+		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]