1999-11-06 06:28:07 +00:00
/* find_dlg.c
* Routines for " find frame " window
*
2003-08-28 23:25:55 +00:00
* $ Id : find_dlg . c , v 1.32 2003 / 08 / 28 23 : 25 : 55 guy Exp $
1999-11-06 06:28:07 +00:00
*
* Ethereal - Network traffic analyzer
2002-01-21 07:37:49 +00:00
* By Gerald Combs < gerald @ ethereal . com >
1999-11-06 06:28:07 +00:00
* Copyright 1998 Gerald Combs
2002-08-28 21:04:11 +00:00
*
1999-11-06 06:28:07 +00:00
* This program is free software ; you can redistribute it and / or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation ; either version 2
* of the License , or ( at your option ) any later version .
2002-08-28 21:04:11 +00:00
*
1999-11-06 06:28:07 +00:00
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
2002-08-28 21:04:11 +00:00
*
1999-11-06 06:28:07 +00:00
* You should have received a copy of the GNU General Public License
* along with this program ; if not , write to the Free Software
* Foundation , Inc . , 59 Temple Place - Suite 330 , Boston , MA 02111 - 1307 , USA .
*/
# ifdef HAVE_CONFIG_H
# include "config.h"
# endif
# include <gtk/gtk.h>
2002-01-21 07:37:49 +00:00
# include <epan/proto.h>
# include <epan/dfilter/dfilter.h>
1999-11-06 06:28:07 +00:00
# include "globals.h"
Split "filter_dialog_cb()" into "filter_dialog_cb()", which pops up a
"global" dialog box when "Edit:Filters" is selected, so that the list of
filters can be edited, and "filter_browse_cb()", which pops up a dialog
box associated with a "Filter:" button and a text entry widget attached
to that button, so that a filter can be selected or saved (although it
also supports the same editing that the "global" dialog box does).
Have "filter_dialog_cb()" connect the window in which the "Filter:"
button lives and the filter dialog box, so that:
if the window in which the "Filter:" button lives goes away, so
does the filter dialog box (as it no longer has a text widget
into which it can stuff the selected filter);
if the "Filter:" button is clicked when there's already a filter
dialog box open, we just reactivate that existing dialog box
rather than popping up a new one.
Also keep a pointer to the "global" filter dialog box, so that we also
arrange that there's only one of them (by reactivating the existing on
if "Edit:Filters" is selected when there's already a "global" filter
dialog box open).
Keep around pointers to the dialog boxes that contain the "Filter:"
buttons, so that we can arrange that there be only one of them (that was
a side-effect of an earlier attempt at fixing the problems described
above, but it's still useful for keeping multiple competing dialog boxes
from being open - there's more of that to be done).
Make the pointer to the "Open Capture File" dialog box widget static to
"file_dlg.c" - nobody outside of "file_dlg.c cares about it.
svn path=/trunk/; revision=1774
2000-04-01 12:03:42 +00:00
# include "ui_util.h"
1999-11-06 06:28:07 +00:00
# include "find_dlg.h"
2000-02-12 06:46:54 +00:00
# include "filter_prefs.h"
2000-01-03 06:59:25 +00:00
# include "simple_dialog.h"
2000-05-02 08:04:31 +00:00
# include "dlg_utils.h"
2002-11-11 15:39:06 +00:00
# include "compat_macros.h"
2003-07-22 23:08:48 +00:00
# include "prefs.h"
# include "prefs_dlg.h"
2003-08-11 22:41:10 +00:00
# include "keys.h"
1999-11-06 06:28:07 +00:00
/* Capture callback data keys */
# define E_FIND_FILT_KEY "find_filter_te"
# define E_FIND_BACKWARD_KEY "find_backward"
2003-07-22 23:08:48 +00:00
# define E_FIND_HEXDATA_KEY "find_hex"
# define E_FIND_ASCIIDATA_KEY "find_ascii"
# define E_FIND_FILTERDATA_KEY "find_filter"
# define E_FIND_STRINGTYPE_KEY "find_string_type"
2003-08-05 00:01:27 +00:00
# define E_CASE_SEARCH_KEY "case_insensitive_search"
2003-08-11 22:41:10 +00:00
# define E_SOURCE_HEX_KEY "hex_data_source"
# define E_SOURCE_DECODE_KEY "decode_data_source"
# define E_SOURCE_SUMMARY_KEY "summary_data_source"
2003-08-28 23:25:55 +00:00
# define E_FILT_TE_BUTTON_KEY "find_filter_button"
2003-08-05 00:01:27 +00:00
static gboolean case_type = TRUE ;
2003-08-11 22:41:10 +00:00
static gboolean summary_data = FALSE ;
static gboolean decode_data = FALSE ;
1999-11-06 06:28:07 +00:00
static void
find_frame_ok_cb ( GtkWidget * ok_bt , gpointer parent_w ) ;
static void
find_frame_close_cb ( GtkWidget * close_bt , gpointer parent_w ) ;
Split "filter_dialog_cb()" into "filter_dialog_cb()", which pops up a
"global" dialog box when "Edit:Filters" is selected, so that the list of
filters can be edited, and "filter_browse_cb()", which pops up a dialog
box associated with a "Filter:" button and a text entry widget attached
to that button, so that a filter can be selected or saved (although it
also supports the same editing that the "global" dialog box does).
Have "filter_dialog_cb()" connect the window in which the "Filter:"
button lives and the filter dialog box, so that:
if the window in which the "Filter:" button lives goes away, so
does the filter dialog box (as it no longer has a text widget
into which it can stuff the selected filter);
if the "Filter:" button is clicked when there's already a filter
dialog box open, we just reactivate that existing dialog box
rather than popping up a new one.
Also keep a pointer to the "global" filter dialog box, so that we also
arrange that there's only one of them (by reactivating the existing on
if "Edit:Filters" is selected when there's already a "global" filter
dialog box open).
Keep around pointers to the dialog boxes that contain the "Filter:"
buttons, so that we can arrange that there be only one of them (that was
a side-effect of an earlier attempt at fixing the problems described
above, but it's still useful for keeping multiple competing dialog boxes
from being open - there's more of that to be done).
Make the pointer to the "Open Capture File" dialog box widget static to
"file_dlg.c" - nobody outside of "file_dlg.c cares about it.
svn path=/trunk/; revision=1774
2000-04-01 12:03:42 +00:00
static void
find_frame_destroy_cb ( GtkWidget * win , gpointer user_data ) ;
2003-08-11 22:41:10 +00:00
static void
ascii_selected_cb ( GtkWidget * button_rb _U_ , gpointer parent_w ) ;
2003-08-28 23:25:55 +00:00
static void
filter_selected_cb ( GtkWidget * button_rb _U_ , gpointer parent_w ) ;
Split "filter_dialog_cb()" into "filter_dialog_cb()", which pops up a
"global" dialog box when "Edit:Filters" is selected, so that the list of
filters can be edited, and "filter_browse_cb()", which pops up a dialog
box associated with a "Filter:" button and a text entry widget attached
to that button, so that a filter can be selected or saved (although it
also supports the same editing that the "global" dialog box does).
Have "filter_dialog_cb()" connect the window in which the "Filter:"
button lives and the filter dialog box, so that:
if the window in which the "Filter:" button lives goes away, so
does the filter dialog box (as it no longer has a text widget
into which it can stuff the selected filter);
if the "Filter:" button is clicked when there's already a filter
dialog box open, we just reactivate that existing dialog box
rather than popping up a new one.
Also keep a pointer to the "global" filter dialog box, so that we also
arrange that there's only one of them (by reactivating the existing on
if "Edit:Filters" is selected when there's already a "global" filter
dialog box open).
Keep around pointers to the dialog boxes that contain the "Filter:"
buttons, so that we can arrange that there be only one of them (that was
a side-effect of an earlier attempt at fixing the problems described
above, but it's still useful for keeping multiple competing dialog boxes
from being open - there's more of that to be done).
Make the pointer to the "Open Capture File" dialog box widget static to
"file_dlg.c" - nobody outside of "file_dlg.c cares about it.
svn path=/trunk/; revision=1774
2000-04-01 12:03:42 +00:00
/*
* Keep a static pointer to the current " Find Frame " window , if any , so
* that if somebody tries to do " Find Frame " while there ' s already a
* " Find Frame " window up , we just pop up the existing one , rather than
* creating a new one .
*/
static GtkWidget * find_frame_w ;
1999-11-06 06:28:07 +00:00
void
2002-03-05 11:56:00 +00:00
find_frame_cb ( GtkWidget * w _U_ , gpointer d _U_ )
1999-11-06 06:28:07 +00:00
{
Split "filter_dialog_cb()" into "filter_dialog_cb()", which pops up a
"global" dialog box when "Edit:Filters" is selected, so that the list of
filters can be edited, and "filter_browse_cb()", which pops up a dialog
box associated with a "Filter:" button and a text entry widget attached
to that button, so that a filter can be selected or saved (although it
also supports the same editing that the "global" dialog box does).
Have "filter_dialog_cb()" connect the window in which the "Filter:"
button lives and the filter dialog box, so that:
if the window in which the "Filter:" button lives goes away, so
does the filter dialog box (as it no longer has a text widget
into which it can stuff the selected filter);
if the "Filter:" button is clicked when there's already a filter
dialog box open, we just reactivate that existing dialog box
rather than popping up a new one.
Also keep a pointer to the "global" filter dialog box, so that we also
arrange that there's only one of them (by reactivating the existing on
if "Edit:Filters" is selected when there's already a "global" filter
dialog box open).
Keep around pointers to the dialog boxes that contain the "Filter:"
buttons, so that we can arrange that there be only one of them (that was
a side-effect of an earlier attempt at fixing the problems described
above, but it's still useful for keeping multiple competing dialog boxes
from being open - there's more of that to be done).
Make the pointer to the "Open Capture File" dialog box widget static to
"file_dlg.c" - nobody outside of "file_dlg.c cares about it.
svn path=/trunk/; revision=1774
2000-04-01 12:03:42 +00:00
GtkWidget * main_vb , * filter_hb , * filter_bt , * filter_te ,
2003-07-22 23:08:48 +00:00
* direction_hb , * forward_rb , * backward_rb ,
* hex_hb , * hex_rb , * ascii_rb , * filter_rb ,
2003-08-11 22:41:10 +00:00
* data_hb , * hex_data_rb , * decode_data_rb , * summary_data_rb ,
2003-08-28 23:25:55 +00:00
* combo_cb ,
* bbox , * ok_bt , * cancel_bt , * case_cb ,
* direction_frame , * find_type_frame , * string_window_frame ,
* string_char_frame , * string_opt_frame ;
GtkTooltips * tooltips ;
2002-11-03 17:38:45 +00:00
# if GTK_MAJOR_VERSION < 2
2000-05-08 04:53:21 +00:00
GtkAccelGroup * accel_group ;
2002-11-03 17:38:45 +00:00
# endif
2003-07-22 23:08:48 +00:00
GList * glist = NULL ;
In the process of destroying a filter editing dialog box, we get a
selection change event on the list of filters. Unfortunately, this can
happen after some other widgets in that dialog box have already been
destroyed - including some of the widgets that such a selection change
event can change.
This sometimes happened when "filter_prefs_delete()" hadn't been called,
so the mechanism we had been using, with a Boolean datum attached to the
dialog box, set in "filter_prefs_delete()" before we actually destroy
the dialog box, wasn't sufficient to keep that from happening.
Attach to the top-level window data items containing pointers to the
widgets changed when a filter is selected from the list, give each of
those widgets their own destroy callbacks, clear the pointer attached to
the top-level widget when the widget is destroyed, and don't do anything
to the widget when a filter is selected from the list if the pointer for
that widget is null, as that means the widget's been destroyed and we
*can't* do anything to it.
Not all filter editing dialogs created on behalf of a "Filter:" button
next to a text entry box should, when you click "OK", activate the text
entry box; if the text entry box is part of a dialog box with multiple
widgets, the user might not have filled in all of the items in that
dialog box, so you shouldn't activate it for them. Add a mechanism by
which, when creating a filter editing dialog box, you can specify
whether the "OK" button should just fill in the text entry box or should
fill it in and also activate it.
svn path=/trunk/; revision=2922
2001-01-21 01:45:07 +00:00
/* No Apply button, but "OK" not only sets our text widget, it
activates it ( i . e . , it causes us to do the search ) . */
2001-01-21 02:27:24 +00:00
static construct_args_t args = {
" Ethereal: Search Filter " ,
FALSE ,
TRUE
} ;
1999-11-06 06:28:07 +00:00
Split "filter_dialog_cb()" into "filter_dialog_cb()", which pops up a
"global" dialog box when "Edit:Filters" is selected, so that the list of
filters can be edited, and "filter_browse_cb()", which pops up a dialog
box associated with a "Filter:" button and a text entry widget attached
to that button, so that a filter can be selected or saved (although it
also supports the same editing that the "global" dialog box does).
Have "filter_dialog_cb()" connect the window in which the "Filter:"
button lives and the filter dialog box, so that:
if the window in which the "Filter:" button lives goes away, so
does the filter dialog box (as it no longer has a text widget
into which it can stuff the selected filter);
if the "Filter:" button is clicked when there's already a filter
dialog box open, we just reactivate that existing dialog box
rather than popping up a new one.
Also keep a pointer to the "global" filter dialog box, so that we also
arrange that there's only one of them (by reactivating the existing on
if "Edit:Filters" is selected when there's already a "global" filter
dialog box open).
Keep around pointers to the dialog boxes that contain the "Filter:"
buttons, so that we can arrange that there be only one of them (that was
a side-effect of an earlier attempt at fixing the problems described
above, but it's still useful for keeping multiple competing dialog boxes
from being open - there's more of that to be done).
Make the pointer to the "Open Capture File" dialog box widget static to
"file_dlg.c" - nobody outside of "file_dlg.c cares about it.
svn path=/trunk/; revision=1774
2000-04-01 12:03:42 +00:00
if ( find_frame_w ! = NULL ) {
/* There's already a "Find Frame" dialog box; reactivate it. */
reactivate_window ( find_frame_w ) ;
return ;
}
2000-08-23 06:56:31 +00:00
find_frame_w = dlg_window_new ( " Ethereal: Find Frame " ) ;
2002-11-11 15:39:06 +00:00
SIGNAL_CONNECT ( find_frame_w , " destroy " , find_frame_destroy_cb , NULL ) ;
2000-05-08 04:53:21 +00:00
2003-08-28 23:25:55 +00:00
tooltips = gtk_tooltips_new ( ) ;
2002-11-11 15:39:06 +00:00
# if GTK_MAJOR_VERSION < 2
2000-05-08 04:53:21 +00:00
/* Accelerator group for the accelerators (or, as they're called in
Windows and , I think , in Motif , " mnemonics " ; Alt + < key > is a mnemonic ,
Ctrl + < key > is an accelerator ) . */
accel_group = gtk_accel_group_new ( ) ;
gtk_window_add_accel_group ( GTK_WINDOW ( find_frame_w ) , accel_group ) ;
2002-11-03 17:38:45 +00:00
# endif
2002-08-28 21:04:11 +00:00
1999-11-06 06:28:07 +00:00
/* Container for each row of widgets */
main_vb = gtk_vbox_new ( FALSE , 3 ) ;
gtk_container_border_width ( GTK_CONTAINER ( main_vb ) , 5 ) ;
gtk_container_add ( GTK_CONTAINER ( find_frame_w ) , main_vb ) ;
gtk_widget_show ( main_vb ) ;
2002-08-28 21:04:11 +00:00
1999-11-06 06:28:07 +00:00
/* Filter row */
filter_hb = gtk_hbox_new ( FALSE , 3 ) ;
gtk_container_add ( GTK_CONTAINER ( main_vb ) , filter_hb ) ;
gtk_widget_show ( filter_hb ) ;
2002-08-28 21:04:11 +00:00
1999-11-06 06:28:07 +00:00
filter_bt = gtk_button_new_with_label ( " Filter: " ) ;
2002-11-11 15:39:06 +00:00
SIGNAL_CONNECT ( filter_bt , " clicked " , display_filter_construct_cb , & args ) ;
2003-01-15 05:20:19 +00:00
SIGNAL_CONNECT ( filter_bt , " destroy " , filter_button_destroy_cb , NULL ) ;
2003-08-28 23:25:55 +00:00
OBJECT_SET_DATA ( filter_bt , E_FILT_TE_BUTTON_KEY , filter_bt ) ;
1999-11-06 06:28:07 +00:00
gtk_box_pack_start ( GTK_BOX ( filter_hb ) , filter_bt , FALSE , TRUE , 0 ) ;
2003-08-28 23:25:55 +00:00
gtk_tooltips_set_tip ( tooltips , filter_bt , ( " Click on the filter button to select a display filter, \n or enter your search criteria into the text box " ) , NULL ) ;
1999-11-06 06:28:07 +00:00
gtk_widget_show ( filter_bt ) ;
2002-08-28 21:04:11 +00:00
1999-11-06 06:28:07 +00:00
filter_te = gtk_entry_new ( ) ;
2000-06-27 04:36:03 +00:00
if ( cfile . sfilter ) gtk_entry_set_text ( GTK_ENTRY ( filter_te ) , cfile . sfilter ) ;
2002-11-11 15:39:06 +00:00
OBJECT_SET_DATA ( filter_bt , E_FILT_TE_PTR_KEY , filter_te ) ;
1999-11-06 06:28:07 +00:00
gtk_box_pack_start ( GTK_BOX ( filter_hb ) , filter_te , TRUE , TRUE , 0 ) ;
gtk_widget_show ( filter_te ) ;
2002-08-28 21:04:11 +00:00
2003-08-28 23:25:55 +00:00
direction_frame = gtk_frame_new ( " Direction " ) ;
gtk_box_pack_start ( GTK_BOX ( main_vb ) , direction_frame , TRUE , TRUE , 0 ) ;
gtk_container_border_width ( GTK_CONTAINER ( direction_frame ) , 5 ) ;
gtk_widget_show ( direction_frame ) ;
1999-11-06 06:28:07 +00:00
/* Misc row: Forward and reverse radio buttons */
direction_hb = gtk_hbox_new ( FALSE , 3 ) ;
2003-08-28 23:25:55 +00:00
gtk_container_border_width ( GTK_CONTAINER ( direction_hb ) , 1 ) ;
gtk_container_add ( GTK_CONTAINER ( direction_frame ) , direction_hb ) ;
1999-11-06 06:28:07 +00:00
gtk_widget_show ( direction_hb ) ;
2002-11-03 17:38:45 +00:00
# if GTK_MAJOR_VERSION < 2
2000-05-08 04:53:21 +00:00
forward_rb = dlg_radio_button_new_with_label_with_mnemonic ( NULL , " _Forward " ,
2002-11-03 17:38:45 +00:00
accel_group ) ;
# else
forward_rb = gtk_radio_button_new_with_mnemonic ( NULL , " _Forward " ) ;
# endif
2000-06-27 04:36:03 +00:00
gtk_toggle_button_set_state ( GTK_TOGGLE_BUTTON ( forward_rb ) , ! cfile . sbackward ) ;
1999-11-06 06:28:07 +00:00
gtk_box_pack_start ( GTK_BOX ( direction_hb ) , forward_rb , TRUE , TRUE , 0 ) ;
gtk_widget_show ( forward_rb ) ;
2003-08-28 23:25:55 +00:00
2002-11-03 17:38:45 +00:00
# if GTK_MAJOR_VERSION < 2
2000-05-08 04:53:21 +00:00
backward_rb = dlg_radio_button_new_with_label_with_mnemonic (
1999-11-06 06:28:07 +00:00
gtk_radio_button_group ( GTK_RADIO_BUTTON ( forward_rb ) ) ,
2000-05-08 04:53:21 +00:00
" _Backward " , accel_group ) ;
2002-11-03 17:38:45 +00:00
# else
backward_rb = gtk_radio_button_new_with_mnemonic_from_widget (
GTK_RADIO_BUTTON ( forward_rb ) , " _Backward " ) ;
# endif
2000-06-27 04:36:03 +00:00
gtk_toggle_button_set_state ( GTK_TOGGLE_BUTTON ( backward_rb ) , cfile . sbackward ) ;
1999-11-06 06:28:07 +00:00
gtk_box_pack_start ( GTK_BOX ( direction_hb ) , backward_rb , TRUE , TRUE , 0 ) ;
gtk_widget_show ( backward_rb ) ;
2003-07-22 23:08:48 +00:00
2003-08-28 23:25:55 +00:00
find_type_frame = gtk_frame_new ( " Find syntax " ) ;
gtk_box_pack_start ( GTK_BOX ( main_vb ) , find_type_frame , TRUE , TRUE , 0 ) ;
gtk_container_border_width ( GTK_CONTAINER ( find_type_frame ) , 5 ) ;
gtk_widget_show ( find_type_frame ) ;
2003-07-22 23:08:48 +00:00
/* Filter/Hex/Ascii Search */
/* Filter */
hex_hb = gtk_hbox_new ( FALSE , 3 ) ;
2003-08-28 23:25:55 +00:00
gtk_container_border_width ( GTK_CONTAINER ( hex_hb ) , 1 ) ;
gtk_container_add ( GTK_CONTAINER ( find_type_frame ) , hex_hb ) ;
2003-07-22 23:08:48 +00:00
gtk_widget_show ( hex_hb ) ;
# if GTK_MAJOR_VERSION < 2
filter_rb = dlg_radio_button_new_with_label_with_mnemonic ( NULL , " _Display Filter " ,
accel_group ) ;
# else
filter_rb = gtk_radio_button_new_with_mnemonic ( NULL , " _Display Filter " ) ;
# endif
gtk_toggle_button_set_state ( GTK_TOGGLE_BUTTON ( filter_rb ) , ! cfile . hex & & ! cfile . ascii ) ;
gtk_box_pack_start ( GTK_BOX ( hex_hb ) , filter_rb , TRUE , TRUE , 0 ) ;
2003-08-28 23:25:55 +00:00
gtk_tooltips_set_tip ( tooltips , filter_rb , ( " Search for data by display filter syntax. \n e.g. ip.addr==10.1.1.1 " ) , NULL ) ;
SIGNAL_CONNECT ( filter_rb , " clicked " , filter_selected_cb , find_frame_w ) ;
2003-07-22 23:08:48 +00:00
gtk_widget_show ( filter_rb ) ;
/* Hex */
# if GTK_MAJOR_VERSION < 2
hex_rb = dlg_radio_button_new_with_label_with_mnemonic (
gtk_radio_button_group ( GTK_RADIO_BUTTON ( filter_rb ) ) ,
" _Hex " , accel_group ) ;
# else
hex_rb = gtk_radio_button_new_with_mnemonic_from_widget (
GTK_RADIO_BUTTON ( filter_rb ) , " _Hex " ) ;
# endif
gtk_toggle_button_set_state ( GTK_TOGGLE_BUTTON ( hex_rb ) , cfile . hex ) ;
gtk_box_pack_start ( GTK_BOX ( hex_hb ) , hex_rb , TRUE , TRUE , 0 ) ;
2003-08-28 23:25:55 +00:00
gtk_tooltips_set_tip ( tooltips , hex_rb , ( " Search for data by hex string. \n e.g. fffffda5 " ) , NULL ) ;
2003-07-22 23:08:48 +00:00
gtk_widget_show ( hex_rb ) ;
/* ASCII Search */
# if GTK_MAJOR_VERSION < 2
ascii_rb = dlg_radio_button_new_with_label_with_mnemonic (
gtk_radio_button_group ( GTK_RADIO_BUTTON ( filter_rb ) ) ,
" _String " , accel_group ) ;
# else
ascii_rb = gtk_radio_button_new_with_mnemonic_from_widget (
GTK_RADIO_BUTTON ( filter_rb ) , " _String " ) ;
# endif
gtk_toggle_button_set_state ( GTK_TOGGLE_BUTTON ( ascii_rb ) , cfile . ascii ) ;
gtk_box_pack_start ( GTK_BOX ( hex_hb ) , ascii_rb , TRUE , TRUE , 0 ) ;
2003-08-28 23:25:55 +00:00
gtk_tooltips_set_tip ( tooltips , ascii_rb , ( " Search for data by string value. \n e.g. My String " ) , NULL ) ;
2003-08-11 22:41:10 +00:00
SIGNAL_CONNECT ( ascii_rb , " clicked " , ascii_selected_cb , find_frame_w ) ;
2003-07-22 23:08:48 +00:00
gtk_widget_show ( ascii_rb ) ;
2003-08-28 23:25:55 +00:00
string_window_frame = gtk_frame_new ( " Search in " ) ;
gtk_box_pack_start ( GTK_BOX ( main_vb ) , string_window_frame , TRUE , TRUE , 0 ) ;
gtk_container_border_width ( GTK_CONTAINER ( string_window_frame ) , 5 ) ;
gtk_widget_show ( string_window_frame ) ;
2003-08-11 22:41:10 +00:00
/* Hex, Decode, or Summary Data Search */
/* Source Hex Data Search Window*/
2003-08-28 23:25:55 +00:00
data_hb = gtk_hbox_new ( TRUE , 0 ) ;
gtk_container_border_width ( GTK_CONTAINER ( data_hb ) , 1 ) ;
gtk_container_add ( GTK_CONTAINER ( string_window_frame ) , data_hb ) ;
2003-08-11 22:41:10 +00:00
gtk_widget_show ( data_hb ) ;
# if GTK_MAJOR_VERSION < 2
2003-08-28 23:25:55 +00:00
hex_data_rb = dlg_radio_button_new_with_label_with_mnemonic ( NULL , " Frame data " ,
2003-08-11 22:41:10 +00:00
accel_group ) ;
# else
2003-08-28 23:25:55 +00:00
hex_data_rb = gtk_radio_button_new_with_mnemonic ( NULL , " Frame data " ) ;
2003-08-11 22:41:10 +00:00
# endif
gtk_toggle_button_set_state ( GTK_TOGGLE_BUTTON ( hex_data_rb ) , ! decode_data & & ! summary_data ) ;
gtk_box_pack_start ( GTK_BOX ( data_hb ) , hex_data_rb , TRUE , TRUE , 0 ) ;
2003-08-28 23:25:55 +00:00
gtk_tooltips_set_tip ( tooltips , hex_data_rb , ( " Search for string in the frame data " ) , NULL ) ;
2003-08-11 22:41:10 +00:00
gtk_widget_show ( hex_data_rb ) ;
/* Search Decode Window */
# if GTK_MAJOR_VERSION < 2
decode_data_rb = dlg_radio_button_new_with_label_with_mnemonic (
gtk_radio_button_group ( GTK_RADIO_BUTTON ( hex_data_rb ) ) ,
2003-08-28 23:25:55 +00:00
" Decoded packet " , accel_group ) ;
2003-08-11 22:41:10 +00:00
# else
decode_data_rb = gtk_radio_button_new_with_mnemonic_from_widget (
2003-08-28 23:25:55 +00:00
GTK_RADIO_BUTTON ( hex_data_rb ) , " Decoded packet " ) ;
2003-08-11 22:41:10 +00:00
# endif
gtk_toggle_button_set_state ( GTK_TOGGLE_BUTTON ( decode_data_rb ) , decode_data ) ;
gtk_box_pack_start ( GTK_BOX ( data_hb ) , decode_data_rb , TRUE , TRUE , 0 ) ;
2003-08-28 23:25:55 +00:00
gtk_tooltips_set_tip ( tooltips , decode_data_rb , ( " Search for string in the decoded packet display (middle pane) " ) , NULL ) ;
2003-08-11 22:41:10 +00:00
gtk_widget_show ( decode_data_rb ) ;
/* Search Summary Window */
# if GTK_MAJOR_VERSION < 2
summary_data_rb = dlg_radio_button_new_with_label_with_mnemonic (
gtk_radio_button_group ( GTK_RADIO_BUTTON ( hex_data_rb ) ) ,
2003-08-28 23:25:55 +00:00
" Packet summary " , accel_group ) ;
2003-08-11 22:41:10 +00:00
# else
summary_data_rb = gtk_radio_button_new_with_mnemonic_from_widget (
2003-08-28 23:25:55 +00:00
GTK_RADIO_BUTTON ( hex_data_rb ) , " Packet summary " ) ;
2003-08-11 22:41:10 +00:00
# endif
gtk_toggle_button_set_state ( GTK_TOGGLE_BUTTON ( summary_data_rb ) , summary_data ) ;
gtk_box_pack_start ( GTK_BOX ( data_hb ) , summary_data_rb , TRUE , TRUE , 0 ) ;
2003-08-28 23:25:55 +00:00
gtk_tooltips_set_tip ( tooltips , summary_data_rb , ( " Search for string in the Info column of the packet summary (top pane) " ) , NULL ) ;
2003-08-11 22:41:10 +00:00
gtk_widget_show ( summary_data_rb ) ;
2003-08-28 23:25:55 +00:00
string_char_frame = gtk_frame_new ( " Character Set " ) ;
gtk_box_pack_start ( GTK_BOX ( main_vb ) , string_char_frame , TRUE , TRUE , 0 ) ;
gtk_container_border_width ( GTK_CONTAINER ( string_char_frame ) , 5 ) ;
gtk_widget_show ( string_char_frame ) ;
2003-08-11 22:41:10 +00:00
/* String Type Selection Dropdown Box
These only apply to the Hex Window search option */
2003-07-22 23:08:48 +00:00
/* Create Combo Box */
combo_cb = gtk_combo_new ( ) ;
glist = g_list_append ( glist , " ASCII Unicode & Non-Unicode " ) ;
glist = g_list_append ( glist , " ASCII Non-Unicode " ) ;
glist = g_list_append ( glist , " ASCII Unicode " ) ;
glist = g_list_append ( glist , " EBCDIC " ) ;
gtk_combo_set_popdown_strings ( GTK_COMBO ( combo_cb ) , glist ) ;
2003-08-28 23:25:55 +00:00
gtk_container_border_width ( GTK_CONTAINER ( combo_cb ) , 1 ) ;
gtk_container_add ( GTK_CONTAINER ( string_char_frame ) , combo_cb ) ;
2003-07-22 23:08:48 +00:00
gtk_widget_show ( combo_cb ) ;
2003-08-28 23:25:55 +00:00
string_opt_frame = gtk_frame_new ( " Options " ) ;
gtk_box_pack_start ( GTK_BOX ( main_vb ) , string_opt_frame , TRUE , TRUE , 0 ) ;
gtk_container_border_width ( GTK_CONTAINER ( string_opt_frame ) , 5 ) ;
gtk_widget_show ( string_opt_frame ) ;
2003-08-05 00:01:27 +00:00
# if GTK_MAJOR_VERSION < 2
case_cb = dlg_check_button_new_with_label_with_mnemonic (
" Case Insensitive Search " , accel_group ) ;
# else
case_cb = gtk_check_button_new_with_mnemonic (
" Case Insensitive Search " ) ;
# endif
gtk_toggle_button_set_state ( GTK_TOGGLE_BUTTON ( case_cb ) ,
case_type ) ;
2003-08-28 23:25:55 +00:00
gtk_container_border_width ( GTK_CONTAINER ( case_cb ) , 1 ) ;
gtk_container_add ( GTK_CONTAINER ( string_opt_frame ) , case_cb ) ;
gtk_tooltips_set_tip ( tooltips , case_cb , ( " Search by mixed upper/lower case? " ) , NULL ) ;
2003-08-05 00:01:27 +00:00
gtk_widget_show ( case_cb ) ;
1999-11-06 06:28:07 +00:00
/* Button row: OK and cancel buttons */
bbox = gtk_hbutton_box_new ( ) ;
gtk_button_box_set_layout ( GTK_BUTTON_BOX ( bbox ) , GTK_BUTTONBOX_END ) ;
gtk_button_box_set_spacing ( GTK_BUTTON_BOX ( bbox ) , 5 ) ;
gtk_container_add ( GTK_CONTAINER ( main_vb ) , bbox ) ;
gtk_widget_show ( bbox ) ;
2002-11-03 17:38:45 +00:00
# if GTK_MAJOR_VERSION < 2
1999-11-06 06:28:07 +00:00
ok_bt = gtk_button_new_with_label ( " OK " ) ;
2002-11-03 17:38:45 +00:00
# else
ok_bt = gtk_button_new_from_stock ( GTK_STOCK_OK ) ;
# endif
2002-11-11 15:39:06 +00:00
SIGNAL_CONNECT ( ok_bt , " clicked " , find_frame_ok_cb , find_frame_w ) ;
1999-11-06 06:28:07 +00:00
GTK_WIDGET_SET_FLAGS ( ok_bt , GTK_CAN_DEFAULT ) ;
gtk_box_pack_start ( GTK_BOX ( bbox ) , ok_bt , TRUE , TRUE , 0 ) ;
2003-08-28 23:25:55 +00:00
gtk_tooltips_set_tip ( tooltips , ok_bt , ( " Perform search " ) , NULL ) ;
1999-11-06 06:28:07 +00:00
gtk_widget_grab_default ( ok_bt ) ;
gtk_widget_show ( ok_bt ) ;
2002-11-03 17:38:45 +00:00
# if GTK_MAJOR_VERSION < 2
1999-11-06 06:28:07 +00:00
cancel_bt = gtk_button_new_with_label ( " Cancel " ) ;
2002-11-03 17:38:45 +00:00
# else
cancel_bt = gtk_button_new_from_stock ( GTK_STOCK_CANCEL ) ;
# endif
2002-11-11 15:39:06 +00:00
SIGNAL_CONNECT ( cancel_bt , " clicked " , find_frame_close_cb , find_frame_w ) ;
1999-11-06 06:28:07 +00:00
GTK_WIDGET_SET_FLAGS ( cancel_bt , GTK_CAN_DEFAULT ) ;
gtk_box_pack_start ( GTK_BOX ( bbox ) , cancel_bt , TRUE , TRUE , 0 ) ;
2003-08-28 23:25:55 +00:00
gtk_tooltips_set_tip ( tooltips , cancel_bt , ( " Cancel search and exit " ) , NULL ) ;
1999-11-06 06:28:07 +00:00
gtk_widget_show ( cancel_bt ) ;
/* Attach pointers to needed widgets to the capture prefs window/object */
2002-11-11 15:39:06 +00:00
OBJECT_SET_DATA ( find_frame_w , E_FIND_FILT_KEY , filter_te ) ;
OBJECT_SET_DATA ( find_frame_w , E_FIND_BACKWARD_KEY , backward_rb ) ;
2003-07-22 23:08:48 +00:00
OBJECT_SET_DATA ( find_frame_w , E_FIND_FILTERDATA_KEY , filter_rb ) ;
OBJECT_SET_DATA ( find_frame_w , E_FIND_HEXDATA_KEY , hex_rb ) ;
OBJECT_SET_DATA ( find_frame_w , E_FIND_ASCIIDATA_KEY , ascii_rb ) ;
OBJECT_SET_DATA ( find_frame_w , E_FIND_STRINGTYPE_KEY , combo_cb ) ;
2003-08-05 00:01:27 +00:00
OBJECT_SET_DATA ( find_frame_w , E_CASE_SEARCH_KEY , case_cb ) ;
2003-08-11 22:41:10 +00:00
OBJECT_SET_DATA ( find_frame_w , E_SOURCE_HEX_KEY , hex_data_rb ) ;
OBJECT_SET_DATA ( find_frame_w , E_SOURCE_DECODE_KEY , decode_data_rb ) ;
OBJECT_SET_DATA ( find_frame_w , E_SOURCE_SUMMARY_KEY , summary_data_rb ) ;
2003-08-28 23:25:55 +00:00
OBJECT_SET_DATA ( find_frame_w , E_FILT_TE_BUTTON_KEY , filter_bt ) ;
2003-07-22 23:08:48 +00:00
1999-11-06 06:28:07 +00:00
2003-08-11 22:41:10 +00:00
ascii_selected_cb ( NULL , find_frame_w ) ;
2003-08-28 23:25:55 +00:00
filter_selected_cb ( NULL , find_frame_w ) ;
2003-04-24 23:18:07 +00:00
/* Catch the "activate" signal on the filter text entry, so that
2000-05-02 08:04:31 +00:00
if the user types Return there , we act as if the " OK " button
had been selected , as happens if Return is typed if some widget
that * doesn ' t * handle the Return key has the input focus . */
dlg_set_activate ( filter_te , ok_bt ) ;
/* Catch the "key_press_event" signal in the window, so that we can catch
the ESC key being pressed and act as if the " Cancel " button had
been selected . */
dlg_set_cancel ( find_frame_w , cancel_bt ) ;
2000-03-15 08:54:24 +00:00
/* Give the initial focus to the "Filter" entry box. */
gtk_widget_grab_focus ( filter_te ) ;
1999-11-06 06:28:07 +00:00
gtk_widget_show ( find_frame_w ) ;
}
2003-08-11 22:41:10 +00:00
/*
* This function will disable the string options until
* the string search is selected .
*/
static void
ascii_selected_cb ( GtkWidget * button_rb _U_ , gpointer parent_w )
{
GtkWidget * ascii_rb , * hex_data_rb , * decode_data_rb , * summary_data_rb ,
* data_combo_cb , * data_case_cb ;
ascii_rb = ( GtkWidget * ) OBJECT_GET_DATA ( parent_w , E_FIND_ASCIIDATA_KEY ) ;
hex_data_rb = ( GtkWidget * ) OBJECT_GET_DATA ( parent_w , E_SOURCE_HEX_KEY ) ;
decode_data_rb = ( GtkWidget * ) OBJECT_GET_DATA ( parent_w , E_SOURCE_DECODE_KEY ) ;
summary_data_rb = ( GtkWidget * ) OBJECT_GET_DATA ( parent_w , E_SOURCE_SUMMARY_KEY ) ;
data_combo_cb = ( GtkWidget * ) OBJECT_GET_DATA ( parent_w , E_FIND_STRINGTYPE_KEY ) ;
data_case_cb = ( GtkWidget * ) OBJECT_GET_DATA ( parent_w , E_CASE_SEARCH_KEY ) ;
if ( gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( ascii_rb ) ) ) {
gtk_widget_set_sensitive ( GTK_WIDGET ( hex_data_rb ) , TRUE ) ;
gtk_widget_set_sensitive ( GTK_WIDGET ( decode_data_rb ) , TRUE ) ;
gtk_widget_set_sensitive ( GTK_WIDGET ( summary_data_rb ) , TRUE ) ;
gtk_widget_set_sensitive ( GTK_WIDGET ( data_combo_cb ) , TRUE ) ;
gtk_widget_set_sensitive ( GTK_WIDGET ( data_case_cb ) , TRUE ) ;
} else {
gtk_widget_set_sensitive ( GTK_WIDGET ( hex_data_rb ) , FALSE ) ;
gtk_widget_set_sensitive ( GTK_WIDGET ( decode_data_rb ) , FALSE ) ;
gtk_widget_set_sensitive ( GTK_WIDGET ( summary_data_rb ) , FALSE ) ;
gtk_widget_set_sensitive ( GTK_WIDGET ( data_combo_cb ) , FALSE ) ;
gtk_widget_set_sensitive ( GTK_WIDGET ( data_case_cb ) , FALSE ) ;
}
return ;
}
2003-08-28 23:25:55 +00:00
/*
* This function will disable the filter button until
* the filter search is selected .
*/
static void
filter_selected_cb ( GtkWidget * button_rb _U_ , gpointer parent_w )
{
GtkWidget * filter_bt , * filter_rb ;
filter_bt = ( GtkWidget * ) OBJECT_GET_DATA ( parent_w , E_FILT_TE_BUTTON_KEY ) ;
filter_rb = ( GtkWidget * ) OBJECT_GET_DATA ( parent_w , E_FIND_FILTERDATA_KEY ) ;
if ( gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( filter_rb ) ) )
{
gtk_widget_set_sensitive ( GTK_WIDGET ( filter_bt ) , TRUE ) ;
}
else
{
gtk_widget_set_sensitive ( GTK_WIDGET ( filter_bt ) , FALSE ) ;
}
return ;
}
2003-08-11 22:41:10 +00:00
1999-11-06 06:28:07 +00:00
static void
2002-03-05 11:56:00 +00:00
find_frame_ok_cb ( GtkWidget * ok_bt _U_ , gpointer parent_w )
1999-11-06 06:28:07 +00:00
{
2003-08-11 22:41:10 +00:00
GtkWidget * filter_te , * backward_rb , * hex_rb , * ascii_rb , * combo_cb , * case_cb ,
* decode_data_rb , * summary_data_rb ;
2003-07-22 23:08:48 +00:00
gchar * filter_text , * string_type ;
2001-02-01 20:21:25 +00:00
dfilter_t * sfcode ;
1999-11-06 06:28:07 +00:00
2002-11-11 15:39:06 +00:00
filter_te = ( GtkWidget * ) OBJECT_GET_DATA ( parent_w , E_FIND_FILT_KEY ) ;
backward_rb = ( GtkWidget * ) OBJECT_GET_DATA ( parent_w , E_FIND_BACKWARD_KEY ) ;
2003-07-22 23:08:48 +00:00
hex_rb = ( GtkWidget * ) OBJECT_GET_DATA ( parent_w , E_FIND_HEXDATA_KEY ) ;
ascii_rb = ( GtkWidget * ) OBJECT_GET_DATA ( parent_w , E_FIND_ASCIIDATA_KEY ) ;
combo_cb = ( GtkWidget * ) OBJECT_GET_DATA ( parent_w , E_FIND_STRINGTYPE_KEY ) ;
2003-08-05 00:01:27 +00:00
case_cb = ( GtkWidget * ) OBJECT_GET_DATA ( parent_w , E_CASE_SEARCH_KEY ) ;
2003-08-11 22:41:10 +00:00
decode_data_rb = ( GtkWidget * ) OBJECT_GET_DATA ( parent_w , E_SOURCE_DECODE_KEY ) ;
summary_data_rb = ( GtkWidget * ) OBJECT_GET_DATA ( parent_w , E_SOURCE_SUMMARY_KEY ) ;
1999-11-06 06:28:07 +00:00
filter_text = gtk_entry_get_text ( GTK_ENTRY ( filter_te ) ) ;
2003-07-22 23:08:48 +00:00
string_type = gtk_entry_get_text ( GTK_ENTRY ( GTK_COMBO ( combo_cb ) - > entry ) ) ;
1999-11-06 06:28:07 +00:00
2003-08-05 00:01:27 +00:00
case_type = gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( case_cb ) ) ;
2003-08-11 22:41:10 +00:00
decode_data = gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( decode_data_rb ) ) ;
summary_data = gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( summary_data_rb ) ) ;
2003-08-05 00:01:27 +00:00
1999-11-06 06:28:07 +00:00
/*
* Try to compile the filter .
*/
2003-07-22 23:08:48 +00:00
if ( ! dfilter_compile ( filter_text , & sfcode ) & & ! GTK_TOGGLE_BUTTON ( hex_rb ) - > active & & ! GTK_TOGGLE_BUTTON ( ascii_rb ) - > active ) {
1999-11-06 06:28:07 +00:00
/* The attempt failed; report an error. */
2000-07-20 05:10:02 +00:00
simple_dialog ( ESD_TYPE_CRIT , NULL , dfilter_error_msg ) ;
1999-11-06 06:28:07 +00:00
return ;
}
/* Was it empty? */
2003-07-22 23:08:48 +00:00
if ( sfcode = = NULL & & ! GTK_TOGGLE_BUTTON ( hex_rb ) - > active & & ! GTK_TOGGLE_BUTTON ( ascii_rb ) - > active ) {
1999-11-06 06:28:07 +00:00
/* Yes - complain. */
2000-07-20 05:10:02 +00:00
simple_dialog ( ESD_TYPE_CRIT , NULL ,
2003-07-22 23:08:48 +00:00
" You didn't specify valid search criteria. " ) ;
1999-11-06 06:28:07 +00:00
return ;
}
/*
* Remember the filter .
*/
2000-06-27 04:36:03 +00:00
if ( cfile . sfilter )
g_free ( cfile . sfilter ) ;
cfile . sfilter = g_strdup ( filter_text ) ;
1999-11-06 06:28:07 +00:00
2000-06-27 04:36:03 +00:00
cfile . sbackward = GTK_TOGGLE_BUTTON ( backward_rb ) - > active ;
2003-07-22 23:08:48 +00:00
cfile . hex = GTK_TOGGLE_BUTTON ( hex_rb ) - > active ;
cfile . ascii = GTK_TOGGLE_BUTTON ( ascii_rb ) - > active ;
cfile . ftype = g_strdup ( string_type ) ;
if ( ! GTK_TOGGLE_BUTTON ( hex_rb ) - > active & & ! GTK_TOGGLE_BUTTON ( ascii_rb ) - > active ) {
if ( ! find_packet ( & cfile , sfcode ) ) {
/* We didn't find the packet. */
simple_dialog ( ESD_TYPE_CRIT , NULL , " No packet matched that filter. " ) ;
return ;
}
}
else
{
2003-08-11 22:41:10 +00:00
if ( ! decode_data & & ! summary_data ) {
if ( ! find_ascii ( & cfile , filter_text , cfile . ascii , string_type , case_type ) ) {
/* We didn't find the packet. */
simple_dialog ( ESD_TYPE_CRIT , NULL , " No packet matched search criteria. " ) ;
return ;
}
}
else
{
/* Use the cfile.hex to indicate if summary or decode search */
/* This way the Next and Previous find options will work */
cfile . hex = summary_data ;
if ( ! find_in_gtk_data ( & cfile , parent_w , filter_text , case_type , summary_data ) ) {
/* We didn't find the packet. */
simple_dialog ( ESD_TYPE_CRIT , NULL , " No packet matched search criteria. " ) ;
return ;
}
2003-07-22 23:08:48 +00:00
}
1999-11-06 06:54:24 +00:00
}
gtk_widget_destroy ( GTK_WIDGET ( parent_w ) ) ;
1999-11-06 06:28:07 +00:00
}
static void
2002-03-05 11:56:00 +00:00
find_frame_close_cb ( GtkWidget * close_bt _U_ , gpointer parent_w )
1999-11-06 06:28:07 +00:00
{
gtk_grab_remove ( GTK_WIDGET ( parent_w ) ) ;
gtk_widget_destroy ( GTK_WIDGET ( parent_w ) ) ;
}
Split "filter_dialog_cb()" into "filter_dialog_cb()", which pops up a
"global" dialog box when "Edit:Filters" is selected, so that the list of
filters can be edited, and "filter_browse_cb()", which pops up a dialog
box associated with a "Filter:" button and a text entry widget attached
to that button, so that a filter can be selected or saved (although it
also supports the same editing that the "global" dialog box does).
Have "filter_dialog_cb()" connect the window in which the "Filter:"
button lives and the filter dialog box, so that:
if the window in which the "Filter:" button lives goes away, so
does the filter dialog box (as it no longer has a text widget
into which it can stuff the selected filter);
if the "Filter:" button is clicked when there's already a filter
dialog box open, we just reactivate that existing dialog box
rather than popping up a new one.
Also keep a pointer to the "global" filter dialog box, so that we also
arrange that there's only one of them (by reactivating the existing on
if "Edit:Filters" is selected when there's already a "global" filter
dialog box open).
Keep around pointers to the dialog boxes that contain the "Filter:"
buttons, so that we can arrange that there be only one of them (that was
a side-effect of an earlier attempt at fixing the problems described
above, but it's still useful for keeping multiple competing dialog boxes
from being open - there's more of that to be done).
Make the pointer to the "Open Capture File" dialog box widget static to
"file_dlg.c" - nobody outside of "file_dlg.c cares about it.
svn path=/trunk/; revision=1774
2000-04-01 12:03:42 +00:00
static void
2003-01-15 05:20:19 +00:00
find_frame_destroy_cb ( GtkWidget * win _U_ , gpointer user_data _U_ )
Split "filter_dialog_cb()" into "filter_dialog_cb()", which pops up a
"global" dialog box when "Edit:Filters" is selected, so that the list of
filters can be edited, and "filter_browse_cb()", which pops up a dialog
box associated with a "Filter:" button and a text entry widget attached
to that button, so that a filter can be selected or saved (although it
also supports the same editing that the "global" dialog box does).
Have "filter_dialog_cb()" connect the window in which the "Filter:"
button lives and the filter dialog box, so that:
if the window in which the "Filter:" button lives goes away, so
does the filter dialog box (as it no longer has a text widget
into which it can stuff the selected filter);
if the "Filter:" button is clicked when there's already a filter
dialog box open, we just reactivate that existing dialog box
rather than popping up a new one.
Also keep a pointer to the "global" filter dialog box, so that we also
arrange that there's only one of them (by reactivating the existing on
if "Edit:Filters" is selected when there's already a "global" filter
dialog box open).
Keep around pointers to the dialog boxes that contain the "Filter:"
buttons, so that we can arrange that there be only one of them (that was
a side-effect of an earlier attempt at fixing the problems described
above, but it's still useful for keeping multiple competing dialog boxes
from being open - there's more of that to be done).
Make the pointer to the "Open Capture File" dialog box widget static to
"file_dlg.c" - nobody outside of "file_dlg.c cares about it.
svn path=/trunk/; revision=1774
2000-04-01 12:03:42 +00:00
{
/* Note that we no longer have a "Find Frame" dialog box. */
find_frame_w = NULL ;
}
2002-05-03 21:55:15 +00:00
static void
find_previous_next ( GtkWidget * w , gpointer d , gboolean sens )
{
dfilter_t * sfcode ;
2003-07-22 23:08:48 +00:00
2002-05-03 21:55:15 +00:00
if ( cfile . sfilter ) {
2003-07-22 23:08:48 +00:00
if ( ! dfilter_compile ( cfile . sfilter , & sfcode ) & & ! cfile . hex & & ! cfile . ascii )
2002-05-03 21:55:15 +00:00
return ;
2003-07-22 23:08:48 +00:00
if ( sfcode = = NULL & & ! cfile . hex & & ! cfile . ascii )
2002-05-03 21:55:15 +00:00
return ;
cfile . sbackward = sens ;
2003-07-22 23:08:48 +00:00
if ( cfile . hex | | cfile . ascii )
{
2003-08-11 22:41:10 +00:00
if ( ! decode_data & & ! summary_data ) {
find_ascii ( & cfile , cfile . sfilter , cfile . ascii , cfile . ftype , case_type ) ;
}
else {
find_in_gtk_data ( & cfile , d , cfile . sfilter , case_type , cfile . hex ) ;
}
2003-07-22 23:08:48 +00:00
}
else
{
find_packet ( & cfile , sfcode ) ;
}
2002-05-03 21:55:15 +00:00
} else
find_frame_cb ( w , d ) ;
}
void
find_next_cb ( GtkWidget * w , gpointer d )
{
find_previous_next ( w , d , FALSE ) ;
}
void
find_previous_cb ( GtkWidget * w , gpointer d )
{
find_previous_next ( w , d , TRUE ) ;
}