4 * $Id: menu.c,v 1.175 2004/02/25 17:44:50 ulfl Exp $
6 * Ethereal - Network traffic analyzer
7 * By Gerald Combs <gerald@ethereal.com>
8 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
36 #include <epan/packet.h>
37 #include <epan/resolv.h>
39 #include "capture_dlg.h"
40 #include "color_dlg.h"
41 #include "filter_prefs.h"
45 #include "summary_dlg.h"
46 #include "prefs_dlg.h"
47 #include "packet_win.h"
49 #include "follow_dlg.h"
50 #include "decode_as_dlg.h"
52 #include "supported_protos_dlg.h"
53 #include "proto_dlg.h"
54 #include "proto_hier_stats_dlg.h"
56 #include <epan/plugins.h>
57 #include <epan/epan_dissect.h>
58 #include "compat_macros.h"
60 #include "gtkglobals.h"
64 #include "../ipproto.h"
65 #include "packet_list.h"
68 #include "../ui_util.h"
69 #include "proto_draw.h"
70 #include "simple_dialog.h"
72 GtkWidget *popup_menu_object;
74 extern void savehex_cb(GtkWidget * w, gpointer data _U_);
77 clear_menu_recent_capture_file_cmd_cb(GtkWidget *w, gpointer unused _U_);
79 typedef struct _menu_item {
83 GtkItemFactoryCallback callback;
84 gpointer callback_data;
85 gboolean (*selected_packet_enabled)(frame_data *, epan_dissect_t *);
86 gboolean (*selected_tree_row_enabled)(field_info *);
90 static GList *tap_menu_tree_root = NULL;
93 merge_all_tap_menus(GList *node);
95 #define GTK_MENU_FUNC(a) ((GtkItemFactoryCallback)(a))
97 static void menus_init(void);
98 static void set_menu_sensitivity (GtkItemFactory *, const gchar *, gint);
99 static void main_toolbar_show_cb(GtkWidget *w _U_, gpointer d _U_);
100 static void filter_toolbar_show_cb(GtkWidget *w _U_, gpointer d _U_);
101 static void packet_list_show_cb(GtkWidget *w _U_, gpointer d _U_);
102 static void tree_view_show_cb(GtkWidget *w _U_, gpointer d _U_);
103 static void byte_view_show_cb(GtkWidget *w _U_, gpointer d _U_);
104 static void statusbar_show_cb(GtkWidget *w _U_, gpointer d _U_);
105 static void timestamp_absolute_cb(GtkWidget *w _U_, gpointer d _U_);
106 static void timestamp_absolute_date_cb(GtkWidget *w _U_, gpointer d _U_);
107 static void timestamp_relative_cb(GtkWidget *w _U_, gpointer d _U_);
108 static void timestamp_delta_cb(GtkWidget *w _U_, gpointer d _U_);
109 static void name_resolution_mac_cb(GtkWidget *w _U_, gpointer d _U_);
110 static void name_resolution_network_cb(GtkWidget *w _U_, gpointer d _U_);
111 static void name_resolution_transport_cb(GtkWidget *w _U_, gpointer d _U_);
112 static void auto_scroll_live_cb(GtkWidget *w _U_, gpointer d _U_);
114 /* This is the GtkItemFactoryEntry structure used to generate new menus.
115 Item 1: The menu path. The letter after the underscore indicates an
116 accelerator key once the menu is open.
117 Item 2: The accelerator key for the entry
118 Item 3: The callback function.
119 Item 4: The callback action. This changes the parameters with
120 which the function is called. The default is 0.
121 Item 5: The item type, used to define what kind of an item it is.
122 Here are the possible values:
126 "<Title>" -> create a title item
127 "<Item>" -> create a simple item
128 "<ImageItem>" -> create an item holding an image (gtk2)
129 "<StockItem>" -> create an item holding a stock image (gtk2)
130 "<CheckItem>" -> create a check item
131 "<ToggleItem>" -> create a toggle item
132 "<RadioItem>" -> create a radio item
133 <path> -> path of a radio item to link against
134 "<Separator>" -> create a separator
135 "<Tearoff>" -> create a tearoff separator (gtk2)
136 "<Branch>" -> create an item to hold sub items (optional)
137 "<LastBranch>" -> create a right justified branch
138 Item 6: extra data needed for ImageItem and StockItem (gtk2)
142 static GtkItemFactoryEntry menu_items[] =
144 ITEM_FACTORY_ENTRY("/_File", NULL, NULL, 0, "<Branch>", NULL),
145 ITEM_FACTORY_STOCK_ENTRY("/File/_Open...", "<control>O", file_open_cmd_cb,
147 ITEM_FACTORY_ENTRY("/File/Open _Recent", NULL, NULL, 0, "<Branch>", NULL),
148 ITEM_FACTORY_STOCK_ENTRY("/File/_Close", "<control>W", file_close_cmd_cb,
150 ITEM_FACTORY_ENTRY("/File/<separator>", NULL, NULL, 0, "<Separator>", NULL),
151 ITEM_FACTORY_STOCK_ENTRY("/File/_Save", "<control>S", file_save_cmd_cb,
153 ITEM_FACTORY_STOCK_ENTRY("/File/Save _As...", "<shift><control>S", file_save_as_cmd_cb,
154 0, GTK_STOCK_SAVE_AS),
155 ITEM_FACTORY_ENTRY("/File/<separator>", NULL, NULL, 0, "<Separator>", NULL),
156 ITEM_FACTORY_ENTRY("/File/_Export", NULL, NULL, 0, "<Branch>", NULL),
157 ITEM_FACTORY_ENTRY("/File/_Export/_Selected Packet Bytes...", "<control>H", savehex_cb,
159 ITEM_FACTORY_ENTRY("/File/<separator>", NULL, NULL, 0, "<Separator>", NULL),
160 ITEM_FACTORY_STOCK_ENTRY("/File/_Print...", "<control>P", file_print_cmd_cb,
162 ITEM_FACTORY_ENTRY("/File/<separator>", NULL, NULL, 0, "<Separator>", NULL),
163 ITEM_FACTORY_STOCK_ENTRY("/File/_Quit", "<control>Q", file_quit_cmd_cb,
165 ITEM_FACTORY_ENTRY("/_Edit", NULL, NULL, 0, "<Branch>", NULL),
167 /* Un-#if this when we actually implement Cut/Copy/Paste. */
168 ITEM_FACTORY_STOCK_ENTRY("/Edit/Cut", "<control>X", NULL,
170 ITEM_FACTORY_STOCK_ENTRY("/Edit/Copy", "<control>C", NULL,
172 ITEM_FACTORY_STOCK_ENTRY("/Edit/Paste", "<control>V", NULL,
174 ITEM_FACTORY_ENTRY("/Edit/<separator>", NULL, NULL, 0, "<Separator>"),
176 ITEM_FACTORY_STOCK_ENTRY("/Edit/_Find Packet...", "<control>F",
177 find_frame_cb, 0, GTK_STOCK_FIND),
178 ITEM_FACTORY_STOCK_ENTRY("/Edit/Find Ne_xt", "<control>N", find_next_cb,
179 0, GTK_STOCK_GO_FORWARD),
180 ITEM_FACTORY_STOCK_ENTRY("/Edit/Find Pre_vious", "<control>B",
181 find_previous_cb, 0, GTK_STOCK_GO_BACK),
182 ITEM_FACTORY_ENTRY("/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL),
183 ITEM_FACTORY_ENTRY("/Edit/_Time Reference", NULL, NULL, 0, "<Branch>", NULL),
184 ITEM_FACTORY_ENTRY("/Edit/Time Reference/Set Time Reference (toggle)", "<control>T", reftime_frame_cb, 0, NULL, NULL),
185 ITEM_FACTORY_ENTRY("/Edit/Time Reference/Find Next", NULL, reftime_frame_cb, 1, NULL, NULL),
186 ITEM_FACTORY_ENTRY("/Edit/Time Reference/Find Previous", NULL, reftime_frame_cb, 2, NULL, NULL),
187 ITEM_FACTORY_ENTRY("/Edit/_Mark Packet", "<control>M", mark_frame_cb,
189 ITEM_FACTORY_ENTRY("/Edit/Mark _All Packets", NULL, mark_all_frames_cb,
191 ITEM_FACTORY_ENTRY("/Edit/_Unmark All Packets", NULL, unmark_all_frames_cb,
193 ITEM_FACTORY_ENTRY("/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL),
194 ITEM_FACTORY_STOCK_ENTRY("/Edit/_Preferences...", "<shift><control>P", prefs_cb,
195 0, GTK_STOCK_PREFERENCES),
196 ITEM_FACTORY_ENTRY("/_View", NULL, NULL, 0, "<Branch>", NULL),
197 ITEM_FACTORY_ENTRY("/View/_Show", NULL, NULL, 0, "<Branch>", NULL),
198 ITEM_FACTORY_ENTRY("/View/Show/Main Toolbar", NULL, main_toolbar_show_cb, 0, "<CheckItem>", NULL),
199 ITEM_FACTORY_ENTRY("/View/Show/Filter Toolbar", NULL, filter_toolbar_show_cb, 0, "<CheckItem>", NULL),
200 ITEM_FACTORY_ENTRY("/View/Show/<separator>", NULL, NULL, 0, "<Separator>", NULL),
201 ITEM_FACTORY_ENTRY("/View/Show/Packet List", NULL, packet_list_show_cb, 0, "<CheckItem>", NULL),
202 ITEM_FACTORY_ENTRY("/View/Show/Packet Details", NULL, tree_view_show_cb, 0, "<CheckItem>", NULL),
203 ITEM_FACTORY_ENTRY("/View/Show/Packet Bytes", NULL, byte_view_show_cb, 0, "<CheckItem>", NULL),
204 ITEM_FACTORY_ENTRY("/View/Show/<separator>", NULL, NULL, 0, "<Separator>", NULL),
205 ITEM_FACTORY_ENTRY("/View/Show/Status Bar", NULL, statusbar_show_cb, 0, "<CheckItem>", NULL),
206 ITEM_FACTORY_ENTRY("/View/_Time Display Format", NULL, NULL, 0, "<Branch>", NULL),
207 ITEM_FACTORY_ENTRY("/View/Time Display Format/Time of Day", NULL, timestamp_absolute_cb,
208 0, "<RadioItem>", NULL),
209 ITEM_FACTORY_ENTRY("/View/Time Display Format/Date and Time of Day", NULL, timestamp_absolute_date_cb,
210 0, "/View/Time Display Format/Time of Day", NULL),
211 ITEM_FACTORY_ENTRY("/View/Time Display Format/Seconds Since Beginning of Capture", NULL, timestamp_relative_cb,
212 0, "/View/Time Display Format/Time of Day", NULL),
213 ITEM_FACTORY_ENTRY("/View/Time Display Format/Seconds Since Previous Packet", NULL, timestamp_delta_cb,
214 0, "/View/Time Display Format/Time of Day", NULL),
215 ITEM_FACTORY_ENTRY("/View/_Name Resolution", NULL, NULL, 0, "<Branch>", NULL),
216 ITEM_FACTORY_ENTRY("/View/Name Resolution/Enable for _MAC Layer", NULL, name_resolution_mac_cb, 0, "<CheckItem>", NULL),
217 ITEM_FACTORY_ENTRY("/View/Name Resolution/Enable for _Network Layer", NULL, name_resolution_network_cb, 0, "<CheckItem>", NULL),
218 ITEM_FACTORY_ENTRY("/View/Name Resolution/Enable for _Transport Layer", NULL, name_resolution_transport_cb, 0, "<CheckItem>", NULL),
219 ITEM_FACTORY_ENTRY("/View/Auto Scroll in _Live Capture", NULL, auto_scroll_live_cb, 0, "<CheckItem>", NULL),
220 ITEM_FACTORY_ENTRY("/View/<separator>", NULL, NULL, 0, "<Separator>", NULL),
221 ITEM_FACTORY_STOCK_ENTRY("/View/Zoom In", "<control>plus", view_zoom_in_cb,
222 0, GTK_STOCK_ZOOM_IN),
223 ITEM_FACTORY_STOCK_ENTRY("/View/Zoom Out", "<control>minus", view_zoom_out_cb,
224 0, GTK_STOCK_ZOOM_OUT),
225 ITEM_FACTORY_STOCK_ENTRY("/View/Normal Size", "<control>equal", view_zoom_100_cb,
226 0, GTK_STOCK_ZOOM_100),
227 ITEM_FACTORY_ENTRY("/View/<separator>", NULL, NULL, 0, "<Separator>", NULL),
228 ITEM_FACTORY_ENTRY("/View/Collapse _All", NULL, collapse_all_cb,
230 ITEM_FACTORY_ENTRY("/View/_Expand All", NULL, expand_all_cb,
232 ITEM_FACTORY_ENTRY("/View/<separator>", NULL, NULL, 0, "<Separator>", NULL),
233 ITEM_FACTORY_STOCK_ENTRY("/View/_Coloring Rules...", NULL, color_display_cb,
234 0, GTK_STOCK_SELECT_COLOR),
235 ITEM_FACTORY_ENTRY("/View/<separator>", NULL, NULL, 0, "<Separator>", NULL),
236 ITEM_FACTORY_ENTRY("/View/Show Packet in New _Window", NULL,
237 new_window_cb, 0, NULL, NULL),
238 ITEM_FACTORY_STOCK_ENTRY("/View/_Reload", "<control>R", file_reload_cmd_cb,
239 0, GTK_STOCK_REFRESH),
240 ITEM_FACTORY_ENTRY("/_Go", NULL, NULL, 0, "<Branch>", NULL),
241 ITEM_FACTORY_STOCK_ENTRY("/Go/_Go to Packet...", "<control>G",
242 goto_frame_cb, 0, GTK_STOCK_JUMP_TO),
243 ITEM_FACTORY_ENTRY("/Go/Go to _Corresponding Packet", NULL, goto_framenum_cb,
245 ITEM_FACTORY_ENTRY("/Go/<separator>", NULL, NULL, 0, "<Separator>", NULL),
246 ITEM_FACTORY_STOCK_ENTRY("/Go/_First Packet", NULL,
247 goto_top_frame_cb, 0, GTK_STOCK_GOTO_TOP),
248 ITEM_FACTORY_STOCK_ENTRY("/Go/_Last Packet", NULL,
249 goto_bottom_frame_cb, 0, GTK_STOCK_GOTO_BOTTOM),
251 ITEM_FACTORY_ENTRY("/_Capture", NULL, NULL, 0, "<Branch>", NULL),
252 ITEM_FACTORY_STOCK_ENTRY("/Capture/_Start...", "<control>K",
253 capture_prep_cb, 0, ETHEREAL_STOCK_CAPTURE_START),
254 ITEM_FACTORY_STOCK_ENTRY("/Capture/S_top", "<control>E", capture_stop_cb,
256 ITEM_FACTORY_STOCK_ENTRY("/Capture/_Capture Filters...", NULL, cfilter_dialog_cb,
257 0, ETHEREAL_STOCK_CAPTURE_FILTER),
258 #endif /* HAVE_LIBPCAP */
259 ITEM_FACTORY_ENTRY("/_Analyze", NULL, NULL, 0, "<Branch>", NULL),
260 ITEM_FACTORY_STOCK_ENTRY("/Analyze/_Display Filters...", NULL, dfilter_dialog_cb,
261 0, ETHEREAL_STOCK_DISPLAY_FILTER),
262 ITEM_FACTORY_ENTRY("/Analyze/_Match", NULL, NULL, 0, "<Branch>", NULL),
263 ITEM_FACTORY_ENTRY("/Analyze/Match/_Selected", NULL,
264 match_selected_cb_replace_ptree, 0, NULL, NULL),
265 ITEM_FACTORY_ENTRY("/Analyze/Match/_Not Selected", NULL,
266 match_selected_cb_not_ptree, 0, NULL, NULL),
267 ITEM_FACTORY_ENTRY("/Analyze/Match/_And Selected", NULL,
268 match_selected_cb_and_ptree, 0, NULL, NULL),
269 ITEM_FACTORY_ENTRY("/Analyze/Match/_Or Selected", NULL,
270 match_selected_cb_or_ptree, 0, NULL, NULL),
271 ITEM_FACTORY_ENTRY("/Analyze/Match/A_nd Not Selected", NULL,
272 match_selected_cb_and_ptree_not, 0, NULL, NULL),
273 ITEM_FACTORY_ENTRY("/Analyze/Match/O_r Not Selected", NULL,
274 match_selected_cb_or_ptree_not, 0, NULL, NULL),
275 ITEM_FACTORY_ENTRY("/Analyze/_Prepare", NULL, NULL, 0, "<Branch>", NULL),
276 ITEM_FACTORY_ENTRY("/Analyze/Prepare/_Selected", NULL,
277 prepare_selected_cb_replace_ptree, 0, NULL, NULL),
278 ITEM_FACTORY_ENTRY("/Analyze/Prepare/_Not Selected", NULL,
279 prepare_selected_cb_not_ptree, 0, NULL, NULL),
280 ITEM_FACTORY_ENTRY("/Analyze/Prepare/_And Selected", NULL,
281 prepare_selected_cb_and_ptree, 0, NULL, NULL),
282 ITEM_FACTORY_ENTRY("/Analyze/Prepare/_Or Selected", NULL,
283 prepare_selected_cb_or_ptree, 0, NULL, NULL),
284 ITEM_FACTORY_ENTRY("/Analyze/Prepare/A_nd Not Selected", NULL,
285 prepare_selected_cb_and_ptree_not, 0, NULL, NULL),
286 ITEM_FACTORY_ENTRY("/Analyze/Prepare/O_r Not Selected", NULL,
287 prepare_selected_cb_or_ptree_not, 0, NULL, NULL),
288 ITEM_FACTORY_ENTRY("/Analyze/<separator>", NULL, NULL, 0, "<Separator>", NULL),
289 ITEM_FACTORY_ENTRY("/Analyze/_Enabled Protocols...", "<shift><control>R", proto_cb, 0, NULL, NULL),
290 ITEM_FACTORY_ENTRY("/Analyze/Decode _As...", NULL, decode_as_cb,
292 ITEM_FACTORY_ENTRY("/Analyze/_User Specified Decodes...", NULL,
293 decode_show_cb, 0, NULL, NULL),
294 ITEM_FACTORY_ENTRY("/Analyze/<separator>", NULL, NULL, 0, "<Separator>", NULL),
295 ITEM_FACTORY_ENTRY("/Analyze/_Follow TCP Stream", NULL,
296 follow_stream_cb, 0, NULL, NULL),
297 ITEM_FACTORY_ENTRY("/_Statistics", NULL, NULL, 0, "<Branch>", NULL),
298 ITEM_FACTORY_ENTRY("/Statistics/_Summary", NULL, summary_open_cb, 0, NULL, NULL),
299 ITEM_FACTORY_ENTRY("/Statistics/_Protocol Hierarchy", NULL,
300 proto_hier_stats_cb, 0, NULL, NULL),
301 ITEM_FACTORY_ENTRY("/_Help", NULL, NULL, 0, "<Branch>", NULL),
302 ITEM_FACTORY_STOCK_ENTRY("/Help/_Contents", "F1", help_cb, 0, GTK_STOCK_HELP),
303 ITEM_FACTORY_ENTRY("/Help/_Supported Protocols", NULL, supported_cb, 0, NULL, NULL),
304 ITEM_FACTORY_ENTRY("/Help/<separator>", NULL, NULL, 0, "<Separator>", NULL),
306 ITEM_FACTORY_ENTRY("/Help/About _Plugins", NULL, tools_plugins_cmd_cb,
308 #endif /* HAVE_PLUGINS */
309 ITEM_FACTORY_ENTRY("/Help/_About Ethereal", NULL, about_ethereal,
314 /* calculate the number of menu_items */
315 static int nmenu_items = sizeof(menu_items) / sizeof(menu_items[0]);
317 /* packet list popup */
318 static GtkItemFactoryEntry packet_list_menu_items[] =
320 ITEM_FACTORY_ENTRY("/Follow TCP Stream", NULL, follow_stream_cb,
322 ITEM_FACTORY_ENTRY("/Decode As...", NULL, decode_as_cb, 0, NULL, NULL),
323 ITEM_FACTORY_ENTRY("/Display Filters...", NULL, dfilter_dialog_cb,
325 ITEM_FACTORY_ENTRY("/<separator>", NULL, NULL, 0, "<Separator>", NULL),
326 ITEM_FACTORY_ENTRY("/Mark Packet", NULL, mark_frame_cb, 0, NULL, NULL),
327 ITEM_FACTORY_ENTRY("/Time Reference", NULL, NULL, 0, "<Branch>", NULL),
328 ITEM_FACTORY_ENTRY("/Time Reference/Set Time Reference (toggle)", NULL, reftime_frame_cb, 0, NULL, NULL),
329 ITEM_FACTORY_ENTRY("/Time Reference/Find Next", NULL, reftime_frame_cb, 1, NULL, NULL),
330 ITEM_FACTORY_ENTRY("/Time Reference/Find Previous", NULL, reftime_frame_cb, 2, NULL, NULL),
331 ITEM_FACTORY_ENTRY("/Match", NULL, NULL, 0, "<Branch>", NULL),
332 ITEM_FACTORY_ENTRY("/Match/_Selected", NULL,
333 match_selected_cb_replace_plist, 0, NULL, NULL),
334 ITEM_FACTORY_ENTRY("/Match/_Not Selected", NULL,
335 match_selected_cb_not_plist, 0, NULL, NULL),
336 ITEM_FACTORY_ENTRY("/Match/_And Selected", NULL,
337 match_selected_cb_and_plist, 0, NULL, NULL),
338 ITEM_FACTORY_ENTRY("/Match/_Or Selected", NULL, match_selected_cb_or_plist,
340 ITEM_FACTORY_ENTRY("/Match/A_nd Not Selected", NULL,
341 match_selected_cb_and_plist_not, 0, NULL, NULL),
342 ITEM_FACTORY_ENTRY("/Match/O_r Not Selected", NULL,
343 match_selected_cb_or_plist_not, 0, NULL, NULL),
344 ITEM_FACTORY_ENTRY("/Prepare", NULL, NULL, 0, "<Branch>", NULL),
345 ITEM_FACTORY_ENTRY("/Prepare/_Selected", NULL,
346 prepare_selected_cb_replace_plist, 0, NULL, NULL),
347 ITEM_FACTORY_ENTRY("/Prepare/_Not Selected", NULL,
348 prepare_selected_cb_not_plist, 0, NULL, NULL),
349 ITEM_FACTORY_ENTRY("/Prepare/_And Selected", NULL,
350 prepare_selected_cb_and_plist, 0, NULL, NULL),
351 ITEM_FACTORY_ENTRY("/Prepare/_Or Selected", NULL,
352 prepare_selected_cb_or_plist, 0, NULL, NULL),
353 ITEM_FACTORY_ENTRY("/Prepare/A_nd Not Selected", NULL,
354 prepare_selected_cb_and_plist_not, 0, NULL, NULL),
355 ITEM_FACTORY_ENTRY("/Prepare/O_r Not Selected", NULL,
356 prepare_selected_cb_or_plist_not, 0, NULL, NULL),
357 ITEM_FACTORY_ENTRY("/<separator>", NULL, NULL, 0, "<Separator>", NULL),
358 ITEM_FACTORY_ENTRY("/Coloring Rules...", NULL, color_display_cb,
360 ITEM_FACTORY_ENTRY("/Print...", NULL, file_print_cmd_cb, 0, NULL, NULL),
361 ITEM_FACTORY_ENTRY("/Show Packet in New Window", NULL, new_window_cb,
365 static GtkItemFactoryEntry tree_view_menu_items[] =
367 ITEM_FACTORY_ENTRY("/Follow TCP Stream", NULL, follow_stream_cb,
369 ITEM_FACTORY_ENTRY("/Decode As...", NULL, decode_as_cb, 0, NULL, NULL),
370 ITEM_FACTORY_ENTRY("/Display Filters...", NULL, dfilter_dialog_cb,
372 ITEM_FACTORY_ENTRY("/<separator>", NULL, NULL, 0, "<Separator>", NULL),
373 ITEM_FACTORY_ENTRY("/_Resolve Name", NULL, resolve_name_cb, 0, NULL, NULL),
374 ITEM_FACTORY_ENTRY("/_Go to Corresponding Packet", NULL, goto_framenum_cb, 0, NULL, NULL),
375 ITEM_FACTORY_ENTRY("/_Export Selected Packet Bytes...", NULL, savehex_cb,
377 ITEM_FACTORY_ENTRY("/Protocol Properties...", NULL, properties_cb,
379 ITEM_FACTORY_ENTRY("/Match", NULL, NULL, 0, "<Branch>", NULL),
380 ITEM_FACTORY_ENTRY("/Match/_Selected", NULL,
381 match_selected_cb_replace_ptree, 0, NULL, NULL),
382 ITEM_FACTORY_ENTRY("/Match/_Not Selected", NULL,
383 match_selected_cb_not_ptree, 0, NULL, NULL),
384 ITEM_FACTORY_ENTRY("/Match/_And Selected", NULL,
385 match_selected_cb_and_ptree, 0, NULL, NULL),
386 ITEM_FACTORY_ENTRY("/Match/_Or Selected", NULL, match_selected_cb_or_ptree,
388 ITEM_FACTORY_ENTRY("/Match/A_nd Not Selected", NULL,
389 match_selected_cb_and_ptree_not, 0, NULL, NULL),
390 ITEM_FACTORY_ENTRY("/Match/O_r Not Selected", NULL,
391 match_selected_cb_or_ptree_not, 0, NULL, NULL),
392 ITEM_FACTORY_ENTRY("/Prepare", NULL, NULL, 0, "<Branch>", NULL),
393 ITEM_FACTORY_ENTRY("/Prepare/_Selected", NULL,
394 prepare_selected_cb_replace_ptree, 0, NULL, NULL),
395 ITEM_FACTORY_ENTRY("/Prepare/_Not Selected", NULL,
396 prepare_selected_cb_not_ptree, 0, NULL, NULL),
397 ITEM_FACTORY_ENTRY("/Prepare/_And Selected", NULL,
398 prepare_selected_cb_and_ptree, 0, NULL, NULL),
399 ITEM_FACTORY_ENTRY("/Prepare/_Or Selected", NULL,
400 prepare_selected_cb_or_ptree, 0, NULL, NULL),
401 ITEM_FACTORY_ENTRY("/Prepare/A_nd Not Selected", NULL,
402 prepare_selected_cb_and_ptree_not, 0, NULL, NULL),
403 ITEM_FACTORY_ENTRY("/Prepare/O_r Not Selected", NULL,
404 prepare_selected_cb_or_ptree_not, 0, NULL, NULL),
405 ITEM_FACTORY_ENTRY("/<separator>", NULL, NULL, 0, "<Separator>", NULL),
406 ITEM_FACTORY_ENTRY("/Collapse All", NULL, collapse_all_cb, 0, NULL, NULL),
407 ITEM_FACTORY_ENTRY("/Expand All", NULL, expand_all_cb, 0, NULL, NULL)
410 static GtkItemFactoryEntry hexdump_menu_items[] =
412 ITEM_FACTORY_ENTRY("/Follow TCP Stream", NULL, follow_stream_cb,
414 ITEM_FACTORY_ENTRY("/Decode As...", NULL, decode_as_cb, 0, NULL, NULL),
415 ITEM_FACTORY_ENTRY("/Display Filters...", NULL, dfilter_dialog_cb,
417 ITEM_FACTORY_ENTRY("/Export Selected Packet Bytes...", NULL, savehex_cb,
421 static int initialize = TRUE;
422 static GtkItemFactory *main_menu_factory = NULL;
423 static GtkItemFactory *packet_list_menu_factory = NULL;
424 static GtkItemFactory *tree_view_menu_factory = NULL;
425 static GtkItemFactory *hexdump_menu_factory = NULL;
427 static GSList *popup_menu_list = NULL;
429 static GtkAccelGroup *grp;
432 main_menu_new(GtkAccelGroup ** table) {
435 grp = gtk_accel_group_new();
440 menubar = main_menu_factory->widget;
454 packet_list_menu_factory = gtk_item_factory_new(GTK_TYPE_MENU, "<main>", NULL);
455 popup_menu_object = gtk_menu_new();
456 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);
457 OBJECT_SET_DATA(popup_menu_object, PM_PACKET_LIST_KEY,
458 packet_list_menu_factory->widget);
459 popup_menu_list = g_slist_append((GSList *)popup_menu_list, packet_list_menu_factory);
461 tree_view_menu_factory = gtk_item_factory_new(GTK_TYPE_MENU, "<main>", NULL);
462 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);
463 OBJECT_SET_DATA(popup_menu_object, PM_TREE_VIEW_KEY,
464 tree_view_menu_factory->widget);
465 popup_menu_list = g_slist_append((GSList *)popup_menu_list, tree_view_menu_factory);
467 hexdump_menu_factory = gtk_item_factory_new(GTK_TYPE_MENU, "<main>", NULL);
468 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);
469 OBJECT_SET_DATA(popup_menu_object, PM_HEXDUMP_KEY,
470 hexdump_menu_factory->widget);
471 popup_menu_list = g_slist_append((GSList *)popup_menu_list, hexdump_menu_factory);
474 main_menu_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", grp);
475 gtk_item_factory_create_items_ac(main_menu_factory, nmenu_items, menu_items, NULL, 2);
477 merge_all_tap_menus(tap_menu_tree_root);
479 /* Initialize enabled/disabled state of menu items */
480 set_menus_for_unsaved_capture_file(FALSE);
481 set_menus_for_capture_file(FALSE);
483 /* Un-#if this when we actually implement Cut/Copy/Paste.
484 Then make sure you enable them when they can be done. */
485 set_menu_sensitivity(main_menu_factory, "/Edit/Cut", FALSE);
486 set_menu_sensitivity(main_menu_factory, "/Edit/Copy", FALSE);
487 set_menu_sensitivity(main_menu_factory, "/Edit/Paste", FALSE);
490 set_menus_for_captured_packets(FALSE);
491 set_menus_for_selected_packet(&cfile);
492 set_menus_for_selected_tree_row(&cfile);
494 /* init with an empty recent files list */
495 clear_menu_recent_capture_file_cmd_cb(NULL, NULL);
500 gint tap_menu_item_add_compare(gconstpointer a, gconstpointer b)
503 ((const menu_item_t *) a)->name,
504 ((const menu_item_t *) b)->name);
508 /* add a menuitem below the current node */
509 GList * tap_menu_item_add(
512 GtkItemFactoryCallback callback,
513 gboolean (*selected_packet_enabled)(frame_data *, epan_dissect_t *),
514 gboolean (*selected_tree_row_enabled)(field_info *),
515 gpointer callback_data,
522 child = g_malloc(sizeof (menu_item_t));
523 child->group = group;
525 child->callback = callback;
526 child->selected_packet_enabled = selected_packet_enabled;
527 child->selected_tree_row_enabled = selected_tree_row_enabled;
528 child->callback_data = callback_data;
529 child->enabled = FALSE;
530 child->children = NULL;
532 /* insert the new child node into the parent */
533 curr = curnode->data;
534 curr->children = g_list_insert_sorted(curr->children, child, tap_menu_item_add_compare);
536 /* return the new node */
537 /* XXX: improve this */
538 return g_list_find(curr->children, child);
542 * Add a new menu item for a tap.
543 * This must be called after we've created the main menu, so it can't
544 * be called from the routine that registers taps - we have to introduce
545 * another per-tap registration routine.
547 * "callback" gets called when the menu item is selected; it should do
548 * the work of creating the tap window.
550 * "selected_packet_enabled" gets called by "set_menus_for_selected_packet()";
551 * it's passed a Boolean that's TRUE if a packet is selected and FALSE
552 * otherwise, and should return TRUE if the tap will work now (which
553 * might depend on whether a packet is selected and, if one is, on the
554 * packet) and FALSE if not.
556 * "selected_tree_row_enabled" gets called by
557 * "set_menus_for_selected_tree_row()"; it's passed a Boolean that's TRUE if
558 * a protocol tree row is selected and FALSE otherwise, and should return
559 * TRUE if the tap will work now (which might depend on whether a tree row
560 * is selected and, if one is, on the tree row) and FALSE if not.
563 register_tap_menu_item(
566 GtkItemFactoryCallback callback,
567 gboolean (*selected_packet_enabled)(frame_data *, epan_dissect_t *),
568 gboolean (*selected_tree_row_enabled)(field_info *),
569 gpointer callback_data)
571 /*static const char toolspath[] = "/Statistics/";*/
581 * The menu path must be relative.
583 g_assert(*name != '/');
586 case(REGISTER_TAP_GROUP_GENERIC): toolspath = "/Statistics/"; break;
587 case(REGISTER_TAP_GROUP_CONVERSATION_LIST): toolspath = "/Statistics/_Conversation List/"; break;
588 case(REGISTER_TAP_GROUP_ENDPOINT_LIST): toolspath = "/Statistics/_Endpoint List/"; break;
589 case(REGISTER_TAP_GROUP_RESPONSE_TIME): toolspath = "/Statistics/Service _Response Time/"; break;
590 case(REGISTER_TAP_GROUP_NONE): toolspath = "/Statistics/"; break;
596 /* add the (empty) root node, if not already done */
597 if(tap_menu_tree_root == NULL) {
598 child = g_malloc0(sizeof (menu_item_t));
599 tap_menu_tree_root = g_list_append(NULL, child);
603 * Create any submenus required.
605 curnode = tap_menu_tree_root;
607 while ((p = strchr(p, '/')) != NULL) {
609 * OK, everything between "name" and "p" is
610 * a menu relative subtree into which the menu item
613 * Construct the absolute path name of that subtree.
615 menupathlen = strlen(toolspath) + 1 + (p - name);
616 menupath = g_malloc(menupathlen);
617 strcpy(menupath, toolspath);
618 strncat(menupath, name, p - name);
621 * Does there exist an entry with that path at this
622 * level of the Analyze menu tree?
624 child = curnode->data;
625 for (childnode = child->children; childnode != NULL; childnode = childnode->next) {
626 child = childnode->data;
627 if (strcmp(child->name, menupath) == 0)
630 if (childnode == NULL) {
632 * No. Create such an item as a subtree, and
633 * add it to the Tools menu tree.
635 childnode = tap_menu_item_add(
636 menupath, group, NULL, NULL ,NULL, NULL, curnode);
639 * Yes. We don't need this "menupath" any longer.
646 * Skip over the '/' we found.
652 * Construct the main menu path for the menu item.
654 menupathlen = strlen(toolspath) + 1 + strlen(name);
655 menupath = g_malloc(menupathlen);
656 strcpy(menupath, toolspath);
657 strcat(menupath, name);
660 * Construct an item factory entry for the item, and add it to
664 menupath, group, callback,
665 selected_packet_enabled, selected_tree_row_enabled,
666 callback_data, curnode);
670 guint merge_tap_menus_layered(GList *node, gint group) {
671 GtkItemFactoryEntry *entry;
674 menu_item_t *node_data = node->data;
677 * Is this a leaf node or an interior node?
679 if (node_data->children == NULL) {
685 * The root node doesn't correspond to a menu tree item; it
686 * has a null name pointer.
688 if (node_data->name != NULL && group == node_data->group) {
689 entry = g_malloc0(sizeof (GtkItemFactoryEntry));
690 entry->path = node_data->name;
691 entry->callback = node_data->callback;
692 gtk_item_factory_create_item(main_menu_factory, entry, node_data->callback_data, 2);
693 set_menu_sensitivity(main_menu_factory, node_data->name, FALSE); /* no capture file yet */
698 * It's an interior node; call
699 * "merge_tap_menus_layered()" on all its children
703 * The root node doesn't correspond to a menu tree item; it
704 * has a null name pointer.
706 if (node_data->name != NULL && group == node_data->group) {
707 entry = g_malloc0(sizeof (GtkItemFactoryEntry));
708 entry->path = node_data->name;
709 entry->item_type = "<Branch>";
710 gtk_item_factory_create_item(main_menu_factory, entry,
712 set_menu_sensitivity(main_menu_factory, node_data->name,
713 FALSE); /* no children yet */
717 for (child = node_data->children; child != NULL; child =
719 added += merge_tap_menus_layered(child, group);
727 void merge_all_tap_menus(GList *node) {
728 GtkItemFactoryEntry *entry;
730 entry = g_malloc0(sizeof (GtkItemFactoryEntry));
731 entry->item_type = "<Separator>";
732 entry->path = "/Statistics/";
735 * merge only the menu items of the specific group,
736 * and then append a seperator
738 if (merge_tap_menus_layered(node, REGISTER_TAP_GROUP_GENERIC)) {
739 gtk_item_factory_create_item(main_menu_factory, entry, NULL, 2);
741 if (merge_tap_menus_layered(node, REGISTER_TAP_GROUP_CONVERSATION_LIST)) {
742 /*gtk_item_factory_create_item(main_menu_factory, entry, NULL, 2);*/
744 if (merge_tap_menus_layered(node, REGISTER_TAP_GROUP_ENDPOINT_LIST)) {
745 /*gtk_item_factory_create_item(main_menu_factory, entry, NULL, 2);*/
747 if (merge_tap_menus_layered(node, REGISTER_TAP_GROUP_RESPONSE_TIME)) {
748 gtk_item_factory_create_item(main_menu_factory, entry, NULL, 2);
750 if (merge_tap_menus_layered(node, REGISTER_TAP_GROUP_NONE)) {
751 /*gtk_item_factory_create_item(main_menu_factory, entry, NULL, 2);*/
758 * Enable/disable menu sensitivity.
761 set_menu_sensitivity(GtkItemFactory *ifactory, const gchar *path, gint val)
764 GtkWidget *menu_item;
769 /* the underscore character regularly confuses things, as it will prevent finding
770 * the menu_item, so it has to be removed first */
771 dup = g_strdup(path);
782 if (ifactory == NULL) {
784 * Do it for all pop-up menus.
786 for (menu_list = popup_menu_list; menu_list != NULL;
787 menu_list = g_slist_next(menu_list))
788 set_menu_sensitivity(menu_list->data, dup, val);
791 * Do it for that particular menu.
793 if ((menu_item = gtk_item_factory_get_widget(ifactory, dup)) != NULL) {
794 if (GTK_IS_MENU(menu_item)) {
796 * "dup" refers to a submenu; "gtk_item_factory_get_widget()"
797 * gets the menu, not the item that, when selected, pops up
800 * We have to change the latter item's sensitivity, so that
801 * it shows up normally if sensitive and grayed-out if
804 menu_item = gtk_menu_get_attach_widget(GTK_MENU(menu_item));
806 gtk_widget_set_sensitive(menu_item, val);
808 /* be sure this menu item *is* existing */
809 g_assert_not_reached();
817 set_menu_object_data_meat(GtkItemFactory *ifactory, gchar *path, gchar *key, gpointer data)
819 GtkWidget *menu = NULL;
821 if ((menu = gtk_item_factory_get_widget(ifactory, path)) != NULL)
822 OBJECT_SET_DATA(menu, key, data);
826 set_menu_object_data (gchar *path, gchar *key, gpointer data) {
827 GSList *menu_list = popup_menu_list;
828 gchar *shortpath = strrchr(path, '/');
830 set_menu_object_data_meat(main_menu_factory, path, key, data);
831 while (menu_list != NULL) {
832 set_menu_object_data_meat(menu_list->data, shortpath, key, data);
833 menu_list = g_slist_next(menu_list);
838 /* Recently used capture files submenu:
839 * Submenu containing the recently used capture files.
840 * The capture filenames are always kept with the absolute path, to be independant
841 * of the current path.
842 * They are only stored inside the labels of the submenu (no separate list). */
844 #define MENU_RECENT_FILES_PATH "/File/Open Recent"
845 #define MENU_RECENT_FILES_KEY "Recent File Name"
848 update_menu_recent_capture_file1(GtkWidget *widget, gpointer cnt) {
849 gchar *widget_cf_name;
851 widget_cf_name = OBJECT_GET_DATA(widget, MENU_RECENT_FILES_KEY);
853 /* if this menu item is a file, count it */
854 if (widget_cf_name) {
860 /* update the menu */
862 update_menu_recent_capture_file(GtkWidget *submenu_recent_files) {
865 gtk_container_foreach(GTK_CONTAINER(submenu_recent_files),
866 update_menu_recent_capture_file1, &cnt);
868 /* make parent menu item sensitive only, if we have any valid files in the list */
869 set_menu_sensitivity(main_menu_factory, MENU_RECENT_FILES_PATH, cnt);
873 /* remove the capture filename from the "Recent Files" menu */
875 remove_menu_recent_capture_file(GtkWidget *widget, gpointer unused _U_) {
876 GtkWidget *submenu_recent_files;
877 gchar *widget_cf_name;
880 widget_cf_name = OBJECT_GET_DATA(widget, MENU_RECENT_FILES_KEY);
881 g_free(widget_cf_name);
883 /* get the submenu container item */
884 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH);
886 /* XXX: is this all we need to do, to free the menu item and its label?
887 The reference count of widget will go to 0, so it'll be freed;
888 will that free the label? */
889 gtk_container_remove(GTK_CONTAINER(submenu_recent_files), widget);
893 /* callback, if the user pushed the <Clear File List> item */
895 clear_menu_recent_capture_file_cmd_cb(GtkWidget *w _U_, gpointer unused _U_) {
896 GtkWidget *submenu_recent_files;
899 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH);
901 gtk_container_foreach(GTK_CONTAINER(submenu_recent_files),
902 remove_menu_recent_capture_file, NULL);
904 update_menu_recent_capture_file(submenu_recent_files);
908 /* callback, if the user pushed a recent file submenu item */
910 menu_open_recent_file_cmd(GtkWidget *w)
912 GtkWidget *submenu_recent_files;
913 GtkWidget *menu_item_child;
917 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH);
919 /* get capture filename from the menu item label */
920 menu_item_child = (GTK_BIN(w))->child;
921 gtk_label_get(GTK_LABEL(menu_item_child), &cf_name);
923 /* open and read the capture file (this will close an existing file) */
924 if ((err = cf_open(cf_name, FALSE, &cfile)) == 0) {
927 /* the capture file isn't existing any longer, remove menu item */
928 /* XXX: ask user to remove item, it's maybe only a temporary problem */
929 remove_menu_recent_capture_file(w, NULL);
932 update_menu_recent_capture_file(submenu_recent_files);
935 static void menu_open_recent_file_answered_cb(gpointer dialog _U_, gint btn, gpointer data _U_)
939 /* save file first */
940 file_save_as_cmd(after_save_open_recent_file, data);
944 menu_open_recent_file_cmd(data);
946 case(ESD_BTN_CANCEL):
949 g_assert_not_reached();
954 menu_open_recent_file_cmd_cb(GtkWidget *widget, gpointer data _U_) {
958 if((cfile.state != FILE_CLOSED) && !cfile.user_saved) {
959 /* user didn't saved his current file, ask him */
960 dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_YES_NO_CANCEL,
961 PRIMARY_TEXT_START "Save capture file before opening a new one?" PRIMARY_TEXT_END "\n\n"
962 "If you open a new capture file without saving, your current capture data will be discarded.");
963 simple_dialog_set_cb(dialog, menu_open_recent_file_answered_cb, widget);
966 menu_open_recent_file_cmd(widget);
970 /* add the capture filename (with an absolute path) to the "Recent Files" menu */
972 add_menu_recent_capture_file_absolute(gchar *cf_name) {
973 GtkWidget *submenu_recent_files;
974 GList *menu_item_list;
976 gchar *widget_cf_name;
977 gchar *normalized_cf_name;
978 GtkWidget *menu_item;
983 normalized_cf_name = g_strdup(cf_name);
985 /* replace all slashes by backslashes */
986 g_strdelimit(normalized_cf_name, "/", '\\');
989 /* get the submenu container item */
990 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH);
992 /* convert container to a GList */
993 menu_item_list = gtk_container_children(GTK_CONTAINER(submenu_recent_files));
995 /* iterate through list items of menu_item_list,
996 * removing special items, a maybe duplicate entry and every item above count_max */
998 for (li = g_list_first(menu_item_list); li; li = li->next, cnt++) {
999 /* get capture filename */
1000 menu_item = GTK_WIDGET(li->data);
1001 widget_cf_name = OBJECT_GET_DATA(menu_item, MENU_RECENT_FILES_KEY);
1003 /* if this element string is one of our special items (seperator, ...) or
1004 * already in the list or
1005 * this element is above maximum count (too old), remove it */
1006 if (!widget_cf_name ||
1008 /* do a case insensitive compare on win32 */
1009 #if GLIB_MAJOR_VERSION < 2
1010 g_strncasecmp(widget_cf_name, normalized_cf_name, 1000) == 0 ||
1012 g_ascii_strncasecmp(widget_cf_name, normalized_cf_name, 1000) == 0 ||
1015 /* do a case sensitive compare on unix */
1016 strncmp(widget_cf_name, normalized_cf_name, 1000) == 0 ||
1018 cnt >= prefs.gui_recent_files_count_max) {
1019 remove_menu_recent_capture_file(li->data, NULL);
1024 g_list_free(menu_item_list);
1026 /* add new item at latest position */
1027 menu_item = gtk_menu_item_new_with_label(normalized_cf_name);
1028 OBJECT_SET_DATA(menu_item, MENU_RECENT_FILES_KEY, normalized_cf_name);
1029 gtk_menu_prepend (GTK_MENU(submenu_recent_files), menu_item);
1030 SIGNAL_CONNECT_OBJECT(GTK_OBJECT(menu_item), "activate",
1031 menu_open_recent_file_cmd_cb, (GtkObject *) menu_item);
1032 gtk_widget_show (menu_item);
1034 /* add seperator at last position */
1035 menu_item = gtk_menu_item_new();
1036 gtk_menu_append (GTK_MENU(submenu_recent_files), menu_item);
1037 gtk_widget_show (menu_item);
1039 /* add new "clear list" item at last position */
1040 menu_item = gtk_menu_item_new_with_label("<Clear File List>");
1041 gtk_menu_append (GTK_MENU(submenu_recent_files), menu_item);
1042 SIGNAL_CONNECT_OBJECT(GTK_OBJECT(menu_item), "activate",
1043 clear_menu_recent_capture_file_cmd_cb, (GtkObject *) menu_item);
1044 gtk_widget_show (menu_item);
1046 update_menu_recent_capture_file(submenu_recent_files);
1050 /* add the capture filename to the "Recent Files" menu */
1051 /* (will change nothing, if this filename is already in the menu) */
1053 add_menu_recent_capture_file(gchar *cf_name) {
1058 /* if this filename is an absolute path, we can use it directly */
1059 if (g_path_is_absolute(cf_name)) {
1060 add_menu_recent_capture_file_absolute(cf_name);
1064 /* this filename is not an absolute path, prepend the current dir */
1065 curr = g_get_current_dir();
1066 absolute = g_strdup_printf("%s%s%s", curr, G_DIR_SEPARATOR_S, cf_name);
1067 add_menu_recent_capture_file_absolute(absolute);
1073 /* write all capture filenames of the menu to the user's recent file */
1075 menu_recent_file_write_all(FILE *rf) {
1076 GtkWidget *submenu_recent_files;
1082 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH);
1084 /* we have to iterate backwards through the children's list,
1085 * so we get the latest item last in the file.
1086 * (don't use gtk_container_foreach() here, it will return the wrong iteration order) */
1087 children = gtk_container_children(GTK_CONTAINER(submenu_recent_files));
1088 child = g_list_last(children);
1089 while(child != NULL) {
1090 /* get capture filename from the menu item label */
1091 cf_name = OBJECT_GET_DATA(child->data, MENU_RECENT_FILES_KEY);
1093 fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", cf_name);
1096 child = g_list_previous(child);
1099 g_list_free(children);
1104 main_toolbar_show_cb(GtkWidget *w _U_, gpointer d _U_)
1107 /* save current setting in recent */
1108 recent.main_toolbar_show = GTK_CHECK_MENU_ITEM(w)->active;
1110 main_widgets_rearrange();
1115 filter_toolbar_show_cb(GtkWidget *w _U_, gpointer d _U_)
1118 /* save current setting in recent */
1119 recent.filter_toolbar_show = GTK_CHECK_MENU_ITEM(w)->active;
1121 main_widgets_rearrange();
1126 packet_list_show_cb(GtkWidget *w _U_, gpointer d _U_)
1129 /* save current setting in recent */
1130 recent.packet_list_show = GTK_CHECK_MENU_ITEM(w)->active;
1132 main_widgets_rearrange();
1137 tree_view_show_cb(GtkWidget *w _U_, gpointer d _U_)
1140 /* save current setting in recent */
1141 recent.tree_view_show = GTK_CHECK_MENU_ITEM(w)->active;
1143 main_widgets_rearrange();
1148 byte_view_show_cb(GtkWidget *w _U_, gpointer d _U_)
1151 /* save current setting in recent */
1152 recent.byte_view_show = GTK_CHECK_MENU_ITEM(w)->active;
1154 main_widgets_rearrange();
1159 statusbar_show_cb(GtkWidget *w _U_, gpointer d _U_)
1162 /* save current setting in recent */
1163 recent.statusbar_show = GTK_CHECK_MENU_ITEM(w)->active;
1165 main_widgets_rearrange();
1170 timestamp_absolute_cb(GtkWidget *w _U_, gpointer d _U_)
1172 if (recent.gui_time_format != TS_ABSOLUTE) {
1173 timestamp_type = TS_ABSOLUTE;
1174 recent.gui_time_format = timestamp_type;
1175 change_time_formats(&cfile);
1180 timestamp_absolute_date_cb(GtkWidget *w _U_, gpointer d _U_)
1182 if (recent.gui_time_format != TS_ABSOLUTE_WITH_DATE) {
1183 timestamp_type = TS_ABSOLUTE_WITH_DATE;
1184 recent.gui_time_format = timestamp_type;
1185 change_time_formats(&cfile);
1190 timestamp_relative_cb(GtkWidget *w _U_, gpointer d _U_)
1192 if (recent.gui_time_format != TS_RELATIVE) {
1193 timestamp_type = TS_RELATIVE;
1194 recent.gui_time_format = timestamp_type;
1195 change_time_formats(&cfile);
1200 timestamp_delta_cb(GtkWidget *w _U_, gpointer d _U_)
1202 if (recent.gui_time_format != TS_DELTA) {
1203 timestamp_type = TS_DELTA;
1204 recent.gui_time_format = timestamp_type;
1205 change_time_formats(&cfile);
1210 name_resolution_mac_cb(GtkWidget *w _U_, gpointer d _U_)
1212 if (GTK_CHECK_MENU_ITEM(w)->active) {
1213 g_resolv_flags |= RESOLV_MAC;
1215 g_resolv_flags &= ~RESOLV_MAC;
1220 name_resolution_network_cb(GtkWidget *w _U_, gpointer d _U_)
1222 if (GTK_CHECK_MENU_ITEM(w)->active) {
1223 g_resolv_flags |= RESOLV_NETWORK;
1225 g_resolv_flags &= ~RESOLV_NETWORK;
1230 name_resolution_transport_cb(GtkWidget *w _U_, gpointer d _U_)
1232 if (GTK_CHECK_MENU_ITEM(w)->active) {
1233 g_resolv_flags |= RESOLV_TRANSPORT;
1235 g_resolv_flags &= ~RESOLV_TRANSPORT;
1240 auto_scroll_live_cb(GtkWidget *w _U_, gpointer d _U_)
1242 auto_scroll_live = GTK_CHECK_MENU_ITEM(w)->active;
1246 /* the recent file read has finished, update the menu corresponding */
1248 menu_recent_read_finished(void) {
1249 GtkWidget *menu = NULL;
1251 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Show/Main Toolbar");
1252 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.main_toolbar_show);
1254 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Show/Filter Toolbar");
1255 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.filter_toolbar_show);
1257 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Show/Packet List");
1258 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.packet_list_show);
1260 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Show/Packet Details");
1261 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.tree_view_show);
1263 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Show/Packet Bytes");
1264 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.byte_view_show);
1266 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Show/Status Bar");
1267 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.statusbar_show);
1269 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Name Resolution/Enable for MAC Layer");
1270 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), g_resolv_flags & RESOLV_MAC);
1272 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Name Resolution/Enable for Network Layer");
1273 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), g_resolv_flags & RESOLV_NETWORK);
1275 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Name Resolution/Enable for Transport Layer");
1276 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), g_resolv_flags & RESOLV_TRANSPORT);
1278 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Auto Scroll in Live Capture");
1279 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), auto_scroll_live);
1281 main_widgets_rearrange();
1283 /* don't change the time format, if we had a command line value */
1284 if (timestamp_type != TS_NOT_SET) {
1285 recent.gui_time_format = timestamp_type;
1288 switch(recent.gui_time_format) {
1290 menu = gtk_item_factory_get_widget(main_menu_factory,
1291 "/View/Time Display Format/Time of Day");
1292 /* set_active will not trigger the callback when activating an active item! */
1293 recent.gui_time_format = -1;
1294 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), FALSE);
1295 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
1297 case(TS_ABSOLUTE_WITH_DATE):
1298 menu = gtk_item_factory_get_widget(main_menu_factory,
1299 "/View/Time Display Format/Date and Time of Day");
1300 recent.gui_time_format = -1;
1301 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
1304 menu = gtk_item_factory_get_widget(main_menu_factory,
1305 "/View/Time Display Format/Seconds Since Beginning of Capture");
1306 recent.gui_time_format = -1;
1307 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
1310 menu = gtk_item_factory_get_widget(main_menu_factory,
1311 "/View/Time Display Format/Seconds Since Previous Packet");
1312 recent.gui_time_format = -1;
1313 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
1316 g_assert_not_reached();
1322 popup_menu_handler(GtkWidget *widget, GdkEvent *event, gpointer data)
1324 GtkWidget *menu = (GtkWidget *)data;
1325 GdkEventButton *event_button = NULL;
1328 if(widget == NULL || event == NULL || data == NULL) {
1333 * If we ever want to make the menu differ based on what row
1334 * and/or column we're above, we'd use "eth_clist_get_selection_info()"
1335 * to find the row and column number for the coordinates; a CTree is,
1336 * I guess, like a CList with one column(?) and the expander widget
1339 /* Check if we are on packet_list object */
1340 if (widget == OBJECT_GET_DATA(popup_menu_object, E_MPACKET_LIST_KEY)) {
1341 if (packet_list_get_event_row_column(widget, (GdkEventButton *)event,
1343 OBJECT_SET_DATA(popup_menu_object, E_MPACKET_LIST_ROW_KEY,
1344 GINT_TO_POINTER(row));
1345 OBJECT_SET_DATA(popup_menu_object, E_MPACKET_LIST_COL_KEY,
1346 GINT_TO_POINTER(column));
1347 packet_list_set_selected_row(row);
1351 /* Check if we are on tree_view object */
1352 if (widget == tree_view) {
1353 tree_view_select(widget, (GdkEventButton *) event);
1356 /* Check if we are on byte_view object */
1357 if(widget == get_notebook_bv_ptr(byte_nb_ptr)) {
1358 byte_view_select(widget, (GdkEventButton *) event);
1361 if(event->type == GDK_BUTTON_PRESS) {
1362 event_button = (GdkEventButton *) event;
1364 /* To qoute the "Gdk Event Structures" doc:
1365 * "Normally button 1 is the left mouse button, 2 is the middle button, and 3 is the right button" */
1366 if(event_button->button == 3) {
1367 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
1368 event_button->button,
1369 event_button->time);
1370 SIGNAL_EMIT_STOP_BY_NAME(widget, "button_press_event");
1374 #if GTK_MAJOR_VERSION >= 2
1375 /* GDK_2BUTTON_PRESS is a doubleclick -> expand/collapse tree row */
1376 /* GTK version 1 seems to be doing this automatically */
1377 if (widget == tree_view && event->type == GDK_2BUTTON_PRESS) {
1380 if (gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(widget),
1381 (gint) (((GdkEventButton *)event)->x),
1382 (gint) (((GdkEventButton *)event)->y),
1383 &path, NULL, NULL, NULL))
1385 if (gtk_tree_view_row_expanded(GTK_TREE_VIEW(widget), path))
1386 gtk_tree_view_collapse_row(GTK_TREE_VIEW(widget), path);
1388 gtk_tree_view_expand_row(GTK_TREE_VIEW(widget), path,
1390 gtk_tree_path_free(path);
1397 /* Enable or disable menu items based on whether you have a capture file
1398 you've finished reading. */
1400 set_menus_for_capture_file(gboolean have_capture_file)
1402 set_menu_sensitivity(main_menu_factory, "/File/Open...", have_capture_file);
1403 set_menu_sensitivity(main_menu_factory, "/File/Open Recent", have_capture_file);
1404 set_menu_sensitivity(main_menu_factory, "/File/Close", have_capture_file);
1405 set_menu_sensitivity(main_menu_factory, "/File/Save As...",
1407 set_menu_sensitivity(main_menu_factory, "/File/Export", have_capture_file);
1408 set_menu_sensitivity(main_menu_factory, "/View/Reload", have_capture_file);
1409 set_toolbar_for_capture_file(have_capture_file);
1410 packets_bar_update();
1413 /* Enable or disable menu items based on whether you have an unsaved
1414 capture file you've finished reading. */
1416 set_menus_for_unsaved_capture_file(gboolean have_unsaved_capture_file)
1418 set_menu_sensitivity(main_menu_factory, "/File/Save",
1419 have_unsaved_capture_file);
1420 set_toolbar_for_unsaved_capture_file(have_unsaved_capture_file);
1423 /* Enable or disable menu items based on whether there's a capture in
1426 set_menus_for_capture_in_progress(gboolean capture_in_progress)
1428 set_menu_sensitivity(main_menu_factory, "/File/Open...",
1429 !capture_in_progress);
1430 set_menu_sensitivity(main_menu_factory, "/File/Open Recent",
1431 !capture_in_progress);
1433 set_menu_sensitivity(main_menu_factory, "/Capture/Start...",
1434 !capture_in_progress);
1435 set_menu_sensitivity(main_menu_factory, "/Capture/Stop",
1436 capture_in_progress);
1437 #endif /* HAVE_LIBPCAP */
1438 set_toolbar_for_capture_in_progress(capture_in_progress);
1441 /* Enable or disable menu items based on whether you have some captured
1444 walk_menu_tree_for_captured_packets(GList *node,
1445 gboolean have_captured_packets)
1447 gboolean is_enabled;
1449 menu_item_t *node_data = node->data;
1452 * Is this a leaf node or an interior node?
1454 if (node_data->children == NULL) {
1458 * If it has no "selected_packet_enabled()" or
1459 * "selected_tree_row_enabled()" routines, we enable
1460 * it. This allows tap windows to be popped up even
1461 * if you have no capture file; this is done to let
1462 * the user pop up multiple tap windows before reading
1463 * in a capture file, so that they can be processed in
1464 * parallel while the capture file is being read rather
1465 * than one at at time as you pop up the windows, and to
1466 * let the user pop up tap windows before starting an
1467 * "Update list of packets in real time" capture, so that
1468 * the statistics can be displayed while the capture is
1471 * If it has either of those routines, we disable it for
1472 * now - as long as, when a capture is first available,
1473 * we don't get called after a packet or tree row is
1474 * selected, that's OK.
1475 * XXX - that should be done better.
1477 if (node_data->selected_packet_enabled == NULL &&
1478 node_data->selected_tree_row_enabled == NULL)
1479 node_data->enabled = TRUE;
1481 node_data->enabled = FALSE;
1484 * It's an interior node; call
1485 * "walk_menu_tree_for_captured_packets()" on all its
1486 * children and, if any of them are enabled, enable
1487 * this node, otherwise disable it.
1489 * XXX - should we just leave all interior nodes enabled?
1490 * Which is a better UI choice?
1493 for (child = node_data->children; child != NULL; child =
1495 if (walk_menu_tree_for_captured_packets(child,
1496 have_captured_packets))
1499 node_data->enabled = is_enabled;
1503 * The root node doesn't correspond to a menu tree item; it
1504 * has a null name pointer.
1506 if (node_data->name != NULL) {
1507 set_menu_sensitivity(main_menu_factory, node_data->name,
1508 node_data->enabled);
1510 return node_data->enabled;
1514 set_menus_for_captured_packets(gboolean have_captured_packets)
1516 set_menu_sensitivity(main_menu_factory, "/File/Print...",
1517 have_captured_packets);
1518 set_menu_sensitivity(packet_list_menu_factory, "/Print...",
1519 have_captured_packets);
1520 set_menu_sensitivity(main_menu_factory, "/Edit/Find Packet...",
1521 have_captured_packets);
1522 set_menu_sensitivity(main_menu_factory, "/Edit/Find Next",
1523 have_captured_packets);
1524 set_menu_sensitivity(main_menu_factory, "/Edit/Find Previous",
1525 have_captured_packets);
1526 set_menu_sensitivity(main_menu_factory, "/View/Zoom In",
1527 have_captured_packets);
1528 set_menu_sensitivity(main_menu_factory, "/View/Zoom Out",
1529 have_captured_packets);
1530 set_menu_sensitivity(main_menu_factory, "/View/Normal Size",
1531 have_captured_packets);
1532 set_menu_sensitivity(main_menu_factory, "/View/Coloring Rules...",
1533 have_captured_packets);
1534 set_menu_sensitivity(packet_list_menu_factory, "/Coloring Rules...",
1535 have_captured_packets);
1536 set_menu_sensitivity(main_menu_factory, "/Go/Go to Packet...",
1537 have_captured_packets);
1538 set_menu_sensitivity(main_menu_factory, "/Go/First Packet",
1539 have_captured_packets);
1540 set_menu_sensitivity(main_menu_factory, "/Go/Last Packet",
1541 have_captured_packets);
1542 set_menu_sensitivity(main_menu_factory, "/Statistics/Summary",
1543 have_captured_packets);
1544 set_menu_sensitivity(main_menu_factory, "/Statistics/Protocol Hierarchy",
1545 have_captured_packets);
1547 walk_menu_tree_for_captured_packets(tap_menu_tree_root,
1548 have_captured_packets);
1549 set_toolbar_for_captured_packets(have_captured_packets);
1550 packets_bar_update();
1553 /* Enable or disable menu items based on whether a packet is selected and,
1554 if so, on the properties of the packet. */
1556 walk_menu_tree_for_selected_packet(GList *node, frame_data *fd,
1557 epan_dissect_t *edt)
1559 gboolean is_enabled;
1561 menu_item_t *node_data = node->data;
1564 * Is this a leaf node or an interior node?
1566 if (node_data->children == NULL) {
1570 * If it has no "selected_packet_enabled()" routine,
1571 * leave its enabled/disabled status alone - it
1572 * doesn't depend on whether we have a packet selected
1573 * or not or on the selected packet.
1575 * If it has a "selected_packet_enabled()" routine,
1576 * call it and set the item's enabled/disabled status
1577 * based on its return value.
1579 if (node_data->selected_packet_enabled != NULL)
1580 node_data->enabled = node_data->selected_packet_enabled(fd, edt);
1583 * It's an interior node; call
1584 * "walk_menu_tree_for_selected_packet()" on all its
1585 * children and, if any of them are enabled, enable
1586 * this node, otherwise disable it.
1588 * XXX - should we just leave all interior nodes enabled?
1589 * Which is a better UI choice?
1592 for (child = node_data->children; child != NULL; child =
1594 if (walk_menu_tree_for_selected_packet(child, fd, edt))
1597 node_data->enabled = is_enabled;
1601 * The root node doesn't correspond to a menu tree item; it
1602 * has a null name pointer.
1604 if (node_data->name != NULL) {
1605 set_menu_sensitivity(main_menu_factory, node_data->name,
1606 node_data->enabled);
1608 return node_data->enabled;
1612 set_menus_for_selected_packet(capture_file *cf)
1614 set_menu_sensitivity(main_menu_factory, "/Edit/Mark Packet",
1615 cf->current_frame != NULL);
1616 set_menu_sensitivity(packet_list_menu_factory, "/Mark Packet",
1617 cf->current_frame != NULL);
1618 set_menu_sensitivity(main_menu_factory, "/Edit/Time Reference",
1619 cf->current_frame != NULL);
1620 set_menu_sensitivity(packet_list_menu_factory, "/Time Reference",
1621 cf->current_frame != NULL);
1622 set_menu_sensitivity(main_menu_factory, "/Edit/Mark All Packets",
1623 cf->current_frame != NULL);
1624 set_menu_sensitivity(main_menu_factory, "/Edit/Unmark All Packets",
1625 cf->current_frame != NULL);
1626 set_menu_sensitivity(main_menu_factory, "/View/Collapse All",
1627 cf->current_frame != NULL);
1628 set_menu_sensitivity(tree_view_menu_factory, "/Collapse All",
1629 cf->current_frame != NULL);
1630 set_menu_sensitivity(main_menu_factory, "/View/Expand All",
1631 cf->current_frame != NULL);
1632 set_menu_sensitivity(tree_view_menu_factory, "/Expand All",
1633 cf->current_frame != NULL);
1634 set_menu_sensitivity(main_menu_factory, "/View/Show Packet in New Window",
1635 cf->current_frame != NULL);
1636 set_menu_sensitivity(packet_list_menu_factory, "/Show Packet in New Window",
1637 cf->current_frame != NULL);
1638 set_menu_sensitivity(main_menu_factory, "/Analyze/Follow TCP Stream",
1639 cf->current_frame != NULL ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
1640 set_menu_sensitivity(NULL, "/Follow TCP Stream",
1641 cf->current_frame != NULL ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
1642 set_menu_sensitivity(main_menu_factory, "/Analyze/Decode As...",
1643 cf->current_frame != NULL && decode_as_ok());
1644 set_menu_sensitivity(NULL, "/Decode As...",
1645 cf->current_frame != NULL && decode_as_ok());
1646 set_menu_sensitivity(tree_view_menu_factory, "/Resolve Name",
1647 cf->current_frame != NULL && (g_resolv_flags & RESOLV_ALL_ADDRS) != RESOLV_ALL_ADDRS);
1648 set_menu_sensitivity(packet_list_menu_factory, "/Match",
1649 cf->current_frame != NULL);
1650 set_menu_sensitivity(packet_list_menu_factory, "/Prepare",
1651 cf->current_frame != NULL);
1653 walk_menu_tree_for_selected_packet(tap_menu_tree_root, cf->current_frame,
1655 packets_bar_update();
1658 /* Enable or disable menu items based on whether a tree row is selected
1659 and, if so, on the properties of the tree row. */
1661 walk_menu_tree_for_selected_tree_row(GList *node, field_info *fi)
1663 gboolean is_enabled;
1665 menu_item_t *node_data = node->data;
1668 * Is this a leaf node or an interior node?
1670 if (node_data->children == NULL) {
1674 * If it has no "selected_tree_row_enabled()" routine,
1675 * leave its enabled/disabled status alone - it
1676 * doesn't depend on whether we have a tree row selected
1677 * or not or on the selected tree row.
1679 * If it has a "selected_tree_row_enabled()" routine,
1680 * call it and set the item's enabled/disabled status
1681 * based on its return value.
1683 if (node_data->selected_tree_row_enabled != NULL)
1684 node_data->enabled = node_data->selected_tree_row_enabled(fi);
1687 * It's an interior node; call
1688 * "walk_menu_tree_for_selected_tree_row()" on all its
1689 * children and, if any of them are enabled, enable
1690 * this node, otherwise disable it.
1692 * XXX - should we just leave all interior nodes enabled?
1693 * Which is a better UI choice?
1696 for (child = node_data->children; child != NULL; child =
1698 if (walk_menu_tree_for_selected_tree_row(child, fi))
1701 node_data->enabled = is_enabled;
1705 * The root node doesn't correspond to a menu tree item; it
1706 * has a null name pointer.
1708 if (node_data->name != NULL) {
1709 set_menu_sensitivity(main_menu_factory, node_data->name,
1710 node_data->enabled);
1712 return node_data->enabled;
1716 set_menus_for_selected_tree_row(capture_file *cf)
1718 gboolean properties;
1721 set_menu_sensitivity(main_menu_factory, "/File/Export/Selected Packet Bytes...",
1722 cf->finfo_selected != NULL);
1723 set_menu_sensitivity(tree_view_menu_factory, "/Export Selected Packet Bytes...",
1724 cf->finfo_selected != NULL);
1725 set_menu_sensitivity(hexdump_menu_factory, "/Export Selected Packet Bytes...",
1726 cf->finfo_selected != NULL);
1728 if (cf->finfo_selected != NULL) {
1729 header_field_info *hfinfo = cf->finfo_selected->hfinfo;
1730 if (hfinfo->parent == -1) {
1731 properties = prefs_is_registered_protocol(hfinfo->abbrev);
1733 properties = prefs_is_registered_protocol(proto_registrar_get_abbrev(hfinfo->parent));
1735 set_menu_sensitivity(main_menu_factory,
1736 "/Go/Go to Corresponding Packet", hfinfo->type == FT_FRAMENUM);
1737 set_menu_sensitivity(tree_view_menu_factory,
1738 "/Go to Corresponding Packet", hfinfo->type == FT_FRAMENUM);
1739 set_menu_sensitivity(main_menu_factory, "/Analyze/Match",
1740 proto_can_match_selected(cf->finfo_selected, cf->edt));
1741 set_menu_sensitivity(tree_view_menu_factory, "/Match",
1742 proto_can_match_selected(cf->finfo_selected, cf->edt));
1743 set_menu_sensitivity(main_menu_factory, "/Analyze/Prepare",
1744 proto_can_match_selected(cf->finfo_selected, cf->edt));
1745 set_menu_sensitivity(tree_view_menu_factory, "/Prepare",
1746 proto_can_match_selected(cf->finfo_selected, cf->edt));
1747 set_menu_sensitivity(tree_view_menu_factory, "/Protocol Properties...",
1750 set_menu_sensitivity(main_menu_factory,
1751 "/Go/Go to Corresponding Packet", FALSE);
1752 set_menu_sensitivity(tree_view_menu_factory,
1753 "/Go to Corresponding Packet", FALSE);
1754 set_menu_sensitivity(main_menu_factory, "/Analyze/Match", FALSE);
1755 set_menu_sensitivity(tree_view_menu_factory, "/Match", FALSE);
1756 set_menu_sensitivity(main_menu_factory, "/Analyze/Prepare", FALSE);
1757 set_menu_sensitivity(tree_view_menu_factory, "/Prepare", FALSE);
1758 set_menu_sensitivity(tree_view_menu_factory, "/Protocol Properties...",
1762 walk_menu_tree_for_selected_tree_row(tap_menu_tree_root, cf->finfo_selected);