[NetworkManager-libreswan] auth-dialog: don't connect to Gtk+ display until necessary



commit a7366e321aa0d2d5200be184d7c974a881a90363
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Thu Oct 18 16:49:08 2018 +0200

    auth-dialog: don't connect to Gtk+ display until necessary
    
    In the external UI mode we may end up not needing a connection to the
    display server at all.
    
    This splits the parsing of Gtk+ command line arguments from connection
    to the display. This also fixes the --help output to actually include
    the Gtk+ arguments (such as --display).
    
    https://gitlab.gnome.org/GNOME/NetworkManager-libreswan/merge_requests/12

 NEWS               | 9 +++++++++
 auth-dialog/main.c | 6 ++++--
 2 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/NEWS b/NEWS
index f0da19b..60ff8c8 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,12 @@
+=========================================================
+NetworkManager-libreswan-1.2.14
+Overview of changes since NetworkManager-libreswan-1.2.12
+=========================================================
+
+* The auth helper in external UI mode can now be run without a display
+  server. Future nmcli version will utilize this for handling the
+  secrets without a graphical desktop.
+
 =========================================================
 NetworkManager-libreswan-1.2.12
 Overview of changes since NetworkManager-libreswan-1.2.10
diff --git a/auth-dialog/main.c b/auth-dialog/main.c
index d02f2b9..09906a8 100644
--- a/auth-dialog/main.c
+++ b/auth-dialog/main.c
@@ -18,7 +18,7 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * (C) Copyright 2004 - 2015 Red Hat, Inc.
+ * (C) Copyright 2004 - 2018 Red Hat, Inc.
  */
 
 #include "nm-default.h"
@@ -225,6 +225,8 @@ std_ask_user (const char *vpn_name,
        g_return_val_if_fail (out_new_password != NULL, FALSE);
        g_return_val_if_fail (out_new_group_password != NULL, FALSE);
 
+       gtk_init (NULL, NULL);
+
        dialog = NMA_VPN_PASSWORD_DIALOG (nma_vpn_password_dialog_new (_("Authenticate VPN"), prompt, NULL));
 
        /* pre-fill dialog with existing passwords */
@@ -439,11 +441,11 @@ main (int argc, char *argv[])
 
        bindtextdomain (GETTEXT_PACKAGE, NULL);
        bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-       gtk_init (&argc, &argv);
        textdomain (GETTEXT_PACKAGE);
 
        context = g_option_context_new ("- IPsec auth dialog");
        g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
+       g_option_context_add_group (context, gtk_get_option_group (FALSE));
 
        if (!g_option_context_parse (context, &argc, &argv, &error)) {
                fprintf (stderr, "Error parsing options: %s\n", error->message);


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