Author: asterix Date: 2008-02-03 22:00:27 +0100 (Sun, 03 Feb 2008) New Revision: 9289
Modified: trunk/src/roster_window.py Log: re-draw groups and accounts after 0.5s so to not call them too often. see #3718
Modified: trunk/src/roster_window.py =================================================================== --- trunk/src/roster_window.py 2008-02-03 19:31:01 UTC (rev 9288) +++ trunk/src/roster_window.py 2008-02-03 21:00:27 UTC (rev 9289) @@ -209,6 +209,14 @@ 'account', our_jid, account, None, tls_pixbuf])
def draw_account(self, account): + if account in self.draw_account_id: + gobject.source_remove(self.draw_account_id[account]) + self.draw_account_id[account] = gobject.timeout_add(500, + self.really_draw_account, account) + + def really_draw_account(self, account): + if account in self.draw_account_id: + del self.draw_account_id[account] model = self.tree.get_model() iter = self.get_account_iter(account) @@ -397,6 +405,16 @@ self.add_contact_to_roster(data['jid'], data['account'])
def draw_group(self, group, account): + key = (group, account) + if key in self.draw_group_id: + gobject.source_remove(self.draw_group_id[key]) + self.draw_group_id[key] = gobject.timeout_add(500, + self.really_draw_group, group, account) + + def really_draw_group(self, group, account): + key = (group, account) + if key in self.draw_group_id: + del self.draw_group_id[key] iter = self.get_group_iter(group, account) if not iter: return @@ -5412,6 +5430,8 @@ self.actions_menu_needs_rebuild = True self.regroup = gajim.config.get('mergeaccounts') self.clicked_path = None # Used remember on wich row we clicked + self.draw_group_id = {} + self.draw_account_id = {} if len(gajim.connections) < 2: # Do not merge accounts if only one exists self.regroup = False #FIXME: When list_accel_closures will be wrapped in pygtk