summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2018-07-13 18:18:19 +0200
committerLubomir Rintel <lkundrak@v3.sk>2018-07-13 18:18:19 +0200
commita7e3a00b85ab280cdbd3e670cbae3a1fd16be275 (patch)
treeff13b4b3c61b03d0119350c915a422abde5ef315
parent5dc6526946181da17667997dc29c03d4a162d37f (diff)
parentd9215e1ad063d0adc88d64c2cd311fd77a288e5b (diff)
downloadnetwork-manager-applet-a7e3a00b85ab280cdbd3e670cbae3a1fd16be275.tar.gz
merge: branch 'lr/vpn-add-idle'
https://gitlab.gnome.org/GNOME/network-manager-applet/merge_requests/12
-rw-r--r--src/connection-editor/main.c59
1 files changed, 10 insertions, 49 deletions
diff --git a/src/connection-editor/main.c b/src/connection-editor/main.c
index ce214d17..29d10154 100644
--- a/src/connection-editor/main.c
+++ b/src/connection-editor/main.c
@@ -39,39 +39,6 @@ gboolean nm_ce_keep_above;
/*************************************************/
-typedef struct {
- gboolean create;
- NMConnectionList *list;
- GType ctype;
- char *detail;
- char *import_filename;
-} CreateConnectionInfo;
-
-static gboolean
-idle_create_connection (gpointer user_data)
-{
- CreateConnectionInfo *info = user_data;
-
- if (info->create) {
- if (!info->ctype)
- nm_connection_list_add (info->list);
- else {
- nm_connection_list_create (info->list, info->ctype,
- info->detail, NULL);
- }
- } else {
- /* import */
- nm_connection_list_create (info->list, info->ctype,
- info->detail, info->import_filename);
- }
-
- g_object_unref (info->list);
- g_free (info->detail);
- g_free (info->import_filename);
- g_slice_free (CreateConnectionInfo, info);
- return FALSE;
-}
-
static gboolean
handle_arguments (GApplication *application,
const char *type,
@@ -85,7 +52,6 @@ handle_arguments (GApplication *application,
GType ctype = 0;
gs_free char *type_tmp = NULL;
const char *p, *detail = NULL;
- CreateConnectionInfo *info;
if (type) {
p = strchr (type, ':');
@@ -113,21 +79,15 @@ handle_arguments (GApplication *application,
if (show) {
/* Just show the given connection type page */
nm_connection_list_set_type (list, ctype);
- } else if (create || import) {
- /* If type is "vpn" and the user cancels the "vpn type" dialog, we need
- * to quit. But we haven't even started yet. So postpone this to an idle.
- */
- info = g_slice_new0 (CreateConnectionInfo);
- info->list = g_object_ref (list);
- info->create = create;
- info->detail = g_strdup (detail);
- if (create)
- info->ctype = ctype;
- else {
- info->ctype = NM_TYPE_SETTING_VPN;
- info->import_filename = g_strdup (import);
- }
- g_idle_add (idle_create_connection, info);
+ } else if (create) {
+ if (!ctype)
+ nm_connection_list_add (list);
+ else
+ nm_connection_list_create (list, ctype, detail, NULL);
+ show_list = FALSE;
+ } else if (import) {
+ /* import */
+ nm_connection_list_create (list, ctype, detail, import);
show_list = FALSE;
} else if (edit_uuid) {
/* Show the edit dialog for the given UUID */
@@ -288,6 +248,7 @@ main (int argc, char *argv[])
opt_ctx = g_option_context_new (NULL);
g_option_context_add_main_entries (opt_ctx, entries, NULL);
+ g_option_context_set_help_enabled (opt_ctx, FALSE);
g_option_context_set_ignore_unknown_options (opt_ctx, TRUE);
g_option_context_parse (opt_ctx, &argc, &argv, NULL);
g_option_context_free (opt_ctx);