[evolution] Bug 741363 - Add 'Always in Current Folder' button to Mark All Read question
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Bug 741363 - Add 'Always in Current Folder' button to Mark All Read question
- Date: Thu, 25 Oct 2018 15:54:20 +0000 (UTC)
commit c488e5f59ba184a1ee2e5a41a023e56ef1d644f1
Author: Milan Crha <mcrha redhat com>
Date: Thu Oct 25 17:54:36 2018 +0200
Bug 741363 - Add 'Always in Current Folder' button to Mark All Read question
Closes https://bugzilla.gnome.org/show_bug.cgi?id=741363
src/mail/mail.error.xml | 1 +
src/modules/mail/e-mail-shell-view-actions.c | 41 +++++++++++++++++++++++++++-
2 files changed, 41 insertions(+), 1 deletion(-)
---
diff --git a/src/mail/mail.error.xml b/src/mail/mail.error.xml
index f676d6ca6c..0d7f054b30 100644
--- a/src/mail/mail.error.xml
+++ b/src/mail/mail.error.xml
@@ -412,6 +412,7 @@ An mbox account will be created to preserve the old mbox folders. You can delete
<button stock="gtk-cancel" response="GTK_RESPONSE_CANCEL"/>
<button _label="In Current Folder and _Subfolders" response="GTK_RESPONSE_YES"/>
<button _label="In Current _Folder Only" response="GTK_RESPONSE_NO"/>
+ <button _label="_Always In Current Folder Only" response="GTK_RESPONSE_ACCEPT"/>
</error>
<error id="browser-close-on-reply" type="question" default="GTK_RESPONSE_NO">
diff --git a/src/modules/mail/e-mail-shell-view-actions.c b/src/modules/mail/e-mail-shell-view-actions.c
index 5642969fcb..56872be27d 100644
--- a/src/modules/mail/e-mail-shell-view-actions.c
+++ b/src/modules/mail/e-mail-shell-view-actions.c
@@ -648,15 +648,37 @@ mark_all_read_prompt_user (EMailShellView *mail_shell_view,
parent = GTK_WINDOW (shell_window);
if (with_subfolders) {
+ GSettings *settings;
+ GdkDisplay *display;
+ GdkKeymap *keymap;
+
+ display = gtk_widget_get_display (GTK_WIDGET (e_shell_view_get_shell_window (E_SHELL_VIEW
(mail_shell_view))));
+ keymap = gdk_keymap_get_for_display (display);
+
+ settings = e_util_ref_settings ("org.gnome.evolution.mail");
+ if ((gdk_keymap_get_modifier_state (keymap) & (GDK_CONTROL_MASK | GDK_SHIFT_MASK |
GDK_MOD1_MASK)) != GDK_SHIFT_MASK &&
+ !g_settings_get_boolean (settings, "prompt-on-mark-all-read")) {
+ g_object_unref (settings);
+ return MARK_ALL_READ_CURRENT_ONLY;
+ }
+
switch (e_alert_run_dialog_for_args (parent,
"mail:ask-mark-all-read-sub", NULL)) {
case GTK_RESPONSE_YES:
+ g_object_unref (settings);
return MARK_ALL_READ_WITH_SUBFOLDERS;
case GTK_RESPONSE_NO:
+ g_object_unref (settings);
+ return MARK_ALL_READ_CURRENT_ONLY;
+ case GTK_RESPONSE_ACCEPT:
+ g_settings_set_boolean (settings, "prompt-on-mark-all-read", FALSE);
+ g_object_unref (settings);
return MARK_ALL_READ_CURRENT_ONLY;
default:
break;
}
+
+ g_object_unref (settings);
} else if (e_util_prompt_user (parent,
"org.gnome.evolution.mail",
"prompt-on-mark-all-read",
@@ -666,6 +688,23 @@ mark_all_read_prompt_user (EMailShellView *mail_shell_view,
return MARK_ALL_READ_CANCEL;
}
+static gboolean
+mark_all_read_child_has_unread (CamelFolderInfo *folder_info)
+{
+ gboolean any_has = FALSE;
+
+ if (!folder_info)
+ return FALSE;
+
+ while (!any_has && folder_info) {
+ any_has = folder_info->unread > 0 || mark_all_read_child_has_unread (folder_info->child);
+
+ folder_info = folder_info->next;
+ }
+
+ return any_has;
+}
+
static void
mark_all_read_got_folder_info (GObject *source,
GAsyncResult *result,
@@ -712,7 +751,7 @@ mark_all_read_got_folder_info (GObject *source,
response = mark_all_read_prompt_user (
context->mail_shell_view,
- context->can_subfolders && folder_info->child != NULL);
+ context->can_subfolders && mark_all_read_child_has_unread (folder_info->child));
if (response == MARK_ALL_READ_CURRENT_ONLY)
g_queue_push_tail (
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]