From 19a00beed249cb5f261ff235781b961f4d3b5d1c Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Fri, 1 Jun 2018 16:20:34 -0700 Subject: [PATCH] Handle --keep-above passed through to editor_command_line Handling of nm-connection-editor command line arguments was changed in f3782da2. Since that commit, most args are handled by `editor_command_line`, but one (`--keep-above`) is handled by `main`. Unfortunately, if `--keep-above` appears with other arguments, `main` does not strip it from argv and parsing in `editor_command_line` fails with "Failed to parse options". To handle this, let's just have `editor_command_line` recognize but ignore `--keep-above` if it encounters it. https://gitlab.gnome.org/GNOME/network-manager-applet/issues/1 Signed-off-by: Adam Williamson --- src/connection-editor/main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/connection-editor/main.c b/src/connection-editor/main.c index 29facda9..92fdbda7 100644 --- a/src/connection-editor/main.c +++ b/src/connection-editor/main.c @@ -224,7 +224,7 @@ editor_command_line (GApplication *application, GOptionContext *opt_ctx = NULL; GError *error = NULL; gs_free char *type = NULL, *uuid = NULL, *import = NULL; - gboolean create = FALSE, show = FALSE; + gboolean create = FALSE, show = FALSE, keepabove = FALSE; int ret = 1; GOptionEntry entries[] = { { "type", 't', 0, G_OPTION_ARG_STRING, &type, "Type of connection to show or create", NM_SETTING_WIRED_SETTING_NAME }, @@ -232,6 +232,10 @@ editor_command_line (GApplication *application, { "show", 's', 0, G_OPTION_ARG_NONE, &show, "Show a given connection type page", NULL }, { "edit", 'e', 0, G_OPTION_ARG_STRING, &uuid, "Edit an existing connection with a given UUID", "UUID" }, { "import", 'i', 0, G_OPTION_ARG_STRING, &import, "Import a VPN connection from given file", NULL }, + /* handled in main but may be passed through here, so we need + * to parse and ignore it + */ + { "keep-above", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &keepabove, NULL, NULL }, { NULL } }; -- 2.17.0