[network-manager-applet/lr/pkcs11: 6/6] XXX debug



commit d01985309737e776eb1dfbce1e02821501a978ee
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Fri Feb 17 19:05:53 2017 +0000

    XXX debug

 src/wireless-security/eap-method-tls.c |   12 ++++++++++++
 src/wireless-security/eap-method.c     |   17 ++++++++++++++---
 2 files changed, 26 insertions(+), 3 deletions(-)
---
diff --git a/src/wireless-security/eap-method-tls.c b/src/wireless-security/eap-method-tls.c
index 759477a..dc2625c 100644
--- a/src/wireless-security/eap-method-tls.c
+++ b/src/wireless-security/eap-method-tls.c
@@ -31,6 +31,10 @@
 #include "nma-ui-utils.h"
 #include "utils.h"
 
+// XXX
+#define gtk_file_chooser_get_uri gtk_file_chooser_get_filename
+#define gtk_file_chooser_set_uri gtk_file_chooser_set_filename
+
 struct _EAPMethodTLS {
        EAPMethod parent;
 
@@ -417,6 +421,14 @@ setup_filepicker (GtkBuilder *builder,
                        if (value)
                                gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value);
                        break;
+#ifdef NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PKCS11
+/* Not available in libnm-glib */
+               case NM_SETTING_802_1X_CK_SCHEME_PKCS11:
+                       value = uri_func (s_8021x);
+                       if (value)
+                               gtk_file_chooser_set_uri (GTK_FILE_CHOOSER (widget), value);
+                       break;
+#endif
                default:
                        g_warning ("don't know how to set %s to a value of unknown scheme %d",
                                   name, scheme);
diff --git a/src/wireless-security/eap-method.c b/src/wireless-security/eap-method.c
index 7cc0eb7..f750c0e 100644
--- a/src/wireless-security/eap-method.c
+++ b/src/wireless-security/eap-method.c
@@ -206,15 +206,26 @@ eap_method_unref (EAPMethod *method)
        }
 }
 
+// XXX
+#define gtk_file_chooser_get_uri gtk_file_chooser_get_filename
+#define gtk_file_chooser_set_uri gtk_file_chooser_set_filename
+
 char *
 eap_method_filepicker_get_value (GtkFileChooser *chooser, NMSetting8021xCKScheme *scheme)
 {
        char *value;
 
        value = gtk_file_chooser_get_uri (chooser);
+if (value && g_utf8_strrchr (value, -1, '/')) value = g_strdup (g_utf8_strrchr (value, -1, '/') + 1);
 
-       *scheme = NM_SETTING_802_1X_CK_SCHEME_PATH;
-       return gtk_file_chooser_get_filename (chooser);
+       if (value && g_str_has_prefix (value, NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PKCS11)) {
+               *scheme = NM_SETTING_802_1X_CK_SCHEME_PKCS11;
+               return value;
+       } else {
+               g_free (value);
+               *scheme = NM_SETTING_802_1X_CK_SCHEME_PATH;
+               return gtk_file_chooser_get_filename (chooser);
+       }
 }
 
 gboolean


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