Skip to content
Snippets Groups Projects
Commit 8decfc44 authored by jimpp's avatar jimpp
Browse files

Sort groups in edit group dialog, even when adding one. Note that it doesn't...

Sort groups in edit group dialog, even when adding one. Note that it doesn't lower groupname before sort.
Make edit group window longer but with no vscroolbar if necessary.
parent 1dfd1563
No related branches found
No related tags found
No related merge requests found
...@@ -159,7 +159,7 @@ ...@@ -159,7 +159,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> <property name="vscrollbar_policy">GTK_POLICY_NEVER</property>
<property name="shadow_type">GTK_SHADOW_IN</property> <property name="shadow_type">GTK_SHADOW_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property> <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
......
...@@ -140,6 +140,7 @@ class EditGroupsDialog: ...@@ -140,6 +140,7 @@ class EditGroupsDialog:
model.append((group, True)) model.append((group, True))
self.add_group(group) self.add_group(group)
self.update_contact() self.update_contact()
self.init_list() # Re-draw list to sort new item
def group_toggled_cb(self, cell, path): def group_toggled_cb(self, cell, path):
self.changes_made = True self.changes_made = True
...@@ -155,15 +156,21 @@ class EditGroupsDialog: ...@@ -155,15 +156,21 @@ class EditGroupsDialog:
def init_list(self): def init_list(self):
store = gtk.ListStore(str, bool) store = gtk.ListStore(str, bool)
self.list.set_model(store) self.list.set_model(store)
for column in self.list.get_columns(): # Clear treeview when re-drawing
self.list.remove_column(column)
groups = [] # Store accounts in a list so we can sort them
for g in gajim.groups[self.account].keys(): for g in gajim.groups[self.account].keys():
if g in helpers.special_groups: if g in helpers.special_groups:
continue continue
iter = store.append() in_group = False
store.set(iter, 0, g)
if g in self.user.groups: if g in self.user.groups:
store.set(iter, 1, True) in_group = True
else: groups.append([g, in_group])
store.set(iter, 1, False) groups.sort()
for group in groups:
iter = store.append()
store.set(iter, 0, group[0]) # Group name
store.set(iter, 1, group[1]) # In group boolean
column = gtk.TreeViewColumn(_('Group')) column = gtk.TreeViewColumn(_('Group'))
column.set_expand(True) column.set_expand(True)
self.list.append_column(column) self.list.append_column(column)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment