Daniel Brötzmann pushed to branch master at gajim / gajim


Commits:
e62e7425 by wurstsalat at 2024-05-03T19:25:43+02:00
fix: ConversationView: Allow consecutive highlights for the same row

Fixes #11813

- - - - -


2 changed files:

- gajim/data/style/gajim.css
- gajim/gtk/conversation/view.py


Changes:

=====================================
gajim/data/style/gajim.css
=====================================
@@ -607,12 +607,28 @@ .transparent-selection > selection {
     color: @theme_fg_color;
 }
 @keyframes highlight {
-    from { background: rgb(140, 160, 180); }
-    to { background: transparent; }
+    0% {
+        background: transparent;
+    }
+    10% {
+        background: rgb(140, 160, 180);
+    }
+    30% {
+        background: transparent;
+    }
+    50% {
+        background: rgb(140, 160, 180);
+    }
+    70% {
+        background: transparent;
+    }
+    100% {
+        background: transparent;
+    }
 }
-.conversation-search-highlight {
-    animation-duration: 3s;
-    animation-timing-function: ease-out;
+.conversation-row-highlight {
+    animation-duration: 1.5s;
+    animation-timing-function: linear;
     animation-iteration-count: 1;
     animation-name: highlight;
 }


=====================================
gajim/gtk/conversation/view.py
=====================================
@@ -15,6 +15,7 @@
 
 from gi.repository import Gdk
 from gi.repository import Gio
+from gi.repository import GLib
 from gi.repository import GObject
 from gi.repository import Gtk
 from nbxmpp.errors import StanzaError
@@ -681,17 +682,24 @@ def acknowledge_message(self, pk: int) -> None:
     def scroll_to_message_and_highlight(self, pk: int) -> None:
         highlight_row = None
         for row in cast(list[BaseRow], self._list_box.get_children()):
-            row.get_style_context().remove_class(
-                'conversation-search-highlight')
             if row.pk == pk:
                 highlight_row = row
+                break
 
         if highlight_row is not None:
+            highlight_row.get_style_context().remove_class(
+                'conversation-row-highlight')
             highlight_row.get_style_context().add_class(
-                'conversation-search-highlight')
+                'conversation-row-highlight')
             # This scrolls the ListBox to the highlighted row
             highlight_row.grab_focus()
 
+            GLib.timeout_add(1500, self._remove_highligh_class, highlight_row)
+
+    def _remove_highligh_class(self, highlight_row: BaseRow) -> None:
+        highlight_row.get_style_context().remove_class(
+            'conversation-row-highlight')
+
     def scroll_to_end(self) -> None:
         adj = self.get_vadjustment()
         adj.set_value(adj.get_upper() - adj.get_page_size())



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/e62e742560a2a2687e992bacceaaf71f6e0a1598

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/e62e742560a2a2687e992bacceaaf71f6e0a1598
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to