[network-manager-openconnect] properties: Show/hide stoken properties based on library capabilities



commit 259c2c3d9a95776cb26f32c41b72e1bb6fc7af13
Author: Kevin Cernekee <cernekee gmail com>
Date:   Sun Oct 14 18:08:26 2012 -0700

    properties: Show/hide stoken properties based on library capabilities
    
    If the library cannot support software tokens, don't show the software
    token vbox.

 properties/nm-openconnect.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/properties/nm-openconnect.c b/properties/nm-openconnect.c
index 32ccce3..b7ca0e1 100644
--- a/properties/nm-openconnect.c
+++ b/properties/nm-openconnect.c
@@ -36,6 +36,16 @@
 #include <string.h>
 #include <gtk/gtk.h>
 
+#include <openconnect.h>
+
+#ifndef OPENCONNECT_CHECK_VER
+#define OPENCONNECT_CHECK_VER(x,y) 0
+#endif
+
+#if !OPENCONNECT_CHECK_VER(2,1)
+#define openconnect_has_stoken_support() 0
+#endif
+
 #define NM_VPN_API_SUBJECT_TO_CHANGE
 
 #include <nm-vpn-plugin-ui-interface.h>
@@ -370,6 +380,10 @@ init_stoken_ui (OpenconnectPluginUiWidget *self,
 	GtkTextBuffer *buffer;
 	const char *value;
 
+	/* don't advertise stoken properties if we can't use them anyway */
+	if (!openconnect_has_stoken_support ())
+		return TRUE;
+
 	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "stoken_vbox"));
 	if (!widget)
 		return FALSE;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]