forked from osmocom/wireshark
Make "new_color_filter()" take the background and foreground colors, as
GdkColors, as arguments. svn path=/trunk/; revision=10613
This commit is contained in:
parent
e20b794c0e
commit
00a057b79f
|
@ -1,7 +1,7 @@
|
||||||
/* color_dlg.c
|
/* color_dlg.c
|
||||||
* Definitions for dialog boxes for color filters
|
* 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
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@ethereal.com>
|
* By Gerald Combs <gerald@ethereal.com>
|
||||||
|
@ -46,6 +46,7 @@
|
||||||
#include "compat_macros.h"
|
#include "compat_macros.h"
|
||||||
#include "filter_prefs.h"
|
#include "filter_prefs.h"
|
||||||
#include "file_dlg.h"
|
#include "file_dlg.h"
|
||||||
|
#include "gtkglobals.h"
|
||||||
|
|
||||||
static GtkWidget* colorize_dialog_new(char *filter);
|
static GtkWidget* colorize_dialog_new(char *filter);
|
||||||
static void add_filter_to_list(gpointer filter_arg, gpointer list_arg);
|
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)
|
create_new_color_filter(GtkButton *button, char *filter)
|
||||||
{
|
{
|
||||||
color_filter_t *colorf;
|
color_filter_t *colorf;
|
||||||
|
GtkStyle *style;
|
||||||
GtkWidget *color_filters;
|
GtkWidget *color_filters;
|
||||||
#if GTK_MAJOR_VERSION >= 2
|
#if GTK_MAJOR_VERSION >= 2
|
||||||
GtkTreeSelection *sel;
|
GtkTreeSelection *sel;
|
||||||
|
@ -939,7 +941,10 @@ create_new_color_filter(GtkButton *button, char *filter)
|
||||||
gtk_clist_unselect_all (GTK_CLIST(color_filters));
|
gtk_clist_unselect_all (GTK_CLIST(color_filters));
|
||||||
#endif
|
#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);
|
color_add_colorf(color_filters, colorf);
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* color_filters.c
|
/* color_filters.c
|
||||||
* Routines for color filters
|
* 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
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@ethereal.com>
|
* By Gerald Combs <gerald@ethereal.com>
|
||||||
|
@ -43,7 +43,6 @@
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include <epan/dfilter/dfilter.h>
|
#include <epan/dfilter/dfilter.h>
|
||||||
#include "simple_dialog.h"
|
#include "simple_dialog.h"
|
||||||
#include "gtkglobals.h"
|
|
||||||
|
|
||||||
static gboolean read_filters(void);
|
static gboolean read_filters(void);
|
||||||
static gboolean read_global_filters(void);
|
static gboolean read_global_filters(void);
|
||||||
|
@ -109,17 +108,17 @@ colfilter_init(void)
|
||||||
/* Create a new filter */
|
/* Create a new filter */
|
||||||
color_filter_t *
|
color_filter_t *
|
||||||
new_color_filter(gchar *name, /* The name of the filter to create */
|
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;
|
color_filter_t *colorf;
|
||||||
GtkStyle *style;
|
|
||||||
|
|
||||||
colorf = g_malloc(sizeof (color_filter_t));
|
colorf = g_malloc(sizeof (color_filter_t));
|
||||||
colorf->filter_name = g_strdup(name);
|
colorf->filter_name = g_strdup(name);
|
||||||
colorf->filter_text = g_strdup(filter_string);
|
colorf->filter_text = g_strdup(filter_string);
|
||||||
style = gtk_widget_get_style(packet_list);
|
gdkcolor_to_color_t(&colorf->bg_color, bg_color);
|
||||||
gdkcolor_to_color_t(&colorf->bg_color, &style->base[GTK_STATE_NORMAL]);
|
gdkcolor_to_color_t(&colorf->fg_color, fg_color);
|
||||||
gdkcolor_to_color_t(&colorf->fg_color, &style->text[GTK_STATE_NORMAL]);
|
|
||||||
colorf->c_colorfilter = NULL;
|
colorf->c_colorfilter = NULL;
|
||||||
colorf->edit_dialog = NULL;
|
colorf->edit_dialog = NULL;
|
||||||
colorf->marked = FALSE;
|
colorf->marked = FALSE;
|
||||||
|
@ -280,10 +279,9 @@ read_filters_file(FILE *f, gpointer arg)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
colorf = new_color_filter(name, filter_exp);
|
colorf = new_color_filter(name, filter_exp, &bg_color,
|
||||||
|
&fg_color);
|
||||||
colorf->c_colorfilter = temp_dfilter;
|
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)
|
if (arg != NULL)
|
||||||
color_add_filter_cb (colorf, arg);
|
color_add_filter_cb (colorf, arg);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* color_filters.h
|
/* color_filters.h
|
||||||
* Definitions for color filters
|
* 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
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@ethereal.com>
|
* By Gerald Combs <gerald@ethereal.com>
|
||||||
|
@ -32,7 +32,8 @@ void colfilter_init(void);
|
||||||
gboolean write_filters(void);
|
gboolean write_filters(void);
|
||||||
gboolean revert_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);
|
void remove_color_filter(color_filter_t *colorf);
|
||||||
gboolean read_other_filters(gchar *path, gpointer arg);
|
gboolean read_other_filters(gchar *path, gpointer arg);
|
||||||
gboolean write_other_filters(gchar *path, gboolean only_marked);
|
gboolean write_other_filters(gchar *path, gboolean only_marked);
|
||||||
|
|
Loading…
Reference in New Issue