aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2012-07-26 23:25:29 +0800
committerMatthew Barnes <mbarnes@redhat.com>2012-08-03 23:40:14 +0800
commit8c99b707e70886f23bd11be088a55b9fc5e54308 (patch)
tree97ddc4c504aab48a97191bfec35e8476ab47ef3f
parent53aa02a92369bd04eae2b1cf1e31dfc8f32044a8 (diff)
downloadgsoc2013-evolution-8c99b707e70886f23bd11be088a55b9fc5e54308.tar.gz
gsoc2013-evolution-8c99b707e70886f23bd11be088a55b9fc5e54308.tar.zst
gsoc2013-evolution-8c99b707e70886f23bd11be088a55b9fc5e54308.zip
e-cal-shell-view-actions.c: Support deleting remote resources.
-rw-r--r--calendar/calendar.error.xml7
-rw-r--r--modules/calendar/e-cal-shell-view-actions.c33
2 files changed, 24 insertions, 16 deletions
diff --git a/calendar/calendar.error.xml b/calendar/calendar.error.xml
index d54f6c5a66..5f3e2250c0 100644
--- a/calendar/calendar.error.xml
+++ b/calendar/calendar.error.xml
@@ -219,6 +219,13 @@
<button stock="gtk-delete" response="GTK_RESPONSE_YES"/>
</error>
+ <error id="prompt-delete-remote-calendar" type="question" default="GTK_RESPONSE_CANCEL">
+ <_primary>Delete remote calendar &quot;{0}&quot;?</_primary>
+ <_secondary>This will permanently remove the calendar &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-cal-shell-view-actions.c b/modules/calendar/e-cal-shell-view-actions.c
index 09ad350b9d..f5a04d7d2f 100644
--- a/modules/calendar/e-cal-shell-view-actions.c
+++ b/modules/calendar/e-cal-shell-view-actions.c
@@ -68,8 +68,8 @@ action_calendar_delete_cb (GtkAction *action,
ECalShellSidebar *cal_shell_sidebar;
EShellWindow *shell_window;
EShellView *shell_view;
- ESourceSelector *selector;
ESource *source;
+ ESourceSelector *selector;
gint response;
shell_view = E_SHELL_VIEW (cal_shell_view);
@@ -77,27 +77,28 @@ action_calendar_delete_cb (GtkAction *action,
cal_shell_sidebar = cal_shell_view->priv->cal_shell_sidebar;
selector = e_cal_shell_sidebar_get_selector (cal_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-calendar",
- 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-calendar",
+ 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_cal_shell_sidebar_remove_source (
- cal_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-calendar",
+ 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);
}