diff options
author | Anders Broman <anders.broman@ericsson.com> | 2012-06-01 07:02:04 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2012-06-01 07:02:04 +0000 |
commit | 86c69b01e7965f37eecbe6195e797a52ab81e23e (patch) | |
tree | 8a119ef130e9bada1463aa8d27aeb62d78c0c195 /ui/gtk/proto_hier_stats_dlg.c | |
parent | d8d6de9561ae5d61a12778117a030c858f608195 (diff) |
From Alexander Koeppe.
Patch that creates the filter according to the protocol tree selected.
Fixes
IPv6 filters built from "Protocol Hierarchy Statistics" dialog not specific
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7250
svn path=/trunk/; revision=42960
Diffstat (limited to 'ui/gtk/proto_hier_stats_dlg.c')
-rw-r--r-- | ui/gtk/proto_hier_stats_dlg.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/ui/gtk/proto_hier_stats_dlg.c b/ui/gtk/proto_hier_stats_dlg.c index acf4a3e13c..024b1342c6 100644 --- a/ui/gtk/proto_hier_stats_dlg.c +++ b/ui/gtk/proto_hier_stats_dlg.c @@ -73,24 +73,46 @@ static GtkWidget *tree; static void proto_hier_select_filter_cb(GtkWidget *widget _U_, gpointer callback_data _U_, guint callback_action) { - char *str = NULL; + gchar *str = NULL; + gchar *strtmp = NULL; const char *filter = NULL; GtkTreeSelection *sel; GtkTreeModel *model; GtkTreeIter iter; + GtkTreePath *path; sel = gtk_tree_view_get_selection (GTK_TREE_VIEW(tree)); gtk_tree_selection_get_selected (sel, &model, &iter); + path = gtk_tree_model_get_path(model,&iter); + gtk_tree_model_get (model, &iter, FILTER_NAME, &filter, -1); - if (filter && 0 != strlen(filter)) { + if (filter && strlen(filter) > 0) { str = g_strdup_printf("%s", filter); } else { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Could not acquire information to build a filter!\nTry expanding or choosing another item."); return; } - apply_selected_filter (callback_action, str); + while (gtk_tree_path_up(path) && gtk_tree_path_get_depth(path) > 0) + { + strtmp = g_strdup_printf("%s", str); + g_free(str); + + gtk_tree_model_get_iter(model, &iter, path); + gtk_tree_model_get(model, &iter, FILTER_NAME, &filter, -1); + if (filter && strlen(filter) > 0) { + str = g_strdup_printf("%s and %s", strtmp, filter); + } else { + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Could not acquire information to build a filter!\nTry expanding or choosing another item."); + return; + } + + g_free(strtmp); + } + apply_selected_filter (callback_action, str); + + gtk_tree_path_free(path); g_free (str); } |