[geary/wip/730682-refine-convo-list] Don't auto-mark messages read when in selection mode.



commit 0b49045bb0e682121c1f100446cc0b4f36128941
Author: Michael James Gratton <mike vee net>
Date:   Sat Jan 6 21:29:53 2018 +1100

    Don't auto-mark messages read when in selection mode.

 src/client/components/main-window.vala             |    8 +++++---
 .../conversation-viewer/conversation-list-box.vala |   14 +++++++++-----
 .../conversation-viewer/conversation-viewer.vala   |    4 +++-
 3 files changed, 17 insertions(+), 9 deletions(-)
---
diff --git a/src/client/components/main-window.vala b/src/client/components/main-window.vala
index 50661e4..202e093 100644
--- a/src/client/components/main-window.vala
+++ b/src/client/components/main-window.vala
@@ -802,7 +802,8 @@ public class MainWindow : Gtk.ApplicationWindow {
         }
     }
 
-    private void show_conversation(Geary.App.Conversation? target) {
+    private void show_conversation(Geary.App.Conversation? target,
+                                   bool auto_mark) {
         Geary.App.Conversation? current = null;
         ConversationListBox? listbox = this.conversation_viewer.current_list;
         if (listbox != null) {
@@ -828,6 +829,7 @@ public class MainWindow : Gtk.ApplicationWindow {
             this.main_toolbar.subject = subject;
             this.conversation_viewer.load_conversation.begin(
                 target,
+                auto_mark,
                 this.application.config,
                 this.application.controller.avatar_session,
                 (obj, ret) => {
@@ -943,7 +945,7 @@ public class MainWindow : Gtk.ApplicationWindow {
     }
 
     private void on_conversation_selection_changed(Geary.App.Conversation? selection) {
-        show_conversation(selection);
+        show_conversation(selection, true);
         query_supported_actions();
     }
 
@@ -967,7 +969,7 @@ public class MainWindow : Gtk.ApplicationWindow {
         if (!marked.is_empty) {
             last_marked = marked.last().conversation;
         }
-        show_conversation(last_marked);
+        show_conversation(last_marked, false);
         this.main_toolbar.update_selection_count(
             this.conversation_list.get_marked_items().size
         );
diff --git a/src/client/conversation-viewer/conversation-list-box.vala 
b/src/client/conversation-viewer/conversation-list-box.vala
index 440df4a..2d45058 100644
--- a/src/client/conversation-viewer/conversation-list-box.vala
+++ b/src/client/conversation-viewer/conversation-list-box.vala
@@ -1,6 +1,6 @@
 /*
  * Copyright 2016 Software Freedom Conservancy Inc.
- * Copyright 2016 Michael Gratton <mike vee net>
+ * Copyright 2016-2018 Michael Gratton <mike vee net>
  *
  * This software is licensed under the GNU Lesser General Public License
  * (version 2.1 or later). See the COPYING file in this distribution.
@@ -487,6 +487,7 @@ public class ConversationListBox : Gtk.ListBox {
                                Geary.ContactStore contact_store,
                                Geary.AccountInformation account_info,
                                bool is_draft_folder,
+                               bool auto_mark,
                                Configuration config,
                                Soup.Session avatar_session,
                                Gtk.Adjustment adjustment) {
@@ -505,11 +506,14 @@ public class ConversationListBox : Gtk.ListBox {
         set_selection_mode(Gtk.SelectionMode.NONE);
         set_sort_func(ConversationListBox.on_sort);
 
-        this.realize.connect(() => {
-                adjustment.value_changed.connect(() => { check_mark_read(); });
-            });
+        if (auto_mark) {
+            this.realize.connect(() => {
+                    adjustment.value_changed.connect(() => { check_mark_read(); });
+                });
+            this.size_allocate.connect(() => { check_mark_read(); });
+        }
+
         this.row_activated.connect(on_row_activated);
-        this.size_allocate.connect(() => { check_mark_read(); });
 
         this.conversation.appended.connect(on_conversation_appended);
         this.conversation.trimmed.connect(on_conversation_trimmed);
diff --git a/src/client/conversation-viewer/conversation-viewer.vala 
b/src/client/conversation-viewer/conversation-viewer.vala
index c7517b8..312b864 100644
--- a/src/client/conversation-viewer/conversation-viewer.vala
+++ b/src/client/conversation-viewer/conversation-viewer.vala
@@ -1,6 +1,6 @@
 /*
  * Copyright 2016 Software Freedom Conservancy Inc.
- * Copyright 2016-2017 Michael Gratton <mike vee net>
+ * Copyright 2016-2018 Michael Gratton <mike vee net>
  *
  * This software is licensed under the GNU Lesser General Public License
  * (version 2.1 or later). See the COPYING file in this distribution.
@@ -162,6 +162,7 @@ public class ConversationViewer : Gtk.Stack {
      * Shows a conversation in the viewer.
      */
     public async void load_conversation(Geary.App.Conversation conversation,
+                                        bool auto_mark,
                                         Configuration config,
                                         Soup.Session avatar_session)
         throws Error {
@@ -175,6 +176,7 @@ public class ConversationViewer : Gtk.Stack {
             account.get_contact_store(),
             account.information,
             location.special_folder_type == Geary.SpecialFolderType.DRAFTS,
+            auto_mark,
             config,
             avatar_session,
             this.conversation_scroller.get_vadjustment()


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]