diff options
author | sake <sake@f5534014-38df-0310-8fa8-9805f1628bb7> | 2007-11-10 15:18:49 +0000 |
---|---|---|
committer | sake <sake@f5534014-38df-0310-8fa8-9805f1628bb7> | 2007-11-10 15:18:49 +0000 |
commit | 088ca305e3a2a383d01ea48cc9f46fd79f4191c2 (patch) | |
tree | a166bf5aaa491f166493b890103a8480777728ff /color_filters.c | |
parent | 6943ead3c9e5fac13381844ab6c2bab9355143d1 (diff) |
This patch makes it possible to disable individual coloring rules
without having to delete them. The patch has been tested on
Fedora-7 with GTK+ 1.2.10 and GTK+ 2.10.11.
Since I don't know how to use "strikethrough" in clists in GTK1
there is a little difference in how the disabled coloring rules
are displayed. In GTK2 they are striked through and in GTK1
they are shown in lightgrey on a white background.
Any info on how to use strikthrough in clists within GTK1 is more
than welcome :-)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@23421 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'color_filters.c')
-rw-r--r-- | color_filters.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/color_filters.c b/color_filters.c index a1c661a95c..2abadc9191 100644 --- a/color_filters.c +++ b/color_filters.c @@ -63,7 +63,8 @@ color_filter_t * color_filter_new(const gchar *name, /* The name of the filter to create */ const gchar *filter_string, /* The string representing the filter */ color_t *bg_color, /* The background color */ - color_t *fg_color) /* The foreground color */ + color_t *fg_color, /* The foreground color */ + gboolean disabled) /* Is the filter disabled? */ { color_filter_t *colorf; @@ -72,6 +73,7 @@ color_filter_new(const gchar *name, /* The name of the filter to create */ colorf->filter_text = g_strdup(filter_string); colorf->bg_color = *bg_color; colorf->fg_color = *fg_color; + colorf->disabled = disabled; colorf->c_colorfilter = NULL; colorf->edit_dialog = NULL; colorf->selected = FALSE; @@ -120,6 +122,7 @@ color_filter_clone(color_filter_t *colorf) new_colorf->filter_text = g_strdup(colorf->filter_text); new_colorf->bg_color = colorf->bg_color; new_colorf->fg_color = colorf->fg_color; + new_colorf->disabled = colorf->disabled; new_colorf->c_colorfilter = NULL; new_colorf->edit_dialog = NULL; new_colorf->selected = FALSE; @@ -284,6 +287,7 @@ color_filters_colorize_packet(gint row, epan_dissect_t *edt) while(curr != NULL) { colorf = curr->data; if ((colorf->c_colorfilter != NULL) && + (!colorf->disabled) && dfilter_apply_edt(colorf->c_colorfilter, edt)) { /* this is the filter to use, apply it to the packet list */ packet_list_set_colors(row, &(colorf->fg_color), &(colorf->bg_color)); @@ -310,6 +314,7 @@ read_filters_file(FILE *f, gpointer user_data) guint32 i = 0; gint32 c; guint16 fg_r, fg_g, fg_b, bg_r, bg_g, bg_b; + gboolean disabled = FALSE; gboolean skip_end_of_line = FALSE; name = g_malloc(name_len + 1); @@ -323,6 +328,7 @@ read_filters_file(FILE *f, gpointer user_data) } while (c != EOF && c != '\n'); if (c == EOF) break; + disabled = FALSE; skip_end_of_line = FALSE; } @@ -335,6 +341,11 @@ read_filters_file(FILE *f, gpointer user_data) if (c == EOF) break; + if (c == '!') { + disabled = TRUE; + continue; + } + /* skip # comments and invalid lines */ if (c != '@') { skip_end_of_line = TRUE; @@ -428,7 +439,7 @@ read_filters_file(FILE *f, gpointer user_data) } colorf = color_filter_new(name, filter_exp, &bg_color, - &fg_color); + &fg_color, disabled); if(user_data == &color_filter_list) { GSList **cfl = (GSList **)user_data; @@ -539,7 +550,8 @@ write_filter(gpointer filter_arg, gpointer data_arg) FILE *f = data->f; if (colorf->selected || !data->only_selected) { - fprintf(f,"@%s@%s@[%d,%d,%d][%d,%d,%d]\n", + fprintf(f,"%s@%s@%s@[%d,%d,%d][%d,%d,%d]\n", + colorf->disabled ? "!" : "", colorf->filter_name, colorf->filter_text, colorf->bg_color.red, |