#include "file_dlg.h"
#include "gtkglobals.h"
#include <epan/prefs.h>
+#include "help_dlg.h"
static GtkWidget* colorize_dialog_new(char *filter);
static void add_filter_to_list(gpointer filter_arg, gpointer list_arg);
{
int count = 0;
- g_slist_foreach(filter_list, count_this_mark, &count);
+ g_slist_foreach(color_filter_list, count_this_mark, &count);
return count;
}
GtkWidget *color_apply;
GtkWidget *color_save;
GtkWidget *color_cancel;
+ GtkWidget *color_help;
#if GTK_MAJOR_VERSION >= 2
GtkListStore *store;
#endif
num_of_filters = 0;
- g_slist_foreach(filter_list, add_filter_to_list, color_filters);
+ g_slist_foreach(color_filter_list, add_filter_to_list, color_filters);
#if GTK_MAJOR_VERSION < 2
gtk_clist_set_selection_mode (GTK_CLIST (color_filters),GTK_SELECTION_EXTENDED);
/* Button row: OK and cancel buttons */
- button_ok_hbox = dlg_button_row_new(GTK_STOCK_OK, GTK_STOCK_APPLY, GTK_STOCK_SAVE, GTK_STOCK_CLOSE/*, GTK_STOCK_CANCEL*/, NULL);
+ if(topic_available(HELP_COLORING_RULES_DIALOG)) {
+ button_ok_hbox = dlg_button_row_new(GTK_STOCK_OK, GTK_STOCK_APPLY, GTK_STOCK_SAVE, GTK_STOCK_CLOSE, GTK_STOCK_HELP, NULL);
+ } else {
+ button_ok_hbox = dlg_button_row_new(GTK_STOCK_OK, GTK_STOCK_APPLY, GTK_STOCK_SAVE, GTK_STOCK_CLOSE/*, GTK_STOCK_CANCEL*/, NULL);
+ }
gtk_box_pack_start (GTK_BOX (dlg_vbox), button_ok_hbox, FALSE, FALSE, 5);
color_ok = OBJECT_GET_DATA(button_ok_hbox, GTK_STOCK_OK);
window_set_cancel_button(color_win, color_cancel, color_cancel_cb);
gtk_tooltips_set_tip (tooltips, color_cancel, ("Close this dialog but don't apply the color filter changes to the display"), NULL);
+ if(topic_available(HELP_COLORING_RULES_DIALOG)) {
+ color_help = OBJECT_GET_DATA(button_ok_hbox, GTK_STOCK_HELP);
+ gtk_tooltips_set_tip (tooltips, color_help, ("Get help about this dialog"), NULL);
+ SIGNAL_CONNECT(color_help, "clicked", topic_cb, HELP_COLORING_RULES_DIALOG);
+ }
+
gtk_widget_grab_default(color_ok);
/* signals and such */
num_of_filters++;
}
-void move_this_row (GtkWidget *color_filters,
+static void move_this_row (GtkWidget *color_filters,
gint filter_number,
gint amount) /* only tested with +1(down) and -1(up) */
{
#endif
- filter_list = g_slist_remove(filter_list, colorf);
- filter_list = g_slist_insert(filter_list, colorf, filter_number + amount);
+ color_filter_list = g_slist_remove(color_filter_list, colorf);
+ color_filter_list = g_slist_insert(color_filter_list, colorf, filter_number + amount);
}
/* Move the selected filters up in the list */
};
/* called for each selected row in the tree.
*/
-void remember_this_row (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer arg)
+static void remember_this_row (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer arg)
{
gint *path_index;
color_filter_t *colorf;
data.count = 0;
data.color_filters = color_filters;
- g_slist_foreach(filter_list, clear_mark, NULL);
+ g_slist_foreach(color_filter_list, clear_mark, NULL);
gtk_tree_selection_selected_foreach(sel,remember_this_row, &data);
if (data.count > 0)
gpointer user_data _U_)
{
/* Destroy any edit dialogs we have open. */
- g_slist_foreach(filter_list, destroy_edit_dialog_cb, NULL);
+ g_slist_foreach(color_filter_list, destroy_edit_dialog_cb, NULL);
colorize_win = NULL;
}
}
void
-color_add_filter_cb (color_filter_t *colorf, gpointer arg)
+color_filter_add_cb(color_filter_t *colorf, gpointer arg)
{
GtkWidget *color_filters = arg;
style = gtk_widget_get_style(packet_list);
gdkcolor_to_color_t(&bg_color, &style->base[GTK_STATE_NORMAL]);
gdkcolor_to_color_t(&fg_color, &style->text[GTK_STATE_NORMAL]);
- colorf = new_color_filter("name", filter, &bg_color, &fg_color); /* Adds at end! */
+ colorf = color_filter_new("name", filter, &bg_color, &fg_color); /* Adds at end! */
color_add_colorf(color_filters, colorf);
window_destroy(colorf->edit_dialog);
/* Remove the color filter from the list of color filters. */
- remove_color_filter(colorf);
+ color_filter_remove(colorf);
/* If we grab the focus after updating the selection, the first
* row is always selected, so we do it before */
window_destroy(colorf->edit_dialog);
/* Remove the color filter from the list of color filters. */
- remove_color_filter(colorf);
+ color_filter_remove(colorf);
#endif
}
static void
color_save_cb(GtkButton *button _U_, gpointer user_data _U_)
{
- if (!write_filters())
+ if (!color_filters_write())
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Could not open filter file: %s", strerror(errno));
}
color_delete (num_of_filters-1, color_filters);
}
- if (!revert_filters())
+ if (!color_filters_revert())
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Could not delete filter file: %s", strerror(errno));
/* colorize list */
- colorize_packets(&cfile);
+ cf_colorize_packets(&cfile);
/* Destroy the dialog box. */
/* XXX: is this useful? user might want to continue with editing new colors */
}
/* clear button: user responded to question */
-void color_clear_answered_cb(gpointer dialog _U_, gint btn, gpointer data)
+static void color_clear_answered_cb(gpointer dialog _U_, gint btn, gpointer data)
{
switch(btn) {
case(ESD_BTN_CLEAR):
color_ok_cb(GtkButton *button _U_, gpointer user_data _U_)
{
/* colorize list */
- colorize_packets(&cfile);
+ cf_colorize_packets(&cfile);
/* Destroy the dialog box. */
window_destroy(colorize_win);
static void
color_apply_cb(GtkButton *button _U_, gpointer user_data _U_)
{
- colorize_packets(&cfile);
+ cf_colorize_packets(&cfile);
}
/* Create an "Edit Color Filter" dialog for a given color filter, and
style->fg[GTK_STATE_NORMAL] = colorf->fg_color;
#endif
gtk_widget_set_style(*colorize_filter_text, style);
+ gtk_style_unref(style);
gtk_box_pack_start (GTK_BOX (filter_string_hbox), *colorize_filter_text, TRUE, TRUE, 0);
gtk_tooltips_set_tip (tooltips, *colorize_filter_text, ("This is the editable text of the filter"), NULL);
if(!dfilter_compile(filter_text, &compiled_filter)) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- "Filter \"%s\" did not compile correctly.\n"
+ "Filter \"%s\" didn't compile correctly.\n"
" Please try again. Filter unchanged.\n%s\n", filter_name,
dfilter_error_msg);
} else {
#endif
gtk_widget_set_style(filt_name_entry, style);
gtk_widget_set_style(filt_text_entry, style);
+ gtk_style_unref(style);
}
}