Make "new_color_filter()" take the background and foreground colors, as
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 16 Apr 2004 19:36:36 +0000 (19:36 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 16 Apr 2004 19:36:36 +0000 (19:36 +0000)
GdkColors, as arguments.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@10613 f5534014-38df-0310-8fa8-9805f1628bb7

gtk/color_dlg.c
gtk/color_filters.c
gtk/color_filters.h

index 82db82c19389ecd0b510def9dc0a3196addef55f..5fa33e2cb4d7324cd0eb3afc91874e3d47dc8af9 100644 (file)
@@ -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);
 
index 9a93005181827f702b3e6bbf3d571285e0df8f2a..a971e499d1a49b1564b1e42f7d4f44b7ada46131 100644 (file)
@@ -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);
index b8698862be3982db0003a9f0c227bfe5c68d49f3..dc941a2a409a5a4fc91e036dd938f37185f2770d 100644 (file)
@@ -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);