aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoroabad <oabad@f5534014-38df-0310-8fa8-9805f1628bb7>2002-09-23 19:09:52 +0000
committeroabad <oabad@f5534014-38df-0310-8fa8-9805f1628bb7>2002-09-23 19:09:52 +0000
commit7eb03ae98351bac834896f6653d6d782f9cc5f6f (patch)
tree6ec4a83fd50769bea03ddb77d3d3765a736e7699
parentd1279130303141eda4d3cc148ba974326b53db8a (diff)
Change to color filters :
- moved color_filter_t in color.h - change color_filter_t to use color_t instead of GdkColor This changed allowed to remove the last gtk includes in file.c. It is now completely free of any gtk related code. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@6324 f5534014-38df-0310-8fa8-9805f1628bb7
-rw-r--r--color.h21
-rw-r--r--file.c24
-rw-r--r--gtk/color_dlg.c26
-rw-r--r--gtk/color_utils.c4
-rw-r--r--gtk/colors.c11
-rw-r--r--gtk/colors.h20
-rw-r--r--gtk/main.c10
-rw-r--r--gtk/packet_list.c20
-rw-r--r--gtk2/color_dlg.c28
-rw-r--r--gtk2/color_utils.c4
-rw-r--r--gtk2/colors.c11
-rw-r--r--gtk2/colors.h20
-rw-r--r--gtk2/main.c10
-rw-r--r--gtk2/packet_list.c20
-rw-r--r--ui_util.h4
15 files changed, 121 insertions, 112 deletions
diff --git a/color.h b/color.h
index a94526dfad..9eef8f8edd 100644
--- a/color.h
+++ b/color.h
@@ -1,7 +1,7 @@
/* color.h
* Definitions for "toolkit-independent" colors
*
- * $Id: color.h,v 1.2 2002/08/28 21:00:06 jmayer Exp $
+ * $Id: color.h,v 1.3 2002/09/23 19:09:47 oabad Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -26,6 +26,8 @@
#ifndef __COLOR_H__
#define __COLOR_H__
+#include "epan/dfilter/dfilter.h"
+
/*
* Data structure holding RGB value for a color.
*
@@ -42,4 +44,21 @@ typedef struct {
guint16 blue;
} color_t;
+/* Data for a color filter. */
+typedef struct _color_filter {
+ gchar *filter_name; /* name of the filter */
+ gchar *filter_text; /* text of the filter expression */
+ color_t bg_color; /* background color for packets that match */
+ color_t fg_color; /* foreground color for packets that match */
+ dfilter_t *c_colorfilter; /* compiled filter expression */
+ void *edit_dialog; /* if filter is being edited, dialog
+ * box for it */
+} color_filter_t;
+
+/* List of all color filters. */
+extern GSList *filter_list;
+
+void
+filter_list_prime_edt(epan_dissect_t *edt);
+
#endif
diff --git a/file.c b/file.c
index 2f1294992e..48c9f6111c 100644
--- a/file.c
+++ b/file.c
@@ -1,7 +1,7 @@
/* file.c
* File I/O routines
*
- * $Id: file.c,v 1.290 2002/09/21 11:36:25 oabad Exp $
+ * $Id: file.c,v 1.291 2002/09/23 19:09:47 oabad Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -26,8 +26,6 @@
# include "config.h"
#endif
-#include <gtk/gtk.h>
-
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
@@ -64,11 +62,6 @@
#include <epan/filesystem.h>
#include "color.h"
-#if GTK_MAJOR_VERSION == 1
-#include "gtk/color_utils.h"
-#else
-#include "gtk2/color_utils.h"
-#endif
#include "column.h"
#include <epan/packet.h>
#include "print.h"
@@ -83,11 +76,6 @@
#include <epan/dfilter/dfilter.h>
#include <epan/conversation.h>
#include "globals.h"
-#if GTK_MAJOR_VERSION == 1
-#include "gtk/colors.h"
-#else
-#include "gtk2/colors.h"
-#endif
#include <epan/epan_dissect.h>
#include "tap.h"
@@ -655,7 +643,6 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf,
gint row;
gboolean create_proto_tree = FALSE;
epan_dissect_t *edt;
- GdkColor fg, bg;
/* We don't yet have a color filter to apply. */
args.colorf = NULL;
@@ -773,13 +760,10 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf,
row = packet_list_append(cf->cinfo.col_data, fdata);
if (fdata->flags.marked) {
- color_t_to_gdkcolor(&bg, &prefs.gui_marked_bg);
- color_t_to_gdkcolor(&fg, &prefs.gui_marked_fg);
- packet_list_set_colors(row, &bg, &fg);
+ packet_list_set_colors(row, &prefs.gui_marked_fg, &prefs.gui_marked_bg);
} else if (filter_list != NULL && (args.colorf != NULL)) {
- bg = args.colorf->bg_color;
- fg = args.colorf->fg_color;
- packet_list_set_colors(row, &bg, &fg);
+ packet_list_set_colors(row, &args.colorf->fg_color,
+ &args.colorf->bg_color);
}
} else {
/* This frame didn't pass the display filter, so it's not being added
diff --git a/gtk/color_dlg.c b/gtk/color_dlg.c
index 79a357e456..8c6ee99949 100644
--- a/gtk/color_dlg.c
+++ b/gtk/color_dlg.c
@@ -1,7 +1,7 @@
/* color_dlg.c
* Definitions for dialog boxes for color filters
*
- * $Id: color_dlg.c,v 1.17 2002/09/05 18:47:44 jmayer Exp $
+ * $Id: color_dlg.c,v 1.18 2002/09/23 19:09:49 oabad Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -34,6 +34,7 @@
#include <epan/packet.h>
#include "colors.h"
#include "color_dlg.h"
+#include "color_utils.h"
#include "file.h"
#include <epan/dfilter/dfilter.h>
#include "simple_dialog.h"
@@ -367,16 +368,19 @@ static void
add_filter_to_clist(gpointer filter_arg, gpointer clist_arg)
{
color_filter_t *colorf = filter_arg;
- GtkWidget *color_filters = clist_arg;
- gchar *data[2];
- gint row;
+ GtkWidget *color_filters = clist_arg;
+ gchar *data[2];
+ gint row;
+ GdkColor bg, fg;
data[0] = colorf->filter_name;
data[1] = colorf->filter_text;
row = gtk_clist_append(GTK_CLIST(color_filters), data);
+ color_t_to_gdkcolor(&fg, &colorf->fg_color);
+ color_t_to_gdkcolor(&bg, &colorf->bg_color);
gtk_clist_set_row_data(GTK_CLIST(color_filters), row, colorf);
- gtk_clist_set_foreground(GTK_CLIST(color_filters), row, &colorf->fg_color);
- gtk_clist_set_background(GTK_CLIST(color_filters), row, &colorf->bg_color);
+ gtk_clist_set_foreground(GTK_CLIST(color_filters), row, &fg);
+ gtk_clist_set_background(GTK_CLIST(color_filters), row, &bg);
num_of_filters++;
}
@@ -705,8 +709,8 @@ edit_color_filter_dialog_new (GtkWidget *color_filters,
gtk_entry_set_text(GTK_ENTRY(*colorize_filter_name), colorf->filter_name);
style = gtk_style_copy(gtk_widget_get_style(*colorize_filter_name));
- style->base[GTK_STATE_NORMAL] = colorf->bg_color;
- style->fg[GTK_STATE_NORMAL] = colorf->fg_color;
+ color_t_to_gdkcolor(&style->base[GTK_STATE_NORMAL], &colorf->bg_color);
+ color_t_to_gdkcolor(&style->fg[GTK_STATE_NORMAL], &colorf->fg_color);
gtk_widget_set_style(*colorize_filter_name, style);
gtk_widget_show (*colorize_filter_name);
@@ -961,8 +965,8 @@ edit_color_filter_ok_cb (GtkButton *button,
if (colorf->filter_text != NULL)
g_free(colorf->filter_text);
colorf->filter_text = filter_text;
- colorf->fg_color = new_fg_color;
- colorf->bg_color = new_bg_color;
+ gdkcolor_to_color_t(&colorf->fg_color, &new_fg_color);
+ gdkcolor_to_color_t(&colorf->bg_color, &new_bg_color);
gtk_clist_set_foreground(GTK_CLIST(color_filters), row_selected,
&new_fg_color);
gtk_clist_set_background(GTK_CLIST(color_filters), row_selected,
@@ -1002,7 +1006,7 @@ color_sel_win_new(color_filter_t *colorf, gboolean is_bg)
static const gchar fg_title_format[] = "Choose foreground color for \"%s\"";
static const gchar bg_title_format[] = "Choose background color for \"%s\"";
GtkWidget *color_sel_win;
- GdkColor *color;
+ color_t *color;
GtkWidget *color_sel_ok;
GtkWidget *color_sel_cancel;
GtkWidget *color_sel_help;
diff --git a/gtk/color_utils.c b/gtk/color_utils.c
index ea360f87a8..8bf665dd77 100644
--- a/gtk/color_utils.c
+++ b/gtk/color_utils.c
@@ -2,7 +2,7 @@
* Utilities for converting between "toolkit-independent" and GDK
* notions of color
*
- * $Id: color_utils.c,v 1.3 2002/09/05 18:47:44 jmayer Exp $
+ * $Id: color_utils.c,v 1.4 2002/09/23 19:09:49 oabad Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -30,7 +30,7 @@
#include <gtk/gtk.h>
-#include "prefs.h" /* to declare "color_t" */
+#include "color.h" /* to declare "color_t" */
void
color_t_to_gdkcolor(GdkColor *target, color_t *source)
diff --git a/gtk/colors.c b/gtk/colors.c
index 8bfd232b1a..872babc27d 100644
--- a/gtk/colors.c
+++ b/gtk/colors.c
@@ -1,7 +1,7 @@
/* colors.c
* Definitions for color structures and routines
*
- * $Id: colors.c,v 1.24 2002/09/05 18:47:44 jmayer Exp $
+ * $Id: colors.c,v 1.25 2002/09/23 19:09:49 oabad Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -36,6 +36,7 @@
#include <epan/packet.h>
#include "colors.h"
+#include "color_utils.h"
#include "file.h"
#include <epan/dfilter/dfilter.h>
#include "simple_dialog.h"
@@ -91,8 +92,8 @@ new_color_filter(gchar *name, /* The name of the filter to create */
colorf = (color_filter_t *)g_malloc(sizeof (color_filter_t));
colorf->filter_name = g_strdup(name);
colorf->filter_text = g_strdup(filter_string);
- colorf->bg_color = WHITE;
- colorf->fg_color = BLACK;
+ gdkcolor_to_color_t(&colorf->bg_color, &WHITE);
+ gdkcolor_to_color_t(&colorf->fg_color, &BLACK);
colorf->c_colorfilter = NULL;
colorf->edit_dialog = NULL;
filter_list = g_slist_append(filter_list, colorf);
@@ -213,8 +214,8 @@ read_filters(void)
bg_color.green = bg_g;
bg_color.blue = bg_b;
- colorf->bg_color = bg_color;
- colorf->fg_color = fg_color;
+ gdkcolor_to_color_t(&colorf->bg_color, &bg_color);
+ gdkcolor_to_color_t(&colorf->fg_color, &fg_color);
} /* if sscanf */
} while(!feof(f));
return TRUE;
diff --git a/gtk/colors.h b/gtk/colors.h
index 1f309e8d71..6c56739018 100644
--- a/gtk/colors.h
+++ b/gtk/colors.h
@@ -1,7 +1,7 @@
/* colors.h
* Definitions for color structures and routines
*
- * $Id: colors.h,v 1.9 2002/09/05 18:47:45 jmayer Exp $
+ * $Id: colors.h,v 1.10 2002/09/23 19:09:49 oabad Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -24,6 +24,8 @@
#ifndef __COLORS_H__
#define __COLORS_H__
+#include "../color.h"
+
#define MAXCOLORS 255
#define MAX_COLOR_FILTER_NAME_LEN 33
#define MAX_COLOR_FILTER_STRING_LEN 256
@@ -34,19 +36,6 @@
extern GdkColor WHITE;
extern GdkColor BLACK;
-/* Data for a color filter. */
-typedef struct _color_filter {
- gchar *filter_name; /* name of the filter */
- gchar *filter_text; /* text of the filter expression */
- GdkColor bg_color; /* background color for packets that match */
- GdkColor fg_color; /* foreground color for packets that match */
- dfilter_t *c_colorfilter; /* compiled filter expression */
- GtkWidget *edit_dialog; /* if filter is being edited, dialog box for it */
-} color_filter_t;
-
-/* List of all color filters. */
-extern GSList *filter_list;
-
void colfilter_init(void);
gboolean write_filters(void);
@@ -56,7 +45,4 @@ void delete_color_filter(color_filter_t *colorf);
gboolean get_color (GdkColor *new_color);
-void
-filter_list_prime_edt(epan_dissect_t *edt);
-
#endif
diff --git a/gtk/main.c b/gtk/main.c
index f465cc7ef3..05ae377df0 100644
--- a/gtk/main.c
+++ b/gtk/main.c
@@ -1,6 +1,6 @@
/* main.c
*
- * $Id: main.c,v 1.263 2002/09/09 20:38:58 guy Exp $
+ * $Id: main.c,v 1.264 2002/09/23 19:09:49 oabad Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -647,14 +647,14 @@ set_frame_mark(gboolean set, frame_data *frame, gint row) {
mark_frame(&cfile, frame);
color_t_to_gdkcolor(&fg, &prefs.gui_marked_fg);
color_t_to_gdkcolor(&bg, &prefs.gui_marked_bg);
+ gtk_clist_set_background(GTK_CLIST(packet_list), row, &bg);
+ gtk_clist_set_foreground(GTK_CLIST(packet_list), row, &fg);
} else {
unmark_frame(&cfile, frame);
- fg = BLACK;
- bg = WHITE;
+ gtk_clist_set_background(GTK_CLIST(packet_list), row, NULL);
+ gtk_clist_set_foreground(GTK_CLIST(packet_list), row, NULL);
}
file_set_save_marked_sensitive();
- gtk_clist_set_background(GTK_CLIST(packet_list), row, &bg);
- gtk_clist_set_foreground(GTK_CLIST(packet_list), row, &fg);
}
static void
diff --git a/gtk/packet_list.c b/gtk/packet_list.c
index 5231ac93a5..226bd8e544 100644
--- a/gtk/packet_list.c
+++ b/gtk/packet_list.c
@@ -1,7 +1,7 @@
/* packet_list.c
* packet list related functions 2002 Olivier Abad
*
- * $Id: packet_list.c,v 1.1 2002/09/21 11:36:27 oabad Exp $
+ * $Id: packet_list.c,v 1.2 2002/09/23 19:09:49 oabad Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -30,7 +30,9 @@
#include "gtkglobals.h"
#include "epan/epan.h"
+#include "color.h"
#include "../ui_util.h"
+#include "color_utils.h"
#include "column.h"
#include "epan/column_info.h"
@@ -95,10 +97,20 @@ packet_list_append(gchar *text[], gpointer data)
}
void
-packet_list_set_colors(gint row, GdkColor *fg, GdkColor *bg)
+packet_list_set_colors(gint row, color_t *fg, color_t *bg)
{
- if (fg) gtk_clist_set_foreground(GTK_CLIST(packet_list), row, fg);
- if (bg) gtk_clist_set_background(GTK_CLIST(packet_list), row, bg);
+ GdkColor gdkfg, gdkbg;
+
+ if (fg)
+ {
+ color_t_to_gdkcolor(&gdkfg, fg);
+ gtk_clist_set_foreground(GTK_CLIST(packet_list), row, &gdkfg);
+ }
+ if (bg)
+ {
+ color_t_to_gdkcolor(&gdkbg, bg);
+ gtk_clist_set_background(GTK_CLIST(packet_list), row, &gdkbg);
+ }
}
gint
diff --git a/gtk2/color_dlg.c b/gtk2/color_dlg.c
index aeff7be802..168bab1930 100644
--- a/gtk2/color_dlg.c
+++ b/gtk2/color_dlg.c
@@ -1,7 +1,7 @@
/* color_dlg.c
* Definitions for dialog boxes for color filters
*
- * $Id: color_dlg.c,v 1.2 2002/09/05 18:48:51 jmayer Exp $
+ * $Id: color_dlg.c,v 1.3 2002/09/23 19:09:52 oabad Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -34,6 +34,7 @@
#include <epan/packet.h>
#include "colors.h"
#include "color_dlg.h"
+#include "color_utils.h"
#include "file.h"
#include <epan/dfilter/dfilter.h>
#include "simple_dialog.h"
@@ -367,16 +368,19 @@ static void
add_filter_to_clist(gpointer filter_arg, gpointer clist_arg)
{
color_filter_t *colorf = filter_arg;
- GtkWidget *color_filters = clist_arg;
- gchar *data[2];
- gint row;
+ GtkWidget *color_filters = clist_arg;
+ gchar *data[2];
+ gint row;
+ GdkColor bg, fg;
data[0] = colorf->filter_name;
data[1] = colorf->filter_text;
row = gtk_clist_append(GTK_CLIST(color_filters), data);
+ color_t_to_gdkcolor(&fg, &colorf->fg_color);
+ color_t_to_gdkcolor(&bg, &colorf->bg_color);
gtk_clist_set_row_data(GTK_CLIST(color_filters), row, colorf);
- gtk_clist_set_foreground(GTK_CLIST(color_filters), row, &colorf->fg_color);
- gtk_clist_set_background(GTK_CLIST(color_filters), row, &colorf->bg_color);
+ gtk_clist_set_foreground(GTK_CLIST(color_filters), row, &fg);
+ gtk_clist_set_background(GTK_CLIST(color_filters), row, &bg);
num_of_filters++;
}
@@ -705,8 +709,8 @@ edit_color_filter_dialog_new (GtkWidget *color_filters,
gtk_entry_set_text(GTK_ENTRY(*colorize_filter_name), colorf->filter_name);
style = gtk_style_copy(gtk_widget_get_style(*colorize_filter_name));
- style->base[GTK_STATE_NORMAL] = colorf->bg_color;
- style->fg[GTK_STATE_NORMAL] = colorf->fg_color;
+ color_t_to_gdkcolor(&style->base[GTK_STATE_NORMAL], &colorf->bg_color);
+ color_t_to_gdkcolor(&style->fg[GTK_STATE_NORMAL], &colorf->fg_color);
gtk_widget_set_style(*colorize_filter_name, style);
gtk_widget_show (*colorize_filter_name);
@@ -961,8 +965,8 @@ edit_color_filter_ok_cb (GtkButton *button,
if (colorf->filter_text != NULL)
g_free(colorf->filter_text);
colorf->filter_text = filter_text;
- colorf->fg_color = new_fg_color;
- colorf->bg_color = new_bg_color;
+ gdkcolor_to_color_t(&colorf->fg_color, &new_fg_color);
+ gdkcolor_to_color_t(&colorf->bg_color, &new_bg_color);
gtk_clist_set_foreground(GTK_CLIST(color_filters), row_selected,
&new_fg_color);
gtk_clist_set_background(GTK_CLIST(color_filters), row_selected,
@@ -1002,13 +1006,13 @@ color_sel_win_new(color_filter_t *colorf, gboolean is_bg)
static const gchar fg_title_format[] = "Choose foreground color for \"%s\"";
static const gchar bg_title_format[] = "Choose background color for \"%s\"";
GtkWidget *color_sel_win;
- GdkColor *color;
+ color_t *color;
GtkWidget *color_sel_ok;
GtkWidget *color_sel_cancel;
GtkWidget *color_sel_help;
if (is_bg) {
- color = &colorf->bg_color;
+ color = &colorf->bg_color;
title_len = strlen(bg_title_format) + strlen(colorf->filter_name);
title = g_malloc(title_len + 1);
sprintf(title, bg_title_format, colorf->filter_name);
diff --git a/gtk2/color_utils.c b/gtk2/color_utils.c
index 94aaf2dbe2..9d37d6efeb 100644
--- a/gtk2/color_utils.c
+++ b/gtk2/color_utils.c
@@ -2,7 +2,7 @@
* Utilities for converting between "toolkit-independent" and GDK
* notions of color
*
- * $Id: color_utils.c,v 1.2 2002/09/05 18:48:51 jmayer Exp $
+ * $Id: color_utils.c,v 1.3 2002/09/23 19:09:52 oabad Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -30,7 +30,7 @@
#include <gtk/gtk.h>
-#include "prefs.h" /* to declare "color_t" */
+#include "color.h" /* to declare "color_t" */
void
color_t_to_gdkcolor(GdkColor *target, color_t *source)
diff --git a/gtk2/colors.c b/gtk2/colors.c
index 0aad705459..5092cd7064 100644
--- a/gtk2/colors.c
+++ b/gtk2/colors.c
@@ -1,7 +1,7 @@
/* colors.c
* Definitions for color structures and routines
*
- * $Id: colors.c,v 1.2 2002/09/05 18:48:51 jmayer Exp $
+ * $Id: colors.c,v 1.3 2002/09/23 19:09:52 oabad Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -36,6 +36,7 @@
#include <epan/packet.h>
#include "colors.h"
+#include "color_utils.h"
#include "file.h"
#include <epan/dfilter/dfilter.h>
#include "simple_dialog.h"
@@ -91,8 +92,8 @@ new_color_filter(gchar *name, /* The name of the filter to create */
colorf = (color_filter_t *)g_malloc(sizeof (color_filter_t));
colorf->filter_name = g_strdup(name);
colorf->filter_text = g_strdup(filter_string);
- colorf->bg_color = WHITE;
- colorf->fg_color = BLACK;
+ gdkcolor_to_color_t(&colorf->bg_color, &WHITE);
+ gdkcolor_to_color_t(&colorf->fg_color, &BLACK);
colorf->c_colorfilter = NULL;
colorf->edit_dialog = NULL;
filter_list = g_slist_append(filter_list, colorf);
@@ -213,8 +214,8 @@ read_filters(void)
bg_color.green = bg_g;
bg_color.blue = bg_b;
- colorf->bg_color = bg_color;
- colorf->fg_color = fg_color;
+ gdkcolor_to_color_t(&colorf->bg_color, &bg_color);
+ gdkcolor_to_color_t(&colorf->fg_color, &fg_color);
} /* if sscanf */
} while(!feof(f));
return TRUE;
diff --git a/gtk2/colors.h b/gtk2/colors.h
index 35508dbea6..1840f64cb6 100644
--- a/gtk2/colors.h
+++ b/gtk2/colors.h
@@ -1,7 +1,7 @@
/* colors.h
* Definitions for color structures and routines
*
- * $Id: colors.h,v 1.2 2002/09/05 18:48:51 jmayer Exp $
+ * $Id: colors.h,v 1.3 2002/09/23 19:09:52 oabad Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -24,6 +24,8 @@
#ifndef __COLORS_H__
#define __COLORS_H__
+#include "../color.h"
+
#define MAXCOLORS 255
#define MAX_COLOR_FILTER_NAME_LEN 33
#define MAX_COLOR_FILTER_STRING_LEN 256
@@ -34,19 +36,6 @@
extern GdkColor WHITE;
extern GdkColor BLACK;
-/* Data for a color filter. */
-typedef struct _color_filter {
- gchar *filter_name; /* name of the filter */
- gchar *filter_text; /* text of the filter expression */
- GdkColor bg_color; /* background color for packets that match */
- GdkColor fg_color; /* foreground color for packets that match */
- dfilter_t *c_colorfilter; /* compiled filter expression */
- GtkWidget *edit_dialog; /* if filter is being edited, dialog box for it */
-} color_filter_t;
-
-/* List of all color filters. */
-extern GSList *filter_list;
-
void colfilter_init(void);
gboolean write_filters(void);
@@ -56,7 +45,4 @@ void delete_color_filter(color_filter_t *colorf);
gboolean get_color (GdkColor *new_color);
-void
-filter_list_prime_edt(epan_dissect_t *edt);
-
#endif
diff --git a/gtk2/main.c b/gtk2/main.c
index acd8ebaa25..8d36805fa2 100644
--- a/gtk2/main.c
+++ b/gtk2/main.c
@@ -1,6 +1,6 @@
/* main.c
*
- * $Id: main.c,v 1.11 2002/09/09 20:39:01 guy Exp $
+ * $Id: main.c,v 1.12 2002/09/23 19:09:52 oabad Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -661,14 +661,14 @@ set_frame_mark(gboolean set, frame_data *frame, gint row) {
mark_frame(&cfile, frame);
color_t_to_gdkcolor(&fg, &prefs.gui_marked_fg);
color_t_to_gdkcolor(&bg, &prefs.gui_marked_bg);
+ gtk_clist_set_background(GTK_CLIST(packet_list), row, &bg);
+ gtk_clist_set_foreground(GTK_CLIST(packet_list), row, &fg);
} else {
unmark_frame(&cfile, frame);
- fg = BLACK;
- bg = WHITE;
+ gtk_clist_set_background(GTK_CLIST(packet_list), row, NULL);
+ gtk_clist_set_foreground(GTK_CLIST(packet_list), row, NULL);
}
file_set_save_marked_sensitive();
- gtk_clist_set_background(GTK_CLIST(packet_list), row, &bg);
- gtk_clist_set_foreground(GTK_CLIST(packet_list), row, &fg);
}
static gint
diff --git a/gtk2/packet_list.c b/gtk2/packet_list.c
index 7e3d7aeeb0..fabb7d6960 100644
--- a/gtk2/packet_list.c
+++ b/gtk2/packet_list.c
@@ -1,7 +1,7 @@
/* packet_list.c
* packet list related functions 2002 Olivier Abad
*
- * $Id: packet_list.c,v 1.1 2002/09/21 11:36:30 oabad Exp $
+ * $Id: packet_list.c,v 1.2 2002/09/23 19:09:52 oabad Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -30,7 +30,9 @@
#include "gtkglobals.h"
#include "epan/epan.h"
+#include "color.h"
#include "../ui_util.h"
+#include "color_utils.h"
#include "column.h"
#include "epan/column_info.h"
@@ -95,10 +97,20 @@ packet_list_append(gchar *text[], gpointer data)
}
void
-packet_list_set_colors(gint row, GdkColor *fg, GdkColor *bg)
+packet_list_set_colors(gint row, color_t *fg, color_t *bg)
{
- if (fg) gtk_clist_set_foreground(GTK_CLIST(packet_list), row, fg);
- if (bg) gtk_clist_set_background(GTK_CLIST(packet_list), row, bg);
+ GdkColor gdkfg, gdkbg;
+
+ if (fg)
+ {
+ color_t_to_gdkcolor(&gdkfg, fg);
+ gtk_clist_set_foreground(GTK_CLIST(packet_list), row, &gdkfg);
+ }
+ if (bg)
+ {
+ color_t_to_gdkcolor(&gdkbg, bg);
+ gtk_clist_set_background(GTK_CLIST(packet_list), row, &gdkbg);
+ }
}
gint
diff --git a/ui_util.h b/ui_util.h
index dbd17968bd..38e8838a24 100644
--- a/ui_util.h
+++ b/ui_util.h
@@ -1,7 +1,7 @@
/* ui_util.h
* Definitions for UI utility routines
*
- * $Id: ui_util.h,v 1.11 2002/09/21 11:36:25 oabad Exp $
+ * $Id: ui_util.h,v 1.12 2002/09/23 19:09:47 oabad Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -43,7 +43,7 @@ void packet_list_set_column_resizeable(gint, gboolean);
void packet_list_set_column_width(gint, gint);
void packet_list_moveto_end(void);
gint packet_list_append(gchar *text[], gpointer data);
-void packet_list_set_colors(gint, GdkColor *, GdkColor *);
+void packet_list_set_colors(gint, color_t *, color_t *);
gint packet_list_find_row_from_data(gpointer);
void packet_list_set_text(gint, gint, const gchar *);
void packet_list_set_cls_time_width(gint);