allow removal of sevral line at the same time in affiliation treeviews

This commit is contained in:
Yann Leboulanger 2006-01-19 21:36:04 +00:00
parent b222507198
commit 00fcf1d617
1 changed files with 22 additions and 34 deletions

View File

@ -1904,6 +1904,8 @@ class GroupchatConfigWindow(DataFormWindow):
liststore = gtk.ListStore(str, str, str, str) # Jid, reason, nick, role liststore = gtk.ListStore(str, str, str, str) # Jid, reason, nick, role
self.affiliation_treeview[affiliation] = gtk.TreeView(liststore) self.affiliation_treeview[affiliation] = gtk.TreeView(liststore)
self.affiliation_treeview[affiliation].get_selection().set_mode(
gtk.SELECTION_MULTIPLE)
self.affiliation_treeview[affiliation].connect('cursor-changed', self.affiliation_treeview[affiliation].connect('cursor-changed',
self.on_affiliation_treeview_cursor_changed, affiliation) self.on_affiliation_treeview_cursor_changed, affiliation)
renderer = gtk.CellRendererText() renderer = gtk.CellRendererText()
@ -1947,39 +1949,21 @@ class GroupchatConfigWindow(DataFormWindow):
if affiliation == 'outcast': if affiliation == 'outcast':
title = _('Banning...') title = _('Banning...')
#You can move '\n' before user@domain if that line is TOO BIG #You can move '\n' before user@domain if that line is TOO BIG
prompt = _('<b>Whom do you want to ban?</b>' '\n\n' prompt = _('<b>Whom do you want to ban?</b>\n\n')
'Can be one of the following:' '\n'
'1. user@domain/resource (only that resource matches).' '\n'
'2. user@domain (any resource matches).' '\n'
'3. domain/resource (only that resource matches).' '\n'
'4. domain (the domain itself matches, as does any user@domain,' '\n'
'domain/resource, or address containing a subdomain.')
elif affiliation == 'member': elif affiliation == 'member':
title = _('Adding Member...') title = _('Adding Member...')
prompt = _('<b>Whom do you want to make a member?</b>' '\n\n' prompt = _('<b>Whom do you want to make a member?</b>\n\n')
'Can be one of the following:' '\n'
'1. user@domain/resource (only that resource matches).' '\n'
'2. user@domain (any resource matches).' '\n'
'3. domain/resource (only that resource matches).' '\n'
'4. domain (the domain itself matches, as does any user@domain,' '\n'
'domain/resource, or address containing a subdomain.')
elif affiliation == 'owner': elif affiliation == 'owner':
title = _('Adding Owner...') title = _('Adding Owner...')
prompt = _('<b>Whom do you want to make a owner?</b>' '\n\n' prompt = _('<b>Whom do you want to make a owner?</b>\n\n')
'Can be one of the following:' '\n'
'1. user@domain/resource (only that resource matches).' '\n'
'2. user@domain (any resource matches).' '\n'
'3. domain/resource (only that resource matches).' '\n'
'4. domain (the domain itself matches, as does any user@domain,' '\n'
'domain/resource, or address containing a subdomain.')
else: else:
title = _('Adding Administrator...') title = _('Adding Administrator...')
prompt = _('<b>Whom do you want to make an administrator?</b>' '\n\n' prompt = _('<b>Whom do you want to make an administrator?</b>\n\n')
'Can be one of the following:' '\n' prompt += _('Can be one of the following:\n'
'1. user@domain/resource (only that resource matches).' '\n' '1. user@domain/resource (only that resource matches).\n'
'2. user@domain (any resource matches).' '\n' '2. user@domain (any resource matches).\n'
'3. domain/resource (only that resource matches).' '\n' '3. domain/resource (only that resource matches).\n'
'4. domain (the domain itself matches, as does any user@domain,' '\n' '4. domain (the domain itself matches, as does any user@domain,\n'
'domain/resource, or address containing a subdomain.') 'domain/resource, or address containing a subdomain.')
instance = dialogs.InputDialog(title, prompt) instance = dialogs.InputDialog(title, prompt)
@ -1995,13 +1979,17 @@ class GroupchatConfigWindow(DataFormWindow):
self.removed_jid[affiliation].remove(jid) self.removed_jid[affiliation].remove(jid)
def on_remove_button_clicked(self, widget, affiliation): def on_remove_button_clicked(self, widget, affiliation):
model, iter = self.affiliation_treeview[affiliation].get_selection()\ selection = self.affiliation_treeview[affiliation].get_selection()
.get_selected() model, paths = selection.get_selected_rows()
if not iter: row_refs = []
return for path in paths:
jid = model[iter][0] row_refs.append(gtk.TreeRowReference(model, path))
model.remove(iter) for row_ref in row_refs:
self.removed_jid[affiliation].append(jid) path = row_ref.get_path()
iter = model.get_iter(path)
jid = model[iter][0]
model.remove(iter)
self.removed_jid[affiliation].append(jid)
self.remove_button[affiliation].set_sensitive(False) self.remove_button[affiliation].set_sensitive(False)
def on_affiliation_treeview_cursor_changed(self, widget, affiliation): def on_affiliation_treeview_cursor_changed(self, widget, affiliation):