diff options
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/color_dlg.c | 9 | ||||
-rw-r--r-- | gtk/color_filters.c | 18 | ||||
-rw-r--r-- | gtk/color_filters.h | 5 |
3 files changed, 18 insertions, 14 deletions
diff --git a/gtk/color_dlg.c b/gtk/color_dlg.c index 82db82c193..5fa33e2cb4 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.44 2004/03/13 15:15:23 ulfl Exp $ + * $Id: color_dlg.c,v 1.45 2004/04/16 19:36:36 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -46,6 +46,7 @@ #include "compat_macros.h" #include "filter_prefs.h" #include "file_dlg.h" +#include "gtkglobals.h" static GtkWidget* colorize_dialog_new(char *filter); static void add_filter_to_list(gpointer filter_arg, gpointer list_arg); @@ -925,6 +926,7 @@ static void create_new_color_filter(GtkButton *button, char *filter) { color_filter_t *colorf; + GtkStyle *style; GtkWidget *color_filters; #if GTK_MAJOR_VERSION >= 2 GtkTreeSelection *sel; @@ -939,7 +941,10 @@ create_new_color_filter(GtkButton *button, char *filter) gtk_clist_unselect_all (GTK_CLIST(color_filters)); #endif - colorf = new_color_filter("name", filter); /* Adds at end! */ + /* Use the default background and foreground colors as the colors. */ + style = gtk_widget_get_style(packet_list); + colorf = new_color_filter("name", filter, &style->base[GTK_STATE_NORMAL], + &style->text[GTK_STATE_NORMAL]); /* Adds at end! */ color_add_colorf(color_filters, colorf); diff --git a/gtk/color_filters.c b/gtk/color_filters.c index 9a93005181..a971e499d1 100644 --- a/gtk/color_filters.c +++ b/gtk/color_filters.c @@ -1,7 +1,7 @@ /* color_filters.c * Routines for color filters * - * $Id: color_filters.c,v 1.9 2004/04/16 19:05:05 guy Exp $ + * $Id: color_filters.c,v 1.10 2004/04/16 19:36:36 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -43,7 +43,6 @@ #include "file.h" #include <epan/dfilter/dfilter.h> #include "simple_dialog.h" -#include "gtkglobals.h" static gboolean read_filters(void); static gboolean read_global_filters(void); @@ -109,17 +108,17 @@ colfilter_init(void) /* Create a new filter */ color_filter_t * new_color_filter(gchar *name, /* The name of the filter to create */ - gchar *filter_string) /* The string representing the filter */ + gchar *filter_string, /* The string representing the filter */ + GdkColor *bg_color, /* The background color */ + GdkColor *fg_color) /* The foreground color */ { color_filter_t *colorf; - GtkStyle *style; colorf = g_malloc(sizeof (color_filter_t)); colorf->filter_name = g_strdup(name); colorf->filter_text = g_strdup(filter_string); - style = gtk_widget_get_style(packet_list); - gdkcolor_to_color_t(&colorf->bg_color, &style->base[GTK_STATE_NORMAL]); - gdkcolor_to_color_t(&colorf->fg_color, &style->text[GTK_STATE_NORMAL]); + gdkcolor_to_color_t(&colorf->bg_color, bg_color); + gdkcolor_to_color_t(&colorf->fg_color, fg_color); colorf->c_colorfilter = NULL; colorf->edit_dialog = NULL; colorf->marked = FALSE; @@ -280,10 +279,9 @@ read_filters_file(FILE *f, gpointer arg) continue; } - colorf = new_color_filter(name, filter_exp); + colorf = new_color_filter(name, filter_exp, &bg_color, + &fg_color); colorf->c_colorfilter = temp_dfilter; - gdkcolor_to_color_t(&colorf->bg_color, &bg_color); - gdkcolor_to_color_t(&colorf->fg_color, &fg_color); if (arg != NULL) color_add_filter_cb (colorf, arg); diff --git a/gtk/color_filters.h b/gtk/color_filters.h index b8698862be..dc941a2a40 100644 --- a/gtk/color_filters.h +++ b/gtk/color_filters.h @@ -1,7 +1,7 @@ /* color_filters.h * Definitions for color filters * - * $Id: color_filters.h,v 1.5 2004/03/14 23:55:53 deniel Exp $ + * $Id: color_filters.h,v 1.6 2004/04/16 19:36:36 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -32,7 +32,8 @@ void colfilter_init(void); gboolean write_filters(void); gboolean revert_filters(void); -color_filter_t *new_color_filter(gchar *name, gchar *filter_string); +color_filter_t *new_color_filter(gchar *name, gchar *filter_string, + GdkColor *bg_color, GdkColor *fg_color); void remove_color_filter(color_filter_t *colorf); gboolean read_other_filters(gchar *path, gpointer arg); gboolean write_other_filters(gchar *path, gboolean only_marked); |