summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Williamson <awilliam@redhat.com>2018-06-01 16:20:34 -0700
committerLubomir Rintel <lkundrak@v3.sk>2018-06-06 23:35:02 +0200
commit88e4dcab27e614e948a78e2235495a78fc0f1993 (patch)
tree173728ffcdc7be0f42f1d02127e1033bf9622107
parentb5e496ccd1038b2613af29973ff51e7efbdbed05 (diff)
downloadnetwork-manager-applet-88e4dcab27e614e948a78e2235495a78fc0f1993.tar.gz
editor: 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 <awilliam@redhat.com>
-rw-r--r--src/connection-editor/main.c6
1 files changed, 5 insertions, 1 deletions
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 }
};