[PATCH nm-openconnect] Generate token_mode dropdown list on the fly

David Woodhouse dwmw2 at infradead.org
Sat Jun 8 14:41:08 EDT 2013


On Sat, 2013-06-08 at 11:23 -0700, Kevin Cernekee wrote:
> Depending on which software token libraries are installed, this could
> include stoken options, TOTP options, both, or neither.  Only show the
> user the options that are available on his system.

Thanks. I was looking vaguely at this and was going to try to put the
extra information into the ComboBox model directly instead of keeping a
separate data structure. My hacks had got about this far...

diff --git a/properties/nm-openconnect-dialog.ui b/properties/nm-openconnect-dialog.ui
index bc38374..4d22339 100644
--- a/properties/nm-openconnect-dialog.ui
+++ b/properties/nm-openconnect-dialog.ui
@@ -734,19 +734,24 @@
         <columns>
           <!-- column-name legible -->
           <column type="gchararray"/>
+          <column type="gchararray"/>
         </columns>
         <data>
           <row>
             <col id="0" translatable="yes">Disabled</col>
+            <col id="1" translatable="no">disabled</col>
           </row>
           <row>
             <col id="0" translatable="yes">RSA SecurID - read from ~/.stokenrc</col>
+            <col id="1" translatable="no">stokenrc</col>
           </row>
           <row>
             <col id="0" translatable="yes">RSA SecurID - manually entered</col>
+            <col id="1" translatable="no">manual</col>
           </row>
           <row>
             <col id="0" translatable="yes">TOTP - manually entered</col>
+            <col id="1" translatable="no">totp</col>
           </row>
         </data>
       </object>
diff --git a/properties/nm-openconnect.c b/properties/nm-openconnect.c
index 7a60937..0fe15ef 100644
--- a/properties/nm-openconnect.c
+++ b/properties/nm-openconnect.c
@@ -554,6 +554,10 @@ update_connection (NMVpnPluginUiWidgetInterface *iface,
 
 	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "token_mode"));
 	idx = gtk_combo_box_get_active (GTK_COMBO_BOX (widget));
+	gtk_combo_box_set_id_column(GTK_COMBO_BOX(widget), 1);
+	printf("Got %d\n", gtk_combo_box_get_active(GTK_COMBO_BOX(widget)));
+	printf("id %s\n", gtk_combo_box_get_active_id(GTK_COMBO_BOX(widget)));
+		   
 	str = NULL;
 	switch (idx) {
 	case 0:

-- 
dwmw2

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5745 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/openconnect-devel/attachments/20130608/d85061ff/attachment.bin>


More information about the openconnect-devel mailing list