aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2012-07-26 22:42:41 +0800
committerMatthew Barnes <mbarnes@redhat.com>2012-08-03 23:40:13 +0800
commit53aa02a92369bd04eae2b1cf1e31dfc8f32044a8 (patch)
treea5cc445ccc469d60c6c7f2c71f55ca0f68e677eb
parent6055337bbac4e516c2c5b41b965fbffce6cf69c6 (diff)
downloadgsoc2013-evolution-53aa02a92369bd04eae2b1cf1e31dfc8f32044a8.tar.gz
gsoc2013-evolution-53aa02a92369bd04eae2b1cf1e31dfc8f32044a8.tar.zst
gsoc2013-evolution-53aa02a92369bd04eae2b1cf1e31dfc8f32044a8.zip
e-book-shell-view-actions.c: Support deleting remote resources.
-rw-r--r--addressbook/addressbook.error.xml7
-rw-r--r--modules/addressbook/e-book-shell-view-actions.c24
2 files changed, 25 insertions, 6 deletions
diff --git a/addressbook/addressbook.error.xml b/addressbook/addressbook.error.xml
index a616e5f114..85151157a9 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 8a319d51ff..54865b7e39 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);
}