handle default value in seclabel combobox. see #7010

This commit is contained in:
Yann Leboulanger 2011-10-13 18:04:43 +02:00
parent 27a85b128e
commit e4c9820146
2 changed files with 14 additions and 3 deletions

View File

@ -311,9 +311,16 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
def on_seclabels_ready(self):
lb = self.seclabel_combo.get_model()
lb.clear()
for label in gajim.connections[self.account].seclabel_catalogues[self.contact.jid][2]:
i = 0
sel = 0
catalogue = gajim.connections[self.account].seclabel_catalogues[
self.contact.jid]
for label in catalogue[2]:
lb.append([label])
self.seclabel_combo.set_active(0)
if label == catalogue[3]:
sel = i
i += 1
self.seclabel_combo.set_active(sel)
self.seclabel_combo.set_no_show_all(False)
self.seclabel_combo.show_all()

View File

@ -1416,14 +1416,18 @@ ConnectionJingle, ConnectionIBBytestream):
items = query.getTags('item')
labels = {}
ll = []
default = None
for item in items:
label = item.getAttr('selector')
labels[label] = item.getTag('securitylabel')
ll.append(label)
if item.getAttr('default') == 'true':
default = label
if to not in self.seclabel_catalogues:
self.seclabel_catalogues[to] = [[], None, None]
self.seclabel_catalogues[to] = [[], None, None, None]
self.seclabel_catalogues[to][1] = labels
self.seclabel_catalogues[to][2] = ll
self.seclabel_catalogues[to][3] = default
for callback in self.seclabel_catalogues[to][0]:
callback()
self.seclabel_catalogues[to][0] = []