changeset 7ab29352bc8d in /home/hg/repos/gajim

branches: 
details:http://hg.gajim.org/gajim?cmd=changeset;node=7ab29352bc8d
description: don't redraw several time the contacts when redrawing the full 
roster. See #7125

diffstat:

 src/roster_window.py |  35 +++++++++++++++++++++--------------
 1 files changed, 21 insertions(+), 14 deletions(-)

diffs (63 lines):

diff -r 8b27ee155e34 -r 7ab29352bc8d src/roster_window.py
--- a/src/roster_window.py      Wed Jul 24 12:39:07 2013 +0200
+++ b/src/roster_window.py      Thu Jul 25 08:54:35 2013 +0200
@@ -261,28 +261,32 @@
         self.draw_account(account)
 
 
-    def add_account_contacts(self, account):
+    def add_account_contacts(self, account, improve_speed=True,
+    draw_contacts=True):
         """
         Add all contacts and groups of the given account to roster, draw them
         and account
         """
-        self._before_fill()
+        if improve_speed:
+            self._before_fill()
         jids = gajim.contacts.get_jid_list(account)
 
         for jid in jids:
             self.add_contact(jid, account)
 
-        # Do not freeze the GUI when drawing the contacts
-        if jids:
-            # Overhead is big, only invoke when needed
-            self._idle_draw_jids_of_account(jids, account)
-
-        # Draw all known groups
-        for group in gajim.groups[account]:
-            self.draw_group(group, account)
-        self.draw_account(account)
-
-        self._after_fill()
+        if draw_contacts:
+            # Do not freeze the GUI when drawing the contacts
+            if jids:
+                # Overhead is big, only invoke when needed
+                self._idle_draw_jids_of_account(jids, account)
+
+            # Draw all known groups
+            for group in gajim.groups[account]:
+                self.draw_group(group, account)
+            self.draw_account(account)
+
+        if improve_speed:
+            self._after_fill()
 
     def _add_group_iter(self, account, group):
         """
@@ -1451,9 +1455,12 @@
         for acct in gajim.contacts.get_accounts():
             self._iters[acct] = {'account': None, 'groups': {}, 'contacts': {}}
 
+        self._before_fill()
         for acct in gajim.contacts.get_accounts():
             self.add_account(acct)
-            self.add_account_contacts(acct)
+            self.add_account_contacts(acct, improve_speed=False,
+                draw_contacts=False)
+        self._after_fill()
 
         # Recalculate column width for ellipsizing
         self.tree.columns_autosize()
_______________________________________________
Commits mailing list
[email protected]
http://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to