[geary/gnumdk/stable: 2/3] client: Mark email as read if row expanded




commit baa9a3d233eca2cf20071da950a46895ca92ae98
Author: Cédric Bellegarde <cedric bellegarde adishatz org>
Date:   Tue Sep 20 14:01:05 2022 +0200

    client: Mark email as read if row expanded
    
    Geary is trying to check if an email is fully read:
    - It's quite buggy, you often need to scroll up and down to mark the
      mail as read
    - It forces user to scroll down to the email signature just to mark
      the mail as read
    
    Simplify this: an email is read if expanded

 .../conversation-viewer/conversation-list-box.vala | 35 +++++-----------------
 .../conversation-viewer/conversation-viewer.vala   |  8 -----
 2 files changed, 8 insertions(+), 35 deletions(-)
---
diff --git a/src/client/conversation-viewer/conversation-list-box.vala 
b/src/client/conversation-viewer/conversation-list-box.vala
index b8a7c0643..b51012012 100644
--- a/src/client/conversation-viewer/conversation-list-box.vala
+++ b/src/client/conversation-viewer/conversation-list-box.vala
@@ -1126,6 +1126,8 @@ public class ConversationListBox : Gtk.ListBox, Geary.BaseInterface {
                 query, enable_query_scroll
             );
         }
+
+        this.mark_read_timer.start();
     }
 
     private inline async void throttle_loading() throws GLib.IOError {
@@ -1264,9 +1266,6 @@ public class ConversationListBox : Gtk.ListBox, Geary.BaseInterface {
     private void check_mark_read() {
         Gee.List<Geary.EmailIdentifier> email_ids =
             new Gee.LinkedList<Geary.EmailIdentifier>();
-        Gtk.Adjustment adj = get_adjustment();
-        int top_bound = (int) adj.value;
-        int bottom_bound = top_bound + (int) adj.page_size;
 
         this.foreach((child) => {
             // Don't bother with not-yet-loaded emails since the
@@ -1277,32 +1276,14 @@ public class ConversationListBox : Gtk.ListBox, Geary.BaseInterface {
             Geary.Email? email = (view != null) ? view.email : null;
             if (row != null &&
                 row.is_expanded &&
-                view.message_body_state == COMPLETED &&
                 !view.is_manually_read &&
+                view.message_body_state == COMPLETED &&
                 email.is_unread().is_certain()) {
-                ConversationMessage conversation_message = view.primary_message;
-                 int body_top = 0;
-                 int body_left = 0;
-                 conversation_message.web_view_translate_coordinates(
-                     this,
-                     0, 0,
-                     out body_left, out body_top
-                 );
-
-                 int body_height = conversation_message.web_view_get_allocated_height();
-                 int body_bottom = body_top + body_height;
-
-                 // Only mark the email as read if it's actually visible
-                 if (body_height > 0 &&
-                     body_bottom > top_bound &&
-                     body_top + MARK_READ_PADDING < bottom_bound) {
-                     email_ids.add(view.email.id);
-
-                     // Since it can take some time for the new flags
-                     // to round-trip back to our signal handlers,
-                     // mark as manually read here
-                     view.is_manually_read = true;
-                 }
+                email_ids.add(view.email.id);
+                // Since it can take some time for the new flags
+                // to round-trip back to our signal handlers,
+                // mark as manually read here
+                view.is_manually_read = true;
              }
         });
 
diff --git a/src/client/conversation-viewer/conversation-viewer.vala 
b/src/client/conversation-viewer/conversation-viewer.vala
index f8782f73c..0e507a021 100644
--- a/src/client/conversation-viewer/conversation-viewer.vala
+++ b/src/client/conversation-viewer/conversation-viewer.vala
@@ -458,14 +458,6 @@ public class ConversationViewer : Gtk.Stack, Geary.BaseInterface {
         }
     }
 
-    [GtkCallback]
-    private bool on_conversation_scroll() {
-        if (this.current_list != null) {
-            this.current_list.mark_visible_read();
-        }
-        return Gdk.EVENT_PROPAGATE;
-    }
-
     private void on_composer_closed() {
         this.current_composer = null;
         if (get_visible_child() == this.composer_page) {


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