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



commit fb48e0a5c4368a2331372f5fc6ec65e58faf9b34
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).

 auth-dialog/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/auth-dialog/main.c b/auth-dialog/main.c
index aa6aa64..996b4b5 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]