changeset 002c0d0a2ef8 in /home/hg/repos/gajim

details:http://hg.gajim.org/gajim?cmd=changeset;node=002c0d0a2ef8
description: handle default value in seclabel combobox. see #7010

diffstat:

 src/chat_control.py               |  11 +++++++++--
 src/common/connection_handlers.py |   6 +++++-
 2 files changed, 14 insertions(+), 3 deletions(-)

diffs (45 lines):

diff -r 797dd9d03316 -r 002c0d0a2ef8 src/chat_control.py
--- a/src/chat_control.py       Wed Oct 12 21:07:02 2011 +0200
+++ b/src/chat_control.py       Thu Oct 13 18:04:43 2011 +0200
@@ -310,9 +310,16 @@
     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()
 
diff -r 797dd9d03316 -r 002c0d0a2ef8 src/common/connection_handlers.py
--- a/src/common/connection_handlers.py Wed Oct 12 21:07:02 2011 +0200
+++ b/src/common/connection_handlers.py Thu Oct 13 18:04:43 2011 +0200
@@ -1417,14 +1417,18 @@
         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] = []
_______________________________________________
Commits mailing list
[email protected]
http://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to