[network-manager-openvpn/bg/bgo774730: 2/3] wip



commit e93e2756721f808f2c293b23b1c31069b0f3b332
Author: Beniamino Galvani <bgalvani redhat com>
Date:   Fri Dec 2 18:53:31 2016 +0100

    wip

 properties/auth-helpers.c |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/properties/auth-helpers.c b/properties/auth-helpers.c
index 7995143..e8a4562 100644
--- a/properties/auth-helpers.c
+++ b/properties/auth-helpers.c
@@ -1003,7 +1003,7 @@ populate_cipher_combo (GtkComboBox *box, const char *user_cipher)
        gboolean user_added = FALSE;
        char *argv[3];
        GError *error = NULL;
-       gboolean success, found_blank = FALSE;
+       gboolean success, ignore_lines = TRUE;
 
        openvpn_binary = nm_find_openvpn ();
        if (!openvpn_binary)
@@ -1042,15 +1042,21 @@ populate_cipher_combo (GtkComboBox *box, const char *user_cipher)
        g_free (tmp);
 
        for (item = items; *item; item++) {
-               char *space = strchr (*item, ' ');
+               char *space;
 
-               /* Don't add anything until after the first blank line */
-               if (!found_blank) {
-                       if (!strlen (*item))
-                               found_blank = TRUE;
+               /* Don't add anything until after the first blank line. Also,
+                * any blank line indicates the start of a comment, ended by
+                * another blank line.
+                */
+               if (!strlen (*item)) {
+                       ignore_lines = !ignore_lines;
                        continue;
                }
 
+               if (ignore_lines)
+                       continue;
+
+               space = strchr (*item, ' ');
                if (space)
                        *space = '\0';
 
@@ -1074,7 +1080,7 @@ populate_cipher_combo (GtkComboBox *box, const char *user_cipher)
                gtk_list_store_insert (store, &iter, 1);
                gtk_list_store_set (store, &iter,
                                    TLS_CIPHER_COL_NAME, user_cipher,
-                                   TLS_CIPHER_COL_DEFAULT, FALSE -1);
+                                   TLS_CIPHER_COL_DEFAULT, FALSE, -1);
                gtk_combo_box_set_active_iter (box, &iter);
        } else if (!user_added) {
                gtk_combo_box_set_active (box, 0);


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