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



commit a2506fe40c2a30c46ec8c5e3be8f57779e80203a
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-pptp/-/merge_requests/5

 NEWS               | 3 +++
 auth-dialog/main.c | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/NEWS b/NEWS
index 705bde6..40e8838 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,9 @@ Overview of changes since NetworkManager-pptp-1.2.8
   It can be enabled by passing --with-libnm-glib to configure script.
   Nobody should need it by now. Users that still use this are encourage
   to let us know before the libnm-glib support is removed for good.
+* 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-pptp-1.2.8
diff --git a/auth-dialog/main.c b/auth-dialog/main.c
index eaf3cf3..f899252 100644
--- a/auth-dialog/main.c
+++ b/auth-dialog/main.c
@@ -171,6 +171,7 @@ get_secrets (const char *vpn_uuid,
                return TRUE;
        }
 
+       gtk_init (NULL, NULL);
 
        dialog = (NMAVpnPasswordDialog *) nma_vpn_password_dialog_new (_("Authenticate VPN"), prompt, NULL);
 
@@ -245,10 +246,9 @@ main (int argc, char *argv[])
        bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
        textdomain (GETTEXT_PACKAGE);
 
-       gtk_init (&argc, &argv);
-
        context = g_option_context_new ("- pptp auth dialog");
        g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
+       g_option_context_add_group (context, gtk_get_option_group (FALSE));
        g_option_context_parse (context, &argc, &argv, NULL);
        g_option_context_free (context);
 


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