apply automatically generated filters strings to the recent dropdown list,
e.g. when applying a "Follow TCP stream", fix a bug in the recent function, discarding the newest entries when saving a full list (now discarding the oldest). svn path=/trunk/; revision=9849
This commit is contained in:
parent
b023bf8c7d
commit
c890e29a99
|
@ -4,7 +4,7 @@
|
|||
* endpoint_talkers_table 2003 Ronnie Sahlberg
|
||||
* Helper routines common to all endpoint talkers tap.
|
||||
*
|
||||
* $Id: endpoint_talkers_table.c,v 1.27 2004/01/13 22:49:14 guy Exp $
|
||||
* $Id: endpoint_talkers_table.c,v 1.28 2004/01/25 18:51:25 ulfl Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -47,6 +47,7 @@
|
|||
#include "color.h"
|
||||
#include "gtk/color_dlg.h"
|
||||
#include "gtkglobals.h"
|
||||
#include "main.h"
|
||||
|
||||
extern GtkWidget *main_display_filter_widget;
|
||||
|
||||
|
@ -517,7 +518,7 @@ ett_select_filter_cb(GtkWidget *widget _U_, gpointer callback_data, guint callba
|
|||
case 0:
|
||||
/* match */
|
||||
gtk_entry_set_text(GTK_ENTRY(main_display_filter_widget), str);
|
||||
filter_packets(&cfile, str);
|
||||
main_filter_packets(&cfile, str);
|
||||
gdk_window_raise(top_level->window);
|
||||
break;
|
||||
case 1:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* follow_dlg.c
|
||||
*
|
||||
* $Id: follow_dlg.c,v 1.38 2004/01/25 01:53:24 guy Exp $
|
||||
* $Id: follow_dlg.c,v 1.39 2004/01/25 18:51:25 ulfl Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -232,7 +232,7 @@ follow_stream_cb(GtkWidget * w, gpointer data _U_)
|
|||
gtk_entry_set_text(GTK_ENTRY(filter_te), follow_filter);
|
||||
|
||||
/* Run the display filter so it goes in effect. */
|
||||
filter_packets(&cfile, follow_filter);
|
||||
main_filter_packets(&cfile, follow_filter);
|
||||
|
||||
/* Free the filter string, as we're done with it. */
|
||||
g_free(follow_filter);
|
||||
|
@ -729,7 +729,7 @@ follow_filter_out_stream(GtkWidget * w _U_, gpointer data)
|
|||
gtk_entry_set_text(GTK_ENTRY(follow_info->filter_te), follow_info->filter_out_filter);
|
||||
|
||||
/* Run the display filter so it goes in effect. */
|
||||
filter_packets(&cfile, follow_info->filter_out_filter);
|
||||
main_filter_packets(&cfile, follow_info->filter_out_filter);
|
||||
|
||||
/* we force a subsequent close */
|
||||
gtk_widget_destroy(follow_info->streamwindow);
|
||||
|
|
54
gtk/main.c
54
gtk/main.c
|
@ -1,6 +1,6 @@
|
|||
/* main.c
|
||||
*
|
||||
* $Id: main.c,v 1.373 2004/01/25 15:10:36 ulfl Exp $
|
||||
* $Id: main.c,v 1.374 2004/01/25 18:51:25 ulfl Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -458,7 +458,7 @@ match_selected_cb_do(gpointer data, int action, gchar *text)
|
|||
|
||||
/* Run the display filter so it goes in effect. */
|
||||
if (action&MATCH_SELECTED_APPLY_NOW)
|
||||
filter_packets(&cfile, new_filter);
|
||||
main_filter_packets(&cfile, new_filter);
|
||||
|
||||
/* Free up the new filter text. */
|
||||
g_free(new_filter);
|
||||
|
@ -711,8 +711,7 @@ prepare_selected_cb_or_plist_not(GtkWidget *w _U_, gpointer data)
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* XXX: use a preference for this setting! */
|
||||
static guint dfilter_combo_max_recent = 10;
|
||||
|
||||
/* add a display filter to the combo box */
|
||||
|
@ -766,6 +765,14 @@ dfilter_recent_combo_write_all(FILE *rf) {
|
|||
}
|
||||
}
|
||||
|
||||
/* empty the combobox entry field */
|
||||
void
|
||||
dfilter_combo_add_empty(void) {
|
||||
GtkWidget *filter_cm = OBJECT_GET_DATA(top_level, E_DFILTER_CM_KEY);
|
||||
|
||||
gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(filter_cm)->entry), "");
|
||||
}
|
||||
|
||||
|
||||
/* add a display filter coming from the user's recent file to the dfilter combo box */
|
||||
gboolean
|
||||
|
@ -783,25 +790,25 @@ dfilter_combo_add_recent(gchar *s) {
|
|||
}
|
||||
|
||||
|
||||
/* Run the current display filter on the current packet set, and
|
||||
redisplay. */
|
||||
static void
|
||||
filter_activate_cb(GtkWidget *w, gpointer data)
|
||||
/* call filter_packets() and add this filter string to the recent filter list */
|
||||
int
|
||||
main_filter_packets(capture_file *cf, const gchar *dftext)
|
||||
{
|
||||
GtkCombo *filter_cm = OBJECT_GET_DATA(w, E_DFILTER_CM_KEY);
|
||||
GtkCombo *filter_cm = OBJECT_GET_DATA(top_level, E_DFILTER_CM_KEY);
|
||||
GList *filter_list = OBJECT_GET_DATA(filter_cm, E_DFILTER_FL_KEY);
|
||||
GList *li;
|
||||
gboolean add_filter = TRUE;
|
||||
gboolean free_filter = TRUE;
|
||||
char *s;
|
||||
int filter_packets_ret;
|
||||
|
||||
g_assert(data);
|
||||
s = g_strdup(gtk_entry_get_text(GTK_ENTRY(data)));
|
||||
|
||||
s = g_strdup(dftext);
|
||||
|
||||
/* GtkCombos don't let us get at their list contents easily, so we maintain
|
||||
our own filter list, and feed it to gtk_combo_set_popdown_strings when
|
||||
a new filter is added. */
|
||||
if (filter_packets(&cfile, s)) {
|
||||
if ((filter_packets_ret = filter_packets(&cfile, s))) {
|
||||
li = g_list_first(filter_list);
|
||||
while (li) {
|
||||
if (li->data && strcmp(s, li->data) == 0)
|
||||
|
@ -810,6 +817,11 @@ filter_activate_cb(GtkWidget *w, gpointer data)
|
|||
}
|
||||
|
||||
if (add_filter) {
|
||||
/* trim list size first */
|
||||
while (g_list_length(filter_list) >= dfilter_combo_max_recent) {
|
||||
filter_list = g_list_remove(filter_list, g_list_first(filter_list)->data);
|
||||
}
|
||||
|
||||
free_filter = FALSE;
|
||||
filter_list = g_list_append(filter_list, s);
|
||||
OBJECT_SET_DATA(filter_cm, E_DFILTER_FL_KEY, filter_list);
|
||||
|
@ -819,6 +831,21 @@ filter_activate_cb(GtkWidget *w, gpointer data)
|
|||
}
|
||||
if (free_filter)
|
||||
g_free(s);
|
||||
|
||||
return filter_packets_ret;
|
||||
}
|
||||
|
||||
|
||||
/* Run the current display filter on the current packet set, and
|
||||
redisplay. */
|
||||
static void
|
||||
filter_activate_cb(GtkWidget *w, gpointer data)
|
||||
{
|
||||
const char *s;
|
||||
|
||||
s = gtk_entry_get_text(GTK_ENTRY(data));
|
||||
|
||||
main_filter_packets(&cfile, s);
|
||||
}
|
||||
|
||||
/* redisplay with no display filter */
|
||||
|
@ -3405,8 +3432,7 @@ create_main_window (gint pl_size, gint tv_size, gint bv_size, e_prefs *prefs)
|
|||
"Open the \"Display Filter\" dialog, to edit/apply filters", "Private");
|
||||
|
||||
filter_cm = gtk_combo_new();
|
||||
filter_list = g_list_append (filter_list, "");
|
||||
gtk_combo_set_popdown_strings(GTK_COMBO(filter_cm), filter_list);
|
||||
filter_list = NULL;
|
||||
gtk_combo_disable_activate(GTK_COMBO(filter_cm));
|
||||
gtk_combo_set_case_sensitive(GTK_COMBO(filter_cm), TRUE);
|
||||
OBJECT_SET_DATA(filter_cm, E_DFILTER_FL_KEY, filter_list);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* main.h
|
||||
* Global defines, etc.
|
||||
*
|
||||
* $Id: main.h,v 1.38 2004/01/24 01:02:54 guy Exp $
|
||||
* $Id: main.h,v 1.39 2004/01/25 18:51:25 ulfl Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -102,9 +102,11 @@ void resolve_name_cb(GtkWidget *, gpointer);
|
|||
void reftime_frame_cb(GtkWidget *, gpointer, guint);
|
||||
|
||||
extern gboolean dfilter_combo_add_recent(gchar *s);
|
||||
extern void dfilter_combo_add_empty(void);
|
||||
extern void dfilter_recent_combo_write_all(FILE *rf);
|
||||
|
||||
extern void main_widgets_rearrange(void);
|
||||
extern int main_filter_packets(capture_file *cf, const gchar *dftext);
|
||||
|
||||
typedef enum {
|
||||
FA_SUCCESS,
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Recent "preference" handling routines
|
||||
* Copyright 2004, Ulf Lamping <ulf.lamping@web.de>
|
||||
*
|
||||
* $Id: recent.c,v 1.6 2004/01/24 01:02:54 guy Exp $
|
||||
* $Id: recent.c,v 1.7 2004/01/25 18:51:25 ulfl Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -244,8 +244,8 @@ read_recent(char **rf_path_return, int *rf_errno_return)
|
|||
if ((rf = fopen(rf_path, "r")) != NULL) {
|
||||
/* We succeeded in opening it; read it. */
|
||||
read_prefs_file(rf_path, rf, read_set_recent_pair);
|
||||
/* set dfilter combobox to have one empty line at the current position */
|
||||
dfilter_combo_add_recent("");
|
||||
/* set dfilter combobox to have an empty line */
|
||||
dfilter_combo_add_empty();
|
||||
fclose(rf);
|
||||
g_free(rf_path);
|
||||
rf_path = NULL;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* rtp_stream_dlg.c
|
||||
* RTP streams summary addition for ethereal
|
||||
*
|
||||
* $Id: rtp_stream_dlg.c,v 1.10 2004/01/25 02:24:44 guy Exp $
|
||||
* $Id: rtp_stream_dlg.c,v 1.11 2004/01/25 18:51:25 ulfl Exp $
|
||||
*
|
||||
* Copyright 2003, Alcatel Business Systems
|
||||
* By Lars Ruoff <lars.ruoff@gmx.net>
|
||||
|
@ -324,7 +324,7 @@ rtpstream_on_filter (GtkButton *button _U_,
|
|||
|
||||
gtk_entry_set_text(GTK_ENTRY(main_display_filter_widget), filter_string);
|
||||
/*
|
||||
filter_packets(&cfile, filter_string);
|
||||
main_filter_packets(&cfile, filter_string);
|
||||
rtpstream_dlg_update(rtpstream_get_info()->strinfo_list);
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Helper routines common to all service response time statistics
|
||||
* tap.
|
||||
*
|
||||
* $Id: service_response_time_table.c,v 1.11 2003/12/04 00:45:39 guy Exp $
|
||||
* $Id: service_response_time_table.c,v 1.12 2004/01/25 18:51:26 ulfl Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -43,6 +43,7 @@
|
|||
#include "gtk/find_dlg.h"
|
||||
#include "color.h"
|
||||
#include "gtk/color_dlg.h"
|
||||
#include "main.h"
|
||||
|
||||
extern GtkWidget *main_display_filter_widget;
|
||||
#define GTK_MENU_FUNC(a) ((GtkItemFactoryCallback)(a))
|
||||
|
@ -210,7 +211,7 @@ srt_select_filter_cb(GtkWidget *widget _U_, gpointer callback_data, guint callba
|
|||
switch(action){
|
||||
case 0:
|
||||
/* match */
|
||||
filter_packets(&cfile, str);
|
||||
main_filter_packets(&cfile, str);
|
||||
case 1:
|
||||
/* prepare */
|
||||
/* do nothing */
|
||||
|
|
Loading…
Reference in New Issue