2 * Definitions for single color filter edit dialog boxes
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
33 #include <epan/packet.h>
36 #include "../color_filters.h"
37 #include "../simple_dialog.h"
39 #include "gtk/color_utils.h"
40 #include "gtk/dlg_utils.h"
41 #include "gtk/gui_utils.h"
42 #include "gtk/stock_icons.h"
43 #include "gtk/filter_dlg.h"
44 #include "gtk/dfilter_expr_dlg.h"
45 #include "gtk/color_edit_dlg.h"
48 #define BUTTON_SIZE_X -1
49 #define BUTTON_SIZE_Y -1
52 static void edit_color_filter_destroy_cb(GObject *object, gpointer user_data);
53 static void edit_color_filter_fg_cb(GtkButton *button, gpointer user_data);
54 static void edit_color_filter_bg_cb(GtkButton *button, gpointer user_data);
56 static void edit_disabled_cb_cb(GtkButton *button, gpointer user_data);
58 static void edit_color_filter_ok_cb(GtkButton *button, gpointer user_data);
59 static void edit_new_color_filter_cancel_cb(GtkButton *button, gpointer user_data);
61 static GtkWidget* color_sel_win_new(color_filter_t *colorf, gboolean);
62 static void color_sel_ok_cb(GtkButton *button, gpointer user_data);
63 static void color_sel_cancel_cb(GtkObject *object, gpointer user_data);
66 #define COLOR_FILTERS_CL "color_filters_cl"
67 #define COLOR_FILTER "color_filter"
68 #define COLOR_FILTER_NAME_TE "color_filter_name_te"
69 #define COLOR_FILTER_TEXT_TE "color_filter_text_te"
70 #define COLOR_SELECTION_FG "color_selection_fg"
71 #define COLOR_SELECTION_BG "color_selection_bg"
72 #define COLOR_SELECTION_PARENT "color_selection_parent"
74 /* XXX - we don't forbid having more than one "Edit color filter" dialog
75 open, so these shouldn't be global. */
76 static GtkWidget *filt_name_entry;
77 static GtkWidget *filt_text_entry;
78 static GtkWidget *disabled_cb;
82 filter_expr_cb(GtkWidget *w _U_, gpointer filter_te)
85 dfilter_expr_dlg_new(GTK_WIDGET(filter_te));
89 /* Create an "Edit Color Filter" dialog for a given color filter, and
90 associate it with that color filter. */
92 edit_color_filter_dialog(GtkWidget *color_filters,
93 gboolean is_new_filter)
95 color_filter_t *colorf;
96 GtkWidget *edit_dialog;
97 GtkWidget *dialog_vbox;
98 GtkTooltips *tooltips;
101 GtkWidget *filter_fr;
102 GtkWidget *filter_fr_vbox;
103 GtkWidget *filter_name_hbox;
104 GtkWidget *color_filter_name;
105 GtkWidget *filter_string_hbox;
106 GtkWidget *add_expression_bt;
107 GtkWidget *color_filter_text;
109 GtkWidget *settings_hbox;
111 GtkWidget *colorize_fr;
112 GtkWidget *colorize_hbox;
113 GtkWidget *colorize_filter_fg;
114 GtkWidget *colorize_filter_bg;
116 GtkWidget *status_fr;
117 GtkWidget *status_vbox;
120 GtkWidget *edit_color_filter_ok;
121 GtkWidget *edit_color_filter_cancel;
126 model = gtk_tree_view_get_model(GTK_TREE_VIEW(color_filters));
128 gtk_tree_model_iter_nth_child(model, &iter, NULL, row_selected);
129 gtk_tree_model_get(model, &iter, 5, &colorf, -1);
131 if (colorf->edit_dialog != NULL) {
132 /* There's already an edit box open for this filter; reactivate it. */
133 reactivate_window(colorf->edit_dialog);
137 tooltips = gtk_tooltips_new ();
140 edit_dialog = dlg_conf_window_new ("Wireshark: Edit Color Filter");
141 gtk_window_set_default_size(GTK_WINDOW(edit_dialog), 500, -1);
142 g_object_set_data(G_OBJECT(edit_dialog), "edit_dialog", edit_dialog);
143 colorf->edit_dialog = edit_dialog;
145 dialog_vbox = gtk_vbox_new (FALSE, 0);
146 gtk_container_set_border_width (GTK_CONTAINER (dialog_vbox), 5);
147 gtk_container_add (GTK_CONTAINER (edit_dialog), dialog_vbox);
150 filter_fr = gtk_frame_new("Filter");
151 gtk_box_pack_start (GTK_BOX (dialog_vbox), filter_fr, FALSE, FALSE, 0);
153 filter_fr_vbox = gtk_vbox_new (FALSE, 0);
154 gtk_container_set_border_width (GTK_CONTAINER (filter_fr_vbox), 5);
155 gtk_container_add(GTK_CONTAINER(filter_fr), filter_fr_vbox);
157 /* filter name hbox */
158 filter_name_hbox = gtk_hbox_new (FALSE, 0);
159 gtk_box_pack_start (GTK_BOX (filter_fr_vbox), filter_name_hbox, TRUE, FALSE, 3);
161 color_filter_name = gtk_label_new (("Name: "));
162 gtk_box_pack_start (GTK_BOX (filter_name_hbox), color_filter_name, FALSE, FALSE, 0);
164 filt_name_entry = gtk_entry_new ();
165 gtk_entry_set_text(GTK_ENTRY(filt_name_entry), colorf->filter_name);
167 style = gtk_style_copy(gtk_widget_get_style(filt_name_entry));
168 color_t_to_gdkcolor(&style->base[GTK_STATE_NORMAL], &colorf->bg_color);
169 color_t_to_gdkcolor(&style->text[GTK_STATE_NORMAL], &colorf->fg_color);
170 gtk_widget_set_style(filt_name_entry, style);
172 gtk_box_pack_start (GTK_BOX (filter_name_hbox), filt_name_entry, TRUE, TRUE, 0);
173 gtk_tooltips_set_tip (tooltips, filt_name_entry, ("This is the editable name of the filter. (No @ characters allowed.)"), NULL);
176 /* filter string hbox */
177 filter_string_hbox = gtk_hbox_new (FALSE, 0);
178 gtk_box_pack_start (GTK_BOX (filter_fr_vbox), filter_string_hbox, TRUE, FALSE, 3);
180 color_filter_text = gtk_label_new (("String: "));
181 gtk_box_pack_start (GTK_BOX (filter_string_hbox), color_filter_text, FALSE, FALSE, 0);
183 filt_text_entry = gtk_entry_new ();
184 g_signal_connect(filt_text_entry, "changed", G_CALLBACK(filter_te_syntax_check_cb), NULL);
185 gtk_entry_set_text(GTK_ENTRY(filt_text_entry), colorf->filter_text);
187 gtk_style_unref(style);
188 gtk_box_pack_start (GTK_BOX (filter_string_hbox), filt_text_entry, TRUE, TRUE, 0);
189 gtk_tooltips_set_tip (tooltips, filt_text_entry, ("This is the editable text of the filter"), NULL);
191 /* Create the "Add Expression..." button, to pop up a dialog
192 for constructing filter comparison expressions. */
193 add_expression_bt = gtk_button_new_from_stock(WIRESHARK_STOCK_ADD_EXPRESSION);
194 g_signal_connect(add_expression_bt, "clicked", G_CALLBACK(filter_expr_cb), filt_text_entry);
195 gtk_box_pack_start (GTK_BOX(filter_string_hbox), add_expression_bt, FALSE, FALSE, 3);
196 gtk_tooltips_set_tip (tooltips, add_expression_bt, ("Add an expression to the filter string"), NULL);
198 /* Show the (in)validity of the default filter string */
199 filter_te_syntax_check_cb(filt_text_entry);
201 /* settings-hbox for "choose color frame" and "status frame" */
202 settings_hbox = gtk_hbox_new (FALSE, 0);
203 gtk_box_pack_start (GTK_BOX (dialog_vbox), settings_hbox, FALSE, FALSE, 0);
205 /* choose color frame */
206 colorize_fr = gtk_frame_new("Display Colors");
207 gtk_box_pack_start (GTK_BOX (settings_hbox), colorize_fr, TRUE, TRUE, 0);
209 colorize_hbox = gtk_hbox_new (FALSE, 0);
210 gtk_container_set_border_width (GTK_CONTAINER (colorize_hbox), 5);
211 gtk_container_add(GTK_CONTAINER(colorize_fr), colorize_hbox);
213 colorize_filter_fg = gtk_button_new_with_label (("Foreground Color..."));
214 gtk_box_pack_start (GTK_BOX (colorize_hbox), colorize_filter_fg, TRUE, FALSE, 0);
215 gtk_tooltips_set_tip (tooltips, colorize_filter_fg, ("Select foreground color for data display"), NULL);
217 colorize_filter_bg = gtk_button_new_with_label (("Background Color..."));
218 gtk_box_pack_start (GTK_BOX (colorize_hbox), colorize_filter_bg, TRUE, FALSE, 0);
219 gtk_tooltips_set_tip (tooltips, colorize_filter_bg, ("Select background color for data display"), NULL);
222 status_fr = gtk_frame_new("Status");
223 gtk_box_pack_start (GTK_BOX (settings_hbox), status_fr, TRUE, TRUE, 0);
225 status_vbox = gtk_vbox_new (FALSE, 0);
226 gtk_container_set_border_width (GTK_CONTAINER (status_vbox), 5);
227 gtk_container_add(GTK_CONTAINER(status_fr), status_vbox);
229 disabled_cb = gtk_check_button_new_with_label("Disabled");
230 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(disabled_cb), colorf->disabled);
231 gtk_box_pack_start (GTK_BOX (status_vbox), disabled_cb, TRUE, FALSE, 0);
232 gtk_tooltips_set_tip (tooltips, disabled_cb, ("Color rule won't be checked if this box is selected"), NULL);
235 bbox = dlg_button_row_new(GTK_STOCK_OK, GTK_STOCK_CANCEL, NULL);
236 gtk_box_pack_start(GTK_BOX(dialog_vbox), bbox, FALSE, FALSE, 0);
237 gtk_container_set_border_width (GTK_CONTAINER (bbox), 0);
239 edit_color_filter_ok = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_OK);
240 gtk_tooltips_set_tip (tooltips, edit_color_filter_ok, ("Accept filter color change"), NULL);
242 edit_color_filter_cancel = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_CANCEL);
243 gtk_tooltips_set_tip (tooltips, edit_color_filter_cancel, ("Reject filter color change"), NULL);
245 gtk_widget_grab_default(edit_color_filter_ok);
247 /* signals and such */
248 g_object_set_data(G_OBJECT(edit_dialog), COLOR_FILTER, colorf);
249 g_signal_connect(edit_dialog, "destroy", G_CALLBACK(edit_color_filter_destroy_cb), NULL);
250 g_object_set_data(G_OBJECT(colorize_filter_fg), COLOR_FILTER, colorf);
251 g_signal_connect(colorize_filter_fg, "clicked", G_CALLBACK(edit_color_filter_fg_cb), NULL);
252 g_object_set_data(G_OBJECT(colorize_filter_bg), COLOR_FILTER, colorf);
253 g_signal_connect(colorize_filter_bg, "clicked", G_CALLBACK(edit_color_filter_bg_cb), NULL);
254 g_object_set_data(G_OBJECT(disabled_cb), COLOR_FILTER, colorf);
255 /* g_signal_connect(disabled_cb, "clicked", edit_disabled_cb_cb, NULL);*/
256 g_object_set_data(G_OBJECT(edit_color_filter_ok), COLOR_FILTERS_CL, color_filters);
257 g_object_set_data(G_OBJECT(edit_color_filter_ok), COLOR_FILTER, colorf);
258 g_signal_connect(edit_color_filter_ok, "clicked", G_CALLBACK(edit_color_filter_ok_cb), edit_dialog);
260 /* set callback to delete new filters if cancel chosen */
263 g_object_set_data(G_OBJECT(edit_color_filter_cancel), COLOR_FILTERS_CL, color_filters);
264 g_signal_connect(edit_color_filter_cancel, "clicked",
265 G_CALLBACK(edit_new_color_filter_cancel_cb), edit_dialog);
267 /* escape will select cancel */
268 window_set_cancel_button(edit_dialog, edit_color_filter_cancel, window_cancel_button_cb);
270 g_signal_connect(edit_dialog, "delete_event", G_CALLBACK(window_delete_event_cb), NULL);
272 gtk_widget_show_all(edit_dialog);
273 window_present(edit_dialog);
276 /* Called when the dialog box is being destroyed; destroy any color
277 selection dialogs opened from this dialog, and null out the pointer
280 edit_color_filter_destroy_cb(GObject *object, gpointer user_data _U_)
282 color_filter_t *colorf;
283 GtkWidget *color_sel;
285 colorf = (color_filter_t *)g_object_get_data(G_OBJECT(object), COLOR_FILTER);
286 colorf->edit_dialog = NULL;
288 /* Destroy any color selection dialogs this dialog had open. */
289 color_sel = (GtkWidget *)g_object_get_data(G_OBJECT(object), COLOR_SELECTION_FG);
290 if (color_sel != NULL)
291 window_destroy(color_sel);
292 color_sel = (GtkWidget *)g_object_get_data(G_OBJECT(object), COLOR_SELECTION_BG);
293 if (color_sel != NULL)
294 window_destroy(color_sel);
297 /* Pop up a color selection box to choose the foreground color. */
299 edit_color_filter_fg_cb(GtkButton *button, gpointer user_data _U_)
301 color_filter_t *colorf;
302 GtkWidget *color_selection_fg;
304 colorf = (color_filter_t *)g_object_get_data(G_OBJECT(button), COLOR_FILTER);
305 /* Do we already have one open for this dialog? */
306 color_selection_fg = g_object_get_data(G_OBJECT(colorf->edit_dialog), COLOR_SELECTION_FG);
307 if (color_selection_fg != NULL) {
308 /* Yes. Just reactivate it. */
309 reactivate_window(color_selection_fg);
311 /* No. Create a new color selection box, and associate it with
313 color_selection_fg = color_sel_win_new(colorf, FALSE);
314 g_object_set_data(G_OBJECT(colorf->edit_dialog), COLOR_SELECTION_FG, color_selection_fg);
315 g_object_set_data(G_OBJECT(color_selection_fg), COLOR_SELECTION_PARENT, colorf->edit_dialog);
319 /* Pop up a color selection box to choose the background color. */
321 edit_color_filter_bg_cb (GtkButton *button,
322 gpointer user_data _U_)
324 color_filter_t *colorf;
325 GtkWidget *color_selection_bg;
327 colorf = (color_filter_t *)g_object_get_data(G_OBJECT(button), COLOR_FILTER);
328 /* Do we already have one open for this dialog? */
329 color_selection_bg = g_object_get_data(G_OBJECT(colorf->edit_dialog), COLOR_SELECTION_BG);
330 if (color_selection_bg != NULL) {
331 /* Yes. Just reactivate it. */
332 reactivate_window(color_selection_bg);
334 /* No. Create a new color selection box, and associate it with
336 color_selection_bg = color_sel_win_new(colorf, TRUE);
337 g_object_set_data(G_OBJECT(colorf->edit_dialog), COLOR_SELECTION_BG, color_selection_bg);
338 g_object_set_data(G_OBJECT(color_selection_bg), COLOR_SELECTION_PARENT, colorf->edit_dialog);
342 /* Toggle the disabled flag */
345 edit_disabled_cb_cb (GtkButton *button,
346 gpointer user_data _U_)
348 color_filter_t *colorf;
350 colorf = (color_filter_t *)g_object_get_data(G_OBJECT(button), COLOR_FILTER);
351 colorf->disabled = GTK_TOGGLE_BUTTON (button)->active;
353 printf("Colorfilter %s is now %s\n",colorf->filter_name,colorf->disabled?"disabled":"enabled");
357 /* accept color (and potential content) change */
359 edit_color_filter_ok_cb (GtkButton *button,
364 GdkColor new_fg_color;
365 GdkColor new_bg_color;
368 gboolean filter_disabled;
369 color_filter_t *colorf;
370 dfilter_t *compiled_filter;
371 GtkWidget *color_filters;
374 gchar fg_str[14], bg_str[14];
376 dialog = (GtkWidget *)user_data;
378 style = gtk_widget_get_style(filt_name_entry);
379 new_bg_color = style->base[GTK_STATE_NORMAL];
380 new_fg_color = style->text[GTK_STATE_NORMAL];
382 filter_name = g_strdup(gtk_entry_get_text(GTK_ENTRY(filt_name_entry)));
383 filter_text = g_strdup(gtk_entry_get_text(GTK_ENTRY(filt_text_entry)));
384 filter_disabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(disabled_cb));
386 if(strchr(filter_name,'@') || strchr(filter_text,'@')){
387 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
388 "Filter names and strings must not"
389 " use the '@' character. Filter unchanged.");
395 if(!dfilter_compile(filter_text, &compiled_filter)) {
396 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
397 "Filter \"%s\" didn't compile correctly.\n"
398 " Please try again. Filter unchanged.\n%s\n", filter_name,
401 color_filters = (GtkWidget *)g_object_get_data(G_OBJECT(button), COLOR_FILTERS_CL);
402 colorf = (color_filter_t *)g_object_get_data(G_OBJECT(button), COLOR_FILTER);
404 if (colorf->filter_name != NULL)
405 g_free(colorf->filter_name);
406 colorf->filter_name = filter_name;
407 if (colorf->filter_text != NULL)
408 g_free(colorf->filter_text);
409 colorf->filter_text = filter_text;
410 colorf->disabled = filter_disabled;
411 gdkcolor_to_color_t(&colorf->fg_color, &new_fg_color);
412 gdkcolor_to_color_t(&colorf->bg_color, &new_bg_color);
413 g_snprintf(fg_str, 14, "#%04X%04X%04X",
414 new_fg_color.red, new_fg_color.green, new_fg_color.blue);
415 g_snprintf(bg_str, 14, "#%04X%04X%04X",
416 new_bg_color.red, new_bg_color.green, new_bg_color.blue);
417 model = gtk_tree_view_get_model(GTK_TREE_VIEW(color_filters));
418 gtk_tree_model_iter_nth_child(model, &iter, NULL, row_selected);
419 gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, filter_name,
420 1, filter_text, 2, fg_str, 3, bg_str,
421 4, filter_disabled, -1);
422 if(colorf->c_colorfilter != NULL)
423 dfilter_free(colorf->c_colorfilter);
424 colorf->c_colorfilter = compiled_filter;
426 /* Destroy the dialog box. */
427 window_destroy(dialog);
431 /* reject new color filter addition */
433 edit_new_color_filter_cancel_cb(GtkButton *button, gpointer user_data _U_)
435 /* Delete the entry. As a side effect this destroys the edit_dialog window. */
436 color_delete(num_of_filters-1, (GtkWidget*)g_object_get_data(G_OBJECT(button), COLOR_FILTERS_CL));
440 color_sel_win_new(color_filter_t *colorf, gboolean is_bg)
443 GtkWidget *color_sel_win;
446 GtkWidget *color_sel_ok;
447 GtkWidget *color_sel_cancel;
448 GtkWidget *color_sel_help;
451 color = &colorf->bg_color;
452 title = g_strdup_printf("Wireshark: Choose background color for \"%s\"",
453 colorf->filter_name);
455 color = &colorf->fg_color;
456 title = g_strdup_printf("Wireshark: Choose foreground color for \"%s\"",
457 colorf->filter_name);
459 color_sel_win = gtk_color_selection_dialog_new(title);
461 g_object_set_data(G_OBJECT(color_sel_win), "color_sel_win", color_sel_win);
462 gtk_container_set_border_width (GTK_CONTAINER (color_sel_win), 10);
465 color_t_to_gdkcolor(&gcolor, color);
466 gtk_color_selection_set_current_color(
468 GTK_COLOR_SELECTION_DIALOG(color_sel_win)->colorsel), &gcolor);
471 color_sel_ok = GTK_COLOR_SELECTION_DIALOG (color_sel_win)->ok_button;
472 g_object_set_data(G_OBJECT(color_sel_win), "color_sel_ok", color_sel_ok);
473 GTK_WIDGET_SET_FLAGS (color_sel_ok, GTK_CAN_DEFAULT);
475 color_sel_cancel = GTK_COLOR_SELECTION_DIALOG (color_sel_win)->cancel_button;
476 g_object_set_data(G_OBJECT(color_sel_win), "color_sel_cancel", color_sel_cancel);
477 GTK_WIDGET_SET_FLAGS (color_sel_cancel, GTK_CAN_DEFAULT);
478 window_set_cancel_button(color_sel_win, color_sel_cancel, NULL); /* ensure esc does req'd local cxl action. */
479 /* esc as handled by the */
480 /* gtk_color_selection_dialog widget */
481 /* doesn't result in this happening. */
483 color_sel_help = GTK_COLOR_SELECTION_DIALOG (color_sel_win)->help_button;
484 g_object_set_data(G_OBJECT(color_sel_win), "color_sel_help", color_sel_help);
487 GTK_WIDGET_SET_FLAGS (color_sel_help, GTK_CAN_DEFAULT);
489 g_signal_connect(color_sel_ok, "clicked", G_CALLBACK(color_sel_ok_cb), color_sel_win);
490 g_signal_connect(color_sel_cancel, "clicked", G_CALLBACK(color_sel_cancel_cb), color_sel_win);
492 gtk_widget_show_all(color_sel_win);
493 return color_sel_win;
497 color_sel_win_destroy(GtkWidget *sel_win)
500 GtkWidget *color_selection_fg, *color_selection_bg;
502 /* Find the "Edit color filter" dialog box with which this is associated. */
503 parent = (GtkWidget *)g_object_get_data(G_OBJECT(sel_win), COLOR_SELECTION_PARENT);
505 /* Find that dialog box's foreground and background color selection
507 color_selection_fg = g_object_get_data(G_OBJECT(parent), COLOR_SELECTION_FG);
508 color_selection_bg = g_object_get_data(G_OBJECT(parent), COLOR_SELECTION_BG);
510 if (sel_win == color_selection_fg) {
511 /* This was its foreground color selection box; it isn't, anymore. */
512 g_object_set_data(G_OBJECT(parent), COLOR_SELECTION_FG, NULL);
514 if (sel_win == color_selection_bg) {
515 /* This was its background color selection box; it isn't, anymore. */
516 g_object_set_data(G_OBJECT(parent), COLOR_SELECTION_BG, NULL);
519 /* Now destroy it. */
520 window_destroy(sel_win);
523 /* Retrieve selected color */
525 color_sel_ok_cb (GtkButton *button _U_,
528 GdkColor new_color; /* Color from color selection dialog */
529 GtkWidget *color_dialog;
532 GtkWidget *color_selection_fg, *color_selection_bg;
535 color_dialog = (GtkWidget *)user_data;
537 gtk_color_selection_get_current_color(GTK_COLOR_SELECTION(
538 GTK_COLOR_SELECTION_DIALOG(color_dialog)->colorsel), &new_color);
540 if ( ! get_color(&new_color) ){
541 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
542 "Could not allocate color. Try again.");
544 /* Find the "Edit color filter" dialog box with which this is
546 parent = (GtkWidget *)g_object_get_data(G_OBJECT(color_dialog), COLOR_SELECTION_PARENT);
548 /* Find that dialog box's foreground and background color selection
550 color_selection_fg = g_object_get_data(G_OBJECT(parent), COLOR_SELECTION_FG);
551 color_selection_bg = g_object_get_data(G_OBJECT(parent), COLOR_SELECTION_BG);
552 is_bg = (color_dialog == color_selection_bg);
554 color_sel_win_destroy(color_dialog);
556 /* now apply the change to the fore/background */
558 style = gtk_style_copy(gtk_widget_get_style(filt_name_entry));
560 style->base[GTK_STATE_NORMAL] = new_color;
562 style->text[GTK_STATE_NORMAL] = new_color;
564 gtk_widget_set_style(filt_name_entry, style);
565 gtk_style_unref(style);
569 /* Don't choose the selected color as the foreground or background
570 color for the filter. */
572 color_sel_cancel_cb (GtkObject *object _U_,
575 GtkWidget *color_dialog;
576 color_dialog = (GtkWidget *)user_data;
577 /* nothing to change here. Just get rid of the dialog box. */
579 color_sel_win_destroy(color_dialog);