1998-09-16 02:39:15 +00:00
|
|
|
/* menu.c
|
|
|
|
* Menu routines
|
|
|
|
*
|
2003-04-22 04:02:49 +00:00
|
|
|
* $Id: menu.c,v 1.88 2003/04/22 04:02:49 guy Exp $
|
1998-09-16 03:22:19 +00:00
|
|
|
*
|
1998-09-16 02:39:15 +00:00
|
|
|
* Ethereal - Network traffic analyzer
|
Enable "Match Selected" only if there's a field selected *and* we can do
a "Match Selected" on it - we can't do a "Match Selected" if the field
has no value (e.g., FT_NULL) and has a length of 0.
If we unselect the current packet, we don't have a protocol tree, so we
don't have a currently selected field - clear the "Match Selected" menu
item and the display in the status line of information about the
currently selected field.
Move the low-level statusbar manipulation into "gtk/main.c", in routines
whose API doesn't expose anything GTK+-ish.
"close_cap_file()" calls one of those routines to clear out the status
bar, so it doesn't need to take a pointer to the statusbar widget as an
argument.
"clear_tree_and_hex_views()" is purely a display-manipulating routine;
move it to "gtk/proto_draw.c".
Extract from "tree_view_unselect_row_cb()" an "unselect_field()" routine
to do all the work that needs to be done if the currently selected
protocol tree row is unselected, and call it if the currently selected
packet list row is unselected (if it's unselected, there *is* no
protocol tree, so no row can be selected), as well as from
"tree_view_unselect_row_cb()".
Before pushing a new field-description message onto the statusbar, pop
the old one off.
Get rid of an unused variable (set, but not used).
svn path=/trunk/; revision=3513
2001-06-05 07:39:31 +00:00
|
|
|
* By Gerald Combs <gerald@ethereal.com>
|
1998-09-16 02:39:15 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1998-09-16 02:39:15 +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
|
|
|
*
|
1998-09-16 02:39:15 +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
|
|
|
*
|
1998-09-16 02:39:15 +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>
|
|
|
|
|
1999-04-05 22:51:44 +00:00
|
|
|
#include <string.h>
|
1999-07-09 04:18:36 +00:00
|
|
|
|
2000-01-03 03:57:04 +00:00
|
|
|
#include "../menu.h"
|
|
|
|
|
1999-09-09 02:42:40 +00:00
|
|
|
#include "main.h"
|
1998-12-17 05:42:33 +00:00
|
|
|
#include "menu.h"
|
2002-01-21 07:37:49 +00:00
|
|
|
#include <epan/packet.h>
|
|
|
|
#include <epan/resolv.h>
|
2002-01-11 07:40:32 +00:00
|
|
|
#include "prefs.h"
|
1999-09-09 03:32:03 +00:00
|
|
|
#include "capture_dlg.h"
|
2000-02-12 08:31:49 +00:00
|
|
|
#include "color_dlg.h"
|
2000-02-12 06:58:42 +00:00
|
|
|
#include "file_dlg.h"
|
2000-02-12 06:46:54 +00:00
|
|
|
#include "filter_prefs.h"
|
1999-11-06 06:28:07 +00:00
|
|
|
#include "find_dlg.h"
|
1999-11-10 07:01:53 +00:00
|
|
|
#include "goto_dlg.h"
|
1999-12-10 04:21:04 +00:00
|
|
|
#include "summary_dlg.h"
|
1999-10-18 12:48:14 +00:00
|
|
|
#include "display_opts.h"
|
1999-09-09 03:32:03 +00:00
|
|
|
#include "prefs_dlg.h"
|
2000-02-29 06:24:41 +00:00
|
|
|
#include "packet_win.h"
|
1998-09-16 02:39:15 +00:00
|
|
|
#include "print.h"
|
2000-08-03 12:44:40 +00:00
|
|
|
#include "follow_dlg.h"
|
2001-02-01 07:34:33 +00:00
|
|
|
#include "decode_as_dlg.h"
|
2000-08-08 12:28:50 +00:00
|
|
|
#include "help_dlg.h"
|
Add the "Edit:Protocols..." feature which currently only implements
the following:
It is now possible to enable/disable a particular protocol decoding
(i.e. the protocol dissector is void or not). When a protocol
is disabled, it is displayed as Data and of course, all linked
sub-protocols are disabled as well.
Disabling a protocol could be interesting:
- in case of buggy dissectors
- in case of wrong heuristics
- for performance reasons
- to decode the data as another protocol (TODO)
Currently (if I am not wrong), all dissectors but NFS can be disabled
(and dissectors that do not register protocols :-)
I do not like the way the RPC sub-dissectors are disabled (in the
sub-dissectors) since this could be done in the RPC dissector itself,
knowing the sub-protocol hfinfo entry (this is why, I've not modified
the NFS one yet).
Two functions are added in proto.c :
gboolean proto_is_protocol_enabled(int n);
void proto_set_decoding(int n, gboolean enabled);
and two MACROs which can be used in dissectors:
OLD_CHECK_DISPLAY_AS_DATA(index, pd, offset, fd, tree)
CHECK_DISPLAY_AS_DATA(index, tvb, pinfo, tree)
See also the XXX in proto_dlg.c and proto.c around the new functions.
svn path=/trunk/; revision=2267
2000-08-13 14:09:15 +00:00
|
|
|
#include "proto_dlg.h"
|
2001-03-22 23:54:47 +00:00
|
|
|
#include "proto_hier_stats_dlg.h"
|
2000-01-18 08:38:18 +00:00
|
|
|
#include "keys.h"
|
2002-01-21 07:37:49 +00:00
|
|
|
#include <epan/plugins.h>
|
2001-12-08 09:27:51 +00:00
|
|
|
#include "tcp_graph.h"
|
2002-01-21 07:37:49 +00:00
|
|
|
#include <epan/epan_dissect.h>
|
2002-11-14 10:32:22 +00:00
|
|
|
#include "io_stat.h"
|
2002-09-07 10:02:36 +00:00
|
|
|
#include "rpc_stat.h"
|
|
|
|
#include "rpc_progs.h"
|
2002-10-25 01:08:49 +00:00
|
|
|
#include "dcerpc_stat.h"
|
2003-01-22 00:40:36 +00:00
|
|
|
#include "smb_stat.h"
|
2003-04-16 07:25:12 +00:00
|
|
|
#include "mgcp_stat.h"
|
2002-11-11 15:39:06 +00:00
|
|
|
#include "compat_macros.h"
|
2002-11-11 18:46:16 +00:00
|
|
|
#include "gtkglobals.h"
|
2003-03-06 20:35:12 +00:00
|
|
|
#include "tap_rtp.h"
|
2003-04-16 07:25:12 +00:00
|
|
|
#include "../tap.h"
|
1998-09-16 02:39:15 +00:00
|
|
|
|
2000-04-06 06:52:10 +00:00
|
|
|
GtkWidget *popup_menu_object;
|
|
|
|
|
2000-01-03 04:06:09 +00:00
|
|
|
#define GTK_MENU_FUNC(a) ((GtkItemFactoryCallback)(a))
|
|
|
|
|
|
|
|
static void menus_init(void);
|
2003-04-22 00:16:58 +00:00
|
|
|
static void set_menu_sensitivity (GtkItemFactory *, gchar *, gint);
|
1998-09-16 02:39:15 +00:00
|
|
|
|
1999-06-12 06:22:47 +00:00
|
|
|
/* This is the GtkItemFactoryEntry structure used to generate new menus.
|
|
|
|
Item 1: The menu path. The letter after the underscore indicates an
|
|
|
|
accelerator key once the menu is open.
|
|
|
|
Item 2: The accelerator key for the entry
|
|
|
|
Item 3: The callback function.
|
|
|
|
Item 4: The callback action. This changes the parameters with
|
|
|
|
which the function is called. The default is 0.
|
|
|
|
Item 5: The item type, used to define what kind of an item it is.
|
|
|
|
Here are the possible values:
|
|
|
|
|
|
|
|
NULL -> "<Item>"
|
|
|
|
"" -> "<Item>"
|
|
|
|
"<Title>" -> create a title item
|
|
|
|
"<Item>" -> create a simple item
|
2002-11-15 23:50:06 +00:00
|
|
|
"<ImageItem>" -> create an item holding an image (gtk2)
|
|
|
|
"<StockItem>" -> create an item holding a stock image (gtk2)
|
1999-06-12 06:22:47 +00:00
|
|
|
"<CheckItem>" -> create a check item
|
|
|
|
"<ToggleItem>" -> create a toggle item
|
|
|
|
"<RadioItem>" -> create a radio item
|
|
|
|
<path> -> path of a radio item to link against
|
|
|
|
"<Separator>" -> create a separator
|
2002-11-15 23:50:06 +00:00
|
|
|
"<Tearoff>" -> create a tearoff separator (gtk2)
|
1999-06-12 06:22:47 +00:00
|
|
|
"<Branch>" -> create an item to hold sub items (optional)
|
2002-08-28 21:04:11 +00:00
|
|
|
"<LastBranch>" -> create a right justified branch
|
2002-11-15 23:50:06 +00:00
|
|
|
Item 6: extra data needed for ImageItem and StockItem (gtk2)
|
1999-06-12 06:22:47 +00:00
|
|
|
*/
|
|
|
|
|
2000-01-18 08:38:18 +00:00
|
|
|
/* main menu */
|
1998-12-17 05:42:33 +00:00
|
|
|
static GtkItemFactoryEntry menu_items[] =
|
|
|
|
{
|
2002-11-15 23:50:06 +00:00
|
|
|
ITEM_FACTORY_ENTRY("/_File", NULL, NULL, 0, "<Branch>", NULL),
|
|
|
|
ITEM_FACTORY_STOCK_ENTRY("/File/_Open...", "<control>O", file_open_cmd_cb,
|
|
|
|
0, GTK_STOCK_OPEN),
|
|
|
|
ITEM_FACTORY_STOCK_ENTRY("/File/_Close", "<control>W", file_close_cmd_cb,
|
|
|
|
0, GTK_STOCK_CLOSE),
|
|
|
|
ITEM_FACTORY_STOCK_ENTRY("/File/_Save", "<control>S", file_save_cmd_cb,
|
|
|
|
0, GTK_STOCK_SAVE),
|
|
|
|
ITEM_FACTORY_STOCK_ENTRY("/File/Save _As...", NULL, file_save_as_cmd_cb,
|
|
|
|
0, GTK_STOCK_SAVE_AS),
|
|
|
|
ITEM_FACTORY_STOCK_ENTRY("/File/_Reload", "<control>R", file_reload_cmd_cb,
|
|
|
|
0, GTK_STOCK_REFRESH),
|
|
|
|
ITEM_FACTORY_ENTRY("/File/<separator>", NULL, NULL, 0, "<Separator>", NULL),
|
|
|
|
ITEM_FACTORY_STOCK_ENTRY("/File/_Print...", NULL, file_print_cmd_cb,
|
|
|
|
0, GTK_STOCK_PRINT),
|
|
|
|
ITEM_FACTORY_ENTRY("/File/<separator>", NULL, NULL, 0, "<Separator>", NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/File/Print Pac_ket", "<control>P",
|
|
|
|
file_print_packet_cmd_cb, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/File/<separator>", NULL, NULL, 0, "<Separator>", NULL),
|
|
|
|
ITEM_FACTORY_STOCK_ENTRY("/File/_Quit", "<control>Q", file_quit_cmd_cb,
|
|
|
|
0, GTK_STOCK_QUIT),
|
|
|
|
ITEM_FACTORY_ENTRY("/_Edit", NULL, NULL, 0, "<Branch>", NULL),
|
2000-09-09 08:17:51 +00:00
|
|
|
#if 0
|
2002-11-15 23:50:06 +00:00
|
|
|
/* Un-#if this when we actually implement Cut/Copy/Paste. */
|
|
|
|
ITEM_FACTORY_STOCK_ENTRY("/Edit/Cut", "<control>X", NULL,
|
|
|
|
0, GTK_STOCK_CUT),
|
|
|
|
ITEM_FACTORY_STOCK_ENTRY("/Edit/Copy", "<control>C", NULL,
|
|
|
|
0, GTK_STOCK_COPY),
|
|
|
|
ITEM_FACTORY_STOCK_ENTRY("/Edit/Paste", "<control>V", NULL,
|
|
|
|
0, GTK_STOCK_PASTE),
|
|
|
|
ITEM_FACTORY_ENTRY("/Edit/<separator>", NULL, NULL, 0, "<Separator>"),
|
2000-09-09 08:17:51 +00:00
|
|
|
#endif
|
2002-11-15 23:50:06 +00:00
|
|
|
ITEM_FACTORY_STOCK_ENTRY("/Edit/_Find Frame...", "<control>F",
|
|
|
|
find_frame_cb, 0, GTK_STOCK_FIND),
|
|
|
|
ITEM_FACTORY_STOCK_ENTRY("/Edit/Find _Next", "<control>N", find_next_cb,
|
|
|
|
0, GTK_STOCK_GO_FORWARD),
|
|
|
|
ITEM_FACTORY_STOCK_ENTRY("/Edit/Find _Previous", "<control>B",
|
|
|
|
find_previous_cb, 0, GTK_STOCK_GO_BACK),
|
|
|
|
ITEM_FACTORY_STOCK_ENTRY("/Edit/_Go To Frame...", "<control>G",
|
|
|
|
goto_frame_cb, 0, GTK_STOCK_JUMP_TO),
|
|
|
|
ITEM_FACTORY_ENTRY("/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Edit/_Mark Frame", "<control>M", mark_frame_cb,
|
|
|
|
0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Edit/Mark _All Frames", NULL, mark_all_frames_cb,
|
|
|
|
0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Edit/_Unmark All Frames", NULL, unmark_all_frames_cb,
|
|
|
|
0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL),
|
|
|
|
ITEM_FACTORY_STOCK_ENTRY("/Edit/_Preferences...", NULL, prefs_cb,
|
|
|
|
0, GTK_STOCK_PREFERENCES),
|
2001-06-27 10:00:14 +00:00
|
|
|
#ifdef HAVE_LIBPCAP
|
2002-11-15 23:50:06 +00:00
|
|
|
ITEM_FACTORY_ENTRY("/Edit/_Capture Filters...", NULL, cfilter_dialog_cb,
|
|
|
|
0, NULL, NULL),
|
2002-11-15 18:45:18 +00:00
|
|
|
#endif /* HAVE_LIBPCAP */
|
2002-11-15 23:50:06 +00:00
|
|
|
ITEM_FACTORY_ENTRY("/Edit/_Display Filters...", NULL, dfilter_dialog_cb,
|
|
|
|
0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Edit/P_rotocols...", NULL, proto_cb, 0, NULL, NULL),
|
1999-07-09 04:18:36 +00:00
|
|
|
#ifdef HAVE_LIBPCAP
|
2002-11-15 23:50:06 +00:00
|
|
|
ITEM_FACTORY_ENTRY("/_Capture", NULL, NULL, 0, "<Branch>", NULL),
|
|
|
|
ITEM_FACTORY_STOCK_ENTRY("/Capture/_Start...", "<control>K",
|
|
|
|
capture_prep_cb, 0, GTK_STOCK_EXECUTE),
|
2000-10-11 06:01:16 +00:00
|
|
|
/*
|
|
|
|
* XXX - this doesn't yet work in Win32.
|
|
|
|
*/
|
|
|
|
#ifndef _WIN32
|
2002-11-15 23:50:06 +00:00
|
|
|
ITEM_FACTORY_STOCK_ENTRY("/Capture/S_top", "<control>E", capture_stop_cb,
|
|
|
|
0, GTK_STOCK_STOP),
|
2000-10-11 06:01:16 +00:00
|
|
|
#endif /* _WIN32 */
|
|
|
|
#endif /* HAVE_LIBPCAP */
|
2002-11-15 23:50:06 +00:00
|
|
|
ITEM_FACTORY_ENTRY("/_Display", NULL, NULL, 0, "<Branch>", NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Display/_Options...", NULL, display_opt_cb,
|
|
|
|
0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Display/_Match", NULL, NULL, 0, "<Branch>", NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Display/Match/_Selected", NULL,
|
|
|
|
match_selected_cb_replace_ptree, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Display/Match/_Not Selected", NULL,
|
|
|
|
match_selected_cb_not_ptree, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Display/Match/_And Selected", NULL,
|
|
|
|
match_selected_cb_and_ptree, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Display/Match/_Or Selected", NULL,
|
|
|
|
match_selected_cb_or_ptree, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Display/Match/A_nd Not Selected", NULL,
|
|
|
|
match_selected_cb_and_ptree_not, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Display/Match/O_r Not Selected", NULL,
|
|
|
|
match_selected_cb_or_ptree_not, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Display/_Prepare", NULL, NULL, 0, "<Branch>", NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Display/Prepare/_Selected", NULL,
|
|
|
|
prepare_selected_cb_replace_ptree, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Display/Prepare/_Not Selected", NULL,
|
|
|
|
prepare_selected_cb_not_ptree, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Display/Prepare/_And Selected", NULL,
|
|
|
|
prepare_selected_cb_and_ptree, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Display/Prepare/_Or Selected", NULL,
|
|
|
|
prepare_selected_cb_or_ptree, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Display/Prepare/A_nd Not Selected", NULL,
|
|
|
|
prepare_selected_cb_and_ptree_not, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Display/Prepare/O_r Not Selected", NULL,
|
|
|
|
prepare_selected_cb_or_ptree_not, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Display/_Colorize Display...", NULL, color_display_cb,
|
|
|
|
0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Display/Collapse _All", NULL, collapse_all_cb,
|
|
|
|
0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Display/_Expand All", NULL, expand_all_cb,
|
|
|
|
0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Display/_Show Packet In New Window", NULL,
|
|
|
|
new_window_cb, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Display/User Specified Decodes...", NULL,
|
|
|
|
decode_show_cb, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/_Tools", NULL, NULL, 0, "<Branch>", NULL),
|
2000-01-15 00:23:13 +00:00
|
|
|
#ifdef HAVE_PLUGINS
|
2002-11-15 23:50:06 +00:00
|
|
|
ITEM_FACTORY_ENTRY("/Tools/_Plugins...", NULL, tools_plugins_cmd_cb,
|
|
|
|
0, NULL, NULL),
|
2002-11-15 18:45:18 +00:00
|
|
|
#endif /* HAVE_PLUGINS */
|
2002-11-15 23:50:06 +00:00
|
|
|
ITEM_FACTORY_ENTRY("/Tools/_Follow TCP Stream", NULL, follow_stream_cb,
|
|
|
|
0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Tools/_Decode As...", NULL, decode_as_cb,
|
|
|
|
0, NULL, NULL),
|
2002-12-19 03:56:04 +00:00
|
|
|
ITEM_FACTORY_ENTRY("/Tools/_Go To Corresponding Frame", NULL, goto_framenum_cb,
|
|
|
|
0, NULL, NULL),
|
1999-06-24 16:25:59 +00:00
|
|
|
/* {"/Tools/Graph", NULL, NULL, 0, NULL}, future use */
|
2002-11-15 23:50:06 +00:00
|
|
|
ITEM_FACTORY_ENTRY("/_Tools/TCP Stream Analysis", NULL, NULL,
|
|
|
|
0, "<Branch>", NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/_Tools/TCP Stream Analysis/Time-Sequence Graph (Stevens)",
|
|
|
|
NULL, tcp_graph_cb, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/_Tools/TCP Stream Analysis/Time-Sequence Graph (tcptrace)",
|
|
|
|
NULL, tcp_graph_cb, 1, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/_Tools/TCP Stream Analysis/Throughput Graph", NULL,
|
|
|
|
tcp_graph_cb, 2, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/_Tools/TCP Stream Analysis/RTT Graph", NULL,
|
|
|
|
tcp_graph_cb, 3, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Tools/_Summary", NULL, summary_open_cb, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Tools/Protocol Hierarchy Statistics", NULL,
|
|
|
|
proto_hier_stats_cb, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Tools/Statistics", NULL, NULL, 0, "<Branch>", NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Tools/Statistics/ONC-RPC", NULL, NULL, 0, "<Branch>",
|
|
|
|
NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Tools/Statistics/ONC-RPC/RTT", NULL, gtk_rpcstat_cb,
|
|
|
|
0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Tools/Statistics/ONC-RPC/Programs", NULL,
|
|
|
|
gtk_rpcprogs_cb, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Tools/Statistics/DCE-RPC", NULL, NULL, 0, "<Branch>",
|
|
|
|
NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Tools/Statistics/DCE-RPC/RTT", NULL, gtk_dcerpcstat_cb,
|
|
|
|
0, NULL, NULL),
|
2002-11-17 11:43:40 +00:00
|
|
|
ITEM_FACTORY_ENTRY("/Tools/Statistics/IO", NULL, NULL, 0, "<Branch>",
|
2002-11-15 23:50:06 +00:00
|
|
|
NULL),
|
2002-11-17 11:43:40 +00:00
|
|
|
ITEM_FACTORY_ENTRY("/Tools/Statistics/IO/IO-Stat", NULL, gtk_iostat_cb,
|
2002-11-15 23:50:06 +00:00
|
|
|
0, NULL, NULL),
|
2003-01-22 00:40:36 +00:00
|
|
|
ITEM_FACTORY_ENTRY("/Tools/Statistics/SMB", NULL, NULL, 0, "<Branch>",
|
|
|
|
NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Tools/Statistics/SMB/RTT", NULL, gtk_smbstat_cb,
|
|
|
|
0, NULL, NULL),
|
2003-04-16 07:25:12 +00:00
|
|
|
ITEM_FACTORY_ENTRY("/Tools/Statistics/MGCP", NULL, NULL, 0, "<Branch>",
|
|
|
|
NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Tools/Statistics/MGCP/RTD", NULL, gtk_mgcpstat_cb,
|
|
|
|
0, NULL, NULL),
|
2003-03-06 21:21:43 +00:00
|
|
|
ITEM_FACTORY_ENTRY("/Tools/Statistics/RTP Analysis...", NULL, rtp_analyse_cb,
|
|
|
|
0, NULL, NULL),
|
2002-11-15 23:50:06 +00:00
|
|
|
ITEM_FACTORY_ENTRY("/_Help", NULL, NULL, 0, "<LastBranch>", NULL),
|
|
|
|
ITEM_FACTORY_STOCK_ENTRY("/Help/_Help", NULL, help_cb, 0, GTK_STOCK_HELP),
|
|
|
|
ITEM_FACTORY_ENTRY("/Help/<separator>", NULL, NULL, 0, "<Separator>", NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Help/_About Ethereal...", NULL, about_ethereal,
|
|
|
|
0, NULL, NULL)
|
1998-12-17 05:42:33 +00:00
|
|
|
};
|
2002-11-15 23:50:06 +00:00
|
|
|
|
1998-09-16 02:39:15 +00:00
|
|
|
|
|
|
|
/* calculate the number of menu_items */
|
|
|
|
static int nmenu_items = sizeof(menu_items) / sizeof(menu_items[0]);
|
|
|
|
|
2000-01-18 08:38:18 +00:00
|
|
|
/* packet list popup */
|
2002-11-03 17:38:45 +00:00
|
|
|
static GtkItemFactoryEntry packet_list_menu_items[] =
|
|
|
|
{
|
2002-11-15 23:50:06 +00:00
|
|
|
ITEM_FACTORY_ENTRY("/Follow TCP Stream", NULL, follow_stream_cb,
|
|
|
|
0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Decode As...", NULL, decode_as_cb, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Display Filters...", NULL, dfilter_dialog_cb,
|
|
|
|
0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/<separator>", NULL, NULL, 0, "<Separator>", NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Mark Frame", NULL, mark_frame_cb, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Match", NULL, NULL, 0, "<Branch>", NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Match/_Selected", NULL,
|
|
|
|
match_selected_cb_replace_plist, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Match/_Not Selected", NULL,
|
|
|
|
match_selected_cb_not_plist, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Match/_And Selected", NULL,
|
|
|
|
match_selected_cb_and_plist, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Match/_Or Selected", NULL, match_selected_cb_or_plist,
|
|
|
|
0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Match/A_nd Not Selected", NULL,
|
|
|
|
match_selected_cb_and_plist_not, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Match/O_r Not Selected", NULL,
|
|
|
|
match_selected_cb_or_plist_not, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Prepare", NULL, NULL, 0, "<Branch>", NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Prepare/_Selected", NULL,
|
|
|
|
prepare_selected_cb_replace_plist, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Prepare/_Not Selected", NULL,
|
|
|
|
prepare_selected_cb_not_plist, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Prepare/_And Selected", NULL,
|
|
|
|
prepare_selected_cb_and_plist, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Prepare/_Or Selected", NULL,
|
|
|
|
prepare_selected_cb_or_plist, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Prepare/A_nd Not Selected", NULL,
|
|
|
|
prepare_selected_cb_and_plist_not, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Prepare/O_r Not Selected", NULL,
|
|
|
|
prepare_selected_cb_or_plist_not, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/<separator>", NULL, NULL, 0, "<Separator>", NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Colorize Display...", NULL, color_display_cb,
|
|
|
|
0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Print...", NULL, file_print_cmd_cb, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Print Packet", NULL, file_print_packet_cmd_cb,
|
|
|
|
0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Show Packet In New Window", NULL, new_window_cb,
|
|
|
|
0, NULL, NULL),
|
2002-11-03 17:38:45 +00:00
|
|
|
};
|
2000-01-18 08:38:18 +00:00
|
|
|
|
|
|
|
static GtkItemFactoryEntry tree_view_menu_items[] =
|
|
|
|
{
|
2002-11-15 23:50:06 +00:00
|
|
|
ITEM_FACTORY_ENTRY("/Follow TCP Stream", NULL, follow_stream_cb,
|
|
|
|
0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Decode As...", NULL, decode_as_cb, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Display Filters...", NULL, dfilter_dialog_cb,
|
|
|
|
0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/<separator>", NULL, NULL, 0, "<Separator>", NULL),
|
2002-12-19 02:58:53 +00:00
|
|
|
ITEM_FACTORY_ENTRY("/_Resolve Name", NULL, resolve_name_cb, 0, NULL, NULL),
|
2002-12-19 03:56:04 +00:00
|
|
|
ITEM_FACTORY_ENTRY("/_Go To Corresponding Frame", NULL, goto_framenum_cb, 0, NULL, NULL),
|
2002-11-15 23:50:06 +00:00
|
|
|
ITEM_FACTORY_ENTRY("/Protocol Properties...", NULL, properties_cb,
|
|
|
|
0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Match", NULL, NULL, 0, "<Branch>", NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Match/_Selected", NULL,
|
|
|
|
match_selected_cb_replace_ptree, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Match/_Not Selected", NULL,
|
|
|
|
match_selected_cb_not_ptree, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Match/_And Selected", NULL,
|
|
|
|
match_selected_cb_and_ptree, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Match/_Or Selected", NULL, match_selected_cb_or_ptree,
|
|
|
|
0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Match/A_nd Not Selected", NULL,
|
|
|
|
match_selected_cb_and_ptree_not, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Match/O_r Not Selected", NULL,
|
|
|
|
match_selected_cb_or_ptree_not, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Prepare", NULL, NULL, 0, "<Branch>", NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Prepare/_Selected", NULL,
|
|
|
|
prepare_selected_cb_replace_ptree, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Prepare/_Not Selected", NULL,
|
|
|
|
prepare_selected_cb_not_ptree, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Prepare/_And Selected", NULL,
|
|
|
|
prepare_selected_cb_and_ptree, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Prepare/_Or Selected", NULL,
|
|
|
|
prepare_selected_cb_or_ptree, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Prepare/A_nd Not Selected", NULL,
|
|
|
|
prepare_selected_cb_and_ptree_not, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Prepare/O_r Not Selected", NULL,
|
|
|
|
prepare_selected_cb_or_ptree_not, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/<separator>", NULL, NULL, 0, "<Separator>", NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Collapse All", NULL, collapse_all_cb, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Expand All", NULL, expand_all_cb, 0, NULL, NULL)
|
2000-01-18 08:38:18 +00:00
|
|
|
};
|
|
|
|
|
2000-08-20 21:55:58 +00:00
|
|
|
static GtkItemFactoryEntry hexdump_menu_items[] =
|
|
|
|
{
|
2002-11-15 23:50:06 +00:00
|
|
|
ITEM_FACTORY_ENTRY("/Follow TCP Stream", NULL, follow_stream_cb,
|
|
|
|
0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Decode As...", NULL, decode_as_cb, 0, NULL, NULL),
|
|
|
|
ITEM_FACTORY_ENTRY("/Display Filters...", NULL, dfilter_dialog_cb,
|
|
|
|
0, NULL, NULL)
|
2000-08-20 21:55:58 +00:00
|
|
|
};
|
2000-01-18 08:38:18 +00:00
|
|
|
|
1998-09-16 02:39:15 +00:00
|
|
|
static int initialize = TRUE;
|
2003-04-22 00:16:58 +00:00
|
|
|
static GtkItemFactory *main_menu_factory = NULL;
|
2000-01-18 08:38:18 +00:00
|
|
|
static GtkItemFactory *packet_list_menu_factory = NULL;
|
|
|
|
static GtkItemFactory *tree_view_menu_factory = NULL;
|
2000-08-20 21:55:58 +00:00
|
|
|
static GtkItemFactory *hexdump_menu_factory = NULL;
|
2000-01-18 08:38:18 +00:00
|
|
|
|
|
|
|
static GSList *popup_menu_list = NULL;
|
1998-09-16 02:39:15 +00:00
|
|
|
|
2000-01-03 04:06:09 +00:00
|
|
|
static GtkAccelGroup *grp;
|
|
|
|
|
1998-09-16 02:39:15 +00:00
|
|
|
void
|
1998-12-17 05:42:33 +00:00
|
|
|
get_main_menu(GtkWidget ** menubar, GtkAccelGroup ** table) {
|
|
|
|
|
|
|
|
grp = gtk_accel_group_new();
|
|
|
|
|
2000-01-18 08:38:18 +00:00
|
|
|
if (initialize) {
|
2003-01-08 23:33:38 +00:00
|
|
|
popup_menu_object = gtk_menu_new();
|
1998-09-16 02:39:15 +00:00
|
|
|
menus_init();
|
2000-01-18 08:38:18 +00:00
|
|
|
}
|
1998-09-16 02:39:15 +00:00
|
|
|
|
1998-12-17 05:42:33 +00:00
|
|
|
if (menubar)
|
2003-04-22 00:16:58 +00:00
|
|
|
*menubar = main_menu_factory->widget;
|
1998-12-17 05:42:33 +00:00
|
|
|
|
1998-09-16 02:39:15 +00:00
|
|
|
if (table)
|
1998-12-17 05:42:33 +00:00
|
|
|
*table = grp;
|
1998-09-16 02:39:15 +00:00
|
|
|
}
|
|
|
|
|
2000-01-03 04:06:09 +00:00
|
|
|
static void
|
1998-09-16 02:39:15 +00:00
|
|
|
menus_init(void) {
|
|
|
|
|
|
|
|
if (initialize) {
|
|
|
|
initialize = FALSE;
|
|
|
|
|
2000-01-18 08:38:18 +00:00
|
|
|
/* popup */
|
|
|
|
|
|
|
|
packet_list_menu_factory = gtk_item_factory_new(GTK_TYPE_MENU, "<main>", NULL);
|
2002-01-11 08:21:02 +00:00
|
|
|
gtk_item_factory_create_items_ac(packet_list_menu_factory, sizeof(packet_list_menu_items)/sizeof(packet_list_menu_items[0]), packet_list_menu_items, popup_menu_object, 2);
|
2002-11-11 15:39:06 +00:00
|
|
|
OBJECT_SET_DATA(popup_menu_object, PM_PACKET_LIST_KEY,
|
|
|
|
packet_list_menu_factory->widget);
|
2000-01-18 08:38:18 +00:00
|
|
|
popup_menu_list = g_slist_append((GSList *)popup_menu_list, packet_list_menu_factory);
|
|
|
|
|
|
|
|
tree_view_menu_factory = gtk_item_factory_new(GTK_TYPE_MENU, "<main>", NULL);
|
2002-01-11 08:21:02 +00:00
|
|
|
gtk_item_factory_create_items_ac(tree_view_menu_factory, sizeof(tree_view_menu_items)/sizeof(tree_view_menu_items[0]), tree_view_menu_items, popup_menu_object, 2);
|
2002-11-11 15:39:06 +00:00
|
|
|
OBJECT_SET_DATA(popup_menu_object, PM_TREE_VIEW_KEY,
|
|
|
|
tree_view_menu_factory->widget);
|
2000-01-18 08:38:18 +00:00
|
|
|
popup_menu_list = g_slist_append((GSList *)popup_menu_list, tree_view_menu_factory);
|
2000-08-20 21:55:58 +00:00
|
|
|
|
|
|
|
hexdump_menu_factory = gtk_item_factory_new(GTK_TYPE_MENU, "<main>", NULL);
|
2002-01-11 08:21:02 +00:00
|
|
|
gtk_item_factory_create_items_ac(hexdump_menu_factory, sizeof(hexdump_menu_items)/sizeof(hexdump_menu_items[0]), hexdump_menu_items, popup_menu_object, 2);
|
2002-11-11 15:39:06 +00:00
|
|
|
OBJECT_SET_DATA(popup_menu_object, PM_HEXDUMP_KEY,
|
|
|
|
hexdump_menu_factory->widget);
|
2000-08-20 21:55:58 +00:00
|
|
|
popup_menu_list = g_slist_append((GSList *)popup_menu_list, hexdump_menu_factory);
|
2002-08-28 21:04:11 +00:00
|
|
|
|
2003-04-22 00:16:58 +00:00
|
|
|
main_menu_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", grp);
|
|
|
|
gtk_item_factory_create_items_ac(main_menu_factory, nmenu_items, menu_items, NULL,2);
|
2000-01-03 03:57:04 +00:00
|
|
|
set_menus_for_unsaved_capture_file(FALSE);
|
|
|
|
set_menus_for_capture_file(FALSE);
|
2000-09-09 08:17:51 +00:00
|
|
|
#if 0
|
|
|
|
/* Un-#if this when we actually implement Cut/Copy/Paste.
|
|
|
|
Then make sure you enable them when they can be done. */
|
2003-04-22 00:16:58 +00:00
|
|
|
set_menu_sensitivity(main_menu_factory, "/Edit/Cut", FALSE);
|
|
|
|
set_menu_sensitivity(main_menu_factory, "/Edit/Copy", FALSE);
|
|
|
|
set_menu_sensitivity(main_menu_factory, "/Edit/Paste", FALSE);
|
2000-09-09 08:17:51 +00:00
|
|
|
#endif
|
2003-04-16 07:25:12 +00:00
|
|
|
|
|
|
|
if(!find_tap_id("mgcp")) {
|
2003-04-22 00:16:58 +00:00
|
|
|
set_menu_sensitivity(main_menu_factory, "/Tools/Statistics/MGCP/RTD",
|
|
|
|
FALSE);
|
2003-04-16 07:25:12 +00:00
|
|
|
}
|
2000-01-03 03:57:04 +00:00
|
|
|
set_menus_for_captured_packets(FALSE);
|
|
|
|
set_menus_for_selected_packet(FALSE);
|
2000-08-15 21:03:55 +00:00
|
|
|
set_menus_for_selected_tree_row(FALSE);
|
1998-09-16 02:39:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-04-22 00:16:58 +00:00
|
|
|
/*
|
|
|
|
* Enable/disable menu sensitivity.
|
|
|
|
*/
|
2000-01-03 04:06:09 +00:00
|
|
|
static void
|
2003-04-22 00:16:58 +00:00
|
|
|
set_menu_sensitivity(GtkItemFactory *ifactory, gchar *path, gint val)
|
|
|
|
{
|
|
|
|
GSList *menu_list;
|
2003-04-22 04:02:49 +00:00
|
|
|
GtkWidget *menu_item;
|
2002-01-11 08:21:02 +00:00
|
|
|
|
2003-04-22 00:16:58 +00:00
|
|
|
if (ifactory == NULL) {
|
|
|
|
/*
|
|
|
|
* Do it for all pop-up menus.
|
|
|
|
*/
|
|
|
|
for (menu_list = popup_menu_list; menu_list != NULL;
|
|
|
|
menu_list = g_slist_next(menu_list))
|
|
|
|
set_menu_sensitivity(menu_list->data, path, val);
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* Do it for that particular menu.
|
|
|
|
*/
|
2003-04-22 04:02:49 +00:00
|
|
|
if ((menu_item = gtk_item_factory_get_widget(ifactory, path)) != NULL) {
|
|
|
|
if (GTK_IS_MENU(menu_item)) {
|
|
|
|
/*
|
|
|
|
* "path" refers to a submenu; "gtk_item_factory_get_widget()"
|
|
|
|
* gets the menu, not the item that, when selected, pops up
|
|
|
|
* the submenu.
|
|
|
|
*
|
|
|
|
* We have to change the latter item's sensitivity, so that
|
|
|
|
* it shows up normally if sensitive and grayed-out if
|
|
|
|
* insensitive.
|
|
|
|
*/
|
|
|
|
menu_item = gtk_menu_get_attach_widget(GTK_MENU(menu_item));
|
|
|
|
}
|
|
|
|
gtk_widget_set_sensitive(menu_item, val);
|
|
|
|
}
|
2000-01-18 08:38:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_menu_object_data_meat(GtkItemFactory *ifactory, gchar *path, gchar *key, gpointer data)
|
|
|
|
{
|
|
|
|
GtkWidget *menu = NULL;
|
2002-08-28 21:04:11 +00:00
|
|
|
|
2000-01-18 08:38:18 +00:00
|
|
|
if ((menu = gtk_item_factory_get_widget(ifactory, path)) != NULL)
|
2002-11-11 15:39:06 +00:00
|
|
|
OBJECT_SET_DATA(menu, key, data);
|
1998-10-12 01:40:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_menu_object_data (gchar *path, gchar *key, gpointer data) {
|
2000-01-18 08:38:18 +00:00
|
|
|
GSList *menu_list = popup_menu_list;
|
2000-01-18 19:01:35 +00:00
|
|
|
gchar *shortpath = strrchr(path, '/');
|
2002-08-28 21:04:11 +00:00
|
|
|
|
2003-04-22 00:16:58 +00:00
|
|
|
set_menu_object_data_meat(main_menu_factory, path, key, data);
|
2000-01-18 08:38:18 +00:00
|
|
|
while (menu_list != NULL) {
|
|
|
|
set_menu_object_data_meat(menu_list->data, shortpath, key, data);
|
|
|
|
menu_list = g_slist_next(menu_list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-08-21 12:33:22 +00:00
|
|
|
gint
|
|
|
|
popup_menu_handler(GtkWidget *widget, GdkEvent *event, gpointer data)
|
2000-01-18 08:38:18 +00:00
|
|
|
{
|
2002-11-11 18:46:16 +00:00
|
|
|
GtkWidget *menu = NULL;
|
|
|
|
GdkEventButton *event_button = NULL;
|
|
|
|
GtkCList *packet_list = NULL;
|
|
|
|
gint row, column;
|
2000-01-18 08:38:18 +00:00
|
|
|
|
2002-11-11 18:46:16 +00:00
|
|
|
if(widget == NULL || event == NULL || data == NULL) {
|
|
|
|
return FALSE;
|
|
|
|
}
|
2002-08-28 21:04:11 +00:00
|
|
|
|
2002-11-11 18:46:16 +00:00
|
|
|
/*
|
|
|
|
* If we ever want to make the menu differ based on what row
|
|
|
|
* and/or column we're above, we'd use "gtk_clist_get_selection_info()"
|
|
|
|
* to find the row and column number for the coordinates; a CTree is,
|
|
|
|
* I guess, like a CList with one column(?) and the expander widget
|
|
|
|
* as a pixmap.
|
|
|
|
*/
|
|
|
|
/* Check if we are on packet_list object */
|
|
|
|
if (widget == OBJECT_GET_DATA(popup_menu_object, E_MPACKET_LIST_KEY)) {
|
|
|
|
packet_list=GTK_CLIST(widget);
|
|
|
|
if (gtk_clist_get_selection_info(GTK_CLIST(packet_list),
|
|
|
|
((GdkEventButton *)event)->x,
|
|
|
|
((GdkEventButton *)event)->y,&row,&column)) {
|
|
|
|
OBJECT_SET_DATA(popup_menu_object, E_MPACKET_LIST_ROW_KEY,
|
2002-11-11 15:39:06 +00:00
|
|
|
GINT_TO_POINTER(row));
|
2002-11-11 18:46:16 +00:00
|
|
|
OBJECT_SET_DATA(popup_menu_object, E_MPACKET_LIST_COL_KEY,
|
2002-11-11 15:39:06 +00:00
|
|
|
GINT_TO_POINTER(column));
|
2002-11-11 18:46:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
menu = (GtkWidget *)data;
|
|
|
|
if(event->type == GDK_BUTTON_PRESS) {
|
|
|
|
event_button = (GdkEventButton *) event;
|
|
|
|
|
|
|
|
if(event_button->button == 3) {
|
|
|
|
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
|
|
|
|
event_button->button,
|
|
|
|
event_button->time);
|
|
|
|
SIGNAL_EMIT_STOP_BY_NAME(widget, "button_press_event");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#if GTK_MAJOR_VERSION >= 2
|
|
|
|
if (widget == tree_view && event->type == GDK_2BUTTON_PRESS) {
|
|
|
|
GtkTreePath *path;
|
|
|
|
|
|
|
|
if (gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(widget),
|
|
|
|
((GdkEventButton *)event)->x,
|
|
|
|
((GdkEventButton *)event)->y,
|
|
|
|
&path, NULL, NULL, NULL))
|
|
|
|
{
|
|
|
|
if (gtk_tree_view_row_expanded(GTK_TREE_VIEW(widget), path))
|
|
|
|
gtk_tree_view_collapse_row(GTK_TREE_VIEW(widget), path);
|
|
|
|
else
|
|
|
|
gtk_tree_view_expand_row(GTK_TREE_VIEW(widget), path,
|
|
|
|
FALSE);
|
|
|
|
gtk_tree_path_free(path);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return FALSE;
|
1998-09-16 02:39:15 +00:00
|
|
|
}
|
|
|
|
|
2000-01-03 03:57:04 +00:00
|
|
|
/* Enable or disable menu items based on whether you have a capture file
|
|
|
|
you've finished reading. */
|
|
|
|
void
|
|
|
|
set_menus_for_capture_file(gboolean have_capture_file)
|
|
|
|
{
|
2003-04-22 00:16:58 +00:00
|
|
|
set_menu_sensitivity(main_menu_factory, "/File/Open...", have_capture_file);
|
|
|
|
set_menu_sensitivity(main_menu_factory, "/File/Save As...",
|
|
|
|
have_capture_file);
|
|
|
|
set_menu_sensitivity(main_menu_factory, "/File/Close", have_capture_file);
|
|
|
|
set_menu_sensitivity(main_menu_factory, "/File/Reload", have_capture_file);
|
2000-01-03 03:57:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Enable or disable menu items based on whether you have an unsaved
|
|
|
|
capture file you've finished reading. */
|
|
|
|
void
|
|
|
|
set_menus_for_unsaved_capture_file(gboolean have_unsaved_capture_file)
|
|
|
|
{
|
2003-04-22 00:16:58 +00:00
|
|
|
set_menu_sensitivity(main_menu_factory, "/File/Save",
|
|
|
|
have_unsaved_capture_file);
|
2000-01-03 03:57:04 +00:00
|
|
|
}
|
1998-09-16 02:39:15 +00:00
|
|
|
|
2000-01-03 03:57:04 +00:00
|
|
|
/* Enable or disable menu items based on whether there's a capture in
|
|
|
|
progress. */
|
|
|
|
void
|
|
|
|
set_menus_for_capture_in_progress(gboolean capture_in_progress)
|
|
|
|
{
|
2003-04-22 00:16:58 +00:00
|
|
|
set_menu_sensitivity(main_menu_factory, "/File/Open...",
|
|
|
|
!capture_in_progress);
|
|
|
|
set_menu_sensitivity(main_menu_factory, "/Capture/Start...",
|
|
|
|
!capture_in_progress);
|
2000-10-11 06:01:16 +00:00
|
|
|
/*
|
|
|
|
* XXX - this doesn't yet work in Win32.
|
|
|
|
*/
|
|
|
|
#ifndef _WIN32
|
2003-04-22 00:16:58 +00:00
|
|
|
set_menu_sensitivity(main_menu_factory, "/Capture/Stop",
|
|
|
|
capture_in_progress);
|
2000-10-11 06:01:16 +00:00
|
|
|
#endif
|
2000-01-03 03:57:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Enable or disable menu items based on whether you have some captured
|
|
|
|
packets. */
|
|
|
|
void
|
|
|
|
set_menus_for_captured_packets(gboolean have_captured_packets)
|
|
|
|
{
|
2003-04-22 00:16:58 +00:00
|
|
|
set_menu_sensitivity(main_menu_factory, "/File/Print...",
|
|
|
|
have_captured_packets);
|
|
|
|
set_menu_sensitivity(packet_list_menu_factory, "/Print...",
|
|
|
|
have_captured_packets);
|
|
|
|
set_menu_sensitivity(main_menu_factory, "/Edit/Find Frame...",
|
|
|
|
have_captured_packets);
|
|
|
|
set_menu_sensitivity(main_menu_factory, "/Edit/Find Next",
|
|
|
|
have_captured_packets);
|
|
|
|
set_menu_sensitivity(main_menu_factory, "/Edit/Find Previous",
|
|
|
|
have_captured_packets);
|
|
|
|
set_menu_sensitivity(main_menu_factory, "/Edit/Go To Frame...",
|
|
|
|
have_captured_packets);
|
|
|
|
set_menu_sensitivity(main_menu_factory, "/Display/Colorize Display...",
|
|
|
|
have_captured_packets);
|
|
|
|
set_menu_sensitivity(packet_list_menu_factory, "/Colorize Display...",
|
|
|
|
have_captured_packets);
|
|
|
|
set_menu_sensitivity(main_menu_factory, "/Tools/Summary",
|
|
|
|
have_captured_packets);
|
|
|
|
set_menu_sensitivity(main_menu_factory,
|
|
|
|
"/Tools/Protocol Hierarchy Statistics", have_captured_packets);
|
|
|
|
set_menu_sensitivity(main_menu_factory, "/Display/Match",
|
|
|
|
have_captured_packets);
|
|
|
|
set_menu_sensitivity(packet_list_menu_factory, "/Match",
|
|
|
|
have_captured_packets);
|
|
|
|
set_menu_sensitivity(tree_view_menu_factory, "/Match",
|
|
|
|
have_captured_packets);
|
|
|
|
set_menu_sensitivity(main_menu_factory, "/Display/Prepare",
|
|
|
|
have_captured_packets);
|
|
|
|
set_menu_sensitivity(packet_list_menu_factory, "/Prepare",
|
|
|
|
have_captured_packets);
|
|
|
|
set_menu_sensitivity(tree_view_menu_factory, "/Prepare",
|
|
|
|
have_captured_packets);
|
2000-01-03 03:57:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Enable or disable menu items based on whether a packet is selected. */
|
|
|
|
void
|
|
|
|
set_menus_for_selected_packet(gboolean have_selected_packet)
|
|
|
|
{
|
2003-04-22 00:16:58 +00:00
|
|
|
set_menu_sensitivity(main_menu_factory, "/File/Print Packet",
|
|
|
|
have_selected_packet);
|
|
|
|
set_menu_sensitivity(packet_list_menu_factory, "/Print Packet",
|
|
|
|
have_selected_packet);
|
|
|
|
set_menu_sensitivity(main_menu_factory, "/Edit/Mark Frame",
|
|
|
|
have_selected_packet);
|
|
|
|
set_menu_sensitivity(packet_list_menu_factory, "/Mark Frame",
|
|
|
|
have_selected_packet);
|
|
|
|
set_menu_sensitivity(main_menu_factory, "/Edit/Mark All Frames",
|
|
|
|
have_selected_packet);
|
|
|
|
set_menu_sensitivity(main_menu_factory, "/Edit/Unmark All Frames",
|
|
|
|
have_selected_packet);
|
|
|
|
set_menu_sensitivity(main_menu_factory, "/Display/Collapse All",
|
|
|
|
have_selected_packet);
|
|
|
|
set_menu_sensitivity(tree_view_menu_factory, "/Collapse All",
|
|
|
|
have_selected_packet);
|
|
|
|
set_menu_sensitivity(main_menu_factory, "/Display/Expand All",
|
|
|
|
have_selected_packet);
|
|
|
|
set_menu_sensitivity(tree_view_menu_factory, "/Expand All",
|
|
|
|
have_selected_packet);
|
|
|
|
set_menu_sensitivity(main_menu_factory, "/Display/Show Packet In New Window",
|
|
|
|
have_selected_packet);
|
|
|
|
set_menu_sensitivity(main_menu_factory, "/Tools/Follow TCP Stream",
|
|
|
|
have_selected_packet ? (cfile.edt->pi.ipproto == 6) : FALSE);
|
|
|
|
set_menu_sensitivity(NULL, "/Follow TCP Stream",
|
2001-11-21 23:16:26 +00:00
|
|
|
have_selected_packet ? (cfile.edt->pi.ipproto == 6) : FALSE);
|
2003-04-22 00:16:58 +00:00
|
|
|
set_menu_sensitivity(main_menu_factory, "/Tools/Decode As...",
|
2001-02-11 23:02:05 +00:00
|
|
|
have_selected_packet && decode_as_ok());
|
2003-04-22 00:16:58 +00:00
|
|
|
set_menu_sensitivity(NULL, "/Decode As...",
|
|
|
|
have_selected_packet && decode_as_ok());
|
|
|
|
set_menu_sensitivity(tree_view_menu_factory, "/Resolve Name",
|
2002-01-13 20:35:12 +00:00
|
|
|
have_selected_packet && g_resolv_flags == 0);
|
2003-04-22 00:16:58 +00:00
|
|
|
set_menu_sensitivity(main_menu_factory, "/Tools/TCP Stream Analysis",
|
|
|
|
have_selected_packet ? (cfile.edt->pi.ipproto == 6) : FALSE);
|
2000-08-15 20:46:17 +00:00
|
|
|
}
|
|
|
|
|
Enable "Match Selected" only if there's a field selected *and* we can do
a "Match Selected" on it - we can't do a "Match Selected" if the field
has no value (e.g., FT_NULL) and has a length of 0.
If we unselect the current packet, we don't have a protocol tree, so we
don't have a currently selected field - clear the "Match Selected" menu
item and the display in the status line of information about the
currently selected field.
Move the low-level statusbar manipulation into "gtk/main.c", in routines
whose API doesn't expose anything GTK+-ish.
"close_cap_file()" calls one of those routines to clear out the status
bar, so it doesn't need to take a pointer to the statusbar widget as an
argument.
"clear_tree_and_hex_views()" is purely a display-manipulating routine;
move it to "gtk/proto_draw.c".
Extract from "tree_view_unselect_row_cb()" an "unselect_field()" routine
to do all the work that needs to be done if the currently selected
protocol tree row is unselected, and call it if the currently selected
packet list row is unselected (if it's unselected, there *is* no
protocol tree, so no row can be selected), as well as from
"tree_view_unselect_row_cb()".
Before pushing a new field-description message onto the statusbar, pop
the old one off.
Get rid of an unused variable (set, but not used).
svn path=/trunk/; revision=3513
2001-06-05 07:39:31 +00:00
|
|
|
/* Enable or disable menu items based on whether a tree row is selected
|
2002-01-11 08:21:02 +00:00
|
|
|
and and on whether a "Match" can be done. */
|
2000-08-15 20:46:17 +00:00
|
|
|
void
|
|
|
|
set_menus_for_selected_tree_row(gboolean have_selected_tree)
|
|
|
|
{
|
|
|
|
gboolean properties = FALSE;
|
Enable "Match Selected" only if there's a field selected *and* we can do
a "Match Selected" on it - we can't do a "Match Selected" if the field
has no value (e.g., FT_NULL) and has a length of 0.
If we unselect the current packet, we don't have a protocol tree, so we
don't have a currently selected field - clear the "Match Selected" menu
item and the display in the status line of information about the
currently selected field.
Move the low-level statusbar manipulation into "gtk/main.c", in routines
whose API doesn't expose anything GTK+-ish.
"close_cap_file()" calls one of those routines to clear out the status
bar, so it doesn't need to take a pointer to the statusbar widget as an
argument.
"clear_tree_and_hex_views()" is purely a display-manipulating routine;
move it to "gtk/proto_draw.c".
Extract from "tree_view_unselect_row_cb()" an "unselect_field()" routine
to do all the work that needs to be done if the currently selected
protocol tree row is unselected, and call it if the currently selected
packet list row is unselected (if it's unselected, there *is* no
protocol tree, so no row can be selected), as well as from
"tree_view_unselect_row_cb()".
Before pushing a new field-description message onto the statusbar, pop
the old one off.
Get rid of an unused variable (set, but not used).
svn path=/trunk/; revision=3513
2001-06-05 07:39:31 +00:00
|
|
|
|
2000-08-15 20:46:17 +00:00
|
|
|
if (finfo_selected) {
|
|
|
|
header_field_info *hfinfo = finfo_selected->hfinfo;
|
|
|
|
if (hfinfo->parent == -1) {
|
|
|
|
properties = prefs_is_registered_protocol(hfinfo->abbrev);
|
|
|
|
} else {
|
|
|
|
properties = prefs_is_registered_protocol(proto_registrar_get_abbrev(hfinfo->parent));
|
|
|
|
}
|
2002-12-19 03:56:04 +00:00
|
|
|
if (hfinfo->type == FT_FRAMENUM) {
|
2003-04-22 00:16:58 +00:00
|
|
|
set_menu_sensitivity(main_menu_factory,
|
|
|
|
"/Tools/Go To Corresponding Frame", TRUE);
|
|
|
|
set_menu_sensitivity(tree_view_menu_factory,
|
|
|
|
"/Go To Corresponding Frame", TRUE);
|
2002-12-19 03:56:04 +00:00
|
|
|
} else {
|
2003-04-22 00:16:58 +00:00
|
|
|
set_menu_sensitivity(main_menu_factory,
|
|
|
|
"/Tools/Go To Corresponding Frame", FALSE);
|
|
|
|
set_menu_sensitivity(tree_view_menu_factory,
|
|
|
|
"/Go To Corresponding Frame", FALSE);
|
2002-12-19 03:56:04 +00:00
|
|
|
}
|
2003-04-22 00:16:58 +00:00
|
|
|
set_menu_sensitivity(main_menu_factory, "/Display/Match",
|
2002-01-11 08:21:02 +00:00
|
|
|
proto_can_match_selected(finfo_selected));
|
2003-04-22 00:16:58 +00:00
|
|
|
set_menu_sensitivity(tree_view_menu_factory, "/Match",
|
2002-01-11 08:21:02 +00:00
|
|
|
proto_can_match_selected(finfo_selected));
|
2003-04-22 00:16:58 +00:00
|
|
|
set_menu_sensitivity(main_menu_factory, "/Display/Prepare",
|
Enable "Match Selected" only if there's a field selected *and* we can do
a "Match Selected" on it - we can't do a "Match Selected" if the field
has no value (e.g., FT_NULL) and has a length of 0.
If we unselect the current packet, we don't have a protocol tree, so we
don't have a currently selected field - clear the "Match Selected" menu
item and the display in the status line of information about the
currently selected field.
Move the low-level statusbar manipulation into "gtk/main.c", in routines
whose API doesn't expose anything GTK+-ish.
"close_cap_file()" calls one of those routines to clear out the status
bar, so it doesn't need to take a pointer to the statusbar widget as an
argument.
"clear_tree_and_hex_views()" is purely a display-manipulating routine;
move it to "gtk/proto_draw.c".
Extract from "tree_view_unselect_row_cb()" an "unselect_field()" routine
to do all the work that needs to be done if the currently selected
protocol tree row is unselected, and call it if the currently selected
packet list row is unselected (if it's unselected, there *is* no
protocol tree, so no row can be selected), as well as from
"tree_view_unselect_row_cb()".
Before pushing a new field-description message onto the statusbar, pop
the old one off.
Get rid of an unused variable (set, but not used).
svn path=/trunk/; revision=3513
2001-06-05 07:39:31 +00:00
|
|
|
proto_can_match_selected(finfo_selected));
|
2003-04-22 00:16:58 +00:00
|
|
|
set_menu_sensitivity(tree_view_menu_factory, "/Prepare",
|
2002-01-11 08:21:02 +00:00
|
|
|
proto_can_match_selected(finfo_selected));
|
|
|
|
} else {
|
2003-04-22 00:16:58 +00:00
|
|
|
set_menu_sensitivity(main_menu_factory, "/Display/Match", FALSE);
|
|
|
|
set_menu_sensitivity(tree_view_menu_factory, "/Match", FALSE);
|
|
|
|
set_menu_sensitivity(main_menu_factory, "/Display/Prepare", FALSE);
|
|
|
|
set_menu_sensitivity(tree_view_menu_factory, "/Prepare", FALSE);
|
|
|
|
set_menu_sensitivity(main_menu_factory,
|
|
|
|
"/Tools/Go To Corresponding Frame", FALSE);
|
|
|
|
set_menu_sensitivity(tree_view_menu_factory,
|
|
|
|
"/Go To Corresponding Frame", FALSE);
|
2002-01-11 08:21:02 +00:00
|
|
|
}
|
Enable "Match Selected" only if there's a field selected *and* we can do
a "Match Selected" on it - we can't do a "Match Selected" if the field
has no value (e.g., FT_NULL) and has a length of 0.
If we unselect the current packet, we don't have a protocol tree, so we
don't have a currently selected field - clear the "Match Selected" menu
item and the display in the status line of information about the
currently selected field.
Move the low-level statusbar manipulation into "gtk/main.c", in routines
whose API doesn't expose anything GTK+-ish.
"close_cap_file()" calls one of those routines to clear out the status
bar, so it doesn't need to take a pointer to the statusbar widget as an
argument.
"clear_tree_and_hex_views()" is purely a display-manipulating routine;
move it to "gtk/proto_draw.c".
Extract from "tree_view_unselect_row_cb()" an "unselect_field()" routine
to do all the work that needs to be done if the currently selected
protocol tree row is unselected, and call it if the currently selected
packet list row is unselected (if it's unselected, there *is* no
protocol tree, so no row can be selected), as well as from
"tree_view_unselect_row_cb()".
Before pushing a new field-description message onto the statusbar, pop
the old one off.
Get rid of an unused variable (set, but not used).
svn path=/trunk/; revision=3513
2001-06-05 07:39:31 +00:00
|
|
|
|
2003-04-22 00:16:58 +00:00
|
|
|
set_menu_sensitivity(tree_view_menu_factory, "/Protocol Properties...",
|
|
|
|
have_selected_tree && properties);
|
2000-01-03 03:57:04 +00:00
|
|
|
}
|