From 0af6ba1a53b604dc294c08c6dfc4dde17b4ea506 Mon Sep 17 00:00:00 2001 From: Roland Knall Date: Fri, 20 Apr 2018 14:59:14 +0200 Subject: extcap: Group arguments Group arguments together to better present them, as well as to have the possibility to better facilitate settings categories. The order of tabs is defined by the numbering of arguments and their appearance. If no tab can be found or no group has been defined for the argument, a default tab will be added. Change-Id: I032881193e09d4ad5d65c9f73fede87695acdace Reviewed-on: https://code.wireshark.org/review/27054 Petri-Dish: Roland Knall Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall --- extcap_parser.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'extcap_parser.c') diff --git a/extcap_parser.c b/extcap_parser.c index 75d248abf1..411e2522be 100644 --- a/extcap_parser.c +++ b/extcap_parser.c @@ -169,6 +169,8 @@ static extcap_token_sentence *extcap_tokenize_sentence(const gchar *s) { param_type = EXTCAP_PARAM_FILE_MUSTEXIST; } else if (g_ascii_strcasecmp(arg, "fileext") == 0) { param_type = EXTCAP_PARAM_FILE_EXTENSION; + } else if (g_ascii_strcasecmp(arg, "group") == 0) { + param_type = EXTCAP_PARAM_GROUP; } else if (g_ascii_strcasecmp(arg, "name") == 0) { param_type = EXTCAP_PARAM_NAME; } else if (g_ascii_strcasecmp(arg, "enabled") == 0) { @@ -251,6 +253,7 @@ void extcap_free_arg(extcap_arg *a) { g_free(a->placeholder); g_free(a->fileextension); g_free(a->regexp); + g_free(a->group); g_free(a->device_name); if (a->range_start != NULL) @@ -462,6 +465,11 @@ static extcap_arg *extcap_parse_arg_sentence(GList *args, extcap_token_sentence target_arg->regexp = g_strdup(param_value); } + if ((param_value = (gchar *)g_hash_table_lookup(s->param_list, ENUM_KEY(EXTCAP_PARAM_GROUP))) + != NULL) { + target_arg->group = g_strdup(param_value); + } + if ((param_value = (gchar *)g_hash_table_lookup(s->param_list, ENUM_KEY(EXTCAP_PARAM_REQUIRED))) != NULL) { target_arg->is_required = g_regex_match_simple(EXTCAP_BOOLEAN_REGEX, param_value, G_REGEX_CASELESS, (GRegexMatchFlags)0); -- cgit v1.2.3