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




commit 744d9617a1301815137ca102936ee5c2df180e7b
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 | 33 ++++------------------
 1 file changed, 6 insertions(+), 27 deletions(-)
---
diff --git a/src/client/conversation-viewer/conversation-list-box.vala 
b/src/client/conversation-viewer/conversation-list-box.vala
index 6688e2718..9bfaf1b52 100644
--- a/src/client/conversation-viewer/conversation-list-box.vala
+++ b/src/client/conversation-viewer/conversation-list-box.vala
@@ -1244,9 +1244,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 +1254,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;
              }
         });
 


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