aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--color_filters.c11
-rw-r--r--color_filters.h7
-rw-r--r--gtk/main.c1
-rw-r--r--gtk/menu.c14
-rw-r--r--gtk/recent.c14
-rw-r--r--gtk/recent.h1
6 files changed, 47 insertions, 1 deletions
diff --git a/color_filters.c b/color_filters.c
index cfa0e602df..ef72946dcd 100644
--- a/color_filters.c
+++ b/color_filters.c
@@ -51,6 +51,9 @@ static gboolean read_global_filters(void);
GSList *color_filter_list = NULL;
GSList *removed_filter_list = NULL;
+/* Color Filters can en-/disabled. */
+gboolean filters_enabled = TRUE;
+
/* Remove the specified filter from the list of existing color filters,
* and add it to the list of removed color filters.
* This way, unmarking and marking a packet which matches a now removed
@@ -140,7 +143,13 @@ prime_edt(gpointer data, gpointer user_data)
gboolean
color_filters_used(void)
{
- return color_filter_list != NULL;
+ return color_filter_list != NULL && filters_enabled;
+}
+
+void
+color_filters_enable(gboolean enable)
+{
+ filters_enabled = enable;
}
diff --git a/color_filters.h b/color_filters.h
index 097c0757c5..46646d05b6 100644
--- a/color_filters.h
+++ b/color_filters.h
@@ -84,6 +84,13 @@ void color_filters_prime_edt(epan_dissect_t *edt);
*/
gboolean color_filters_used(void);
+/** En-/disable color filters
+ *
+ * @param enable TRUE to enable (default)
+ */
+void
+color_filters_enable(gboolean enable);
+
/** Colorize a specific packet.
*
* @param row the row in the packet list
diff --git a/gtk/main.c b/gtk/main.c
index 293bc0b477..327f257a21 100644
--- a/gtk/main.c
+++ b/gtk/main.c
@@ -2250,6 +2250,7 @@ main(int argc, char *argv[])
/* Read the recent file, as we have the gui now ready for it. */
read_recent(&rf_path, &rf_open_errno);
+ color_filters_enable(recent.packet_list_colorize);
/* rearrange all the widgets as we now have the recent settings for this */
main_widgets_rearrange();
diff --git a/gtk/menu.c b/gtk/menu.c
index 61bc3a68c8..ced5f3b8ef 100644
--- a/gtk/menu.c
+++ b/gtk/menu.c
@@ -75,6 +75,7 @@
#include "hostlist_table.h"
#include "simple_dialog.h"
#include "packet_history.h"
+#include "color_filters.h"
GtkWidget *popup_menu_object;
@@ -117,6 +118,7 @@ static void name_resolution_transport_cb(GtkWidget *w _U_, gpointer d _U_);
#ifdef HAVE_LIBPCAP
static void auto_scroll_live_cb(GtkWidget *w _U_, gpointer d _U_);
#endif
+static void colorize_cb(GtkWidget *w _U_, gpointer d _U_);
/* This is the GtkItemFactoryEntry structure used to generate new menus.
Item 1: The menu path. The letter after the underscore indicates an
@@ -235,6 +237,7 @@ static GtkItemFactoryEntry menu_items[] =
ITEM_FACTORY_ENTRY("/View/Packet _List", NULL, packet_list_show_cb, 0, "<CheckItem>", NULL),
ITEM_FACTORY_ENTRY("/View/Packet _Details", NULL, tree_view_show_cb, 0, "<CheckItem>", NULL),
ITEM_FACTORY_ENTRY("/View/Packet _Bytes", NULL, byte_view_show_cb, 0, "<CheckItem>", NULL),
+ ITEM_FACTORY_ENTRY("/View/Colorize Packet List", NULL, colorize_cb, 0, "<CheckItem>", NULL),
ITEM_FACTORY_ENTRY("/View/<separator>", NULL, NULL, 0, "<Separator>", NULL),
ITEM_FACTORY_ENTRY("/View/_Time Display Format", NULL, NULL, 0, "<Branch>", NULL),
ITEM_FACTORY_ENTRY("/View/Time Display Format/Time of Day", NULL, timestamp_absolute_cb,
@@ -1336,6 +1339,14 @@ auto_scroll_live_cb(GtkWidget *w _U_, gpointer d _U_)
}
#endif
+static void
+colorize_cb(GtkWidget *w _U_, gpointer d _U_)
+{
+ recent.packet_list_colorize = GTK_CHECK_MENU_ITEM(w)->active;
+ color_filters_enable(recent.packet_list_colorize);
+ cf_colorize_packets(&cfile);
+}
+
/* the recent file read has finished, update the menu corresponding */
void
menu_recent_read_finished(void) {
@@ -1359,6 +1370,9 @@ menu_recent_read_finished(void) {
menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Packet Bytes");
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.byte_view_show);
+ menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Colorize Packet List");
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.packet_list_colorize);
+
menu_name_resolution_changed();
#ifdef HAVE_LIBPCAP
diff --git a/gtk/recent.c b/gtk/recent.c
index 5e200f8e96..1c772e6d1c 100644
--- a/gtk/recent.c
+++ b/gtk/recent.c
@@ -49,6 +49,7 @@
#define RECENT_KEY_TREE_VIEW_SHOW "gui.tree_view_show"
#define RECENT_KEY_BYTE_VIEW_SHOW "gui.byte_view_show"
#define RECENT_KEY_STATUSBAR_SHOW "gui.statusbar_show"
+#define RECENT_KEY_PACKET_LIST_COLORIZE "gui.packet_list_colorize"
#define RECENT_GUI_TIME_FORMAT "gui.time_format"
#define RECENT_GUI_ZOOM_LEVEL "gui.zoom_level"
#define RECENT_GUI_GEOMETRY_MAIN_X "gui.geometry_main_x"
@@ -179,6 +180,11 @@ write_recent(void)
fprintf(rf, RECENT_KEY_STATUSBAR_SHOW ": %s\n",
recent.statusbar_show == TRUE ? "TRUE" : "FALSE");
+ fprintf(rf, "\n# Packet list colorize (hide).\n");
+ fprintf(rf, "# TRUE or FALSE (case-insensitive).\n");
+ fprintf(rf, RECENT_KEY_PACKET_LIST_COLORIZE ": %s\n",
+ recent.packet_list_colorize == TRUE ? "TRUE" : "FALSE");
+
fprintf(rf, "\n# Timestamp display format.\n");
fprintf(rf, "# One of: RELATIVE, ABSOLUTE, ABSOLUTE_WITH_DATE, DELTA\n");
fprintf(rf, RECENT_GUI_TIME_FORMAT ": %s\n",
@@ -312,6 +318,13 @@ read_set_recent_pair(gchar *key, gchar *value)
else {
recent.statusbar_show = FALSE;
}
+ } else if (strcmp(key, RECENT_KEY_PACKET_LIST_COLORIZE) == 0) {
+ if (strcasecmp(value, "true") == 0) {
+ recent.packet_list_colorize = TRUE;
+ }
+ else {
+ recent.packet_list_colorize = FALSE;
+ }
} else if (strcmp(key, RECENT_GUI_TIME_FORMAT) == 0) {
recent.gui_time_format =
find_index_from_string_array(value, ts_type_text, TS_RELATIVE);
@@ -405,6 +418,7 @@ read_recent(char **rf_path_return, int *rf_errno_return)
recent.tree_view_show = TRUE;
recent.byte_view_show = TRUE;
recent.statusbar_show = TRUE;
+ recent.packet_list_colorize = TRUE;
recent.gui_time_format = TS_RELATIVE;
recent.gui_zoom_level = 0;
diff --git a/gtk/recent.h b/gtk/recent.h
index f034962c35..109dda478f 100644
--- a/gtk/recent.h
+++ b/gtk/recent.h
@@ -47,6 +47,7 @@ typedef struct recent_settings_tag {
gboolean tree_view_show;
gboolean byte_view_show;
gboolean statusbar_show;
+ gboolean packet_list_colorize;
gint gui_time_format;
gint gui_zoom_level;