improve Gajim startup by disabling roster sorting while adding rows

This commit is contained in:
Yann Leboulanger 2010-07-24 00:22:23 +02:00
parent e70fd78d20
commit ff1fd521be
2 changed files with 13 additions and 2 deletions

View File

@ -3246,8 +3246,10 @@ class Interface:
self.show_systray()
self.roster = roster_window.RosterWindow()
self.roster._before_fill()
for account in gajim.connections:
gajim.connections[account].load_roster_from_db()
self.roster._after_fill()
# get instances for windows/dialogs that will show_all()/hide()
self.instances['file_transfers'] = dialogs.FileTransfersWindow()

View File

@ -284,7 +284,6 @@ class RosterWindow:
self.starting = True
jids = gajim.contacts.get_jid_list(account)
self.tree.freeze_child_notify()
for jid in jids:
self.add_contact(jid, account)
@ -298,7 +297,6 @@ class RosterWindow:
self.draw_group(group, account)
self.draw_account(account)
self.tree.thaw_child_notify()
self.starting = False
@ -1364,6 +1362,17 @@ class RosterWindow:
task = _draw_all_contacts(jids, account)
gobject.idle_add(task.next)
def _before_fill(self):
self.tree.freeze_child_notify()
self.tree.set_model(None)
# disable sorting
self.model.set_sort_column_id(-2, gtk.SORT_ASCENDING)
def _after_fill(self):
self.model.set_sort_column_id(1, gtk.SORT_ASCENDING)
self.tree.set_model(self.modelfilter)
self.tree.thaw_child_notify()
def setup_and_draw_roster(self):
"""
Create new empty model and draw roster