[geary/gnumdk/mark_as_read_if_expanded] client: Mark email as read if row expanded




commit f242b733d7505f436fa28d615734763ac9d919d6
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   | 13 --------
 2 files changed, 8 insertions(+), 40 deletions(-)
---
diff --git a/src/client/conversation-viewer/conversation-list-box.vala 
b/src/client/conversation-viewer/conversation-list-box.vala
index 6688e2718..c72ec2e9f 100644
--- a/src/client/conversation-viewer/conversation-list-box.vala
+++ b/src/client/conversation-viewer/conversation-list-box.vala
@@ -1106,6 +1106,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 {
@@ -1244,9 +1246,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
@@ -1257,32 +1256,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 e3a9825e8..4e39f3a59 100644
--- a/src/client/conversation-viewer/conversation-viewer.vala
+++ b/src/client/conversation-viewer/conversation-viewer.vala
@@ -353,12 +353,6 @@ public class ConversationViewer : Gtk.Stack, Geary.BaseInterface {
         scroller.set_hexpand(true);
         scroller.set_vexpand(true);
         scroller.show();
-        scroller.scroll_event.connect(
-            on_conversation_scroll
-        );
-        scroller.get_vscrollbar().button_release_event.connect(
-            on_conversation_scroll
-        );
         this.conversation_scroller = scroller;
         this.conversation_page.add(scroller);
 
@@ -490,13 +484,6 @@ public class ConversationViewer : Gtk.Stack, Geary.BaseInterface {
         }
     }
 
-    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]