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


Commits:
0a5579ae by wurstsalat at 2024-08-10T00:44:12+02:00
imprv: Search: Add fade-in effect for results and make search icon spin

Fade-in transition adds feedback that this is a new result

- - - - -


2 changed files:

- gajim/data/style/gajim.css
- gajim/gtk/search_view.py


Changes:

=====================================
gajim/data/style/gajim.css
=====================================
@@ -144,6 +144,9 @@ .spin {
     animation-timing-function: linear;
     animation-iteration-count: infinite;
 }
+.opacity-0 {
+    opacity: 0;
+}
 
 /* General purpose classes ================================================= */
 .dialog-margin > box { margin: 18px;}
@@ -525,6 +528,7 @@ .search-view {
 .search-view-row {
     padding: 4px 3px 4px 6px;
     border-radius: 4px;
+    transition: opacity 500ms ease-in-out;
 }
 .search-view-row-grid textview {
        background: transparent;


=====================================
gajim/gtk/search_view.py
=====================================
@@ -14,6 +14,7 @@
 from enum import Enum
 
 import cairo
+from gi.repository import GLib
 from gi.repository import GObject
 from gi.repository import Gtk
 from nbxmpp import JID
@@ -179,7 +180,10 @@ def _on_search(self, entry: Gtk.Entry) -> None:
         self._add_results()
 
     def _set_placeholder_mode(self, placeholder_mode: PlaceholderMode) -> None:
+        self._ui.placeholder_image.get_style_context().remove_class('spin')
+
         if placeholder_mode == PlaceholderMode.SEARCHING:
+            self._ui.placeholder_image.get_style_context().add_class('spin')
             icon_name = 'view-refresh-symbolic'
             text = _('Searching…')
 
@@ -422,7 +426,9 @@ def __init__(self, db_row: Message) -> None:
             self.contact,
             BareContact | GroupchatContact | GroupchatParticipant)
 
-        self.get_style_context().add_class('search-view-row')
+        style_context = self.get_style_context()
+        style_context.add_class('search-view-row')
+        style_context.add_class('opacity-0')
         self._ui = get_builder('search_view.ui')
         self.add(self._ui.result_row_grid)
 
@@ -450,6 +456,7 @@ def __init__(self, db_row: Message) -> None:
         message_widget.add_with_styling(text, nickname=contact_name)
         self._ui.result_row_grid.attach(message_widget, 1, 1, 2, 1)
 
+        GLib.timeout_add(100, style_context.remove_class, 'opacity-0')
         self.show_all()
 
     def _get_client(self, account_jid: str) -> Client:



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

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


_______________________________________________
Commits mailing list -- commits@gajim.org
To unsubscribe send an email to commits-le...@gajim.org

Reply via email to