diff options
author | ulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7> | 2006-10-01 17:59:30 +0000 |
---|---|---|
committer | ulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7> | 2006-10-01 17:59:30 +0000 |
commit | 111b85b1e9cf7411a9b0cf17c5eebae0bae66f18 (patch) | |
tree | 63e1c3d257416fa137d27b6c51815ac1656f8061 | |
parent | 309b01cc05bae0777b00b45ae2d6ea07a9cd47a6 (diff) |
Change the filter dialog (capture and display filters), so it has a real Cancel button now - the former Close button didn't reverted the changes done.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@19390 f5534014-38df-0310-8fa8-9805f1628bb7
-rw-r--r-- | filters.c | 185 | ||||
-rw-r--r-- | filters.h | 16 | ||||
-rw-r--r-- | gtk/filter_dlg.c | 170 |
3 files changed, 243 insertions, 128 deletions
@@ -58,16 +58,26 @@ #define DFILTER_FILE_NAME "dfilters" /* - * List of capture filters. + * List of capture filters - saved. */ static GList *capture_filters = NULL; /* - * List of display filters. + * List of display filters - saved. */ static GList *display_filters = NULL; /* + * List of capture filters - currently edited. + */ +static GList *capture_edited_filters = NULL; + +/* + * List of display filters - currently edited. + */ +static GList *display_edited_filters = NULL; + +/* * Read in a list of filters. * * On success, "*pref_path_return" is set to NULL. @@ -78,16 +88,37 @@ static GList *display_filters = NULL; #define INIT_BUF_SIZE 128 +GList * +add_filter_entry(GList *fl, const char *filt_name, const char *filt_expr) +{ + filter_def *filt; + + filt = (filter_def *) g_malloc(sizeof(filter_def)); + filt->name = g_strdup(filt_name); + filt->strval = g_strdup(filt_expr); + return g_list_append(fl, filt); +} + +GList * +remove_filter_entry(GList *fl, GList *fl_entry) +{ + filter_def *filt; + + filt = (filter_def *) fl_entry->data; + g_free(filt->name); + g_free(filt->strval); + g_free(filt); + return g_list_remove_link(fl, fl_entry); +} + void -read_filter_list(filter_list_type_t list, char **pref_path_return, +read_filter_list(filter_list_type_t list_type, char **pref_path_return, int *errno_return) { const char *ff_name; char *ff_path; FILE *ff; - GList **flp; - GList *fl_ent; - filter_def *filt; + GList **flpp; int c; char *filt_name, *filt_expr; int filt_name_len, filt_expr_len; @@ -96,16 +127,16 @@ read_filter_list(filter_list_type_t list, char **pref_path_return, *pref_path_return = NULL; /* assume no error */ - switch (list) { + switch (list_type) { case CFILTER_LIST: ff_name = CFILTER_FILE_NAME; - flp = &capture_filters; + flpp = &capture_filters; break; case DFILTER_LIST: ff_name = DFILTER_FILE_NAME; - flp = &display_filters; + flpp = &display_filters; break; default: @@ -170,17 +201,9 @@ read_filter_list(filter_list_type_t list, char **pref_path_return, } /* If we already have a list of filters, discard it. */ - if (*flp != NULL) { - fl_ent = g_list_first(*flp); - while (fl_ent != NULL) { - filt = (filter_def *) fl_ent->data; - g_free(filt->name); - g_free(filt->strval); - g_free(filt); - fl_ent = fl_ent->next; - } - g_list_free(*flp); - *flp = NULL; + /* this should never happen - this function is called only once for each list! */ + while(*flpp) { + *flpp = remove_filter_entry(*flpp, g_list_first(*flpp)); } /* Allocate the filter name buffer. */ @@ -327,10 +350,7 @@ read_filter_list(filter_list_type_t list, char **pref_path_return, filt_expr[filt_expr_index] = '\0'; /* Add the new filter to the list of filters */ - filt = (filter_def *) g_malloc(sizeof(filter_def)); - filt->name = g_strdup(filt_name); - filt->strval = g_strdup(filt_expr); - *flp = g_list_append(*flp, filt); + *flpp = add_filter_entry(*flpp, filt_name, filt_expr); } if (ferror(ff)) { *pref_path_return = ff_path; @@ -340,43 +360,64 @@ read_filter_list(filter_list_type_t list, char **pref_path_return, fclose(ff); g_free(filt_name); g_free(filt_expr); + + /* init the corresponding edited list */ + switch (list_type) { + case CFILTER_LIST: + copy_filter_list(CFILTER_EDITED_LIST, CFILTER_LIST); + break; + case DFILTER_LIST: + copy_filter_list(DFILTER_EDITED_LIST, DFILTER_LIST); + break; + default: + g_assert_not_reached(); + return; + } } /* * Get a pointer to a list of filters. */ static GList ** -get_filter_list(filter_list_type_t list) +get_filter_list(filter_list_type_t list_type) { - GList **flp; + GList **flpp; - switch (list) { + switch (list_type) { case CFILTER_LIST: - flp = &capture_filters; + flpp = &capture_filters; break; case DFILTER_LIST: - flp = &display_filters; + flpp = &display_filters; + break; + + case CFILTER_EDITED_LIST: + flpp = &capture_edited_filters; + break; + + case DFILTER_EDITED_LIST: + flpp = &display_edited_filters; break; default: g_assert_not_reached(); - flp = NULL; + flpp = NULL; } - return flp; + return flpp; } /* * Get a pointer to the first entry in a filter list. */ GList * -get_filter_list_first(filter_list_type_t list) +get_filter_list_first(filter_list_type_t list_type) { - GList **flp; + GList **flpp; - flp = get_filter_list(list); - return g_list_first(*flp); + flpp = get_filter_list(list_type); + return g_list_first(*flpp); } /* @@ -384,35 +425,27 @@ get_filter_list_first(filter_list_type_t list) * Returns a pointer to the newly-added entry. */ GList * -add_to_filter_list(filter_list_type_t list, const char *name, +add_to_filter_list(filter_list_type_t list_type, const char *name, const char *expression) { - GList **flp; - filter_def *filt; + GList **flpp; + + flpp = get_filter_list(list_type); + *flpp = add_filter_entry(*flpp, name, expression); - flp = get_filter_list(list); - filt = (filter_def *) g_malloc(sizeof(filter_def)); - filt->name = g_strdup(name); - filt->strval = g_strdup(expression); - *flp = g_list_append(*flp, filt); - return g_list_last(*flp); + return g_list_last(*flpp); } /* * Remove a filter from a list. */ void -remove_from_filter_list(filter_list_type_t list, GList *fl_entry) +remove_from_filter_list(filter_list_type_t list_type, GList *fl_entry) { - GList **flp; - filter_def *filt; + GList **flpp; - flp = get_filter_list(list); - filt = (filter_def *) fl_entry->data; - g_free(filt->name); - g_free(filt->strval); - g_free(filt); - *flp = g_list_remove_link(*flp, fl_entry); + flpp = get_filter_list(list_type); + *flpp = remove_filter_entry(*flpp, fl_entry); } /* @@ -424,20 +457,20 @@ remove_from_filter_list(filter_list_type_t list, GList *fl_entry) * and "*errno_return" is set to the error. */ void -save_filter_list(filter_list_type_t list, char **pref_path_return, +save_filter_list(filter_list_type_t list_type, char **pref_path_return, int *errno_return) { const gchar *ff_name; gchar *ff_path, *ff_path_new; GList *fl; - GList *flp; + GList *flpp; filter_def *filt; FILE *ff; guchar *p, c; *pref_path_return = NULL; /* assume no error */ - switch (list) { + switch (list_type) { case CFILTER_LIST: ff_name = CFILTER_FILE_NAME; @@ -467,9 +500,9 @@ save_filter_list(filter_list_type_t list, char **pref_path_return, g_free(ff_path_new); return; } - flp = g_list_first(fl); - while (flp) { - filt = (filter_def *) flp->data; + flpp = g_list_first(fl); + while (flpp) { + filt = (filter_def *) flpp->data; /* Write out the filter name as a quoted string; escape any quotes or backslashes. */ @@ -494,7 +527,7 @@ save_filter_list(filter_list_type_t list, char **pref_path_return, g_free(ff_path_new); return; } - flp = flp->next; + flpp = flpp->next; } if (fclose(ff) == EOF) { *pref_path_return = ff_path; @@ -531,3 +564,35 @@ save_filter_list(filter_list_type_t list, char **pref_path_return, g_free(ff_path_new); g_free(ff_path); } + +/* + * Copy a filter list into another. + */ +void copy_filter_list(filter_list_type_t dest_type, filter_list_type_t src_type) +{ + GList **flpp_dest; + GList **flpp_src; + GList *flp_src; + filter_def *filt; + + g_assert(dest_type != src_type); + + flpp_dest = get_filter_list(dest_type); + flpp_src = get_filter_list(src_type); + flp_src = *flpp_src; + + /* throw away the "old" destination list - a NULL list is ok here */ + while(*flpp_dest) { + *flpp_dest = remove_filter_entry(*flpp_dest, g_list_first(*flpp_dest)); + } + g_assert(g_list_length(*flpp_dest) == 0); + + /* copy the list entries */ + while(flp_src) { + filt = (flp_src)->data; + + *flpp_dest = add_filter_entry(*flpp_dest, filt->name, filt->strval); + flp_src = g_list_next(flp_src); + } +} + @@ -27,8 +27,10 @@ * Filter lists. */ typedef enum { - CFILTER_LIST, /* capture filter list */ - DFILTER_LIST /* display filter list */ + CFILTER_LIST, /* capture filter list - saved */ + DFILTER_LIST, /* display filter list - saved */ + CFILTER_EDITED_LIST, /* capture filter list - currently edited */ + DFILTER_EDITED_LIST /* display filter list - currently edited */ } filter_list_type_t; /* @@ -47,7 +49,7 @@ typedef struct { * the file we tried to read - it should be freed by our caller - * and "*errno_return" is set to the error. */ -void read_filter_list(filter_list_type_t list, char **pref_path_return, +void read_filter_list(filter_list_type_t list_type, char **pref_path_return, int *errno_return); /* @@ -75,5 +77,11 @@ void remove_from_filter_list(filter_list_type_t list, GList *fl_entry); * the file we tried to read - it should be freed by our caller - * and "*errno_return" is set to the error. */ -void save_filter_list(filter_list_type_t list, char **pref_path_return, +void save_filter_list(filter_list_type_t list_type, char **pref_path_return, int *errno_return); + +/* + * Clone the filter list so it can be edited. + */ +void copy_filter_list(filter_list_type_t dest_type, filter_list_type_t src_type); + diff --git a/gtk/filter_dlg.c b/gtk/filter_dlg.c index 1152c85438..58913946d4 100644 --- a/gtk/filter_dlg.c +++ b/gtk/filter_dlg.c @@ -64,7 +64,7 @@ typedef struct _filter_cb_data { } filter_cb_data; static GtkWidget *filter_dialog_new(GtkWidget *button, GtkWidget *filter_te, - filter_list_type_t list, + filter_list_type_t list_type, construct_args_t *construct_args); static void filter_dlg_dclick(GtkWidget *dummy, gpointer main_w_arg, gpointer activate); @@ -74,6 +74,11 @@ static void filter_apply(GtkWidget *main_w, gboolean destroy); static void filter_dlg_save_cb(GtkWidget *save_bt, gpointer parent_w); static void filter_dlg_destroy_cb(GtkWidget *win, gpointer data); +static gboolean +filter_dlg_delete_event_cb(GtkWidget *prefs_w, GdkEvent *event, gpointer data); +static void +filter_dlg_cancel_cb(GtkWidget *cancel_bt, gpointer data); + static gint filter_sel_list_button_cb(GtkWidget *, GdkEventButton *, gpointer); #if GTK_MAJOR_VERSION < 2 @@ -249,15 +254,15 @@ remember_filter_dialog(GtkWidget *main_w, GList **filter_dialogs) /* Remove a filter dialog from the specified list of filter_dialogs. */ static void -forget_filter_dialog(GtkWidget *main_w, filter_list_type_t list) +forget_filter_dialog(GtkWidget *main_w, filter_list_type_t list_type) { - switch (list) { + switch (list_type) { - case CFILTER_LIST: + case CFILTER_EDITED_LIST: cfilter_dialogs = g_list_remove(cfilter_dialogs, main_w); break; - case DFILTER_LIST: + case DFILTER_EDITED_LIST: dfilter_dialogs = g_list_remove(dfilter_dialogs, main_w); break; @@ -269,14 +274,14 @@ forget_filter_dialog(GtkWidget *main_w, filter_list_type_t list) /* Get the dialog list corresponding to a particular filter list. */ static GList * -get_filter_dialog_list(filter_list_type_t list) +get_filter_dialog_list(filter_list_type_t list_type) { - switch (list) { + switch (list_type) { - case CFILTER_LIST: + case CFILTER_EDITED_LIST: return cfilter_dialogs; - case DFILTER_LIST: + case DFILTER_EDITED_LIST: return dfilter_dialogs; default: @@ -287,7 +292,7 @@ get_filter_dialog_list(filter_list_type_t list) static GtkWidget * filter_dialog_new(GtkWidget *button, GtkWidget *parent_filter_te, - filter_list_type_t list, construct_args_t *construct_args) + filter_list_type_t list_type, construct_args_t *construct_args) { GtkWidget *main_w, /* main window */ *main_vb, /* main container */ @@ -295,7 +300,7 @@ filter_dialog_new(GtkWidget *button, GtkWidget *parent_filter_te, *ok_bt, /* "OK" button */ *apply_bt, /* "Apply" button */ *save_bt, /* "Save" button */ - *close_bt, /* "Cancel" button */ + *cancel_bt, /* "Cancel" button */ *help_bt; /* "Help" button */ GtkWidget *filter_vb, /* filter settings box */ *props_vb; @@ -318,8 +323,8 @@ filter_dialog_new(GtkWidget *button, GtkWidget *parent_filter_te, GtkTooltips *tooltips; GList *fl_entry; filter_def *filt; - static filter_list_type_t cfilter_list_type = CFILTER_LIST; - static filter_list_type_t dfilter_list_type = DFILTER_LIST; + static filter_list_type_t cfilter_list_type = CFILTER_EDITED_LIST; + static filter_list_type_t dfilter_list_type = DFILTER_EDITED_LIST; filter_list_type_t *filter_list_type_p; GList **filter_dialogs; const gchar *filter_te_str = NULL; @@ -340,16 +345,18 @@ filter_dialog_new(GtkWidget *button, GtkWidget *parent_filter_te, /* Get a pointer to a static variable holding the type of filter on which we're working, so we can pass that pointer to callback routines. */ - switch (list) { + switch (list_type) { case CFILTER_LIST: filter_dialogs = &cfilter_dialogs; filter_list_type_p = &cfilter_list_type; + list_type = CFILTER_EDITED_LIST; break; case DFILTER_LIST: filter_dialogs = &dfilter_dialogs; filter_list_type_p = &dfilter_list_type; + list_type = DFILTER_EDITED_LIST; break; default: @@ -472,7 +479,7 @@ filter_dialog_new(GtkWidget *button, GtkWidget *parent_filter_te, construct_args->activate_on_ok ? "" : NULL); /* fill in data */ - fl_entry = get_filter_list_first(list); + fl_entry = get_filter_list_first(list_type); while (fl_entry != NULL) { filt = (filter_def *) fl_entry->data; #if GTK_MAJOR_VERSION < 2 @@ -554,7 +561,7 @@ filter_dialog_new(GtkWidget *button, GtkWidget *parent_filter_te, OBJECT_SET_DATA(main_w, E_FILT_PARENT_FILTER_TE_KEY, parent_filter_te); - if (list == DFILTER_LIST) { + if (list_type == DFILTER_EDITED_LIST) { gtk_tooltips_set_tip(tooltips, filter_te, "Enter a display filter. " "The background color of this field is changed by a continuous syntax check (green is valid, red is invalid).", @@ -573,15 +580,15 @@ filter_dialog_new(GtkWidget *button, GtkWidget *parent_filter_te, /* button row */ if (parent_filter_te != NULL) { if (construct_args->wants_apply_button) { - bbox = dlg_button_row_new(GTK_STOCK_OK, GTK_STOCK_APPLY, GTK_STOCK_SAVE, GTK_STOCK_CLOSE, GTK_STOCK_HELP, NULL); + bbox = dlg_button_row_new(GTK_STOCK_OK, GTK_STOCK_APPLY, GTK_STOCK_SAVE, GTK_STOCK_CANCEL, GTK_STOCK_HELP, NULL); } else { - bbox = dlg_button_row_new(GTK_STOCK_OK, GTK_STOCK_SAVE, GTK_STOCK_CLOSE, GTK_STOCK_HELP, NULL); + bbox = dlg_button_row_new(GTK_STOCK_OK, GTK_STOCK_SAVE, GTK_STOCK_CANCEL, GTK_STOCK_HELP, NULL); } } else { if (construct_args->wants_apply_button) { - bbox = dlg_button_row_new(GTK_STOCK_APPLY, GTK_STOCK_SAVE, GTK_STOCK_CLOSE, GTK_STOCK_HELP, NULL); + bbox = dlg_button_row_new(GTK_STOCK_APPLY, GTK_STOCK_SAVE, GTK_STOCK_CANCEL, GTK_STOCK_HELP, NULL); } else { - bbox = dlg_button_row_new(GTK_STOCK_SAVE, GTK_STOCK_CLOSE, GTK_STOCK_HELP, NULL); + bbox = dlg_button_row_new(GTK_STOCK_SAVE, GTK_STOCK_CANCEL, GTK_STOCK_HELP, NULL); } } gtk_box_pack_start(GTK_BOX(main_vb), bbox, FALSE, FALSE, 5); @@ -616,32 +623,24 @@ filter_dialog_new(GtkWidget *button, GtkWidget *parent_filter_te, SIGNAL_CONNECT(save_bt, "clicked", filter_dlg_save_cb, filter_list_type_p); gtk_tooltips_set_tip (tooltips, save_bt, ("Save the filters permanently and keep this dialog open"), NULL); - close_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE); - gtk_tooltips_set_tip (tooltips, close_bt, ("Close this dialog but don't apply the filter changes"), NULL); - if (parent_filter_te == NULL) - gtk_widget_grab_default(close_bt); + cancel_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_CANCEL); + gtk_tooltips_set_tip (tooltips, cancel_bt, ("Cancel the changes"), NULL); + SIGNAL_CONNECT(cancel_bt, "clicked", filter_dlg_cancel_cb, filter_list_type_p); help_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_HELP); - if (list == CFILTER_LIST) { + if (list_type == CFILTER_EDITED_LIST) { SIGNAL_CONNECT(help_bt, "clicked", topic_cb, HELP_CAPTURE_FILTERS_DIALOG); } else { SIGNAL_CONNECT(help_bt, "clicked", topic_cb, HELP_DISPLAY_FILTERS_DIALOG); } gtk_tooltips_set_tip (tooltips, help_bt, ("Show topic specific help"), NULL); - window_set_cancel_button(main_w, close_bt, window_cancel_button_cb); - if(ok_bt) { gtk_widget_grab_default(ok_bt); } remember_filter_dialog(main_w, filter_dialogs); - SIGNAL_CONNECT(main_w, "delete_event", window_delete_event_cb, NULL); - /* Call a handler when we're destroyed, so we can detach ourselves - from the button. */ - SIGNAL_CONNECT(main_w, "destroy", filter_dlg_destroy_cb, filter_list_type_p); - if (button != NULL) { /* This dialog box was created by a "Filter" button. Set the E_FILT_BUTTON_PTR_KEY for the new dialog to point to @@ -670,6 +669,9 @@ filter_dialog_new(GtkWidget *button, GtkWidget *parent_filter_te, } #endif + SIGNAL_CONNECT(main_w, "delete_event", filter_dlg_delete_event_cb, filter_list_type_p); + SIGNAL_CONNECT(main_w, "destroy", filter_dlg_destroy_cb, filter_list_type_p); + gtk_widget_show(main_w); window_present(main_w); @@ -818,11 +820,31 @@ filter_apply(GtkWidget *main_w, gboolean destroy) static void filter_dlg_save_cb(GtkWidget *save_bt _U_, gpointer data) { - filter_list_type_t list = *(filter_list_type_t *)data; + filter_list_type_t list_type = *(filter_list_type_t *)data; char *pf_dir_path; char *f_path; int f_save_errno; - const char *filter_type; + const char *filter_type; + + switch (list_type) { + + case CFILTER_EDITED_LIST: + filter_type = "capture"; + list_type = CFILTER_LIST; + copy_filter_list(CFILTER_LIST, CFILTER_EDITED_LIST); + break; + + case DFILTER_EDITED_LIST: + filter_type = "display"; + list_type = DFILTER_LIST; + copy_filter_list(DFILTER_LIST, DFILTER_EDITED_LIST); + break; + + default: + g_assert_not_reached(); + filter_type = NULL; + break; + } /* Create the directory that holds personal configuration files, if necessary. */ @@ -834,24 +856,9 @@ filter_dlg_save_cb(GtkWidget *save_bt _U_, gpointer data) return; } - save_filter_list(list, &f_path, &f_save_errno); + save_filter_list(list_type, &f_path, &f_save_errno); if (f_path != NULL) { /* We had an error saving the filter. */ - switch (list) { - - case CFILTER_LIST: - filter_type = "capture"; - break; - - case DFILTER_LIST: - filter_type = "display"; - break; - - default: - g_assert_not_reached(); - filter_type = NULL; - break; - } simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Could not save to your %s filter file\n\"%s\": %s.", filter_type, f_path, strerror(f_save_errno)); @@ -859,10 +866,45 @@ filter_dlg_save_cb(GtkWidget *save_bt _U_, gpointer data) } } +/* cancel button pressed, revert changes saved and exit dialog */ +static void +filter_dlg_cancel_cb(GtkWidget *cancel_bt, gpointer data) +{ + filter_list_type_t list_type = *(filter_list_type_t *)data; + GtkWidget *main_w = gtk_widget_get_toplevel(cancel_bt); + + + /* revert changes in the edited list */ + /* XXX - how to tell other dialogs that the list changed? */ + switch (list_type) { + case CFILTER_EDITED_LIST: + copy_filter_list(CFILTER_EDITED_LIST, CFILTER_LIST); + break; + case DFILTER_EDITED_LIST: + copy_filter_list(DFILTER_EDITED_LIST, DFILTER_LIST); + break; + default: + g_assert_not_reached(); + break; + } + + window_destroy(GTK_WIDGET(main_w)); +} + +/* Treat this as a cancel, by calling "filter_dlg_cancel_cb()" */ +static gboolean +filter_dlg_delete_event_cb(GtkWidget *main_w, GdkEvent *event _U_, + gpointer data) +{ + filter_dlg_cancel_cb(main_w, data); + return FALSE; +} + + static void filter_dlg_destroy_cb(GtkWidget *win, gpointer data) { - filter_list_type_t list = *(filter_list_type_t *)data; + filter_list_type_t list_type = *(filter_list_type_t *)data; GtkWidget *button; /* Get the button that requested that we be popped up, if any. @@ -876,10 +918,10 @@ filter_dlg_destroy_cb(GtkWidget *win, gpointer data) } else { /* This is an editing dialog popped up from, for example, a menu item; note that we no longer have one. */ - switch (list) { + switch (list_type) { #ifdef HAVE_LIBPCAP - case CFILTER_LIST: + case CFILTER_EDITED_LIST: g_assert(win == global_cfilter_w); global_cfilter_w = NULL; break; @@ -891,7 +933,7 @@ filter_dlg_destroy_cb(GtkWidget *win, gpointer data) } /* Remove this from the list of filter dialog windows. */ - forget_filter_dialog(win, list); + forget_filter_dialog(win, list_type); } #if GTK_MAJOR_VERSION < 2 @@ -1074,7 +1116,7 @@ filter_new_bt_clicked_cb(GtkWidget *w, gpointer data) GtkWidget *name_te = OBJECT_GET_DATA(main_w, E_FILT_NAME_TE_KEY); GtkWidget *filter_te = OBJECT_GET_DATA(main_w, E_FILT_FILTER_TE_KEY); GtkWidget *filter_l = OBJECT_GET_DATA(main_w, E_FILT_FILTER_L_KEY); - filter_list_type_t list = *(filter_list_type_t *)data; + filter_list_type_t list_type = *(filter_list_type_t *)data; GList *fl_entry; const gchar *name, *strval; new_filter_cb_args_t args; @@ -1093,13 +1135,13 @@ filter_new_bt_clicked_cb(GtkWidget *w, gpointer data) } /* Add a new entry to the filter list. */ - fl_entry = add_to_filter_list(list, name, strval); + fl_entry = add_to_filter_list(list_type, name, strval); /* Update all the filter list widgets, not just the one in the dialog box in which we clicked on "Copy". */ args.active_filter_l = filter_l; args.nflp = fl_entry; - g_list_foreach(get_filter_dialog_list(list), new_filter_cb, &args); + g_list_foreach(get_filter_dialog_list(list_type), new_filter_cb, &args); } @@ -1165,7 +1207,7 @@ filter_name_te_changed_cb(GtkWidget *w, gpointer data) GtkWidget *filter_l = OBJECT_GET_DATA(main_w, E_FILT_FILTER_L_KEY); filter_def *filt; GList *fl_entry; - filter_list_type_t list = *(filter_list_type_t *)data; + filter_list_type_t list_type = *(filter_list_type_t *)data; const gchar *name = ""; const gchar *strval = ""; @@ -1187,7 +1229,7 @@ filter_name_te_changed_cb(GtkWidget *w, gpointer data) name = gtk_entry_get_text(GTK_ENTRY(name_te)); strval = gtk_entry_get_text(GTK_ENTRY(filter_te)); - if (DFILTER_LIST == list) { + if (DFILTER_EDITED_LIST == list_type) { /* colorize filter string entry */ filter_te_syntax_check_cb(filter_te); } @@ -1215,7 +1257,7 @@ filter_name_te_changed_cb(GtkWidget *w, gpointer data) /* Update all the filter list widgets, not just the one in the dialog box in which we clicked on "Copy". */ - g_list_foreach(get_filter_dialog_list(list), chg_filter_cb, + g_list_foreach(get_filter_dialog_list(list_type), chg_filter_cb, fl_entry); } } @@ -1248,7 +1290,7 @@ filter_del_bt_clicked_cb(GtkWidget *w, gpointer data) { GtkWidget *main_w = gtk_widget_get_toplevel(w); GtkWidget *filter_l = OBJECT_GET_DATA(main_w, E_FILT_FILTER_L_KEY); - filter_list_type_t list = *(filter_list_type_t *)data; + filter_list_type_t list_type = *(filter_list_type_t *)data; GList *fl_entry; #if GTK_MAJOR_VERSION < 2 GList *sl; @@ -1280,15 +1322,15 @@ filter_del_bt_clicked_cb(GtkWidget *w, gpointer data) #endif if (fl_entry != NULL) { /* Remove the entry from the filter list. */ - remove_from_filter_list(list, fl_entry); + remove_from_filter_list(list_type, fl_entry); /* Update all the filter list widgets, not just the one in the dialog box in which we clicked on "Delete". */ #if GTK_MAJOR_VERSION < 2 - g_list_foreach(get_filter_dialog_list(list), delete_filter_cb, + g_list_foreach(get_filter_dialog_list(list_type), delete_filter_cb, &pos); #else - g_list_foreach(get_filter_dialog_list(list), delete_filter_cb, pos); + g_list_foreach(get_filter_dialog_list(list_type), delete_filter_cb, pos); #endif } #if GTK_MAJOR_VERSION >= 2 |