From 5c60b517a70cab8138312ec39946f18f3ed75f58 Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Sun, 25 Jun 2017 11:48:46 -0400 Subject: Add support for comments for a display filter button Add a field to the display filter button UAT to allow comments to be displayed as part of the tooltip to the diplay filter button Bug: 13814 Change-Id: I74459e4102856258d31d6429e2fd924a9f798cd5 Reviewed-on: https://code.wireshark.org/review/22390 Petri-Dish: Michael Mann Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann --- epan/filter_expressions.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'epan/filter_expressions.c') diff --git a/epan/filter_expressions.c b/epan/filter_expressions.c index 048bad65bd..ae69c15989 100644 --- a/epan/filter_expressions.c +++ b/epan/filter_expressions.c @@ -39,6 +39,7 @@ static guint num_display_filter_macros = 0; UAT_BOOL_CB_DEF(display_filter_macro_uat, enabled, filter_expression_t) UAT_CSTRING_CB_DEF(display_filter_macro_uat, label, filter_expression_t) UAT_DISPLAY_FILTER_CB_DEF(display_filter_macro_uat, expression, filter_expression_t) +UAT_CSTRING_CB_DEF(display_filter_macro_uat, comment, filter_expression_t) /* * Create a new filter_expression and add it to the end of the list @@ -46,7 +47,7 @@ UAT_DISPLAY_FILTER_CB_DEF(display_filter_macro_uat, expression, filter_expressio */ filter_expression_t* filter_expression_new(const gchar *label, const gchar *expr, - const gboolean enabled) + const gchar *comment, const gboolean enabled) { filter_expression_t expression; @@ -54,6 +55,7 @@ filter_expression_new(const gchar *label, const gchar *expr, memset(&expression, 0, sizeof(expression)); expression.label = g_strdup(label); expression.expression = g_strdup(expr); + expression.comment = g_strdup(comment); expression.enabled = enabled; /* XXX - This is just returned to make GTK GUI work. */ @@ -75,6 +77,7 @@ static void display_filter_free_cb(void*r) { g_free(rec->label); g_free(rec->expression); + g_free(rec->comment); } static void* display_filter_copy_cb(void* n, const void* o, size_t siz _U_) { @@ -84,6 +87,7 @@ static void* display_filter_copy_cb(void* n, const void* o, size_t siz _U_) { new_record->button = old_record->button; new_record->label = g_strdup(old_record->label); new_record->expression = g_strdup(old_record->expression); + new_record->comment = g_strdup(old_record->comment); new_record->enabled = old_record->enabled; @@ -97,6 +101,8 @@ static uat_field_t display_filter_uat_flds[] = { "Name of the display filter button"), UAT_FLD_DISPLAY_FILTER(display_filter_macro_uat, expression, "Filter Expression", "Filter expression to be applied by the button"), + UAT_FLD_CSTRING(display_filter_macro_uat, comment, "Comment", + "Comment describing filter expression"), UAT_END_FIELDS }; -- cgit v1.2.1