summaryrefslogtreecommitdiff
path: root/ui/gtk/prefs_font_color.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2013-06-28 03:03:36 +0000
committerMichael Mann <mmann78@netscape.net>2013-06-28 03:03:36 +0000
commit277aed869ebcc6e9c66045a126ee3d58b07e47ff (patch)
treef8c407691d71a921da324af4b402fa457812703e /ui/gtk/prefs_font_color.c
parent10918860b6eef84a0721e54f62b46e7e4280b37d (diff)
downloadwireshark-277aed869ebcc6e9c66045a126ee3d58b07e47ff.tar.gz
Make colors used by colorize_filter_te_as_* as preferences. Bug 5413 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5413)
svn path=/trunk/; revision=50203
Diffstat (limited to 'ui/gtk/prefs_font_color.c')
-rw-r--r--ui/gtk/prefs_font_color.c60
1 files changed, 57 insertions, 3 deletions
diff --git a/ui/gtk/prefs_font_color.c b/ui/gtk/prefs_font_color.c
index 07dc2b3928..ade3806aba 100644
--- a/ui/gtk/prefs_font_color.c
+++ b/ui/gtk/prefs_font_color.c
@@ -75,6 +75,9 @@
#define SAMPLE_IGNORED_TEXT "Sample ignored packet text\n"
#define SAMPLE_CLIENT_TEXT "Sample 'Follow Stream' client text\n"
#define SAMPLE_SERVER_TEXT "Sample 'Follow Stream' server text\n"
+#define SAMPLE_TEXT_VALID_TEXT "Sample valid filter text\n"
+#define SAMPLE_TEXT_INVALID_TEXT "Sample invalid filter text\n"
+#define SAMPLE_TEXT_DEPRECATED_TEXT "Sample deprecated filter text\n"
#define MFG_IDX 0
#define MBG_IDX 1
@@ -84,7 +87,10 @@
#define CBG_IDX 5
#define SFG_IDX 6
#define SBG_IDX 7
-#define MAX_IDX 8 /* set this to the number of IDX values */
+#define FTV_IDX 8
+#define FTI_IDX 9
+#define FTD_IDX 10
+#define MAX_IDX 11 /* set this to the number of IDX values */
#define COLOR_SAMPLE_KEY "text_color_sample"
#define FONT_SAMPLE_KEY "font_sample"
@@ -95,7 +101,8 @@ static void update_font(PangoFontDescription *, GtkWidget *, GtkWidget *);
static void update_text_color(GObject *obj, GParamSpec *pspec, gpointer data);
static void update_current_color(GtkWidget *, gpointer);
-static GdkXxx tcolors[MAX_IDX], *curcolor = NULL;
+static const color_t filter_text_fg_color = {0, 0, 0, 0}; /* black */
+static GdkXxx tcolors[MAX_IDX], filter_text_fg, *curcolor = NULL;
#if ! GTK_CHECK_VERSION(3,4,0)
static GdkXxx tcolors_orig[MAX_IDX];
@@ -133,7 +140,10 @@ font_color_prefs_show(void)
"'Follow Stream' client foreground", /* CFG_IDX 4*/
"'Follow Stream' client background", /* CBG_IDX 5*/
"'Follow Stream' server foreground", /* SFG_IDX 6*/
- "'Follow Stream' server background" /* SBG_IDX 7*/
+ "'Follow Stream' server background", /* SBG_IDX 7*/
+ "Valid filter text entry", /* FTV_IDX 8*/
+ "Invalid filter text entry", /* FTI_IDX 9*/
+ "Deprecated filter text entry" /* FTD_IDX 10*/
};
int mcount = sizeof(mt) / sizeof (gchar *);
GtkTextBuffer *buf;
@@ -157,6 +167,10 @@ font_color_prefs_show(void)
color_t_to_gdkxxx(&tcolors[CBG_IDX], &prefs.st_client_bg);
color_t_to_gdkxxx(&tcolors[SFG_IDX], &prefs.st_server_fg);
color_t_to_gdkxxx(&tcolors[SBG_IDX], &prefs.st_server_bg);
+ color_t_to_gdkxxx(&tcolors[FTV_IDX], &prefs.gui_text_valid);
+ color_t_to_gdkxxx(&tcolors[FTI_IDX], &prefs.gui_text_invalid);
+ color_t_to_gdkxxx(&tcolors[FTD_IDX], &prefs.gui_text_deprecated);
+ color_t_to_gdkxxx(&filter_text_fg, &filter_text_fg_color);
#if ! GTK_CHECK_VERSION(3,4,0)
for (i=0; i<MAX_IDX; i++) {
@@ -262,6 +276,18 @@ font_color_prefs_show(void)
TAG_PROP_FG_COLOR, &tcolors[SFG_IDX],
TAG_PROP_BG_COLOR, &tcolors[SBG_IDX],
NULL);
+ gtk_text_buffer_create_tag(buf, "text_valid",
+ TAG_PROP_FG_COLOR, &filter_text_fg,
+ TAG_PROP_BG_COLOR, &tcolors[FTV_IDX],
+ NULL);
+ gtk_text_buffer_create_tag(buf, "text_invalid",
+ TAG_PROP_FG_COLOR, &filter_text_fg,
+ TAG_PROP_BG_COLOR, &tcolors[FTI_IDX],
+ NULL);
+ gtk_text_buffer_create_tag(buf, "text_deprecated",
+ TAG_PROP_FG_COLOR, &filter_text_fg,
+ TAG_PROP_BG_COLOR, &tcolors[FTD_IDX],
+ NULL);
gtk_text_buffer_insert_with_tags_by_name(buf, &iter, SAMPLE_MARKED_TEXT, -1,
"marked", NULL);
@@ -271,6 +297,12 @@ font_color_prefs_show(void)
"client", NULL);
gtk_text_buffer_insert_with_tags_by_name(buf, &iter, SAMPLE_SERVER_TEXT, -1,
"server", NULL);
+ gtk_text_buffer_insert_with_tags_by_name(buf, &iter, SAMPLE_TEXT_VALID_TEXT, -1,
+ "text_valid", NULL);
+ gtk_text_buffer_insert_with_tags_by_name(buf, &iter, SAMPLE_TEXT_INVALID_TEXT, -1,
+ "text_invalid", NULL);
+ gtk_text_buffer_insert_with_tags_by_name(buf, &iter, SAMPLE_TEXT_DEPRECATED_TEXT, -1,
+ "text_deprecated", NULL);
ws_gtk_grid_attach_extended(GTK_GRID(main_grid), color_sample,
2, GRID_COLOR_ROW, 1, 2,
@@ -392,6 +424,25 @@ update_text_color(GObject *obj, GParamSpec *pspec _U_, gpointer data _U_) {
TAG_PROP_FG_COLOR, &tcolors[SFG_IDX],
TAG_PROP_BG_COLOR, &tcolors[SBG_IDX],
NULL);
+
+ tag = gtk_text_tag_table_lookup(gtk_text_buffer_get_tag_table(buf), "text_valid");
+ g_object_set(tag,
+ TAG_PROP_FG_COLOR, &filter_text_fg,
+ TAG_PROP_BG_COLOR, &tcolors[FTV_IDX],
+ NULL);
+
+ tag = gtk_text_tag_table_lookup(gtk_text_buffer_get_tag_table(buf), "text_invalid");
+ g_object_set(tag,
+ TAG_PROP_FG_COLOR, &filter_text_fg,
+ TAG_PROP_BG_COLOR, &tcolors[FTI_IDX],
+ NULL);
+
+ tag = gtk_text_tag_table_lookup(gtk_text_buffer_get_tag_table(buf), "text_deprecated");
+ g_object_set(tag,
+ TAG_PROP_FG_COLOR, &filter_text_fg,
+ TAG_PROP_BG_COLOR, &tcolors[FTD_IDX],
+ NULL);
+
}
@@ -429,6 +480,9 @@ font_color_prefs_fetch(GtkWidget *w _U_)
gdkxxx_to_color_t(&prefs.st_client_bg, &tcolors[CBG_IDX]);
gdkxxx_to_color_t(&prefs.st_server_fg, &tcolors[SFG_IDX]);
gdkxxx_to_color_t(&prefs.st_server_bg, &tcolors[SBG_IDX]);
+ gdkxxx_to_color_t(&prefs.gui_text_valid, &tcolors[FTV_IDX]);
+ gdkxxx_to_color_t(&prefs.gui_text_invalid, &tcolors[FTI_IDX]);
+ gdkxxx_to_color_t(&prefs.gui_text_deprecated, &tcolors[FTD_IDX]);
/*
* XXX - we need to have a way to fetch the preferences into