diff options
-rw-r--r-- | gtk/color_dlg.c | 40 | ||||
-rw-r--r-- | gtk/color_dlg.h | 3 | ||||
-rw-r--r-- | gtk/endpoint_talkers_table.c | 27 |
3 files changed, 62 insertions, 8 deletions
diff --git a/gtk/color_dlg.c b/gtk/color_dlg.c index 97922d0b41..9d7cea734e 100644 --- a/gtk/color_dlg.c +++ b/gtk/color_dlg.c @@ -1,7 +1,7 @@ /* color_dlg.c * Definitions for dialog boxes for color filters * - * $Id: color_dlg.c,v 1.26 2003/08/27 22:55:51 guy Exp $ + * $Id: color_dlg.c,v 1.27 2003/10/07 10:07:47 sahlberg Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -46,7 +46,7 @@ #include "compat_macros.h" #include "file_dlg.h" -static GtkWidget* colorize_dialog_new(void); +static GtkWidget* colorize_dialog_new(char *filter); static void add_filter_to_list(gpointer filter_arg, gpointer list_arg); static void color_filter_up_cb(GtkButton *button, gpointer user_data); static void color_filter_down_cb(GtkButton *button, gpointer user_data); @@ -60,6 +60,7 @@ static void remember_selected_row(GtkTreeSelection *sel, gpointer list); #endif static void color_destroy_cb(GtkButton *button, gpointer user_data); static void destroy_edit_dialog_cb(gpointer filter_arg, gpointer dummy); +static void create_new_color_filter(GtkButton *button, char *filter); static void color_new_cb(GtkButton *button, gpointer user_data); static void color_edit_cb(GtkButton *button, gpointer user_data); static void color_delete_cb(GtkWidget *widget, gpointer user_data); @@ -120,7 +121,20 @@ color_display_cb(GtkWidget *w _U_, gpointer d _U_) reactivate_window(colorize_win); } else { /* Create a new "Colorize Display" dialog. */ - colorize_win = colorize_dialog_new(); + colorize_win = colorize_dialog_new(NULL); + } +} + +/* this opens the colorize dialogue and presets the filter string */ +void +color_display_with_filter(char *filter) +{ + if (colorize_win != NULL) { + /* There's already a color dialog box active; reactivate it. */ + reactivate_window(colorize_win); + } else { + /* Create a new "Colorize Display" dialog. */ + colorize_win = colorize_dialog_new(filter); } } @@ -147,7 +161,7 @@ int color_marked_count(void) /* Create the "Apply Color Filters" dialog. */ static GtkWidget* -colorize_dialog_new (void) +colorize_dialog_new (char *filter) { GtkWidget *color_win; GtkWidget *dlg_vbox; @@ -508,6 +522,12 @@ colorize_dialog_new (void) dlg_set_cancel(color_win, color_cancel); + if(filter){ + /* if we specified a preset filter string, open the new dialog and + set the filter */ + create_new_color_filter(GTK_BUTTON(color_new), filter); + } + return color_win; } @@ -950,7 +970,7 @@ color_import_cb(GtkButton *button, gpointer user_data ) /* Create a new filter in the list, and pop up an "Edit color filter" dialog box to edit it. */ static void -color_new_cb(GtkButton *button, gpointer user_data _U_) +create_new_color_filter(GtkButton *button, char *filter) { color_filter_t *colorf; GtkWidget *color_filters; @@ -967,7 +987,7 @@ color_new_cb(GtkButton *button, gpointer user_data _U_) gtk_clist_unselect_all (GTK_CLIST(color_filters)); #endif - colorf = new_color_filter("name", "filter"); /* Adds at end! */ + colorf = new_color_filter("name", filter); /* Adds at end! */ color_add_colorf(color_filters, colorf); @@ -979,6 +999,14 @@ color_new_cb(GtkButton *button, gpointer user_data _U_) #endif } +/* Create a new filter in the list, and pop up an "Edit color filter" + dialog box to edit it. */ +static void +color_new_cb(GtkButton *button, gpointer user_data _U_) +{ + create_new_color_filter(button, "filter"); +} + /* Pop up an "Edit color filter" dialog box to edit an existing filter. */ static void color_edit_cb(GtkButton *button, gpointer user_data _U_) diff --git a/gtk/color_dlg.h b/gtk/color_dlg.h index 05b7198211..bd772e5fd6 100644 --- a/gtk/color_dlg.h +++ b/gtk/color_dlg.h @@ -1,7 +1,7 @@ /* color_dlg.h * Definitions for dialog boxes for color filters * - * $Id: color_dlg.h,v 1.3 2003/08/18 21:27:10 sahlberg Exp $ + * $Id: color_dlg.h,v 1.4 2003/10/07 10:07:47 sahlberg Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -26,6 +26,7 @@ #ifndef __COLOR_DLG_H__ #define __COLOR_DLG_H__ +void color_display_with_filter(char *filter); void color_display_cb(GtkWidget *w, gpointer d); int color_marked_count(void); void color_add_filter_cb (color_filter_t *colorf, gpointer arg); diff --git a/gtk/endpoint_talkers_table.c b/gtk/endpoint_talkers_table.c index 12c49a0581..3257bd00b4 100644 --- a/gtk/endpoint_talkers_table.c +++ b/gtk/endpoint_talkers_table.c @@ -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.21 2003/10/07 09:30:34 sahlberg Exp $ + * $Id: endpoint_talkers_table.c,v 1.22 2003/10/07 10:07:47 sahlberg Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -316,6 +316,7 @@ ett_click_column_cb(GtkCList *clist, gint column, gpointer data) 2: Find Frame 3: Find Next 4: Find Previous + 5: Colorize Conversation filter_type: 0: Selected 1: Not Selected @@ -530,6 +531,10 @@ ett_select_filter_cb(GtkWidget *widget _U_, gpointer callback_data, guint callba /* find previous */ find_previous_next_frame_with_filter(str, TRUE); break; + case 5: + /* colorize conversation */ + color_display_with_filter(str); + break; } } @@ -855,6 +860,26 @@ static GtkItemFactoryEntry ett_list_menu_items[] = ett_select_filter_cb, 4*65536+0*256+7, NULL, NULL), ITEM_FACTORY_ENTRY("/Find Frame/Find Previous/ANY --> EP2", NULL, ett_select_filter_cb, 4*65536+0*256+8, NULL, NULL), + /* Colorize Conversation */ + ITEM_FACTORY_ENTRY("/Colorize Conversation", NULL, NULL, 0, "<Branch>", NULL), + ITEM_FACTORY_ENTRY("/Colorize Conversation/EP1 <-> EP2", NULL, + ett_select_filter_cb, 5*65536+0*256+0, NULL, NULL), + ITEM_FACTORY_ENTRY("/Colorize Conversation/EP1 --> EP2", NULL, + ett_select_filter_cb, 5*65536+0*256+1, NULL, NULL), + ITEM_FACTORY_ENTRY("/Colorize Conversation/EP1 <-- EP2", NULL, + ett_select_filter_cb, 5*65536+0*256+2, NULL, NULL), + ITEM_FACTORY_ENTRY("/Colorize Conversation/EP1 <-> ANY", NULL, + ett_select_filter_cb, 5*65536+0*256+3, NULL, NULL), + ITEM_FACTORY_ENTRY("/Colorize Conversation/EP1 --> ANY", NULL, + ett_select_filter_cb, 5*65536+0*256+4, NULL, NULL), + ITEM_FACTORY_ENTRY("/Colorize Conversation/EP1 <-- ANY", NULL, + ett_select_filter_cb, 5*65536+0*256+5, NULL, NULL), + ITEM_FACTORY_ENTRY("/Colorize Conversation/ANY <-> EP2", NULL, + ett_select_filter_cb, 5*65536+0*256+6, NULL, NULL), + ITEM_FACTORY_ENTRY("/Colorize Conversation/ANY <-- EP2", NULL, + ett_select_filter_cb, 5*65536+0*256+7, NULL, NULL), + ITEM_FACTORY_ENTRY("/Colorize Conversation/ANY --> EP2", NULL, + ett_select_filter_cb, 5*65536+0*256+8, NULL, NULL), }; |