Auto sort bookmarked rooms list (when opening manage dialog and when adding

new one). Fixes #3739.
This commit is contained in:
Jean-Marie Traissard 2008-04-06 13:14:00 +00:00
parent 59cc0a4aa8
commit 06fdc8367b
2 changed files with 14 additions and 2 deletions

View File

@ -2642,6 +2642,7 @@ class ManageBookmarksWindow:
# Account-JID, RoomName, Room-JID, Autojoin, Minimize, Passowrd, Nick,
# Show_Status
self.treestore = gtk.TreeStore(str, str, str, bool, bool, str, str, str)
self.treestore.set_sort_column_id(1, gtk.SORT_ASCENDING)
# Store bookmarks in treeview.
for account in gajim.connections:

View File

@ -1740,9 +1740,20 @@ class GroupchatControl(ChatControlBase):
_('Group Chat "%s" is already in your bookmarks.') % bm['jid'])
return
gajim.connections[self.account].bookmarks.append(bm)
gajim.connections[self.account].store_bookmarks()
place_found = False
index = 0
# Respect alpha order
for bookmark in gajim.connections[self.account].bookmarks:
if bookmark['name'] > bm['name']:
place_found = True
break
index += 1
if place_found:
gajim.connections[self.account].bookmarks.insert(index, bm)
else:
gajim.connections[self.account].bookmarks.append(bm)
gajim.connections[self.account].store_bookmarks()
gajim.interface.roster.set_actions_menu_needs_rebuild()
dialogs.InformationDialog(