[evolution/wip/webkit2] Bug 769152 - Confirm folder Unsubscribe before doing so
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit2] Bug 769152 - Confirm folder Unsubscribe before doing so
- Date: Wed, 10 Aug 2016 13:47:41 +0000 (UTC)
commit 94a1d35198547640005d05bd73245b29aeb344a2
Author: Milan Crha <mcrha redhat com>
Date: Fri Aug 5 08:53:51 2016 +0200
Bug 769152 - Confirm folder Unsubscribe before doing so
mail/mail.error.xml | 7 +++++
modules/mail/e-mail-shell-view-actions.c | 40 +++++++++++++++++++++++++++--
2 files changed, 44 insertions(+), 3 deletions(-)
---
diff --git a/mail/mail.error.xml b/mail/mail.error.xml
index c4b6f9e..0be2744 100644
--- a/mail/mail.error.xml
+++ b/mail/mail.error.xml
@@ -214,6 +214,13 @@ The reported error was "{0}".</_secondary>
<button stock="gtk-delete" response="GTK_RESPONSE_OK"/>
</error>
+ <error id="ask-unsubscribe-folder" type="question" default="GTK_RESPONSE_NO">
+ <_primary>Really unsubscribe folder "{0}"?</_primary>
+ <_secondary xml:space="preserve">If you unsubscribe the folder, it might not be visible in the
Evolution, while still being available on the server. You can re-subscribe in Folder->Subscriptions...
menu.</_secondary>
+ <button _label="Do _Not Unsubscribe" response="GTK_RESPONSE_NO"/>
+ <button _label="_Unsubscribe" response="GTK_RESPONSE_YES"/>
+ </error>
+
<error id="ask-delete-vfolder" type="question" default="GTK_RESPONSE_CANCEL">
<_primary>Really delete folder "{0}" and all of its subfolders?</_primary>
<button _label="Do _Not Delete" response="GTK_RESPONSE_CANCEL"/>
diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c
index a38686f..d843671 100644
--- a/modules/mail/e-mail-shell-view-actions.c
+++ b/modules/mail/e-mail-shell-view-actions.c
@@ -983,6 +983,34 @@ action_mail_folder_select_subthread_cb (GtkAction *action,
message_list_select_subthread (MESSAGE_LIST (message_list));
}
+static gboolean
+ask_can_unsubscribe_folder (GtkWindow *parent,
+ EMailSession *session,
+ CamelStore *store,
+ const gchar *folder_name)
+{
+ CamelFolder *folder;
+ gchar *full_display_name;
+ gboolean res;
+
+ g_return_val_if_fail (E_IS_MAIL_SESSION (session), FALSE);
+ g_return_val_if_fail (CAMEL_IS_STORE (store), FALSE);
+ g_return_val_if_fail (folder_name != NULL, FALSE);
+
+ folder = mail_folder_cache_ref_folder (e_mail_session_get_folder_cache (session), store, folder_name);
+ g_return_val_if_fail (CAMEL_IS_FOLDER (folder), FALSE);
+
+ full_display_name = e_mail_folder_to_full_display_name (folder, NULL);
+
+ res = GTK_RESPONSE_YES == e_alert_run_dialog_for_args (parent,
+ "mail:ask-unsubscribe-folder", full_display_name ? full_display_name : folder_name, NULL);
+
+ g_clear_object (&folder);
+ g_free (full_display_name);
+
+ return res;
+}
+
static void
action_mail_folder_unsubscribe_cb (GtkAction *action,
EMailShellView *mail_shell_view)
@@ -991,6 +1019,8 @@ action_mail_folder_unsubscribe_cb (GtkAction *action,
EMailShellSidebar *mail_shell_sidebar;
EMailView *mail_view;
EMFolderTree *folder_tree;
+ EShellWindow *shell_window;
+ EMailSession *session;
CamelStore *selected_store = NULL;
gchar *selected_folder_name = NULL;
@@ -1005,9 +1035,13 @@ action_mail_folder_unsubscribe_cb (GtkAction *action,
g_return_if_fail (CAMEL_IS_STORE (selected_store));
g_return_if_fail (selected_folder_name != NULL);
- e_mail_reader_unsubscribe_folder_name (
- E_MAIL_READER (mail_view),
- selected_store, selected_folder_name);
+ shell_window = e_shell_view_get_shell_window (E_SHELL_VIEW (mail_shell_view));
+ session = em_folder_tree_get_session (folder_tree);
+
+ if (ask_can_unsubscribe_folder (GTK_WINDOW (shell_window), session, selected_store,
selected_folder_name))
+ e_mail_reader_unsubscribe_folder_name (
+ E_MAIL_READER (mail_view),
+ selected_store, selected_folder_name);
g_object_unref (selected_store);
g_free (selected_folder_name);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]