Philipp Hörist pushed to branch master at gajim / gajim


Commits:
545119ca by Philipp Hörist at 2022-10-12T19:19:49+02:00
perf: GroupchatRoster: Don’t load roster when its hidden

- - - - -


2 changed files:

- gajim/data/gui/groupchat_roster.ui
- gajim/gtk/groupchat_roster.py


Changes:

=====================================
gajim/data/gui/groupchat_roster.ui
=====================================
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.38.2 -->
+<!-- Generated with glade 3.40.0 -->
 <interface>
   <requires lib="gtk+" version="3.20"/>
   <object class="GtkTreeStore" id="participant_store">
@@ -22,7 +22,6 @@
       <object class="GtkTreeView" id="roster_treeview">
         <property name="visible">True</property>
         <property name="can-focus">True</property>
-        <property name="model">participant_store</property>
         <property name="headers-visible">False</property>
         <property name="expander-column">expander</property>
         <property name="search-column">1</property>
@@ -30,6 +29,9 @@
         <signal name="focus-out-event" handler="_on_focus_out" swapped="no"/>
         <signal name="query-tooltip" handler="_query_tooltip" swapped="no"/>
         <signal name="row-activated" handler="_on_roster_row_activated" 
swapped="no"/>
+        <child internal-child="selection">
+          <object class="GtkTreeSelection"/>
+        </child>
         <child>
           <object class="GtkTreeViewColumn" id="contact_column">
             <property name="sizing">fixed</property>


=====================================
gajim/gtk/groupchat_roster.py
=====================================
@@ -114,6 +114,8 @@ def __init__(self) -> None:
         self.set_reveal_child(
             not app.settings.get('hide_groupchat_occupants_list'))
 
+        self.connect('notify::reveal-child', self._on_reveal)
+
     def _hide_roster(self, hide_roster: bool, *args: Any) -> None:
         transition = Gtk.RevealerTransitionType.SLIDE_RIGHT
         if not hide_roster:
@@ -123,10 +125,17 @@ def _hide_roster(self, hide_roster: bool, *args: Any) -> 
None:
         self.set_transition_type(transition)
         self.set_reveal_child(not hide_roster)
 
+    def _on_reveal(self, revealer: Gtk.Revealer, param: Any) -> None:
+        if revealer.get_reveal_child():
+            self._load_roster()
+        else:
+            self._unload_roster()
+
     def clear(self) -> None:
-        log.info('Clear')
         if self._contact is None:
             return
+
+        log.info('Clear')
         self._unload_roster()
         self._contact.disconnect_signal(self, 'state-changed')
         self._contact = None
@@ -485,6 +494,9 @@ def enable_sort(self, enable: bool) -> None:
         self._store.set_sort_column_id(column, Gtk.SortType.ASCENDING)
 
     def _load_roster(self) -> None:
+        if not self.get_reveal_child():
+            return
+
         log.info('Load Roster')
         assert self._contact is not None
         self._contact.multi_connect({
@@ -505,6 +517,9 @@ def _load_roster(self) -> None:
         self._roster.expand_all()
 
     def _unload_roster(self) -> None:
+        if self._roster.get_model() is None:
+            return
+
         log.info('Unload Roster')
         assert self._contact is not None
         self._contact.multi_disconnect(self, CONTACT_SIGNALS)



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

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


_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to