Do not allow to add special groups in edit groups dialog.
This commit is contained in:
parent
cb4229f4d3
commit
683c3145e0
|
@ -139,6 +139,9 @@ class EditGroupsDialog:
|
||||||
group = self.xml.get_widget('group_entry').get_text().decode('utf-8')
|
group = self.xml.get_widget('group_entry').get_text().decode('utf-8')
|
||||||
if not group:
|
if not group:
|
||||||
return
|
return
|
||||||
|
# Do not allow special groups
|
||||||
|
if group in helpers.special_groups:
|
||||||
|
return
|
||||||
# check if it already exists
|
# check if it already exists
|
||||||
model = self.list.get_model()
|
model = self.list.get_model()
|
||||||
iter = model.get_iter_root()
|
iter = model.get_iter_root()
|
||||||
|
@ -180,14 +183,16 @@ class EditGroupsDialog:
|
||||||
if account not in accounts:
|
if account not in accounts:
|
||||||
accounts.append(account)
|
accounts.append(account)
|
||||||
for g in gajim.groups[account].keys():
|
for g in gajim.groups[account].keys():
|
||||||
if g in helpers.special_groups:
|
|
||||||
continue
|
|
||||||
if g in groups:
|
if g in groups:
|
||||||
continue
|
continue
|
||||||
groups[g] = 0
|
groups[g] = 0
|
||||||
for g in contact.groups:
|
for g in contact.groups:
|
||||||
groups[g] += 1
|
groups[g] += 1
|
||||||
group_list = groups.keys()
|
group_list = []
|
||||||
|
# Remove special groups if they are empty
|
||||||
|
for group in groups:
|
||||||
|
if group not in helpers.special_groups or groups[group] > 0:
|
||||||
|
group_list.append(group)
|
||||||
group_list.sort()
|
group_list.sort()
|
||||||
for group in group_list:
|
for group in group_list:
|
||||||
iter = store.append()
|
iter = store.append()
|
||||||
|
|
Loading…
Reference in New Issue