6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
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.
34 #include <epan/packet.h>
35 #include <epan/addr_resolv.h>
36 #include <epan/prefs.h>
37 #include <epan/prefs-int.h>
39 #include <epan/timestamp.h>
40 #include <epan/etypes.h>
41 #include <epan/ipproto.h>
42 #include <epan/dissector_filters.h>
43 #include <epan/strutil.h>
44 #include <epan/plugins.h>
45 #include <epan/epan_dissect.h>
46 #include <epan/column.h>
49 #include "../ui_util.h"
50 #include "../simple_dialog.h"
51 #include "../main_statusbar.h"
52 #include "../color_filters.h"
53 #include "../stat_menu.h"
56 #include "gtk/about_dlg.h"
57 #include "gtk/capture_dlg.h"
58 #include "gtk/capture_if_dlg.h"
59 #include "gtk/color_dlg.h"
60 #include "gtk/filter_dlg.h"
61 #include "gtk/profile_dlg.h"
62 #include "gtk/dlg_utils.h"
63 #include "gtk/capture_file_dlg.h"
64 #include "gtk/fileset_dlg.h"
65 #include "gtk/file_import_dlg.h"
66 #include "gtk/find_dlg.h"
67 #include "gtk/goto_dlg.h"
68 #include "gtk/summary_dlg.h"
69 #include "gtk/prefs_dlg.h"
70 #include "gtk/packet_win.h"
71 #include "gtk/follow_tcp.h"
72 #include "gtk/follow_udp.h"
73 #include "gtk/follow_ssl.h"
74 #include "gtk/decode_as_dlg.h"
75 #include "gtk/help_dlg.h"
76 #include "gtk/supported_protos_dlg.h"
77 #include "gtk/proto_dlg.h"
78 #include "gtk/proto_hier_stats_dlg.h"
80 #include "gtk/stock_icons.h"
81 #include "gtk/gtkglobals.h"
82 #include "gtk/recent.h"
83 #include "gtk/main_proto_draw.h"
84 #include "gtk/conversations_table.h"
85 #include "gtk/hostlist_table.h"
86 #include "gtk/packet_history.h"
87 #include "gtk/sctp_stat.h"
88 #include "gtk/firewall_dlg.h"
89 #include "gtk/macros_dlg.h"
90 #include "gtk/export_object.h"
91 #include "gtk/gui_stat_menu.h"
93 #include "gtk/menus.h"
94 #include "gtk/main_toolbar.h"
95 #include "gtk/main_welcome.h"
96 #include "gtk/uat_gui.h"
97 #include "gtk/gui_utils.h"
98 #include "gtk/manual_addr_resolv.h"
99 #include "gtk/proto_help.h"
100 #include "gtk/dissector_tables_dlg.h"
101 #include "gtk/utf8_entities.h"
103 #ifdef NEW_PACKET_LIST
104 #include "gtk/new_packet_list.h"
106 #include "gtk/main_packet_list.h"
109 #ifdef HAVE_IGE_MAC_INTEGRATION
110 #include <ige-mac-menu.h>
113 #ifdef HAVE_GTKOSXAPPLICATION
114 #include <igemacintegration/gtkosxapplication.h>
117 static int initialize = TRUE;
118 #ifdef MAIN_MENU_USE_UIMANAGER
119 GtkActionGroup *main_menu_bar_action_group;
121 static GtkItemFactory *main_menu_factory = NULL;
122 #endif /* MAIN_MENU_USE_UIMANAGER */
123 static GtkUIManager *ui_manager_main_menubar = NULL;
124 static GtkUIManager *ui_manager_packet_list_heading = NULL;
125 static GtkUIManager *ui_manager_packet_list_menu = NULL;
126 static GtkUIManager *ui_manager_tree_view_menu = NULL;
127 static GtkUIManager *ui_manager_bytes_menu = NULL;
128 static GtkUIManager *ui_manager_statusbar_profiles_menu = NULL;
129 static GSList *popup_menu_list = NULL;
131 static GtkAccelGroup *grp;
133 typedef struct _menu_item {
137 const char *stock_id;
139 GtkItemFactoryCallback callback;
140 gpointer callback_data;
141 gboolean (*selected_packet_enabled)(frame_data *, epan_dissect_t *, gpointer callback_data);
142 gboolean (*selected_tree_row_enabled)(field_info *, gpointer callback_data);
146 static GList *tap_menu_tree_root = NULL;
148 GtkWidget *popup_menu_object;
151 #define GTK_MENU_FUNC(a) ((GtkItemFactoryCallback)(a))
153 static void merge_all_tap_menus(GList *node);
154 #ifdef MAIN_MENU_USE_UIMANAGER
155 static void menu_open_recent_file_cmd_cb(GtkAction *action, gpointer data _U_ );
156 static void add_recent_items (guint merge_id, GtkUIManager *ui_manager);
157 #endif /* MAIN_MENU_USE_UIMANAGER */
159 static void menus_init(void);
160 static void set_menu_sensitivity (GtkUIManager *ui_manager, const gchar *, gint);
161 #ifndef MAIN_MENU_USE_UIMANAGER
162 static void clear_menu_recent_capture_file_cmd_cb(GtkWidget *w, gpointer unused _U_);
163 static void set_menu_sensitivity_old (const gchar *, gint);
164 #endif /* MAIN_MENU_USE_UIMANAGER */
165 static void show_hide_cb(GtkWidget *w, gpointer data, gint action);
166 #ifndef MAIN_MENU_USE_UIMANAGER
167 static void timestamp_format_cb(GtkWidget *w, gpointer d, gint action);
168 static void timestamp_precision_cb(GtkWidget *w, gpointer d, gint action);
170 static void timestamp_seconds_time_cb(GtkWidget *w, gpointer d, gint action);
171 static void name_resolution_cb(GtkWidget *w, gpointer d, gint action);
173 #ifndef MAIN_MENU_USE_UIMANAGER
174 static void auto_scroll_live_cb(GtkWidget *w, gpointer d);
177 static void colorize_cb(GtkWidget *w, gpointer d);
180 /* As a general GUI guideline, we try to follow the Gnome Human Interface Guidelines, which can be found at:
181 http://developer.gnome.org/projects/gup/hig/1.0/index.html
183 Please note: there are some differences between the Gnome HIG menu suggestions and our implementation:
185 File/Open Recent: the Gnome HIG suggests putting the list of recently used files as elements into the File menuitem.
186 As this is ok for only a few items, this will become unhandy for 10 or even more list entries.
187 For this reason, we use a submenu for this.
189 File/Close: the Gnome HIG suggests putting this item just above the Quit item.
190 This results in unintuitive behaviour as both Close and Quit items are very near together.
191 By putting the Close item near the open item(s), it better suggests that it will close the
192 currently opened/captured file only.
196 SHOW_HIDE_MAIN_TOOLBAR = 1,
197 SHOW_HIDE_FILTER_TOOLBAR,
198 SHOW_HIDE_AIRPCAP_TOOLBAR,
200 SHOW_HIDE_PACKET_LIST,
203 } show_hide_values_e;
214 build_conversation_filter(int action, gboolean show_dialog)
216 packet_info *pi = &cfile.edt->pi;
222 if (pi->profinet_type == 0) {
224 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
225 "Error filtering conversation. Please make\n"
226 "sure you have a PROFINET CBA packet selected.");
231 if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4
232 && pi->ipproto == IP_PROTO_TCP ) {
234 switch(pi->profinet_type) {
236 buf = g_strdup_printf("(ip.src eq %s and ip.dst eq %s and cba.acco.dcom == 1) || (ip.src eq %s and ip.dst eq %s and cba.acco.dcom == 0)",
237 ip_to_str( pi->net_dst.data),
238 ip_to_str( pi->net_src.data),
239 ip_to_str( pi->net_src.data),
240 ip_to_str( pi->net_dst.data));
243 buf = g_strdup_printf("(ip.src eq %s and ip.dst eq %s and cba.acco.dcom == 1) || (ip.src eq %s and ip.dst eq %s and cba.acco.dcom == 0)",
244 ip_to_str( pi->net_src.data),
245 ip_to_str( pi->net_dst.data),
246 ip_to_str( pi->net_dst.data),
247 ip_to_str( pi->net_src.data));
250 buf = g_strdup_printf("(ip.src eq %s and ip.dst eq %s and cba.acco.srt == 1) || (ip.src eq %s and ip.dst eq %s and cba.acco.srt == 0)",
251 ip_to_str( pi->net_dst.data),
252 ip_to_str( pi->net_src.data),
253 ip_to_str( pi->net_src.data),
254 ip_to_str( pi->net_dst.data));
257 buf = g_strdup_printf("(ip.src eq %s and ip.dst eq %s and cba.acco.srt == 1) || (ip.src eq %s and ip.dst eq %s and cba.acco.srt == 0)",
258 ip_to_str( pi->net_src.data),
259 ip_to_str( pi->net_dst.data),
260 ip_to_str( pi->net_dst.data),
261 ip_to_str( pi->net_src.data));
271 if (pi->ipproto != IP_PROTO_TCP) {
273 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
274 "Error filtering conversation. Please make\n"
275 "sure you have a TCP packet selected.");
280 if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4 ) {
282 buf = g_strdup_printf("(ip.addr eq %s and ip.addr eq %s) and (tcp.port eq %d and tcp.port eq %d)",
283 ip_to_str( pi->net_src.data),
284 ip_to_str( pi->net_dst.data),
285 pi->srcport, pi->destport );
286 } else if( pi->net_src.type == AT_IPv6 && pi->net_dst.type == AT_IPv6 ) {
288 buf = g_strdup_printf("(ipv6.addr eq %s and ipv6.addr eq %s) and (tcp.port eq %d and tcp.port eq %d)",
289 ip6_to_str((const struct e_in6_addr *)pi->net_src.data),
290 ip6_to_str((const struct e_in6_addr *)pi->net_dst.data),
291 pi->srcport, pi->destport );
297 if (pi->ipproto != IP_PROTO_UDP) {
299 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
300 "Error filtering conversation. Please make\n"
301 "sure you have a UDP packet selected.");
306 if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4 ) {
308 buf = g_strdup_printf("(ip.addr eq %s and ip.addr eq %s) and (udp.port eq %d and udp.port eq %d)",
309 ip_to_str( pi->net_src.data),
310 ip_to_str( pi->net_dst.data),
311 pi->srcport, pi->destport );
312 } else if( pi->net_src.type == AT_IPv6 && pi->net_dst.type == AT_IPv6 ) {
314 buf = g_strdup_printf("(ipv6.addr eq %s and ipv6.addr eq %s) and (udp.port eq %d and udp.port eq %d)",
315 ip6_to_str((const struct e_in6_addr *)pi->net_src.data),
316 ip6_to_str((const struct e_in6_addr *)pi->net_dst.data),
317 pi->srcport, pi->destport );
323 if ((pi->ethertype != ETHERTYPE_IP) && (pi->ethertype != ETHERTYPE_IPv6)) {
325 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
326 "Error filtering conversation. Please make\n"
327 "sure you have a IP packet selected.");
332 if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4 ) {
334 buf = g_strdup_printf("ip.addr eq %s and ip.addr eq %s",
335 ip_to_str( pi->net_src.data),
336 ip_to_str( pi->net_dst.data));
337 } else if( pi->net_src.type == AT_IPv6 && pi->net_dst.type == AT_IPv6 ) {
339 buf = g_strdup_printf("ipv6.addr eq %s and ipv6.addr eq %s",
340 ip6_to_str((const struct e_in6_addr *)pi->net_src.data),
341 ip6_to_str((const struct e_in6_addr *)pi->net_dst.data));
347 /* XXX - is this the right way to check for Ethernet? */
348 /* check for the data link address type */
349 /* (ethertype will be 0 when used as length field) */
350 if (pi->dl_src.type != AT_ETHER) {
352 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
353 "Error filtering conversation. Please make\n"
354 "sure you have a Ethernet packet selected.");
359 if( pi->dl_src.type == AT_ETHER && pi->dl_dst.type == AT_ETHER ) {
361 buf = g_strdup_printf("eth.addr eq %s and eth.addr eq %s",
362 ether_to_str( pi->dl_src.data),
363 ether_to_str( pi->dl_dst.data));
376 conversation_cb(GtkAction *a _U_, gpointer data _U_, int action)
379 GtkWidget *filter_te;
381 if (cfile.current_frame) {
382 /* create a filter-string based on the selected packet and action */
383 filter = build_conversation_filter(action, TRUE);
385 /* Run the display filter so it goes in effect - even if it's the
386 same as the previous display filter. */
387 filter_te = gtk_bin_get_child(GTK_BIN(g_object_get_data(G_OBJECT(top_level), E_DFILTER_CM_KEY)));
389 gtk_entry_set_text(GTK_ENTRY(filter_te), filter);
390 main_filter_packets(&cfile, filter, TRUE);
397 colorize_conversation_cb(GtkWidget * w _U_, gpointer data _U_, int action)
399 gchar *filter = NULL;
401 if( (action>>8) == 255 ) {
402 color_filters_reset_tmp();
403 #ifdef NEW_PACKET_LIST
404 new_packet_list_colorize_packets();
406 cf_colorize_packets(&cfile);
408 } else if (cfile.current_frame) {
409 if( (action&0xff) == 0 ) {
410 /* colorize_conversation_cb was called from the window-menu
411 * or through an accelerator key. Try to build a conversation
412 * filter in the order TCP, UDP, IP, Ethernet and apply the
414 filter = build_conversation_filter(CONV_TCP,FALSE);
416 filter = build_conversation_filter(CONV_UDP,FALSE);
418 filter = build_conversation_filter(CONV_IP,FALSE);
420 filter = build_conversation_filter(CONV_ETHER,FALSE);
421 if( filter == NULL ) {
422 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Unable to build conversation filter.");
426 /* create a filter-string based on the selected packet and action */
427 filter = build_conversation_filter(action&0xff, TRUE);
430 if( (action>>8) == 0) {
431 /* Open the "new coloring filter" dialog with the filter */
432 color_display_with_filter(filter);
434 /* Set one of the temporary coloring filters */
435 color_filters_set_tmp((guint8)(action>>8),filter,FALSE);
436 #ifdef NEW_PACKET_LIST
437 new_packet_list_colorize_packets();
439 cf_colorize_packets(&cfile);
448 goto_conversation_frame(gboolean dir)
451 dfilter_t *dfcode = NULL;
452 gboolean found_packet=FALSE;
454 filter = build_conversation_filter(CONV_TCP,FALSE);
456 filter = build_conversation_filter(CONV_UDP,FALSE);
458 filter = build_conversation_filter(CONV_IP,FALSE);
459 if( filter == NULL ) {
460 statusbar_push_temporary_msg("Unable to build conversation filter.");
465 if (!dfilter_compile(filter, &dfcode)) {
466 /* The attempt failed; report an error. */
467 statusbar_push_temporary_msg("Error compiling filter for this conversation.");
472 found_packet = cf_find_packet_dfilter(&cfile, dfcode, dir);
475 /* We didn't find a packet */
476 statusbar_push_temporary_msg("No previous/next packet in conversation.");
479 dfilter_free(dfcode);
483 #ifdef MAIN_MENU_USE_UIMANAGER
485 goto_next_frame_conversation_cb(GtkAction *action _U_, gpointer user_data _U_)
487 goto_conversation_frame(FALSE);
491 goto_previous_frame_conversation_cb(GtkAction *action _U_, gpointer user_data _U_)
493 goto_conversation_frame(TRUE);
497 goto_next_frame_conversation_cb(GtkWidget *w _U_, gpointer d _U_)
499 goto_conversation_frame(FALSE);
503 goto_previous_frame_conversation_cb(GtkWidget *w _U_, gpointer d _U_)
505 goto_conversation_frame(TRUE);
507 #endif /* MAIN_MENU_USE_UIMANAGER */
514 tree_view_menu_apply_selected_cb(GtkAction *action _U_, gpointer user_data)
516 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter/Selected");
517 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_REPLACE|MATCH_SELECTED_APPLY_NOW);
521 tree_view_menu_apply_not_selected_cb(GtkAction *action _U_, gpointer user_data)
523 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter/NotSelected");
524 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_NOT|MATCH_SELECTED_APPLY_NOW);
528 tree_view_menu_apply_and_selected_cb(GtkAction *action _U_, gpointer user_data)
530 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter/AndSelected");
531 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_AND|MATCH_SELECTED_APPLY_NOW);
535 tree_view_menu_apply_or_selected_cb(GtkAction *action _U_, gpointer user_data)
537 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter/OrSelected");
538 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_OR|MATCH_SELECTED_APPLY_NOW);
542 tree_view_menu_apply_and_not_selected_cb(GtkAction *action _U_, gpointer user_data)
544 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter/AndNotSelected");
545 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_AND_NOT|MATCH_SELECTED_APPLY_NOW);
549 tree_view_menu_apply_or_not_selected_cb(GtkAction *action _U_, gpointer user_data)
551 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter/OrNotSelected");
552 match_selected_ptree_cb( widget , user_data,MATCH_SELECTED_OR_NOT|MATCH_SELECTED_APPLY_NOW);
554 /* Prepare a filter */
556 tree_view_menu_prepare_selected_cb(GtkAction *action _U_, gpointer user_data)
558 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter/Selected");
559 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_REPLACE);
563 tree_view_menu_prepare_not_selected_cb(GtkAction *action _U_, gpointer user_data)
565 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter/NotSelected");
566 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_NOT);
570 tree_view_menu_prepare_and_selected_cb(GtkAction *action _U_, gpointer user_data)
572 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter/AndSelected");
573 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_AND);
577 tree_view_menu_prepare_or_selected_cb(GtkAction *action _U_, gpointer user_data)
579 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter/OrSelected");
580 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_OR);
584 tree_view_menu_prepare_and_not_selected_cb(GtkAction *action _U_, gpointer user_data)
586 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter/AndNotSelected");
587 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_AND_NOT);
591 tree_view_menu_prepare_or_not_selected_cb(GtkAction *action _U_, gpointer user_data)
593 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter/OrNotSelected");
594 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_OR_NOT);
597 /* Prepare for use of GTKUImanager */
598 #ifdef MAIN_MENU_USE_UIMANAGER
601 copy_description_cb(GtkAction *action _U_, gpointer user_data)
603 copy_selected_plist_cb( NULL /* widget _U_ */ , user_data, COPY_SELECTED_DESCRIPTION);
607 copy_fieldname_cb(GtkAction *action _U_, gpointer user_data)
609 copy_selected_plist_cb( NULL /* widget _U_ */ , user_data, COPY_SELECTED_FIELDNAME);
613 copy_value_cb(GtkAction *action _U_, gpointer user_data)
615 copy_selected_plist_cb( NULL /* widget _U_ */ , user_data, COPY_SELECTED_VALUE);
619 copy_as_filter_cb(GtkAction *action _U_, gpointer user_data)
621 match_selected_ptree_cb( NULL /* widget _U_ */ , user_data, MATCH_SELECTED_REPLACE|MATCH_SELECTED_COPY_ONLY);
625 set_reftime_cb(GtkAction *action _U_, gpointer user_data)
627 reftime_frame_cb( NULL /* widget _U_ */ , user_data, REFTIME_TOGGLE);
631 find_next_ref_time_cb(GtkAction *action _U_, gpointer user_data)
633 reftime_frame_cb( NULL /* widget _U_ */ , user_data, REFTIME_FIND_NEXT);
637 find_previous_ref_time_cb(GtkAction *action _U_, gpointer user_data)
639 reftime_frame_cb( NULL /* widget _U_ */ , user_data, REFTIME_FIND_PREV);
643 menus_prefs_cb(GtkAction *action _U_, gpointer user_data)
645 prefs_page_cb( NULL /* widget _U_ */ , user_data, PREFS_PAGE_USER_INTERFACE);
649 main_toolbar_show_hide_cb(GtkAction *action _U_, gpointer user_data)
651 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/MainToolbar");
654 g_warning("main_toolbar_show_hide_cb: No widget found");
656 show_hide_cb( widget, user_data, SHOW_HIDE_MAIN_TOOLBAR);
661 filter_toolbar_show_hide_cb(GtkAction * action _U_, gpointer user_data)
663 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/FilterToolbar");
665 g_warning("filter_toolbar_show_hide_cb: No widget found");
667 show_hide_cb( widget, user_data, SHOW_HIDE_FILTER_TOOLBAR);
673 wireless_toolbar_show_hide_cb(GtkAction *action _U_, gpointer user_data)
675 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/WirelessToolbar");
677 g_warning("wireless_toolbar_show_hide_cb: No widget found");
679 show_hide_cb( widget, user_data, SHOW_HIDE_AIRPCAP_TOOLBAR);
682 #endif /* HAVE_AIRPCAP */
685 status_bar_show_hide_cb(GtkAction *action _U_, gpointer user_data)
687 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/Statusbar");
689 g_warning("status_bar_show_hide_cb: No widget found");
691 show_hide_cb( widget, user_data, SHOW_HIDE_STATUSBAR);
695 packet_list_show_hide_cb(GtkAction *action _U_, gpointer user_data)
697 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/PacketList");
699 g_warning("packet_list_show_hide_cb: No widget found");
701 show_hide_cb( widget, user_data, SHOW_HIDE_PACKET_LIST);
705 packet_details_show_hide_cb(GtkAction *action _U_, gpointer user_data)
707 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/PacketDetails");
709 g_warning("packet_details_show_hide_cb: No widget found");
711 show_hide_cb( widget, user_data, SHOW_HIDE_TREE_VIEW);
715 packet_bytes_show_hide_cb(GtkAction *action _U_, gpointer user_data)
717 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/PacketBytes");
719 g_warning("packet_bytes_show_hide_cb: No widget found");
721 show_hide_cb( widget, user_data, SHOW_HIDE_BYTE_VIEW);
726 timestamp_format_new_cb (GtkRadioAction *action, GtkRadioAction *current _U_, gpointer user_data _U_)
730 value = gtk_radio_action_get_current_value (action);
731 g_warning("timestamp_format_new_cb, value %u, recent.gui_time_format %u",value, recent.gui_time_format);
732 if (recent.gui_time_format != value) {
733 timestamp_set_type(value);
734 recent.gui_time_format = value;
735 #ifdef NEW_PACKET_LIST
736 /* This call adjusts column width */
737 cf_timestamp_auto_precision(&cfile);
738 new_packet_list_queue_draw();
740 cf_change_time_formats(&cfile);
747 timestamp_precision_new_cb (GtkRadioAction *action, GtkRadioAction *current _U_, gpointer user_data _U_)
751 value = gtk_radio_action_get_current_value (action);
752 g_warning("timestamp_precision_new_cb, value %u, recent.gui_time_precision %u",value, recent.gui_time_precision);
753 if (recent.gui_time_precision != value) {
754 /* the actual precision will be set in cf_change_time_formats() below */
755 if (value == TS_PREC_AUTO) {
756 timestamp_set_precision(TS_PREC_AUTO_SEC);
758 timestamp_set_precision(value);
760 recent.gui_time_precision = value;
761 #ifdef NEW_PACKET_LIST
762 /* This call adjusts column width */
763 cf_timestamp_auto_precision(&cfile);
764 new_packet_list_queue_draw();
766 cf_change_time_formats(&cfile);
773 view_menu_seconds_time_cb(GtkAction *action _U_, gpointer user_data)
775 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/TimeDisplayFormat/DisplaySecondsWithHoursAndMinutes");
777 g_warning("view_menu_seconds_time_cb: No widget found");
779 timestamp_seconds_time_cb(widget, user_data, 0);
784 view_menu_en_for_MAC_cb(GtkAction *action _U_, gpointer user_data)
786 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/EnableforMACLayer");
788 g_warning("view_menu_en_for_MAC_cb: No widget found");
790 name_resolution_cb( widget , user_data, RESOLV_MAC);
795 view_menu_en_for_network_cb(GtkAction *action _U_, gpointer user_data)
797 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/EnableforNetworkLayer");
799 g_warning("view_menu_en_for_network_cb: No widget found");
801 name_resolution_cb( widget , user_data, RESOLV_NETWORK);
806 view_menu_en_for_transport_cb(GtkAction *action _U_, gpointer user_data)
808 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/EnableforTransportLayer");
810 g_warning("view_menu_en_for_transport_cb: No widget found");
812 name_resolution_cb( widget , user_data, RESOLV_TRANSPORT);
817 view_menu_colorize_pkt_lst_cb(GtkAction *action _U_, gpointer user_data)
819 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/ColorizePacketList");
821 g_warning("view_menu_colorize_pkt_lst_cb: No widget found");
823 colorize_cb( widget , user_data);
829 view_menu_auto_scroll_live_cb(GtkAction *action _U_, gpointer user_data _U_)
831 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/AutoScrollinLiveCapture");
834 g_warning("view_menu_auto_scroll_live_cb: No widget found");
836 menu_auto_scroll_live_changed(GTK_CHECK_MENU_ITEM(widget)->active);
841 view_menu_color_conv_color1_cb(GtkAction *action _U_, gpointer user_data)
843 colorize_conversation_cb( NULL /* widget _U_*/ , user_data, 1*256);
847 view_menu_color_conv_color2_cb(GtkAction *action _U_, gpointer user_data)
849 colorize_conversation_cb( NULL /* widget _U_*/ , user_data, 2*256);
853 view_menu_color_conv_color3_cb(GtkAction *action _U_, gpointer user_data)
855 colorize_conversation_cb( NULL /* widget _U_*/ , user_data, 3*256);
859 view_menu_color_conv_color4_cb(GtkAction *action _U_, gpointer user_data)
861 colorize_conversation_cb( NULL /* widget _U_*/ , user_data, 4*256);
865 view_menu_color_conv_color5_cb(GtkAction *action _U_, gpointer user_data)
867 colorize_conversation_cb( NULL /* widget _U_*/ , user_data, 5*256);
871 view_menu_color_conv_color6_cb(GtkAction *action _U_, gpointer user_data)
873 colorize_conversation_cb( NULL /* widget _U_*/ , user_data, 6*256);
877 view_menu_color_conv_color7_cb(GtkAction *action _U_, gpointer user_data)
879 colorize_conversation_cb( NULL /* widget _U_*/ , user_data, 7*256);
883 view_menu_color_conv_color8_cb(GtkAction *action _U_, gpointer user_data)
885 colorize_conversation_cb( NULL /* widget _U_*/ , user_data, 8*256);
889 view_menu_color_conv_color9_cb(GtkAction *action _U_, gpointer user_data)
891 colorize_conversation_cb( NULL /* widget _U_*/ , user_data, 9*256);
895 view_menu_color_conv_color10_cb(GtkAction *action _U_, gpointer user_data)
897 colorize_conversation_cb( NULL /* widget _U_*/ , user_data, 10*256);
901 view_menu_color_conv_new_rule_cb(GtkAction *action _U_, gpointer user_data)
903 colorize_conversation_cb( NULL /* widget _U_*/ , user_data, 0);
907 view_menu_reset_coloring_cb(GtkAction *action _U_, gpointer user_data)
909 colorize_conversation_cb( NULL /* widget _U_*/ , user_data, 255*256);
913 help_menu_cont_cb(GtkAction *action _U_, gpointer user_data _U_)
915 topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(HELP_CONTENT));
919 help_menu_faq_cb(GtkAction *action _U_, gpointer user_data _U_)
921 topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(ONLINEPAGE_FAQ));
925 help_menu_wireshark_cb(GtkAction *action _U_, gpointer user_data _U_)
927 topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_WIRESHARK));
931 help_menu_wireshark_flt_cb(GtkAction *action _U_, gpointer user_data _U_)
933 topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_WIRESHARK_FILTER));
937 help_menu_Tshark_cb(GtkAction *action _U_, gpointer user_data _U_)
939 topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_TSHARK));
943 help_menu_RawShark_cb(GtkAction *action _U_, gpointer user_data _U_)
945 topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_RAWSHARK));
949 help_menu_Dumpcap_cb(GtkAction *action _U_, gpointer user_data _U_)
951 topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_DUMPCAP));
955 help_menu_Mergecap_cb(GtkAction *action _U_, gpointer user_data _U_)
957 topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_MERGECAP));
961 help_menu_Editcap_cb(GtkAction *action _U_, gpointer user_data _U_)
963 topic_menu_cb(NULL/* widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_EDITCAP));
967 help_menu_Text2pcap_cb(GtkAction *action _U_, gpointer user_data _U_)
969 topic_menu_cb(NULL/* widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_TEXT2PCAP));
973 help_menu_Website_cb(GtkAction *action _U_, gpointer user_data _U_)
975 topic_menu_cb(NULL/* widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(ONLINEPAGE_HOME));
979 help_menu_Wiki_cb(GtkAction *action _U_, gpointer user_data _U_)
981 topic_menu_cb(NULL/* widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(ONLINEPAGE_WIKI));
985 help_menu_Downloads_cb(GtkAction *action _U_, gpointer user_data _U_)
987 topic_menu_cb(NULL/* widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(ONLINEPAGE_DOWNLOAD));
991 help_menu_SampleCaptures_cb(GtkAction *action _U_, gpointer user_data _U_)
993 topic_menu_cb( NULL/* widget_U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(ONLINEPAGE_SAMPLE_FILES));
996 static const char *ui_desc_menubar =
998 " <menubar name ='Menubar'>\n"
999 " <menu name= 'FileMenu' action='/File'>\n"
1000 " <menuitem name='Open' action='/File/Open'/>\n"
1001 " <menu name='OpenRecent' action='/File/OpenRecent'>\n"
1002 " <placeholder name='RecentFiles'/>\n"
1004 " <menuitem name='Merge' action='/File/Merge'/>\n"
1005 " <menuitem name='Import' action='/File/Import'/>\n"
1006 " <menuitem name='Close' action='/File/Close'/>\n"
1008 " <menuitem name='Save' action='/File/Save'/>\n"
1009 " <menuitem name='SaveAs' action='/File/SaveAs'/>\n"
1011 " <menu name= 'Set' action='/File/Set'>\n"
1012 " <menuitem name='ListFiles' action='/File/Set/ListFiles'/>\n"
1013 " <menuitem name='NextFile' action='/File/Set/NextFile'/>\n"
1014 " <menuitem name='PreviousFile' action='/File/Set/PreviousFile'/>\n"
1017 " <menu name= 'Export' action='/File/Export'>\n"
1019 " <menuitem name='File' action='/File/Export/File'/>\n"
1021 " <menu name= 'File' action='/File/Export/File'>\n"
1022 " <menuitem name='AsTxt' action='/File/Export/File/Text'/>\n"
1023 " <menuitem name='AsPostScript' action='/File/Export/File/PostScript'/>\n"
1024 " <menuitem name='AsCSV' action='/File/Export/File/CSV'/>\n"
1025 " <menuitem name='AsCArrays' action='/File/Export/File/CArrays'/>\n"
1027 " <menuitem name='AsPSML' action='/File/Export/File/PSML'/>\n"
1028 " <menuitem name='AsPDML' action='/File/Export/File/PDML'/>\n"
1032 " <menuitem name='SelectedPacketBytes' action='/File/Export/SelectedPacketBytes'/>\n"
1033 " <menu name= 'Objects' action='/File/Export/Objects'>\n"
1034 " <menuitem name='HTTP' action='/File/Export/Objects/HTTP'/>\n"
1035 " <menuitem name='DICOM' action='/File/Export/Objects/DICOM'/>\n"
1036 " <menuitem name='SMB' action='/File/Export/Objects/SMB'/>\n"
1040 " <menuitem name='Print' action='/File/Print'/>\n"
1042 " <menuitem name='Quit' action='/File/Quit'/>\n"
1044 " <menu name= 'EditMenu' action='/Edit'>\n"
1045 " <menu name= 'Copy' action='/Edit/Copy'>\n"
1046 " <menuitem name='Description' action='/Edit/Copy/Description'/>\n"
1047 " <menuitem name='Fieldname' action='/Edit/Copy/Fieldname'/>\n"
1048 " <menuitem name='Value' action='/Edit/Copy/Value'/>\n"
1050 " <menuitem name='AsFilter' action='/Edit/Copy/AsFilter'/>\n"
1052 " <menuitem name='FindPacket' action='/Edit/FindPacket'/>\n"
1053 " <menuitem name='FindNext' action='/Edit/FindNext'/>\n"
1054 " <menuitem name='FindPrevious' action='/Edit/FindPrevious'/>\n"
1056 #ifdef NEW_PACKET_LIST
1057 " <menuitem name='MarkPacket' action='/Edit/MarkPacket'/>\n"
1058 " <menuitem name='MarkAllDisplayedPackets' action='/Edit/MarkAllDisplayedPackets'/>\n"
1059 " <menuitem name='UnmarkAllPackets' action='/Edit/UnmarkAllPackets'/>\n"
1060 " <menuitem name='FindNextMark' action='/Edit/FindNextMark'/>\n"
1061 " <menuitem name='FindPreviousMark' action='/Edit/FindPreviousMark'/>\n"
1063 " <menuitem name='IgnorePacket' action='/Edit/IgnorePacket'/>\n"
1064 " <menuitem name='IgnoreAllDisplayedPackets' action='/Edit/IgnoreAllDisplayedPackets'/>\n"
1065 " <menuitem name='Un-IgnoreAllPackets' action='/Edit/Un-IgnoreAllPackets'/>\n"
1067 " <menuitem name='SetTimeReference' action='/Edit/SetTimeReference'/>\n"
1068 " <menuitem name='Un-TimeReferenceAllPackets' action='/Edit/Un-TimeReferenceAllPackets'/>\n"
1069 " <menuitem name='FindNextTimeReference' action='/Edit/FindNextTimeReference'/>\n"
1070 " <menuitem name='FindPreviousTimeReference' action='/Edit/FindPreviousTimeReference'/>\n"
1072 #else /* NEW_PACKET_LIST */
1073 #error "You must use the new packet list if you are using GTKUIManager for menus"
1075 " <menuitem name='ConfigurationProfiles' action='/Edit/ConfigurationProfiles'/>\n"
1076 " <menuitem name='Preferences' action='/Edit/Preferences'/>\n"
1078 " <menu name= 'ViewMenu' action='/View'>\n"
1079 " <menuitem name='MainToolbar' action='/View/MainToolbar'/>\n"
1080 " <menuitem name='FilterToolbar' action='/View/FilterToolbar'/>\n"
1082 " <menuitem name='WirelessToolbar' action='/View/WirelessToolbar'/>\n"
1084 " <menuitem name='Statusbar' action='/View/Statusbar'/>\n"
1086 " <menuitem name='PacketList' action='/View/PacketList'/>\n"
1087 " <menuitem name='PacketDetails' action='/View/PacketDetails'/>\n"
1088 " <menuitem name='PacketBytes' action='/View/PacketBytes'/>\n"
1090 " <menu name= 'TimeDisplayFormat' action='/View/TimeDisplayFormat'>\n"
1091 " <menuitem name='DateandTimeofDay' action='/View/TimeDisplayFormat/DateandTimeofDay'/>\n"
1092 " <menuitem name='TimeofDay' action='/View/TimeDisplayFormat/TimeofDay'/>\n"
1093 " <menuitem name='SecondsSinceEpoch' action='/View/TimeDisplayFormat/SecondsSinceEpoch'/>\n"
1094 " <menuitem name='SecondsSinceBeginningofCapture' action='/View/TimeDisplayFormat/SecondsSinceBeginningofCapture'/>\n"
1095 " <menuitem name='SecondsSincePreviousCapturedPacket' action='/View/TimeDisplayFormat/SecondsSincePreviousCapturedPacket'/>\n"
1096 " <menuitem name='SecondsSincePreviousDisplayedPacket' action='/View/TimeDisplayFormat/SecondsSincePreviousDisplayedPacket'/>\n"
1098 " <menuitem name='FileFormatPrecision-Automatic' action='/View/TimeDisplayFormat/FileFormatPrecision-Automatic'/>\n"
1099 " <menuitem name='FileFormatPrecision-Seconds' action='/View/TimeDisplayFormat/FileFormatPrecision-Seconds'/>\n"
1100 " <menuitem name='FileFormatPrecision-Deciseconds' action='/View/TimeDisplayFormat/FileFormatPrecision-Deciseconds'/>\n"
1101 " <menuitem name='FileFormatPrecision-Centiseconds' action='/View/TimeDisplayFormat/FileFormatPrecision-Centiseconds'/>\n"
1102 " <menuitem name='FileFormatPrecision-Milliseconds' action='/View/TimeDisplayFormat/FileFormatPrecision-Milliseconds'/>\n"
1103 " <menuitem name='FileFormatPrecision-Microseconds' action='/View/TimeDisplayFormat/FileFormatPrecision-Microseconds'/>\n"
1104 " <menuitem name='FileFormatPrecision-Nanoseconds' action='/View/TimeDisplayFormat/FileFormatPrecision-Nanoseconds'/>\n"
1106 " <menuitem name='DisplaySecondsWithHoursAndMinutes' action='/View/TimeDisplayFormat/DisplaySecondsWithHoursAndMinutes'/>\n"
1108 " <menu name= 'NameResolution' action='/View/NameResolution'>\n"
1109 " <menuitem name='ResolveName' action='/View/NameResolution/ResolveName'/>\n"
1111 " <menuitem name='EnableforMACLayer' action='/View/NameResolution/EnableforMACLayer'/>\n"
1112 " <menuitem name='EnableforNetworkLayer' action='/View/NameResolution/EnableforNetworkLayer'/>\n"
1113 " <menuitem name='EnableforTransportLayer' action='/View/NameResolution/EnableforTransportLayer'/>\n"
1115 " <menuitem name='ColorizePacketList' action='/View/ColorizePacketList'/>\n"
1116 " <menuitem name='AutoScrollinLiveCapture' action='/View/AutoScrollinLiveCapture'/>\n"
1118 " <menuitem name='ZoomIn' action='/View/ZoomIn'/>\n"
1119 " <menuitem name='ZoomOut' action='/View/ZoomOut'/>\n"
1120 " <menuitem name='NormalSize' action='/View/NormalSize'/>\n"
1122 " <menuitem name='ResizeAllColumns' action='/View/ResizeAllColumns'/>\n"
1123 " <menuitem name='DisplayedColumns' action='/View/DisplayedColumns'/>\n"
1125 " <menuitem name='ExpandSubtrees' action='/View/ExpandSubtrees'/>\n"
1126 " <menuitem name='ExpandAll' action='/View/ExpandAll'/>\n"
1127 " <menuitem name='CollapseAll' action='/View/CollapseAll'/>\n"
1129 " <menu name= 'ColorizeConversation' action='/View/ColorizeConversation'>\n"
1130 " <menuitem name='Color1' action='/View/ColorizeConversation/Color 1'/>\n"
1131 " <menuitem name='Color2' action='/View/ColorizeConversation/Color 2'/>\n"
1132 " <menuitem name='Color3' action='/View/ColorizeConversation/Color 3'/>\n"
1133 " <menuitem name='Color4' action='/View/ColorizeConversation/Color 4'/>\n"
1134 " <menuitem name='Color5' action='/View/ColorizeConversation/Color 5'/>\n"
1135 " <menuitem name='Color6' action='/View/ColorizeConversation/Color 6'/>\n"
1136 " <menuitem name='Color7' action='/View/ColorizeConversation/Color 7'/>\n"
1137 " <menuitem name='Color8' action='/View/ColorizeConversation/Color 8'/>\n"
1138 " <menuitem name='Color9' action='/View/ColorizeConversation/Color 9'/>\n"
1139 " <menuitem name='Color10' action='/View/ColorizeConversation/Color 10'/>\n"
1140 " <menuitem name='NewColoringRule' action='/View/ColorizeConversation/NewColoringRule'/>\n"
1143 " <menuitem name='ResetColoring1-10' action='/View/ResetColoring1-10'/>\n"
1144 " <menuitem name='ColoringRules' action='/View/ColoringRules'/>\n"
1146 " <menuitem name='ShowPacketinNewWindow' action='/View/ShowPacketinNewWindow'/>\n"
1147 " <menuitem name='Reload' action='/View/Reload'/>\n"
1149 " <menu name= 'GoMenu' action='/Go'>\n"
1150 " <menuitem name='Back' action='/Go/Back'/>\n"
1151 " <menuitem name='Forward' action='/Go/Forward'/>\n"
1152 " <menuitem name='Goto' action='/Go/Goto'/>\n"
1153 " <menuitem name='GotoCorrespondingPacket' action='/Go/GotoCorrespondingPacket'/>\n"
1155 " <menuitem name='PreviousPacket' action='/Go/PreviousPacket'/>\n"
1156 " <menuitem name='NextPacket' action='/Go/NextPacket'/>\n"
1157 " <menuitem name='FirstPacket' action='/Go/FirstPacket'/>\n"
1158 " <menuitem name='LastPacket' action='/Go/LastPacket'/>\n"
1159 " <menuitem name='PreviousPacketInConversation' action='/Go/PreviousPacketInConversation'/>\n"
1160 " <menuitem name='NextPacketInConversation' action='/Go/NextPacketInConversation'/>\n"
1163 " <menu name= 'CaptureMenu' action='/Capture'>\n"
1164 " <menuitem name='Interfaces' action='/Capture/Interfaces'/>\n"
1165 " <menuitem name='Options' action='/Capture/Options'/>\n"
1166 " <menuitem name='Start' action='/Capture/Start'/>\n"
1167 " <menuitem name='Stop' action='/Capture/Stop'/>\n"
1168 " <menuitem name='Restart' action='/Capture/Restart'/>\n"
1169 " <menuitem name='CaptureFilters' action='/Capture/CaptureFilters'/>\n"
1171 #endif /* HAVE_LIBPCAP */
1172 " <menu name= 'AnalyzeMenu' action='/Analyze'>\n"
1173 " <menuitem name='DisplayFilters' action='/Analyze/DisplayFilters'/>\n"
1175 " <menuitem name='ApplyasColumn' action='/Analyze/ApplyasColumn'/>\n"
1176 " <menu name= 'ApplyAsFilter' action='/Analyze/ApplyasFilter'>\n"
1177 " <menuitem name='Selected' action='/Analyze/ApplyasFilter/Selected'/>\n"
1178 " <menuitem name='NotSelected' action='/Analyze/ApplyasFilter/NotSelected'/>\n"
1179 " <menuitem name='AndSelected' action='/Analyze/ApplyasFilter/AndSelected'/>\n"
1180 " <menuitem name='OrSelected' action='/Analyze/ApplyasFilter/OrSelected'/>\n"
1181 " <menuitem name='AndNotSelected' action='/Analyze/ApplyasFilter/AndNotSelected'/>\n"
1182 " <menuitem name='OrNotSelected' action='/Analyze/ApplyasFilter/OrNotSelected'/>\n"
1184 " <menu name= 'PrepareaFilter' action='/Analyze/PrepareaFilter'>\n"
1185 " <menuitem name='Selected' action='/Analyze/PrepareaFilter/Selected'/>\n"
1186 " <menuitem name='NotSelected' action='/Analyze/PrepareaFilter/NotSelected'/>\n"
1187 " <menuitem name='AndSelected' action='/Analyze/PrepareaFilter/AndSelected'/>\n"
1188 " <menuitem name='OrSelected' action='/Analyze/PrepareaFilter/OrSelected'/>\n"
1189 " <menuitem name='AndNotSelected' action='/Analyze/PrepareaFilter/AndNotSelected'/>\n"
1190 " <menuitem name='OrNotSelected' action='/Analyze/PrepareaFilter/OrNotSelected'/>\n"
1192 " <menuitem name='EnabledProtocols' action='/Analyze/EnabledProtocols'/>\n"
1193 " <menuitem name='DecodeAs' action='/Analyze/DecodeAs'/>\n"
1194 " <menuitem name='UserSpecifiedDecodes' action='/Analyze/UserSpecifiedDecodes'/>\n"
1196 " <menuitem name='FollowTCPStream' action='/Analyze/FollowTCPStream'/>\n"
1197 " <menuitem name='FollowUDPStream' action='/Analyze/FollowUDPStream'/>\n"
1198 " <menuitem name='FollowSSLStream' action='/Analyze/FollowSSLStream'/>\n"
1200 " <menu name= 'StatisticsMenu' action='/Statistics'>\n"
1201 " <menuitem name='Summary' action='/Statistics/Summary'/>\n"
1202 " <menuitem name='ProtocolHierarchy' action='/Statistics/ProtocolHierarchy'/>\n"
1203 " <menuitem name='Conversations' action='/Statistics/Conversations'/>\n"
1204 " <menuitem name='Endpoints' action='/Statistics/Endpoints'/>\n"
1206 " <menu name= 'TelephonyMenu' action='/Telephony'>\n"
1208 " <menu name= 'ToolsMenu' action='/Tools'>\n"
1209 " <menuitem name='FirewallACLRules' action='/Tools/FirewallACLRules'/>\n"
1211 " <menu name= 'WSinternalMenu' action='/WSinternal'>\n"
1212 " <menuitem name='Dissectortables' action='/WSinternal/Dissectortables'/>\n"
1214 " <menu name= 'HelpMenu' action='/Help'>\n"
1215 " <menuitem name='Contents' action='/Help/Contents'/>\n"
1216 " <menuitem name='FAQs' action='/Help/FAQs'/>\n"
1217 " <menu name= 'ManualPages' action='/Help/ManualPages'>\n"
1218 " <menuitem name='Wireshark' action='/Help/ManualPages/Wireshark'/>\n"
1219 " <menuitem name='WiresharkFilter' action='/Help/ManualPages/WiresharkFilter'/>\n"
1221 " <menuitem name='TShark' action='/Help/ManualPages/TShark'/>\n"
1222 " <menuitem name='RawShark' action='/Help/ManualPages/RawShark'/>\n"
1223 " <menuitem name='Dumpcap' action='/Help/ManualPages/Dumpcap'/>\n"
1224 " <menuitem name='Mergecap' action='/Help/ManualPages/Mergecap'/>\n"
1225 " <menuitem name='Editcap' action='/Help/ManualPages/Editcap'/>\n"
1226 " <menuitem name='Text2pcap' action='/Help/ManualPages/Text2pcap'/>\n"
1229 " <menuitem name='Website' action='/Help/Website'/>\n"
1230 " <menuitem name='Wiki' action='/Help/Wiki'/>\n"
1231 " <menuitem name='Downloads' action='/Help/Downloads'/>\n"
1232 " <menuitem name='SampleCaptures' action='/Help/SampleCaptures'/>\n"
1234 " <menuitem name='SupportedProtocols' action='/Help/SupportedProtocols'/>\n"
1236 " <menuitem name='AboutWireshark' action='/Help/AboutWireshark'/>\n"
1245 * Please do not use keystrokes that are used as "universal" shortcuts in
1246 * various desktop environments:
1249 * http://support.microsoft.com/kb/126449
1252 * http://library.gnome.org/users/user-guide/nightly/keyboard-skills.html.en
1255 * http://developer.kde.org/documentation/standards/kde/style/keys/shortcuts.html
1257 * In particular, do not use the following <control> sequences for anything
1258 * other than their standard purposes:
1260 * <control>O File->Open
1261 * <control>S File->Save
1262 * <control>P File->Print
1263 * <control>W File->Close
1264 * <control>Q File->Quit
1265 * <control>Z Edit->Undo (which we don't currently have)
1266 * <control>X Edit->Cut (which we don't currently have)
1267 * <control>C Edit->Copy (which we don't currently have)
1268 * <control>V Edit->Paste (which we don't currently have)
1269 * <control>A Edit->Select All (which we don't currently have)
1271 * Note that some if not all of the Edit keys above already perform those
1272 * functions in text boxes, such as the Filter box. Do no, under any
1273 * circumstances, make a change that keeps them from doing so.
1279 * const gchar *name;
1280 * const gchar *stock_id;
1281 * const gchar *label;
1282 * const gchar *accelerator;
1283 * const gchar *tooltip;
1284 * GCallback callback;
1286 * const gchar *name; The name of the action.
1287 * const gchar *stock_id; The stock id for the action, or the name of an icon from the icon theme.
1288 * const gchar *label; The label for the action. This field should typically be marked for translation,
1289 * see gtk_action_group_set_translation_domain().
1290 * If label is NULL, the label of the stock item with id stock_id is used.
1291 * const gchar *accelerator; The accelerator for the action, in the format understood by gtk_accelerator_parse().
1292 * const gchar *tooltip; The tooltip for the action. This field should typically be marked for translation,
1293 * see gtk_action_group_set_translation_domain().
1294 * GCallback callback; The function to call when the action is activated.
1297 static const GtkActionEntry main_menu_bar_entries[] = {
1299 { "/File", NULL, "_File", NULL, NULL, NULL },
1300 { "/Edit", NULL, "_Edit", NULL, NULL, NULL },
1301 { "/View", NULL, "_View", NULL, NULL, NULL },
1302 { "/Go", NULL, "_Go", NULL, NULL, NULL },
1304 { "/Capture", NULL, "_Capture", NULL, NULL, NULL },
1306 { "/Analyze", NULL, "_Analyze", NULL, NULL, NULL },
1307 { "/Statistics", NULL, "_Statistics", NULL, NULL, NULL },
1308 { "/Telephony", NULL, "Telephon_y", NULL, NULL, NULL },
1309 { "/Tools", NULL, "_Tools", NULL, NULL, NULL },
1310 { "/WSinternal", NULL, "WS internal", NULL, NULL, NULL },
1311 { "/Help", NULL, "_Help", NULL, NULL, NULL },
1313 { "/File/Open", GTK_STOCK_OPEN, "_Open...", "<control>O", "Open a file", G_CALLBACK(file_open_cmd_cb) },
1314 { "/File/OpenRecent", NULL, "Open _Recent", NULL, NULL, NULL },
1315 { "/File/Merge", NULL, "_Merge...", NULL, NULL, G_CALLBACK(file_merge_cmd_cb) },
1316 { "/File/Import", NULL, "_Import...", NULL, NULL, G_CALLBACK(file_import_cmd_cb) },
1317 { "/File/Close", GTK_STOCK_CLOSE, "_Close", "<control>W", NULL, G_CALLBACK(file_close_cmd_cb) },
1319 { "/File/Save", GTK_STOCK_SAVE, "_Save", "<control>S", NULL, G_CALLBACK(file_save_cmd_cb) },
1320 { "/File/SaveAs", GTK_STOCK_SAVE_AS, "Save _As...", "<shift><control>S", NULL, G_CALLBACK(file_save_as_cmd_cb) },
1322 { "/File/Set", NULL, "File Set", NULL, NULL, NULL },
1323 { "/File/Export", NULL, "Export", NULL, NULL, NULL },
1324 { "/File/Print", GTK_STOCK_PRINT, "_Print...", "<control>P", NULL, G_CALLBACK(file_print_cmd_cb) },
1325 { "/File/Quit", GTK_STOCK_QUIT, "_Quit", "<control>Q", NULL, G_CALLBACK(file_quit_cmd_cb) },
1327 { "/File/Set/ListFiles", WIRESHARK_STOCK_FILE_SET_LIST, "List Files", NULL, NULL, G_CALLBACK(fileset_cb) },
1328 { "/File/Set/NextFile", WIRESHARK_STOCK_FILE_SET_NEXT, "Next File", NULL, NULL, G_CALLBACK(fileset_next_cb) },
1329 { "/File/Set/PreviousFile",WIRESHARK_STOCK_FILE_SET_PREVIOUS, "Previous File", NULL, NULL, G_CALLBACK(fileset_previous_cb) },
1332 { "/File/Export/File", NULL, "File...", NULL, NULL, G_CALLBACK(export_text_cmd_cb) },
1334 { "/File/Export/File", NULL, "File...", NULL, NULL, NULL },
1335 { "/File/Export/File/Text", NULL, "as \"Plain _Text\" file...", NULL, NULL, G_CALLBACK(export_text_cmd_cb) },
1336 { "/File/Export/File/PostScript", NULL, "as \"_PostScript\" file...", NULL, NULL, G_CALLBACK(export_ps_cmd_cb) },
1337 { "/File/Export/File/CSV", NULL, "as \"_CSV\" (Comma Separated Values packet summary) file...",
1338 NULL, NULL, G_CALLBACK(export_csv_cmd_cb) },
1339 { "/File/Export/File/CArrays", NULL, "as \"C _Arrays\" (packet bytes) file...",
1340 NULL, NULL, G_CALLBACK(export_carrays_cmd_cb) },
1341 { "/File/Export/File/PSML", NULL, "as XML - \"P_SML\" (packet summary) file...",
1342 NULL, NULL, G_CALLBACK(export_psml_cmd_cb) },
1343 { "/File/Export/File/PDML", NULL, "as XML - \"P_DML\" (packet details) file...",
1344 NULL, NULL, G_CALLBACK(export_pdml_cmd_cb) },
1346 { "/File/Export/SelectedPacketBytes", NULL, "Selected Packet _Bytes...", "<control>H", NULL, G_CALLBACK(savehex_cb) },
1347 { "/File/Export/Objects", NULL, "Objects", NULL, NULL, NULL },
1348 { "/File/Export/Objects/HTTP", NULL, "_HTTP", NULL, NULL, G_CALLBACK(eo_http_cb) },
1349 { "/File/Export/Objects/DICOM", NULL, "_DICOM", NULL, NULL, G_CALLBACK(eo_dicom_cb) },
1350 { "/File/Export/Objects/SMB", NULL, "_SMB", NULL, NULL, G_CALLBACK(eo_smb_cb) },
1353 { "/Edit/Copy", NULL, "Copy", NULL, NULL, NULL },
1355 { "/Edit/Copy/Description", NULL, "Description", "<shift><control>D", NULL, G_CALLBACK(copy_description_cb) },
1356 { "/Edit/Copy/Fieldname", NULL, "Fieldname", "<shift><control>F", NULL, G_CALLBACK(copy_fieldname_cb) },
1357 { "/Edit/Copy/Value", NULL, "Value", "<shift><control>V", NULL, G_CALLBACK(copy_value_cb) },
1358 { "/Edit/Copy/AsFilter", NULL, "As Filter", "<shift><control>C", NULL, G_CALLBACK(copy_as_filter_cb) },
1362 * Un-#if this when we actually implement Cut/Copy/Paste for the
1363 * packet list and packet detail windows.
1365 * Note: when we implement Cut/Copy/Paste in those windows, we
1366 * will almost certainly want to allow multiple packets to be
1367 * selected in the packet list pane and multiple packet detail
1368 * items to be selected in the packet detail pane, so that
1369 * the user can, for example, copy the summaries of multiple
1370 * packets to the clipboard from the packet list pane and multiple
1371 * packet detail items - perhaps *all* packet detail items - from
1372 * the packet detail pane. Given that, we'll also want to
1373 * implement Select All.
1375 * If multiple packets are selected, we would probably display nothing
1376 * in the packet detail pane, just as we do if no packet is selected,
1377 * and any menu items etc. that would pertain only to a single packet
1378 * would be disabled.
1380 * If multiple packet detail items are selected, we would probably
1381 * disable all items that pertain only to a single packet detail
1382 * item, such as some items in the status bar.
1384 * XXX - the actions for these will be different depending on what
1385 * widget we're in; ^C should copy from the filter text widget if
1386 * we're in that widget, the packet list if we're in that widget
1387 * (presumably copying the summaries of selected packets to the
1388 * clipboard, e.g. the text copy would be the text of the columns),
1389 * the packet detail if we're in that widget (presumably copying
1390 * the contents of selected protocol tree items to the clipboard,
1391 * e.g. the text copy would be the text displayed for those items),
1394 * Given that those menu items should also affect text widgets
1395 * such as the filter box, we would again want Select All, and,
1396 * at least for the filter box, we would also want Undo and Redo.
1397 * We would only want Cut, Paste, Undo, and Redo for the packet
1398 * list and packet detail panes if we support modifying them.
1400 {"/Edit/_Undo", "<control>Z", NULL,
1401 0, "<StockItem>", GTK_STOCK_UNDO,},
1402 {"/Edit/_Redo", "<shift><control>Z", NULL,
1403 0, "<StockItem>", GTK_STOCK_REDO,},
1404 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1405 {"/Edit/Cu_t", "<control>X", NULL,
1406 0, "<StockItem>", GTK_STOCK_CUT,},
1407 {"/Edit/_Copy", "<control>C", NULL,
1408 0, "<StockItem>", GTK_STOCK_COPY,},
1409 {"/Edit/_Paste", "<control>V", NULL,
1410 0, "<StockItem>", GTK_STOCK_PASTE,},
1411 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1412 {"/Edit/Select _All", "<control>A", NULL, 0,
1413 #ifdef GTK_STOCK_SELECT_ALL /* first appeared in 2.10 */
1414 "<StockItem>", GTK_STOCK_SELECT_ALL,
1417 #endif /* GTK_STOCK_SELECT_ALL */
1419 { "/Edit/FindPacket", GTK_STOCK_FIND, "_Find Packet...", "<control>F", NULL, G_CALLBACK(find_frame_cb) },
1420 { "/Edit/FindNext", NULL, "Find Ne_xt", "<control>N", NULL, G_CALLBACK(find_next_cb) },
1421 { "/Edit/FindPrevious", NULL, "Find Pre_vious", "<control>B", NULL, G_CALLBACK(find_previous_cb) },
1423 #ifdef NEW_PACKET_LIST
1424 { "/Edit/MarkPacket", NULL, "_Mark Packet (toggle)", "<control>M", NULL, G_CALLBACK(new_packet_list_mark_frame_cb) },
1425 { "/Edit/FindNextMark", NULL, "Find Next Mark", "<shift><control>N", NULL, G_CALLBACK(find_next_mark_cb) },
1426 { "/Edit/FindPreviousMark", NULL, "Find Next Mark", "<shift><control>B", NULL, G_CALLBACK(find_prev_mark_cb) },
1427 { "/Edit/MarkAllDisplayedPackets", NULL, "Mark All Displayed Packets (toggle)", "<control>A", NULL, G_CALLBACK(new_packet_list_mark_all_displayed_frames_cb) },
1428 { "/Edit/UnmarkAllPackets", NULL, "_Unmark All Packets", "<control>D", NULL, G_CALLBACK(new_packet_list_unmark_all_frames_cb) },
1430 { "/Edit/IgnorePacket", NULL, "_Ignore Packet (toggle)", "<control>X", NULL, G_CALLBACK(new_packet_list_ignore_frame_cb) },
1432 * XXX - this next one overrides /Edit/Copy/Description
1434 { "/Edit/IgnoreAllDisplayedPackets", NULL, "_Ignore All Displayed Packets (toggle)","<alt><shift><control>X", NULL, G_CALLBACK(new_packet_list_ignore_all_displayed_frames_cb) },
1435 { "/Edit/Un-IgnoreAllPackets", NULL, "U_n-Ignore All Packets", "<shift><control>X", NULL, G_CALLBACK(new_packet_list_unignore_all_frames_cb) },
1436 { "/Edit/SetTimeReference", WIRESHARK_STOCK_TIME, "Set Time Reference (toggle)", "<control>T", NULL, G_CALLBACK(set_reftime_cb) },
1437 { "/Edit/Un-TimeReferenceAllPackets",NULL, "Un-Time Reference All Packets", "<alt><control>T", NULL, G_CALLBACK(new_packet_list_untime_reference_all_frames_cb) },
1438 { "/Edit/FindNextTimeReference", NULL, "Find Next Time Reference", "<alt><control>N", NULL, G_CALLBACK(find_next_ref_time_cb) },
1439 { "/Edit/FindPreviousTimeReference", NULL, "Find Previous Time Reference", "<alt><control>B", NULL, G_CALLBACK(find_previous_ref_time_cb) },
1441 #else /* NEW_PACKET_LIST */
1442 #error "You must use the new packet list if you are using GTKUIManager for menus"
1443 #endif /* NEW_PACKET_LIST */
1444 { "/Edit/ConfigurationProfiles", NULL, "_Configuration Profiles...", "<shift><control>A", NULL, G_CALLBACK(profile_dialog_cb) },
1445 { "/Edit/Preferences", GTK_STOCK_PREFERENCES, "_Preferences...", "<shift><control>P", NULL, G_CALLBACK(menus_prefs_cb) },
1448 { "/View/TimeDisplayFormat", NULL, "_Time Display Format", NULL, NULL, NULL },
1450 { "/View/NameResolution", NULL, "Name Resol_ution", NULL, NULL, NULL },
1451 { "/View/ZoomIn", GTK_STOCK_ZOOM_IN, "_Zoom In", "<control>plus", NULL, G_CALLBACK(view_zoom_in_cb) },
1452 { "/View/ZoomOut", GTK_STOCK_ZOOM_OUT, "Zoom _Out", "<control>minus", NULL, G_CALLBACK(view_zoom_out_cb) },
1453 { "/View/NormalSize", GTK_STOCK_ZOOM_100, "_Normal Size", "<control>equal", NULL, G_CALLBACK(view_zoom_100_cb) },
1454 #ifdef NEW_PACKET_LIST
1455 { "/View/ResizeAllColumns", WIRESHARK_STOCK_RESIZE_COLUMNS, "Resize All Columns", "<shift><control>R", NULL, G_CALLBACK(new_packet_list_resize_columns_cb) },
1456 { "/View/DisplayedColumns", NULL, "Displayed Columns", NULL, NULL, NULL },
1458 #error "You must use the new packet list if you are using GTKUIManager for menus"
1459 #endif /* NEW_PACKET_LIST */
1460 { "/View/ExpandSubtrees", NULL, "Expand Subtrees", NULL, NULL, G_CALLBACK(expand_tree_cb) },
1461 { "/View/ExpandAll", NULL, "Expand All", NULL, NULL, G_CALLBACK(expand_all_cb) },
1462 { "/View/CollapseAll", NULL, "Collapse All", NULL, NULL, G_CALLBACK(collapse_all_cb) },
1463 { "/View/ColorizeConversation", NULL, "Colorize Conversation",NULL, NULL, NULL },
1465 { "/View/ColorizeConversation/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(view_menu_color_conv_color1_cb) },
1466 { "/View/ColorizeConversation/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(view_menu_color_conv_color2_cb) },
1467 { "/View/ColorizeConversation/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(view_menu_color_conv_color3_cb) },
1468 { "/View/ColorizeConversation/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(view_menu_color_conv_color4_cb) },
1469 { "/View/ColorizeConversation/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(view_menu_color_conv_color5_cb) },
1470 { "/View/ColorizeConversation/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(view_menu_color_conv_color6_cb) },
1471 { "/View/ColorizeConversation/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(view_menu_color_conv_color7_cb) },
1472 { "/View/ColorizeConversation/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(view_menu_color_conv_color8_cb) },
1473 { "/View/ColorizeConversation/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(view_menu_color_conv_color9_cb) },
1474 { "/View/ColorizeConversation/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(view_menu_color_conv_color10_cb) },
1475 { "/View/ColorizeConversation/NewColoringRule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(view_menu_color_conv_new_rule_cb) },
1477 { "/View/ResetColoring1-10", NULL, "Reset Coloring 1-10", "<control>space", NULL, G_CALLBACK(view_menu_reset_coloring_cb) },
1478 { "/View/ColoringRules", GTK_STOCK_SELECT_COLOR, "_Coloring Rules...", NULL, NULL, G_CALLBACK(color_display_cb) },
1479 { "/View/ShowPacketinNewWindow", NULL, "Show Packet in New _Window", NULL, NULL, G_CALLBACK(new_window_cb) },
1480 { "/View/Reload", GTK_STOCK_REFRESH, "_Reload", "<control>R", NULL, G_CALLBACK(file_reload_cmd_cb) },
1483 { "/Go/Back", GTK_STOCK_GO_BACK, "_Back", "<alt>Left", NULL, G_CALLBACK(history_back_cb) },
1484 { "/Go/Forward", GTK_STOCK_GO_FORWARD, "_Forward", "<alt>Right", NULL, G_CALLBACK(history_forward_cb) },
1485 { "/Go/Goto", GTK_STOCK_JUMP_TO, "_Go to Packet...", "<control>G", NULL, G_CALLBACK(goto_frame_cb) },
1486 { "/Go/GotoCorrespondingPacket", NULL, "Go to _Corresponding Packet", NULL, NULL, G_CALLBACK(goto_framenum_cb) },
1487 { "/Go/PreviousPacket", GTK_STOCK_GO_UP, "Previous Packet", "<control>Up", NULL, G_CALLBACK(goto_previous_frame_cb) },
1488 { "/Go/NextPacket", GTK_STOCK_GO_DOWN, "Next Packet", "<control>Down", NULL, G_CALLBACK(goto_next_frame_cb) },
1489 { "/Go/FirstPacket", GTK_STOCK_GOTO_TOP, "F_irst Packet", "<control>Home", NULL, G_CALLBACK(goto_top_frame_cb) },
1490 { "/Go/LastPacket", GTK_STOCK_GOTO_BOTTOM, "_Last Packet", "<control>End", NULL, G_CALLBACK(goto_bottom_frame_cb) },
1491 { "/Go/PreviousPacketInConversation", GTK_STOCK_GO_UP, "Previous Packet In Conversation", "<control>bracketleft", NULL, G_CALLBACK(goto_previous_frame_conversation_cb) },
1492 { "/Go/NextPacketInConversation", GTK_STOCK_GO_DOWN, "Next Packet In Conversation", "<control>bracketright", NULL, G_CALLBACK(goto_next_frame_conversation_cb) },
1495 { "/Capture/Interfaces", WIRESHARK_STOCK_CAPTURE_INTERFACES, "_Interfaces...", "<control>I", NULL, G_CALLBACK(capture_if_cb) },
1496 { "/Capture/Options", WIRESHARK_STOCK_CAPTURE_OPTIONS, "_Options...", "<control>K", NULL, G_CALLBACK(capture_prep_cb) },
1497 { "/Capture/Start", WIRESHARK_STOCK_CAPTURE_START, "_Start", "<control>E", NULL, G_CALLBACK(capture_start_cb) },
1498 { "/Capture/Stop", WIRESHARK_STOCK_CAPTURE_STOP, "S_top", "<control>E", NULL, G_CALLBACK(capture_stop_cb) },
1499 { "/Capture/Restart", WIRESHARK_STOCK_CAPTURE_RESTART, "_Restart", "<control>R", NULL, G_CALLBACK(capture_restart_cb) },
1500 { "/Capture/CaptureFilters", WIRESHARK_STOCK_CAPTURE_FILTER, "Capture _Filters...", NULL, NULL, G_CALLBACK(cfilter_dialog_cb) },
1502 #endif /* HAVE_LIBPCAP */
1503 { "/Analyze/DisplayFilters", WIRESHARK_STOCK_DISPLAY_FILTER, "_Display Filters...", NULL, NULL, G_CALLBACK(dfilter_dialog_cb) },
1505 { "/Analyze/DisplayFilterMacros", NULL, "Display Filter _Macros...", NULL, NULL, G_CALLBACK(macros_dialog_cb) },
1506 { "/Analyze/ApplyasColumn", NULL, "Apply as Column", NULL, NULL, G_CALLBACK(apply_as_custom_column_cb) },
1507 { "/Analyze/ApplyasFilter", NULL, "Apply as Filter", NULL, NULL, NULL },
1509 { "/Analyze/ApplyasFilter/Selected", NULL, "_Selected" , NULL, NULL, G_CALLBACK(tree_view_menu_apply_selected_cb) },
1510 { "/Analyze/ApplyasFilter/NotSelected", NULL, "_Not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_not_selected_cb) },
1511 { "/Analyze/ApplyasFilter/AndSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _and Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_and_selected_cb) },
1512 { "/Analyze/ApplyasFilter/OrSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _or Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_or_selected_cb) },
1513 { "/Analyze/ApplyasFilter/AndNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " a_nd not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_and_not_selected_cb) },
1514 { "/Analyze/ApplyasFilter/OrNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " o_r not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_or_not_selected_cb) },
1516 { "/Analyze/PrepareaFilter", NULL, "Prepare a Filter", NULL, NULL, NULL },
1517 { "/Analyze/PrepareaFilter/Selected", NULL, "_Selected" , NULL, NULL, G_CALLBACK(tree_view_menu_prepare_selected_cb) },
1518 { "/Analyze/PrepareaFilter/NotSelected", NULL, "_Not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_not_selected_cb) },
1519 { "/Analyze/PrepareaFilter/AndSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _and Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_and_selected_cb) },
1520 { "/Analyze/PrepareaFilter/OrSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _or Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_or_selected_cb) },
1521 { "/Analyze/PrepareaFilter/AndNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " a_nd not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_and_not_selected_cb) },
1522 { "/Analyze/PrepareaFilter/OrNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " o_r not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_or_not_selected_cb) },
1524 { "/Analyze/EnabledProtocols", WIRESHARK_STOCK_CHECKBOX, "_Enabled Protocols...", "<shift><control>E", NULL, G_CALLBACK(proto_cb) },
1525 { "/Analyze/DecodeAs", WIRESHARK_STOCK_DECODE_AS, "Decode _As...", NULL, NULL, G_CALLBACK(decode_as_cb) },
1526 { "/Analyze/UserSpecifiedDecodes", WIRESHARK_STOCK_DECODE_AS, "_User Specified Decodes...", NULL, NULL, G_CALLBACK(decode_show_cb) },
1528 { "/Analyze/FollowTCPStream", NULL, "Follow TCP Stream", NULL, NULL, G_CALLBACK(follow_tcp_stream_cb) },
1529 { "/Analyze/FollowUDPStream", NULL, "Follow UDP Stream", NULL, NULL, G_CALLBACK(follow_udp_stream_cb) },
1530 { "/Analyze/FollowSSLStream", NULL, "Follow SSL Stream", NULL, NULL, G_CALLBACK(follow_ssl_stream_cb) },
1533 { "/Statistics/Summary", GTK_STOCK_PROPERTIES, "_Summary", NULL, NULL, G_CALLBACK(summary_open_cb) },
1534 { "/Statistics/ProtocolHierarchy", NULL, "_Protocol Hierarchy", NULL, NULL, G_CALLBACK(proto_hier_stats_cb) },
1535 { "/Statistics/Conversations", WIRESHARK_STOCK_CONVERSATIONS, "Conversations", NULL, NULL, G_CALLBACK(init_conversation_notebook_cb) },
1536 { "/Statistics/Endpoints", WIRESHARK_STOCK_ENDPOINTS, "Endpoints", NULL, NULL, G_CALLBACK(init_hostlist_notebook_cb) },
1538 { "/Tools/FirewallACLRules", NULL, "Firewall ACL Rules", NULL, NULL, G_CALLBACK(firewall_rule_cb) },
1540 { "/WSinternal/Dissectortables", NULL, "Dissector tables", NULL, NULL, G_CALLBACK(dissector_tables_dlg_cb) },
1542 { "/Help/Contents", GTK_STOCK_HELP, "_Contents", "F1", NULL, G_CALLBACK(help_menu_cont_cb) },
1543 { "/Help/FAQs", NULL, "FAQ's", NULL, NULL, G_CALLBACK(help_menu_faq_cb) },
1544 { "/Help/ManualPages", NULL, "ManualPages", NULL, NULL, NULL },
1545 { "/Help/ManualPages/Wireshark", NULL, "Wireshark", NULL, NULL, G_CALLBACK(help_menu_wireshark_cb) },
1546 { "/Help/ManualPages/WiresharkFilter", NULL, "Wireshark Filter", NULL, NULL, G_CALLBACK(help_menu_wireshark_flt_cb) },
1547 { "/Help/ManualPages/TShark", NULL, "Wireshark", NULL, NULL, G_CALLBACK(help_menu_Tshark_cb) },
1548 { "/Help/ManualPages/RawShark", NULL, "RawShark", NULL, NULL, G_CALLBACK(help_menu_RawShark_cb) },
1549 { "/Help/ManualPages/Dumpcap", NULL, "Dumpcap", NULL, NULL, G_CALLBACK(help_menu_Dumpcap_cb) },
1550 { "/Help/ManualPages/Mergecap", NULL, "Mergecap", NULL, NULL, G_CALLBACK(help_menu_Mergecap_cb) },
1551 { "/Help/ManualPages/Editcap", NULL, "Editcap", NULL, NULL, G_CALLBACK(help_menu_Editcap_cb) },
1552 { "/Help/ManualPages/Text2pcap", NULL, "Text2pcap", NULL, NULL, G_CALLBACK(help_menu_Text2pcap_cb) },
1554 { "/Help/Website", GTK_STOCK_HOME, "Website", NULL, NULL, G_CALLBACK(help_menu_Website_cb) },
1555 { "/Help/Wiki", WIRESHARK_STOCK_WIKI, "Wiki", NULL, NULL, G_CALLBACK(help_menu_Wiki_cb) },
1556 { "/Help/Downloads", NULL, "Downloads", NULL, NULL, G_CALLBACK(help_menu_Downloads_cb) },
1557 { "/Help/SampleCaptures", NULL, "Sample Captures", NULL, NULL, G_CALLBACK(help_menu_SampleCaptures_cb) },
1558 { "/Help/SupportedProtocols", NULL, "_Supported Protocols (slow!)", NULL, NULL, G_CALLBACK(supported_cb) },
1559 { "/Help/AboutWireshark", WIRESHARK_STOCK_ABOUT, "_About Wireshark", NULL, NULL, G_CALLBACK(about_wireshark_cb) },
1562 static const GtkToggleActionEntry main_menu_bar_toggle_action_entries[] =
1564 /* name, stock id, label, accel, tooltip, callback, is_active */
1565 {"/View/MainToolbar", NULL, "_Main Toolbar", NULL, NULL, G_CALLBACK(main_toolbar_show_hide_cb), TRUE},
1566 {"/View/FilterToolbar", NULL, "_FilterToolbar", NULL, NULL, G_CALLBACK(filter_toolbar_show_hide_cb), TRUE},
1568 {"/View/WirelessToolbar", NULL, "_WirelessToolbar", NULL, NULL, G_CALLBACK(wireless_toolbar_show_hide_cb), TRUE},
1569 #endif /* HAVE_AIRPCAP */
1570 {"/View/Statusbar", NULL, "_Statusbar", NULL, NULL, G_CALLBACK(status_bar_show_hide_cb), TRUE},
1571 {"/View/PacketList", NULL, "Packet _List", NULL, NULL, G_CALLBACK(packet_list_show_hide_cb), TRUE},
1572 {"/View/PacketDetails", NULL, "Packet _Details", NULL, NULL, G_CALLBACK(packet_details_show_hide_cb), TRUE},
1573 {"/View/PacketBytes", NULL, "Packet _Bytes", NULL, NULL, G_CALLBACK(packet_bytes_show_hide_cb), TRUE},
1574 {"/View/TimeDisplayFormat/DisplaySecondsWithHoursAndMinutes", NULL, "Display Seconds with hours and minutes", NULL, NULL, G_CALLBACK(view_menu_seconds_time_cb), FALSE},
1575 {"/View/NameResolution/ResolveName", NULL, "_Resolve Name", NULL, NULL, G_CALLBACK(resolve_name_cb), FALSE},
1576 {"/View/NameResolution/EnableforMACLayer", NULL, "Enable for _MAC Layer", NULL, NULL, G_CALLBACK(view_menu_en_for_MAC_cb), TRUE},
1577 {"/View/NameResolution/EnableforNetworkLayer", NULL, "Enable for _Network Layer", NULL, NULL, G_CALLBACK(view_menu_en_for_network_cb), TRUE },
1578 {"/View/NameResolution/EnableforTransportLayer", NULL, "Enable for _Transport Layer", NULL, NULL, G_CALLBACK(view_menu_en_for_transport_cb), TRUE },
1579 {"/View/ColorizePacketList", NULL, "Colorize Packet List", NULL, NULL, G_CALLBACK(view_menu_colorize_pkt_lst_cb), TRUE },
1581 {"/View/AutoScrollinLiveCapture", NULL, "Auto Scroll in Li_ve Capture", NULL, NULL, G_CALLBACK(view_menu_auto_scroll_live_cb), TRUE },
1587 static const GtkRadioActionEntry main_menu_bar_radio_view_time_entries [] =
1589 /* name, stock id, label, accel, tooltip, value */
1590 { "/View/TimeDisplayFormat/DateandTimeofDay", NULL, "Date and Time of Day: 1970-01-01 01:02:03.123456", "<alt><control>1", NULL, TS_ABSOLUTE_WITH_DATE },
1591 { "/View/TimeDisplayFormat/TimeofDay", NULL, "Time of Day: 01:02:03.123456", "<alt><control>2", NULL, TS_ABSOLUTE },
1592 { "/View/TimeDisplayFormat/SecondsSinceEpoch", NULL, "Seconds Since Epoch (1970-01-01): 1234567890.123456", "<alt><control>3", NULL, TS_EPOCH },
1593 { "/View/TimeDisplayFormat/SecondsSinceBeginningofCapture", NULL, "Seconds Since Beginning of Capture: 123.123456", "<alt><control>4", NULL, TS_RELATIVE },
1594 { "/View/TimeDisplayFormat/SecondsSincePreviousCapturedPacket", NULL, "Seconds Since Previous Captured Packet: 1.123456", "<alt><control>5", NULL, TS_DELTA },
1595 { "/View/TimeDisplayFormat/SecondsSincePreviousDisplayedPacket",NULL, "Seconds Since Previous Displayed Packet: 1.123456", "<alt><control>6", NULL, TS_DELTA_DIS },
1598 static const GtkRadioActionEntry main_menu_bar_radio_view_time_fileformat_prec_entries [] =
1600 /* name, stock id, label, accel, tooltip, value */
1601 { "/View/TimeDisplayFormat/FileFormatPrecision-Automatic", NULL, "Automatic (File Format Precision)", NULL, NULL, TS_PREC_AUTO },
1602 { "/View/TimeDisplayFormat/FileFormatPrecision-Seconds", NULL, "Seconds: 0", NULL, NULL, TS_PREC_FIXED_SEC },
1603 { "/View/TimeDisplayFormat/FileFormatPrecision-Deciseconds", NULL, "Deciseconds: 0.1", NULL, NULL, TS_PREC_FIXED_DSEC },
1604 { "/View/TimeDisplayFormat/FileFormatPrecision-Centiseconds", NULL, "Centiseconds: 0.12", NULL, NULL, TS_PREC_FIXED_CSEC },
1605 { "/View/TimeDisplayFormat/FileFormatPrecision-Milliseconds", NULL, "Milliseconds: 0.123", NULL, NULL, TS_PREC_FIXED_MSEC },
1606 { "/View/TimeDisplayFormat/FileFormatPrecision-Microseconds", NULL, "Microseconds: 0.123456", NULL, NULL, TS_PREC_FIXED_USEC },
1607 { "/View/TimeDisplayFormat/FileFormatPrecision-Nanoseconds", NULL, "Nanoseconds: 0.123456789", NULL, NULL, TS_PREC_FIXED_NSEC },
1609 #else /* MAIN_MENU_USE_UIMANAGER */
1613 * Please do not use keystrokes that are used as "universal" shortcuts in
1614 * various desktop environments:
1617 * http://support.microsoft.com/kb/126449
1620 * http://library.gnome.org/users/user-guide/nightly/keyboard-skills.html.en
1623 * http://developer.kde.org/documentation/standards/kde/style/keys/shortcuts.html
1625 * In particular, do not use the following <control> sequences for anything
1626 * other than their standard purposes:
1628 * <control>O File->Open
1629 * <control>S File->Save
1630 * <control>P File->Print
1631 * <control>W File->Close
1632 * <control>Q File->Quit
1633 * <control>Z Edit->Undo (which we don't currently have)
1634 * <control>X Edit->Cut (which we don't currently have)
1635 * <control>C Edit->Copy (which we don't currently have)
1636 * <control>V Edit->Paste (which we don't currently have)
1637 * <control>A Edit->Select All (which we don't currently have)
1639 * Note that some if not all of the Edit keys above already perform those
1640 * functions in text boxes, such as the Filter box. Do no, under any
1641 * circumstances, make a change that keeps them from doing so.
1644 /* This is the GtkItemFactoryEntry structure used to generate new menus.
1645 Item 1: The menu path. The letter after the underscore indicates an
1646 accelerator key once the menu is open.
1647 Item 2: The accelerator key for the entry
1648 Item 3: The callback function.
1649 Item 4: The callback action. This changes the parameters with
1650 which the function is called. The default is 0.
1651 Item 5: The item type, used to define what kind of an item it is.
1652 Here are the possible values:
1656 "<Title>" -> create a title item
1657 "<Item>" -> create a simple item
1658 "<ImageItem>" -> create an item holding an image
1659 "<StockItem>" -> create an item holding a stock image
1660 "<CheckItem>" -> create a check item
1661 "<ToggleItem>" -> create a toggle item
1662 "<RadioItem>" -> create a radio item
1663 <path> -> path of a radio item to link against
1664 "<Separator>" -> create a separator
1665 "<Tearoff>" -> create a tearoff separator
1666 "<Branch>" -> create an item to hold sub items (optional)
1667 "<LastBranch>" -> create a right justified branch
1668 Item 6: extra data needed for ImageItem and StockItem
1670 static GtkItemFactoryEntry menu_items[] =
1672 {"/_File", NULL, NULL, 0, "<Branch>", NULL,},
1673 {"/File/_Open...", "<control>O", GTK_MENU_FUNC(file_open_cmd_cb),
1674 0, "<StockItem>", GTK_STOCK_OPEN,},
1675 {"/File/Open _Recent", NULL, NULL, 0, "<Branch>", NULL,},
1676 {"/File/_Merge...", NULL, GTK_MENU_FUNC(file_merge_cmd_cb), 0, NULL, NULL,},
1677 {"/File/_Import...", NULL, GTK_MENU_FUNC(file_import_cmd_cb), 0, NULL, NULL,},
1678 {"/File/_Close", "<control>W", GTK_MENU_FUNC(file_close_cmd_cb),
1679 0, "<StockItem>", GTK_STOCK_CLOSE,},
1680 {"/File/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1681 {"/File/_Save", "<control>S", GTK_MENU_FUNC(file_save_cmd_cb),
1682 0, "<StockItem>", GTK_STOCK_SAVE,},
1683 {"/File/Save _As...", "<shift><control>S", GTK_MENU_FUNC(file_save_as_cmd_cb),
1684 0, "<StockItem>", GTK_STOCK_SAVE_AS,},
1685 {"/File/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1686 {"/File/File Set", NULL, NULL, 0, "<Branch>", NULL,},
1687 {"/File/File Set/List Files", NULL, GTK_MENU_FUNC(fileset_cb), 0, "<StockItem>", WIRESHARK_STOCK_FILE_SET_LIST,},
1688 {"/File/File Set/Next File", NULL, GTK_MENU_FUNC(fileset_next_cb), 0, "<StockItem>", WIRESHARK_STOCK_FILE_SET_NEXT,},
1689 {"/File/File Set/Previous File", NULL, GTK_MENU_FUNC(fileset_previous_cb), 0, "<StockItem>", WIRESHARK_STOCK_FILE_SET_PREVIOUS,},
1690 {"/File/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1691 {"/File/_Export", NULL, NULL, 0, "<Branch>", NULL,},
1693 {"/File/Export/File...", NULL, GTK_MENU_FUNC(export_text_cmd_cb),
1696 {"/File/Export/as \"Plain _Text\" file...", NULL, GTK_MENU_FUNC(export_text_cmd_cb),
1698 {"/File/Export/as \"_PostScript\" file...", NULL, GTK_MENU_FUNC(export_ps_cmd_cb),
1700 {"/File/Export/as \"_CSV\" (Comma Separated Values packet summary) file...",
1701 NULL, GTK_MENU_FUNC(export_csv_cmd_cb), 0, NULL, NULL,},
1702 {"/File/Export/as \"C _Arrays\" (packet bytes) file...", NULL, GTK_MENU_FUNC(export_carrays_cmd_cb),
1704 {"/File/Export/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1705 {"/File/Export/as XML - \"P_SML\" (packet summary) file...", NULL, GTK_MENU_FUNC(export_psml_cmd_cb),
1707 {"/File/Export/as XML - \"P_DML\" (packet details) file...", NULL, GTK_MENU_FUNC(export_pdml_cmd_cb),
1709 {"/File/Export/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1711 {"/File/Export/Selected Packet _Bytes...", "<control>H", GTK_MENU_FUNC(savehex_cb),
1713 {"/File/Export/_Objects/_HTTP", NULL, GTK_MENU_FUNC(eo_http_cb), 0, NULL, NULL,},
1714 {"/File/Export/_Objects/_DICOM", NULL, GTK_MENU_FUNC(eo_dicom_cb), 0, NULL, NULL,},
1715 {"/File/Export/_Objects/_SMB", NULL, GTK_MENU_FUNC(eo_smb_cb), 0, NULL, NULL,},
1716 {"/File/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1717 {"/File/_Print...", "<control>P", GTK_MENU_FUNC(file_print_cmd_cb),
1718 0, "<StockItem>", GTK_STOCK_PRINT,},
1719 {"/File/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1720 {"/File/_Quit", "<control>Q", GTK_MENU_FUNC(file_quit_cmd_cb),
1721 0, "<StockItem>", GTK_STOCK_QUIT,},
1722 {"/_Edit", NULL, NULL, 0, "<Branch>", NULL,},
1723 {"/Edit/Copy", NULL, NULL, 0, "<Branch>", NULL,},
1724 {"/Edit/Copy/Description", "<shift><control>D", GTK_MENU_FUNC(copy_selected_plist_cb), COPY_SELECTED_DESCRIPTION, NULL, NULL,},
1725 {"/Edit/Copy/Fieldname", "<shift><control>F", GTK_MENU_FUNC(copy_selected_plist_cb), COPY_SELECTED_FIELDNAME, NULL, NULL,},
1726 {"/Edit/Copy/Value", "<shift><control>V", GTK_MENU_FUNC(copy_selected_plist_cb), COPY_SELECTED_VALUE, NULL, NULL,},
1727 {"/Edit/Copy/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1728 {"/Edit/Copy/As Filter", "<shift><control>C", GTK_MENU_FUNC(match_selected_ptree_cb),
1729 MATCH_SELECTED_REPLACE|MATCH_SELECTED_COPY_ONLY, NULL, NULL,},
1732 * Un-#if this when we actually implement Cut/Copy/Paste for the
1733 * packet list and packet detail windows.
1735 * Note: when we implement Cut/Copy/Paste in those windows, we
1736 * will almost certainly want to allow multiple packets to be
1737 * selected in the packet list pane and multiple packet detail
1738 * items to be selected in the packet detail pane, so that
1739 * the user can, for example, copy the summaries of multiple
1740 * packets to the clipboard from the packet list pane and multiple
1741 * packet detail items - perhaps *all* packet detail items - from
1742 * the packet detail pane. Given that, we'll also want to
1743 * implement Select All.
1745 * If multiple packets are selected, we would probably display nothing
1746 * in the packet detail pane, just as we do if no packet is selected,
1747 * and any menu items etc. that would pertain only to a single packet
1748 * would be disabled.
1750 * If multiple packet detail items are selected, we would probably
1751 * disable all items that pertain only to a single packet detail
1752 * item, such as some items in the status bar.
1754 * XXX - the actions for these will be different depending on what
1755 * widget we're in; ^C should copy from the filter text widget if
1756 * we're in that widget, the packet list if we're in that widget
1757 * (presumably copying the summaries of selected packets to the
1758 * clipboard, e.g. the text copy would be the text of the columns),
1759 * the packet detail if we're in that widget (presumably copying
1760 * the contents of selected protocol tree items to the clipboard,
1761 * e.g. the text copy would be the text displayed for those items),
1764 * Given that those menu items should also affect text widgets
1765 * such as the filter box, we would again want Select All, and,
1766 * at least for the filter box, we would also want Undo and Redo.
1767 * We would only want Cut, Paste, Undo, and Redo for the packet
1768 * list and packet detail panes if we support modifying them.
1770 {"/Edit/_Undo", "<control>Z", NULL,
1771 0, "<StockItem>", GTK_STOCK_UNDO,},
1772 {"/Edit/_Redo", "<shift><control>Z", NULL,
1773 0, "<StockItem>", GTK_STOCK_REDO,},
1774 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1775 {"/Edit/Cu_t", "<control>X", NULL,
1776 0, "<StockItem>", GTK_STOCK_CUT,},
1777 {"/Edit/_Copy", "<control>C", NULL,
1778 0, "<StockItem>", GTK_STOCK_COPY,},
1779 {"/Edit/_Paste", "<control>V", NULL,
1780 0, "<StockItem>", GTK_STOCK_PASTE,},
1781 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1782 {"/Edit/Select _All", "<control>A", NULL, 0,
1783 #ifdef GTK_STOCK_SELECT_ALL /* first appeared in 2.10 */
1784 "<StockItem>", GTK_STOCK_SELECT_ALL,
1787 #endif /* GTK_STOCK_SELECT_ALL */
1790 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1791 {"/Edit/_Find Packet...", "<control>F", GTK_MENU_FUNC(find_frame_cb), 0, "<StockItem>", GTK_STOCK_FIND,},
1792 {"/Edit/Find Ne_xt", "<control>N", GTK_MENU_FUNC(find_next_cb), 0, NULL, NULL,},
1793 {"/Edit/Find Pre_vious", "<control>B", GTK_MENU_FUNC(find_previous_cb), 0, NULL, NULL,},
1794 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1795 #ifdef NEW_PACKET_LIST
1796 {"/Edit/_Mark Packet (toggle)", "<control>M", GTK_MENU_FUNC(new_packet_list_mark_frame_cb),0, NULL, NULL,},
1797 {"/Edit/Mark All Displayed Packets (toggle)", "<shift><control>M", GTK_MENU_FUNC(new_packet_list_mark_all_displayed_frames_cb), 0, NULL, NULL,},
1798 {"/Edit/Unmark All Packets", "<alt><control>M", GTK_MENU_FUNC(new_packet_list_unmark_all_frames_cb), 0, NULL, NULL,},
1799 {"/Edit/Find Next Mark", "<shift><control>N", GTK_MENU_FUNC(find_next_mark_cb), 0, NULL, NULL,},
1800 {"/Edit/Find Previous Mark", "<shift><control>B", GTK_MENU_FUNC(find_prev_mark_cb), 0, NULL, NULL,},
1801 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1802 {"/Edit/_Ignore Packet (toggle)", "<control>D", GTK_MENU_FUNC(new_packet_list_ignore_frame_cb), 0, NULL, NULL,},
1804 * XXX - this next one overrides /Edit/Copy/Description
1806 {"/Edit/Ignore All Displayed Packets (toggle)","<shift><control>D", GTK_MENU_FUNC(new_packet_list_ignore_all_displayed_frames_cb), 0, NULL, NULL,},
1807 {"/Edit/U_n-Ignore All Packets", "<alt><control>D", GTK_MENU_FUNC(new_packet_list_unignore_all_frames_cb), 0, NULL, NULL,},
1808 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1809 {"/Edit/Set Time Reference (toggle)", "<control>T", GTK_MENU_FUNC(reftime_frame_cb), REFTIME_TOGGLE, "<StockItem>", WIRESHARK_STOCK_TIME,},
1810 {"/Edit/Un-Time Reference All Packets", "<alt><control>T", GTK_MENU_FUNC(new_packet_list_untime_reference_all_frames_cb), 0, NULL, NULL,},
1811 {"/Edit/Find Next Time Reference", "<alt><control>N", GTK_MENU_FUNC(reftime_frame_cb), REFTIME_FIND_NEXT, NULL, NULL,},
1812 {"/Edit/Find Previous Time Reference", "<alt><control>B", GTK_MENU_FUNC(reftime_frame_cb), REFTIME_FIND_PREV, NULL, NULL,},
1813 #else /* NEW_PACKET_LIST */
1815 * XXX - this should be changed to match the list used with the new
1816 * packet list, assuming we don't just drop the old packet list
1819 {"/Edit/_Mark Packet (toggle)", "<control>M", GTK_MENU_FUNC(packet_list_mark_frame_cb),
1821 {"/Edit/Find Next Mark", "<shift><control>N", GTK_MENU_FUNC(find_next_mark_cb),
1823 {"/Edit/Find Previous Mark", "<shift><control>B", GTK_MENU_FUNC(find_prev_mark_cb),
1825 {"/Edit/Mark _All Displayed Packets (toggle)", "<shift><control>M", GTK_MENU_FUNC(packet_list_mark_all_frames_cb), 0, NULL, NULL,},
1826 {"/Edit/_Unmark All Packets", "<alt><control>M", GTK_MENU_FUNC(packet_list_unmark_all_frames_cb), 0, NULL, NULL,},
1827 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1828 {"/Edit/_Ignore Packet (toggle)", "<control>D", GTK_MENU_FUNC(packet_list_ignore_frame_cb),
1830 {"/Edit/Ignore All Displayed Packets (toggle)", "<shift><control>D", GTK_MENU_FUNC(packet_list_ignore_all_frames_cb),
1832 {"/Edit/U_n-Ignore All Packets", "<alt><control>D", GTK_MENU_FUNC(packet_list_unignore_all_frames_cb),
1834 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1835 {"/Edit/Set Time Reference (toggle)", "<control>T", GTK_MENU_FUNC(reftime_frame_cb),
1836 REFTIME_TOGGLE, "<StockItem>", WIRESHARK_STOCK_TIME,},
1837 {"/Edit/Find Next Time Reference", "<alt><shift><control>N", GTK_MENU_FUNC(reftime_frame_cb), REFTIME_FIND_NEXT, NULL, NULL,},
1838 {"/Edit/Find Previous Time Reference", "<alt><shift><control>B", GTK_MENU_FUNC(reftime_frame_cb), REFTIME_FIND_PREV, NULL, NULL,},
1839 #endif /* NEW_PACKET_LIST */
1840 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1841 {"/Edit/_Configuration Profiles...", "<shift><control>A", GTK_MENU_FUNC(profile_dialog_cb), 0, NULL, NULL,},
1842 {"/Edit/_Preferences...", "<shift><control>P", GTK_MENU_FUNC(prefs_page_cb),
1843 PREFS_PAGE_USER_INTERFACE, "<StockItem>", GTK_STOCK_PREFERENCES,},
1844 {"/_View", NULL, NULL, 0, "<Branch>", NULL,},
1845 {"/View/_Main Toolbar", NULL, GTK_MENU_FUNC(show_hide_cb), SHOW_HIDE_MAIN_TOOLBAR, "<CheckItem>", NULL,},
1846 {"/View/_Filter Toolbar", NULL, GTK_MENU_FUNC(show_hide_cb), SHOW_HIDE_FILTER_TOOLBAR, "<CheckItem>", NULL,},
1848 {"/View/_Wireless Toolbar", NULL, GTK_MENU_FUNC(show_hide_cb), SHOW_HIDE_AIRPCAP_TOOLBAR, "<CheckItem>", NULL,},
1850 {"/View/_Statusbar", NULL, GTK_MENU_FUNC(show_hide_cb), SHOW_HIDE_STATUSBAR, "<CheckItem>", NULL,},
1851 {"/View/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1852 {"/View/Packet _List", NULL, GTK_MENU_FUNC(show_hide_cb), SHOW_HIDE_PACKET_LIST, "<CheckItem>", NULL,},
1853 {"/View/Packet _Details", NULL, GTK_MENU_FUNC(show_hide_cb), SHOW_HIDE_TREE_VIEW, "<CheckItem>", NULL,},
1854 {"/View/Packet _Bytes", NULL, GTK_MENU_FUNC(show_hide_cb), SHOW_HIDE_BYTE_VIEW, "<CheckItem>", NULL,},
1855 {"/View/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1856 {"/View/_Time Display Format", NULL, NULL, 0, "<Branch>", NULL,},
1857 {"/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456", "<alt><control>1", GTK_MENU_FUNC(timestamp_format_cb),
1858 TS_ABSOLUTE_WITH_DATE, "<RadioItem>", NULL,},
1859 {"/View/Time Display Format/Time of Day: 01:02:03.123456", "<alt><control>2", GTK_MENU_FUNC(timestamp_format_cb),
1860 TS_ABSOLUTE, "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456", NULL,},
1861 {"/View/Time Display Format/Seconds Since Epoch (1970-01-01): 1234567890.123456", "<alt><control>3", GTK_MENU_FUNC(timestamp_format_cb),
1862 TS_EPOCH, "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456", NULL,},
1863 {"/View/Time Display Format/Seconds Since Beginning of Capture: 123.123456", "<alt><control>4", GTK_MENU_FUNC(timestamp_format_cb),
1864 TS_RELATIVE, "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456", NULL,},
1865 {"/View/Time Display Format/Seconds Since Previous Captured Packet: 1.123456", "<alt><control>5", GTK_MENU_FUNC(timestamp_format_cb),
1866 TS_DELTA, "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456", NULL,},
1867 {"/View/Time Display Format/Seconds Since Previous Displayed Packet: 1.123456", "<alt><control>6", GTK_MENU_FUNC(timestamp_format_cb),
1868 TS_DELTA_DIS, "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456", NULL,},
1869 {"/View/Time Display Format/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1870 {"/View/Time Display Format/Automatic (File Format Precision)", NULL, GTK_MENU_FUNC(timestamp_precision_cb),
1871 TS_PREC_AUTO, "<RadioItem>", NULL,},
1872 {"/View/Time Display Format/Seconds: 0", NULL, GTK_MENU_FUNC(timestamp_precision_cb),
1873 TS_PREC_FIXED_SEC, "/View/Time Display Format/Automatic (File Format Precision)", NULL,},
1874 {"/View/Time Display Format/Deciseconds: 0.1", NULL, GTK_MENU_FUNC(timestamp_precision_cb),
1875 TS_PREC_FIXED_DSEC, "/View/Time Display Format/Automatic (File Format Precision)", NULL,},
1876 {"/View/Time Display Format/Centiseconds: 0.12", NULL, GTK_MENU_FUNC(timestamp_precision_cb),
1877 TS_PREC_FIXED_CSEC, "/View/Time Display Format/Automatic (File Format Precision)", NULL,},
1878 {"/View/Time Display Format/Milliseconds: 0.123", NULL, GTK_MENU_FUNC(timestamp_precision_cb),
1879 TS_PREC_FIXED_MSEC, "/View/Time Display Format/Automatic (File Format Precision)", NULL,},
1880 {"/View/Time Display Format/Microseconds: 0.123456", NULL, GTK_MENU_FUNC(timestamp_precision_cb),
1881 TS_PREC_FIXED_USEC, "/View/Time Display Format/Automatic (File Format Precision)", NULL,},
1882 {"/View/Time Display Format/Nanoseconds: 0.123456789", NULL, GTK_MENU_FUNC(timestamp_precision_cb),
1883 TS_PREC_FIXED_NSEC, "/View/Time Display Format/Automatic (File Format Precision)", NULL,},
1884 {"/View/Time Display Format/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1885 {"/View/Time Display Format/Display Seconds with hours and minutes", "<alt><control>0", GTK_MENU_FUNC(timestamp_seconds_time_cb), 0, "<CheckItem>", NULL,},
1886 {"/View/Name Resol_ution", NULL, NULL, 0, "<Branch>", NULL,},
1887 {"/View/Name Resolution/_Resolve Name", NULL, GTK_MENU_FUNC(resolve_name_cb), 0, NULL, NULL,},
1888 {"/View/Name Resolution/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1889 {"/View/Name Resolution/Enable for _MAC Layer", NULL, GTK_MENU_FUNC(name_resolution_cb), RESOLV_MAC, "<CheckItem>", NULL,},
1890 {"/View/Name Resolution/Enable for _Network Layer", NULL, GTK_MENU_FUNC(name_resolution_cb), RESOLV_NETWORK, "<CheckItem>", NULL,},
1891 {"/View/Name Resolution/Enable for _Transport Layer", NULL, GTK_MENU_FUNC(name_resolution_cb), RESOLV_TRANSPORT, "<CheckItem>", NULL,},
1892 {"/View/Colorize Packet List", NULL, colorize_cb, 0, "<CheckItem>", NULL,},
1894 {"/View/Auto Scroll in Li_ve Capture", NULL, GTK_MENU_FUNC(auto_scroll_live_cb), 0, "<CheckItem>", NULL,},
1896 {"/View/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1897 {"/View/_Zoom In", "<control>plus", GTK_MENU_FUNC(view_zoom_in_cb),
1898 0, "<StockItem>", GTK_STOCK_ZOOM_IN,},
1899 {"/View/Zoom _Out", "<control>minus", GTK_MENU_FUNC(view_zoom_out_cb),
1900 0, "<StockItem>", GTK_STOCK_ZOOM_OUT,},
1901 {"/View/_Normal Size", "<control>equal", GTK_MENU_FUNC(view_zoom_100_cb),
1902 0, "<StockItem>", GTK_STOCK_ZOOM_100,},
1903 #ifdef NEW_PACKET_LIST
1904 {"/View/Resize All Columns", "<shift><control>R", GTK_MENU_FUNC(new_packet_list_resize_columns_cb),
1905 0, "<StockItem>", WIRESHARK_STOCK_RESIZE_COLUMNS,},
1906 {"/View/Displayed Columns", NULL, NULL, 0, NULL, NULL,},
1908 {"/View/Resize All Columns", "<shift><control>R", GTK_MENU_FUNC(packet_list_resize_columns_cb),
1909 0, "<StockItem>", WIRESHARK_STOCK_RESIZE_COLUMNS,},
1910 #endif /* NEW_PACKET_LIST */
1911 {"/View/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1912 {"/View/E_xpand Subtrees", "<shift>Right", GTK_MENU_FUNC(expand_tree_cb), 0, NULL, NULL,},
1913 {"/View/_Expand All", "<control>Right", GTK_MENU_FUNC(expand_all_cb),
1915 {"/View/Collapse _All", "<control>Left", GTK_MENU_FUNC(collapse_all_cb),
1917 {"/View/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1918 {"/View/Colorize Conversation", NULL, NULL, 0, "<Branch>",NULL,},
1919 {"/View/Colorize Conversation/Color 1", "<control>1",
1920 GTK_MENU_FUNC(colorize_conversation_cb), 1*256, "<StockItem>", WIRESHARK_STOCK_COLOR1,},
1921 {"/View/Colorize Conversation/Color 2", "<control>2",
1922 GTK_MENU_FUNC(colorize_conversation_cb), 2*256, "<StockItem>", WIRESHARK_STOCK_COLOR2,},
1923 {"/View/Colorize Conversation/Color 3", "<control>3",
1924 GTK_MENU_FUNC(colorize_conversation_cb), 3*256, "<StockItem>", WIRESHARK_STOCK_COLOR3,},
1925 {"/View/Colorize Conversation/Color 4", "<control>4",
1926 GTK_MENU_FUNC(colorize_conversation_cb), 4*256, "<StockItem>", WIRESHARK_STOCK_COLOR4,},
1927 {"/View/Colorize Conversation/Color 5", "<control>5",
1928 GTK_MENU_FUNC(colorize_conversation_cb), 5*256, "<StockItem>", WIRESHARK_STOCK_COLOR5,},
1929 {"/View/Colorize Conversation/Color 6", "<control>6",
1930 GTK_MENU_FUNC(colorize_conversation_cb), 6*256, "<StockItem>", WIRESHARK_STOCK_COLOR6,},
1931 {"/View/Colorize Conversation/Color 7", "<control>7",
1932 GTK_MENU_FUNC(colorize_conversation_cb), 7*256, "<StockItem>", WIRESHARK_STOCK_COLOR7,},
1933 {"/View/Colorize Conversation/Color 8", "<control>8",
1934 GTK_MENU_FUNC(colorize_conversation_cb), 8*256, "<StockItem>", WIRESHARK_STOCK_COLOR8,},
1935 {"/View/Colorize Conversation/Color 9", "<control>9",
1936 GTK_MENU_FUNC(colorize_conversation_cb), 9*256, "<StockItem>", WIRESHARK_STOCK_COLOR9,},
1937 {"/View/Colorize Conversation/Color 10", "<control>0",
1938 GTK_MENU_FUNC(colorize_conversation_cb), 10*256, "<StockItem>", WIRESHARK_STOCK_COLOR0,},
1939 {"/View/Colorize Conversation/<separator>", NULL,
1940 NULL, 0, "<Separator>",NULL,},
1941 {"/View/Colorize Conversation/New Coloring Rule...", NULL,
1942 GTK_MENU_FUNC(colorize_conversation_cb), 0, "<StockItem>", GTK_STOCK_SELECT_COLOR,},
1943 {"/View/Reset Coloring 1-10", "<control>space",
1944 GTK_MENU_FUNC(colorize_conversation_cb), 255*256, NULL, NULL,},
1945 {"/View/_Coloring Rules...", NULL, color_display_cb,
1946 0, "<StockItem>", GTK_STOCK_SELECT_COLOR,},
1947 {"/View/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1950 {"/View/Show Packet in New _Window", NULL,
1951 GTK_MENU_FUNC(new_window_cb), 0, NULL, NULL,},
1952 {"/View/_Reload", "<control>R", GTK_MENU_FUNC(file_reload_cmd_cb),
1953 0, "<StockItem>", GTK_STOCK_REFRESH,},
1954 {"/_Go", NULL, NULL, 0, "<Branch>", NULL,},
1955 {"/Go/_Back", "<alt>Left",
1956 GTK_MENU_FUNC(history_back_cb), 0, "<StockItem>", GTK_STOCK_GO_BACK,},
1957 {"/Go/_Forward", "<alt>Right",
1958 GTK_MENU_FUNC(history_forward_cb), 0, "<StockItem>", GTK_STOCK_GO_FORWARD,},
1959 {"/Go/_Go to Packet...", "<control>G",
1960 GTK_MENU_FUNC(goto_frame_cb), 0, "<StockItem>", GTK_STOCK_JUMP_TO,},
1961 {"/Go/Go to _Corresponding Packet", NULL, GTK_MENU_FUNC(goto_framenum_cb),
1963 {"/Go/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1964 {"/Go/Previous Packet", "<control>Up",
1965 GTK_MENU_FUNC(goto_previous_frame_cb), 0, "<StockItem>", GTK_STOCK_GO_UP,},
1966 {"/Go/Next Packet", "<control>Down",
1967 GTK_MENU_FUNC(goto_next_frame_cb), 0, "<StockItem>", GTK_STOCK_GO_DOWN,},
1968 {"/Go/F_irst Packet", "<control>Home",
1969 GTK_MENU_FUNC(goto_top_frame_cb), 0, "<StockItem>", GTK_STOCK_GOTO_TOP,},
1970 {"/Go/_Last Packet", "<control>End",
1971 GTK_MENU_FUNC(goto_bottom_frame_cb), 0, "<StockItem>", GTK_STOCK_GOTO_BOTTOM,},
1972 {"/Go/Previous Packet In Conversation", "<control>bracketleft",
1973 GTK_MENU_FUNC(goto_previous_frame_conversation_cb), 0, NULL, NULL,},
1974 {"/Go/Next Packet In Conversation", "<control>bracketright",
1975 GTK_MENU_FUNC(goto_next_frame_conversation_cb), 0, NULL, NULL,},
1977 {"/_Capture", NULL, NULL, 0, "<Branch>", NULL,},
1978 {"/Capture/_Interfaces...", "<control>I",
1979 GTK_MENU_FUNC(capture_if_cb), 0, "<StockItem>", WIRESHARK_STOCK_CAPTURE_INTERFACES,},
1980 {"/Capture/_Options...", "<control>K",
1981 GTK_MENU_FUNC(capture_prep_cb), 0, "<StockItem>", WIRESHARK_STOCK_CAPTURE_OPTIONS,},
1982 {"/Capture/_Start", "<control>E",
1983 GTK_MENU_FUNC(capture_start_cb), 0, "<StockItem>", WIRESHARK_STOCK_CAPTURE_START,},
1984 {"/Capture/S_top", "<control>E", GTK_MENU_FUNC(capture_stop_cb),
1985 0, "<StockItem>", WIRESHARK_STOCK_CAPTURE_STOP,},
1986 {"/Capture/_Restart", "<control>R", GTK_MENU_FUNC(capture_restart_cb),
1987 0, "<StockItem>", WIRESHARK_STOCK_CAPTURE_RESTART,},
1988 {"/Capture/Capture _Filters...", NULL, GTK_MENU_FUNC(cfilter_dialog_cb),
1989 0, "<StockItem>", WIRESHARK_STOCK_CAPTURE_FILTER,},
1990 #endif /* HAVE_LIBPCAP */
1991 {"/_Analyze", NULL, NULL, 0, "<Branch>", NULL,},
1992 {"/Analyze/_Display Filters...", NULL, GTK_MENU_FUNC(dfilter_dialog_cb),
1993 0, "<StockItem>", WIRESHARK_STOCK_DISPLAY_FILTER,},
1994 {"/Analyze/Display Filter _Macros...", NULL, GTK_MENU_FUNC(macros_dialog_cb), 0, NULL, NULL,},
1995 {"/Analyze/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1996 {"/Analyze/Apply as Column", NULL, GTK_MENU_FUNC(apply_as_custom_column_cb), 0, NULL, NULL},
1997 {"/Analyze/Appl_y as Filter", NULL, NULL, 0, "<Branch>", NULL,},
1998 {"/Analyze/Apply as Filter/_Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
1999 MATCH_SELECTED_REPLACE|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
2000 {"/Analyze/Apply as Filter/_Not Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
2001 MATCH_SELECTED_NOT|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
2002 {"/Analyze/Apply as Filter/" UTF8_HORIZONTAL_ELLIPSIS " _and Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
2003 MATCH_SELECTED_AND|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
2004 {"/Analyze/Apply as Filter/" UTF8_HORIZONTAL_ELLIPSIS " _or Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
2005 MATCH_SELECTED_OR|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
2006 {"/Analyze/Apply as Filter/" UTF8_HORIZONTAL_ELLIPSIS " a_nd not Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
2007 MATCH_SELECTED_AND_NOT|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
2008 {"/Analyze/Apply as Filter/" UTF8_HORIZONTAL_ELLIPSIS " o_r not Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
2009 MATCH_SELECTED_OR_NOT|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
2010 {"/Analyze/_Prepare a Filter", NULL, NULL, 0, "<Branch>", NULL,},
2011 {"/Analyze/Prepare a Filter/_Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
2012 MATCH_SELECTED_REPLACE, NULL, NULL,},
2013 {"/Analyze/Prepare a Filter/_Not Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
2014 MATCH_SELECTED_NOT, NULL, NULL,},
2015 {"/Analyze/Prepare a Filter/" UTF8_HORIZONTAL_ELLIPSIS " _and Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
2016 MATCH_SELECTED_AND, NULL, NULL,},
2017 {"/Analyze/Prepare a Filter/" UTF8_HORIZONTAL_ELLIPSIS " _or Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
2018 MATCH_SELECTED_OR, NULL, NULL,},
2019 {"/Analyze/Prepare a Filter/" UTF8_HORIZONTAL_ELLIPSIS " a_nd not Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
2020 MATCH_SELECTED_AND_NOT, NULL, NULL,},
2021 {"/Analyze/Prepare a Filter/" UTF8_HORIZONTAL_ELLIPSIS " o_r not Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
2022 MATCH_SELECTED_OR_NOT, NULL, NULL,},
2023 {"/Analyze/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
2024 {"/Analyze/_Enabled Protocols...", "<shift><control>E", GTK_MENU_FUNC(proto_cb),
2025 0, "<StockItem>", WIRESHARK_STOCK_CHECKBOX,},
2026 {"/Analyze/Decode _As...", NULL, GTK_MENU_FUNC(decode_as_cb),
2027 0, "<StockItem>", WIRESHARK_STOCK_DECODE_AS,},
2028 {"/Analyze/_User Specified Decodes...", NULL,
2029 GTK_MENU_FUNC(decode_show_cb), 0, "<StockItem>", WIRESHARK_STOCK_DECODE_AS,},
2030 {"/Analyze/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
2031 {"/Analyze/_Follow TCP Stream", NULL,
2032 GTK_MENU_FUNC(follow_tcp_stream_cb), 0, NULL, NULL,},
2033 {"/Analyze/_Follow UDP Stream", NULL,
2034 GTK_MENU_FUNC(follow_udp_stream_cb), 0, NULL, NULL,},
2035 {"/Analyze/_Follow SSL Stream", NULL,
2036 GTK_MENU_FUNC(follow_ssl_stream_cb), 0, NULL, NULL,},
2037 {"/_Statistics", NULL, NULL, 0, "<Branch>", NULL,},
2038 {"/Statistics/_Summary", NULL, GTK_MENU_FUNC(summary_open_cb), 0, "<StockItem>", GTK_STOCK_PROPERTIES,},
2039 {"/Statistics/_Protocol Hierarchy", NULL,
2040 GTK_MENU_FUNC(proto_hier_stats_cb), 0, NULL, NULL,},
2041 {"/Statistics/Conversations", NULL,
2042 GTK_MENU_FUNC(init_conversation_notebook_cb), 0, "<StockItem>", WIRESHARK_STOCK_CONVERSATIONS,},
2043 {"/Statistics/Endpoints", NULL,
2044 GTK_MENU_FUNC(init_hostlist_notebook_cb), 0, "<StockItem>", WIRESHARK_STOCK_ENDPOINTS,},
2045 {"/Telephon_y", NULL, NULL, 0, "<Branch>", NULL,},
2046 {"/_Tools", NULL, NULL, 0, "<Branch>", NULL,},
2047 {"/Tools/Firewall ACL Rules", NULL,
2048 firewall_rule_cb, 0, NULL, NULL,},
2049 {"/WS internal", NULL, NULL, 0, "<Branch>", NULL,},
2050 {"/WS internal/Dissector tables", NULL, GTK_MENU_FUNC(dissector_tables_dlg_cb),
2052 {"/_Help", NULL, NULL, 0, "<Branch>", NULL,},
2053 {"/Help/_Contents", "F1", GTK_MENU_FUNC(topic_menu_cb), HELP_CONTENT, "<StockItem>", GTK_STOCK_HELP,},
2054 {"/Help/FAQ's", NULL, GTK_MENU_FUNC(topic_menu_cb), ONLINEPAGE_FAQ, NULL, NULL,},
2055 {"/Help/Manual Pages", NULL, NULL, 0, "<Branch>", NULL,},
2056 {"/Help/Manual Pages/Wireshark", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_WIRESHARK, NULL, NULL,},
2057 {"/Help/Manual Pages/Wireshark Filter", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_WIRESHARK_FILTER, NULL, NULL,},
2058 {"/Help/Manual Pages/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
2059 {"/Help/Manual Pages/TShark", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_TSHARK, NULL, NULL,},
2060 {"/Help/Manual Pages/RawShark", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_RAWSHARK, NULL, NULL,},
2061 {"/Help/Manual Pages/Dumpcap", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_DUMPCAP, NULL, NULL,},
2062 {"/Help/Manual Pages/Mergecap", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_MERGECAP, NULL, NULL,},
2063 {"/Help/Manual Pages/Editcap", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_EDITCAP, NULL, NULL,},
2064 {"/Help/Manual Pages/Text2pcap", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_TEXT2PCAP, NULL, NULL,},
2065 {"/Help/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
2066 {"/Help/Website", NULL, GTK_MENU_FUNC(topic_menu_cb), ONLINEPAGE_HOME, "<StockItem>", GTK_STOCK_HOME,},
2067 {"/Help/Wiki", NULL, GTK_MENU_FUNC(topic_menu_cb), ONLINEPAGE_WIKI, "<StockItem>", WIRESHARK_STOCK_WIKI,},
2068 {"/Help/Downloads", NULL, GTK_MENU_FUNC(topic_menu_cb), ONLINEPAGE_DOWNLOAD, NULL, NULL,},
2069 {"/Help/Sample Captures", NULL, GTK_MENU_FUNC(topic_menu_cb), ONLINEPAGE_SAMPLE_FILES, NULL, NULL,},
2070 {"/Help/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
2071 {"/Help/_Supported Protocols (slow!)", NULL, GTK_MENU_FUNC(supported_cb), 0, NULL, NULL,},
2072 {"/Help/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
2073 {"/Help/_About Wireshark", NULL, GTK_MENU_FUNC(about_wireshark_cb),
2074 0, "<StockItem>", WIRESHARK_STOCK_ABOUT}
2077 /* calculate the number of menu_items */
2078 static int nmenu_items = sizeof(menu_items) / sizeof(menu_items[0]);
2079 #endif /* MAIN_MENU_USE_UIMANAGER */
2083 select_bytes_view_cb (GtkRadioAction *action, GtkRadioAction *current _U_, gpointer user_data _U_)
2087 value = gtk_radio_action_get_current_value (action);
2089 select_bytes_view( NULL, NULL, value);
2093 sort_ascending_cb(GtkAction *action _U_, gpointer user_data)
2095 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/SortAscending");
2096 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_SORT_ASCENDING);
2100 sort_descending_cb(GtkAction *action _U_, gpointer user_data)
2102 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/SortDescending");
2103 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_SORT_DESCENDING);
2107 no_sorting_cb(GtkAction *action _U_, gpointer user_data)
2109 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/NoSorting");
2110 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_SORT_NONE);
2114 packet_list_heading_show_resolved_cb(GtkAction *action _U_, gpointer user_data _U_)
2116 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/ShowResolved");
2118 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_TOGGLE_RESOLVED);
2122 packet_list_heading_align_left_cb(GtkAction *action _U_, gpointer user_data)
2124 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/AlignLeft");
2125 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_ALIGN_LEFT);
2129 packet_list_heading_align_center_cb(GtkAction *action _U_, gpointer user_data)
2131 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/AlignCenter");
2132 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_ALIGN_CENTER);
2136 packet_list_heading_align_right_cb(GtkAction *action _U_, gpointer user_data)
2138 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/AlignRight");
2139 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_ALIGN_RIGHT);
2143 packet_list_heading_col_pref_cb(GtkAction *action _U_, gpointer user_data)
2145 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/ColumnPreferences");
2146 prefs_page_cb( widget , user_data, PREFS_PAGE_COLUMNS);
2150 packet_list_heading_resize_col_cb(GtkAction *action _U_, gpointer user_data)
2152 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/ResizeColumn");
2153 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_RESIZE);
2157 packet_list_heading_change_col_cb(GtkAction *action _U_, gpointer user_data)
2159 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/RenameColumnTitle");
2160 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_CHANGE);
2164 packet_list_heading_activate_all_columns_cb(GtkAction *action _U_, gpointer user_data _U_)
2166 new_packet_list_set_all_columns_visible ();
2170 packet_list_heading_hide_col_cb(GtkAction *action _U_, gpointer user_data)
2172 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/RenameColumnTitle");
2173 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_HIDE);
2177 packet_list_heading_remove_col_cb(GtkAction *action _U_, gpointer user_data)
2179 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/RemoveColumn");
2180 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_REMOVE);
2184 packet_list_menu_set_ref_time_cb(GtkAction *action _U_, gpointer user_data)
2186 reftime_frame_cb( NULL /* widget _U_ */ , user_data, REFTIME_TOGGLE);
2191 packet_list_menu_apply_selected_cb(GtkAction *action _U_, gpointer user_data)
2193 match_selected_plist_cb( NULL /* widget _U_ */, user_data, MATCH_SELECTED_REPLACE|MATCH_SELECTED_APPLY_NOW);
2197 packet_list_menu_apply_not_selected_cb(GtkAction *action _U_, gpointer user_data)
2199 match_selected_plist_cb( NULL /* widget _U_ */ , user_data, MATCH_SELECTED_NOT|MATCH_SELECTED_APPLY_NOW);
2203 packet_list_menu_apply_and_selected_cb(GtkAction *action _U_, gpointer user_data)
2205 match_selected_plist_cb( NULL /* widget _U_ */ , user_data, MATCH_SELECTED_AND|MATCH_SELECTED_APPLY_NOW);
2209 packet_list_menu_apply_or_selected_cb(GtkAction *action _U_, gpointer user_data)
2211 match_selected_plist_cb( NULL /* widget _U_ */ , user_data, MATCH_SELECTED_OR|MATCH_SELECTED_APPLY_NOW);
2215 packet_list_menu_apply_and_not_selected_cb(GtkAction *action _U_, gpointer user_data)
2217 match_selected_plist_cb( NULL /* widget _U_ */ , user_data, MATCH_SELECTED_AND_NOT|MATCH_SELECTED_APPLY_NOW);
2221 packet_list_menu_apply_or_not_selected_cb(GtkAction *action _U_, gpointer user_data)
2223 match_selected_plist_cb( NULL /* widget _U_ */ , user_data,MATCH_SELECTED_OR_NOT|MATCH_SELECTED_APPLY_NOW);
2225 /* Prepare a filter */
2227 packet_list_menu_prepare_selected_cb(GtkAction *action _U_, gpointer user_data)
2229 match_selected_plist_cb( NULL /* widget _U_ */ , user_data, MATCH_SELECTED_REPLACE);
2233 packet_list_menu_prepare_not_selected_cb(GtkAction *action _U_, gpointer user_data)
2235 match_selected_plist_cb( NULL /* widget _U_ */ , user_data, MATCH_SELECTED_NOT);
2239 packet_list_menu_prepare_and_selected_cb(GtkAction *action _U_, gpointer user_data)
2241 match_selected_plist_cb( NULL /* widget _U_ */ , user_data, MATCH_SELECTED_AND);
2245 packet_list_menu_prepare_or_selected_cb(GtkAction *action _U_, gpointer user_data)
2247 match_selected_plist_cb( NULL /* widget _U_ */ , user_data, MATCH_SELECTED_OR);
2251 packet_list_menu_prepare_and_not_selected_cb(GtkAction *action _U_, gpointer user_data)
2253 match_selected_plist_cb( NULL /* widget _U_ */ , user_data, MATCH_SELECTED_AND_NOT);
2257 packet_list_menu_prepare_or_not_selected_cb(GtkAction *action _U_, gpointer user_data)
2259 match_selected_plist_cb( NULL /* widget _U_ */ , user_data, MATCH_SELECTED_OR_NOT);
2263 packet_list_menu_conversation_ethernet_cb(GtkAction *action, gpointer user_data)
2265 conversation_cb( action, user_data, CONV_ETHER);
2269 packet_list_menu_conversation_ip_cb(GtkAction *action _U_, gpointer user_data)
2271 conversation_cb( action, user_data, CONV_IP);
2275 packet_list_menu_conversation_tcp_cb(GtkAction *action _U_, gpointer user_data)
2277 conversation_cb( action, user_data, CONV_TCP);
2281 packet_list_menu_conversation_udp_cb(GtkAction *action _U_, gpointer user_data)
2283 conversation_cb( action, user_data, CONV_UDP);
2287 packet_list_menu_conversation_pn_cba_cb(GtkAction *action _U_, gpointer user_data)
2289 conversation_cb( action, user_data, CONV_CBA);
2295 packet_list_menu_color_conv_ethernet_color1_cb(GtkAction *action _U_, gpointer user_data)
2297 colorize_conversation_cb( NULL /* widget _U_ */, user_data, CONV_ETHER+1*256);
2302 packet_list_menu_color_conv_ethernet_color2_cb(GtkAction *action _U_, gpointer user_data)
2304 colorize_conversation_cb( NULL/* widget _U_ */ , user_data, CONV_ETHER+1*256);
2308 packet_list_menu_color_conv_ethernet_color3_cb(GtkAction *action _U_, gpointer user_data)
2310 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_ETHER+3*256);
2314 packet_list_menu_color_conv_ethernet_color4_cb(GtkAction *action _U_, gpointer user_data)
2316 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_ETHER+4*256);
2320 packet_list_menu_color_conv_ethernet_color5_cb(GtkAction *action _U_, gpointer user_data)
2322 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_ETHER+5*256);
2326 packet_list_menu_color_conv_ethernet_color6_cb(GtkAction *action _U_, gpointer user_data)
2328 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_ETHER+6*256);
2332 packet_list_menu_color_conv_ethernet_color7_cb(GtkAction *action _U_, gpointer user_data)
2334 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_ETHER+7*256);
2338 packet_list_menu_color_conv_ethernet_color8_cb(GtkAction *action _U_, gpointer user_data)
2340 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_ETHER+8*256);
2344 packet_list_menu_color_conv_ethernet_color9_cb(GtkAction *action _U_, gpointer user_data)
2346 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_ETHER+9*256);
2350 packet_list_menu_color_conv_ethernet_color10_cb(GtkAction *action _U_, gpointer user_data)
2352 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_ETHER+10*256);
2357 packet_list_menu_color_conv_ethernet_new_rule_cb(GtkAction *action _U_, gpointer user_data)
2359 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_ETHER);
2366 packet_list_menu_color_conv_ip_color1_cb(GtkAction *action _U_, gpointer user_data)
2368 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_IP+1*256);
2373 packet_list_menu_color_conv_ip_color2_cb(GtkAction *action _U_, gpointer user_data)
2375 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_IP+1*256);
2379 packet_list_menu_color_conv_ip_color3_cb(GtkAction *action _U_, gpointer user_data)
2381 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_IP+3*256);
2385 packet_list_menu_color_conv_ip_color4_cb(GtkAction *action _U_, gpointer user_data)
2387 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_IP+4*256);
2391 packet_list_menu_color_conv_ip_color5_cb(GtkAction *action _U_, gpointer user_data)
2393 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_IP+5*256);
2397 packet_list_menu_color_conv_ip_color6_cb(GtkAction *action _U_, gpointer user_data)
2399 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_IP+6*256);
2403 packet_list_menu_color_conv_ip_color7_cb(GtkAction *action _U_, gpointer user_data)
2405 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_IP+7*256);
2409 packet_list_menu_color_conv_ip_color8_cb(GtkAction *action _U_, gpointer user_data)
2411 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_IP+8*256);
2415 packet_list_menu_color_conv_ip_color9_cb(GtkAction *action _U_, gpointer user_data)
2417 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_IP+9*256);
2421 packet_list_menu_color_conv_ip_color10_cb(GtkAction *action _U_, gpointer user_data)
2423 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_IP+10*256);
2428 packet_list_menu_color_conv_ip_new_rule_cb(GtkAction *action _U_, gpointer user_data)
2430 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_TCP);
2436 packet_list_menu_color_conv_tcp_color1_cb(GtkAction *action _U_, gpointer user_data)
2438 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_TCP+1*256);
2443 packet_list_menu_color_conv_tcp_color2_cb(GtkAction *action _U_, gpointer user_data)
2445 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_TCP+1*256);
2449 packet_list_menu_color_conv_tcp_color3_cb(GtkAction *action _U_, gpointer user_data)
2451 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_TCP+3*256);
2455 packet_list_menu_color_conv_tcp_color4_cb(GtkAction *action _U_, gpointer user_data)
2457 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_TCP+4*256);
2461 packet_list_menu_color_conv_tcp_color5_cb(GtkAction *action _U_, gpointer user_data)
2463 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_TCP+5*256);
2467 packet_list_menu_color_conv_tcp_color6_cb(GtkAction *action _U_, gpointer user_data)
2469 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_TCP+6*256);
2473 packet_list_menu_color_conv_tcp_color7_cb(GtkAction *action _U_, gpointer user_data)
2475 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_TCP+7*256);
2479 packet_list_menu_color_conv_tcp_color8_cb(GtkAction *action _U_, gpointer user_data)
2481 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_TCP+8*256);
2485 packet_list_menu_color_conv_tcp_color9_cb(GtkAction *action _U_, gpointer user_data)
2487 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_TCP+9*256);
2491 packet_list_menu_color_conv_tcp_color10_cb(GtkAction *action _U_, gpointer user_data)
2493 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_TCP+10*256);
2498 packet_list_menu_color_conv_tcp_new_rule_cb(GtkAction *action _U_, gpointer user_data)
2500 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_TCP);
2506 packet_list_menu_color_conv_udp_color1_cb(GtkAction *action _U_, gpointer user_data)
2508 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_UDP+1*256);
2513 packet_list_menu_color_conv_udp_color2_cb(GtkAction *action _U_, gpointer user_data)
2515 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_UDP+1*256);
2519 packet_list_menu_color_conv_udp_color3_cb(GtkAction *action _U_, gpointer user_data)
2521 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_UDP+3*256);
2525 packet_list_menu_color_conv_udp_color4_cb(GtkAction *action _U_, gpointer user_data)
2527 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_UDP+4*256);
2531 packet_list_menu_color_conv_udp_color5_cb(GtkAction *action _U_, gpointer user_data)
2533 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_UDP+5*256);
2537 packet_list_menu_color_conv_udp_color6_cb(GtkAction *action _U_, gpointer user_data)
2539 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_UDP+6*256);
2543 packet_list_menu_color_conv_udp_color7_cb(GtkAction *action _U_, gpointer user_data)
2545 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_UDP+7*256);
2549 packet_list_menu_color_conv_udp_color8_cb(GtkAction *action _U_, gpointer user_data)
2551 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_UDP+8*256);
2555 packet_list_menu_color_conv_udp_color9_cb(GtkAction *action _U_, gpointer user_data)
2557 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_UDP+9*256);
2561 packet_list_menu_color_conv_udp_color10_cb(GtkAction *action _U_, gpointer user_data)
2563 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_UDP+10*256);
2568 packet_list_menu_color_conv_udp_new_rule_cb(GtkAction *action _U_, gpointer user_data)
2570 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_UDP);
2577 packet_list_menu_color_conv_cba_color1_cb(GtkAction *action _U_, gpointer user_data)
2579 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_CBA+1*256);
2584 packet_list_menu_color_conv_cba_color2_cb(GtkAction *action _U_, gpointer user_data)
2586 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_CBA+1*256);
2590 packet_list_menu_color_conv_cba_color3_cb(GtkAction *action _U_, gpointer user_data)
2592 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_CBA+3*256);
2596 packet_list_menu_color_conv_cba_color4_cb(GtkAction *action _U_, gpointer user_data)
2598 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_CBA+4*256);
2602 packet_list_menu_color_conv_cba_color5_cb(GtkAction *action _U_, gpointer user_data)
2604 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_CBA+5*256);
2608 packet_list_menu_color_conv_cba_color6_cb(GtkAction *action _U_, gpointer user_data)
2610 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_CBA+6*256);
2614 packet_list_menu_color_conv_cba_color7_cb(GtkAction *action _U_, gpointer user_data)
2616 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_CBA+7*256);
2619 packet_list_menu_color_conv_cba_color8_cb(GtkAction *action _U_, gpointer user_data)
2621 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_CBA+8*256);
2624 packet_list_menu_color_conv_cba_color9_cb(GtkAction *action _U_, gpointer user_data)
2626 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_CBA+9*256);
2629 packet_list_menu_color_conv_cba_color10_cb(GtkAction *action _U_, gpointer user_data)
2631 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_CBA+10*256);
2635 packet_list_menu_color_conv_cba_new_rule_cb(GtkAction *action _U_, gpointer user_data)
2637 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_CBA);
2640 #ifdef NEW_PACKET_LIST
2642 packet_list_menu_copy_sum_txt(GtkAction *action _U_, gpointer user_data)
2644 new_packet_list_copy_summary_cb( NULL /* widget _U_ */ , user_data, CS_TEXT);
2648 packet_list_menu_copy_sum_csv(GtkAction *action _U_, gpointer user_data)
2650 new_packet_list_copy_summary_cb( NULL /* widget _U_ */ , user_data, CS_CSV);
2654 packet_list_menu_copy_sum_txt(GtkAction *action _U_, gpointer user_data)
2656 packet_list_copy_summary_cb( NULL /* widget _U_ */ , user_data, CS_TEXT);
2660 packet_list_menu_copy_sum_csv(GtkAction *action _U_, gpointer user_data)
2662 packet_list_copy_summary_cb( NULL /* widget _U_ */ , user_data, CS_CSV);
2664 #endif /* NEW_PACKET_LIST */
2667 packet_list_menu_copy_as_flt(GtkAction *action _U_, gpointer user_data)
2669 match_selected_plist_cb( NULL /* widget _U_ */ , user_data, MATCH_SELECTED_REPLACE|MATCH_SELECTED_COPY_ONLY);
2673 packet_list_menu_copy_bytes_oht_cb(GtkAction *action _U_, gpointer user_data)
2675 copy_hex_cb( NULL /* widget _U_ */ , user_data, CD_ALLINFO | CD_FLAGS_SELECTEDONLY);
2679 packet_list_menu_copy_bytes_oh_cb(GtkAction *action _U_, gpointer user_data)
2681 copy_hex_cb( NULL /* widget _U_ */ , user_data, CD_HEXCOLUMNS | CD_FLAGS_SELECTEDONLY);
2685 packet_list_menu_copy_bytes_text_cb(GtkAction *action _U_, gpointer user_data)
2687 copy_hex_cb( NULL /* widget _U_ */ , user_data, CD_TEXTONLY | CD_FLAGS_SELECTEDONLY);
2692 packet_list_menu_copy_bytes_hex_strm_cb(GtkAction *action _U_, gpointer user_data)
2694 copy_hex_cb( NULL /* widget _U_ */ , user_data, CD_HEX | CD_FLAGS_SELECTEDONLY);
2699 packet_list_menu_copy_bytes_bin_strm_cb(GtkAction *action _U_, gpointer user_data)
2701 copy_hex_cb( NULL /* widget _U_ */ , user_data, CD_BINARY | CD_FLAGS_SELECTEDONLY);
2709 tree_view_menu_color_with_flt_color1_cb(GtkAction *action _U_, gpointer user_data)
2711 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 1);
2716 tree_view_menu_color_with_flt_color2_cb(GtkAction *action _U_, gpointer user_data)
2718 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 2);
2722 tree_view_menu_color_with_flt_color3_cb(GtkAction *action _U_, gpointer user_data)
2724 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 3);
2728 tree_view_menu_color_with_flt_color4_cb(GtkAction *action _U_, gpointer user_data)
2730 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 4);
2734 tree_view_menu_color_with_flt_color5_cb(GtkAction *action _U_, gpointer user_data)
2736 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 5);
2740 tree_view_menu_color_with_flt_color6_cb(GtkAction *action _U_, gpointer user_data)
2742 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 6);
2746 tree_view_menu_color_with_flt_color7_cb(GtkAction *action _U_, gpointer user_data)
2748 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 7);
2752 tree_view_menu_color_with_flt_color8_cb(GtkAction *action _U_, gpointer user_data)
2754 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 8);
2758 tree_view_menu_color_with_flt_color9_cb(GtkAction *action _U_, gpointer user_data)
2760 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 9);
2764 tree_view_menu_color_with_flt_color10_cb(GtkAction *action _U_, gpointer user_data)
2766 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 10);
2771 tree_view_menu_color_with_flt_new_rule_cb(GtkAction *action _U_, gpointer user_data)
2773 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 0);
2778 tree_view_menu_copy_desc(GtkAction *action _U_, gpointer user_data)
2780 copy_selected_plist_cb( NULL /* widget _U_ */ , user_data, COPY_SELECTED_DESCRIPTION);
2785 tree_view_menu_copy_field(GtkAction *action _U_, gpointer user_data)
2787 copy_selected_plist_cb( NULL /* widget _U_ */ , user_data, COPY_SELECTED_FIELDNAME);
2792 tree_view_menu_copy_value(GtkAction *action _U_, gpointer user_data)
2794 copy_selected_plist_cb( NULL /* widget _U_ */ , user_data, COPY_SELECTED_VALUE);
2799 tree_view_menu_copy_as_flt(GtkAction *action _U_, gpointer user_data)
2801 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/Copy/AsFilter");
2802 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_REPLACE|MATCH_SELECTED_COPY_ONLY);
2806 static const char *ui_desc_packet_list_heading_menu_popup =
2808 " <popup name='PacketListHeadingPopup' action='PopupAction'>\n"
2809 " <menuitem name='SortAscending' action='/Sort Ascending'/>\n"
2810 " <menuitem name='SortDescending' action='/Sort Descending'/>\n"
2811 " <menuitem name='NoSorting' action='/No Sorting'/>\n"
2813 " <menuitem name='ShowResolved' action='/Show Resolved'/>\n"
2815 " <menuitem name='AlignLeft' action='/Align Left'/>\n"
2816 " <menuitem name='AlignCenter' action='/Align Center'/>\n"
2817 " <menuitem name='AlignRight' action='/Align Right'/>\n"
2819 " <menuitem name='ColumnPreferences' action='/Column Preferences'/>\n"
2820 " <menuitem name='EditColumnDetails' action='/Edit Column Details'/>\n"
2821 " <menuitem name='ResizeColumn' action='/Resize Column'/>\n"
2823 " <menu name='DisplayedColumns' action='/Displayed Columns'>\n"
2824 " <menuitem name='Display All' action='/Displayed Columns/Display All'/>\n"
2826 " <menuitem name='HideColumn' action='/Hide Column'/>\n"
2827 " <menuitem name='RemoveColumn' action='/Remove Column'/>\n"
2831 static const GtkActionEntry packet_list_heading_menu_popup_action_entries[] = {
2832 { "/Sort Ascending", GTK_STOCK_SORT_ASCENDING, "Sort Ascending", NULL, NULL, G_CALLBACK(sort_ascending_cb) },
2833 { "/Sort Descending", GTK_STOCK_SORT_DESCENDING, "Sort Descending", NULL, NULL, G_CALLBACK(sort_descending_cb) },
2834 { "/No Sorting", NULL, "No Sorting", NULL, NULL, G_CALLBACK(no_sorting_cb) },
2835 { "/Align Left", GTK_STOCK_JUSTIFY_LEFT, "Align Left", NULL, NULL, G_CALLBACK(packet_list_heading_align_left_cb) },
2836 { "/Align Center", GTK_STOCK_JUSTIFY_CENTER, "Align Center", NULL, NULL, G_CALLBACK(packet_list_heading_align_center_cb) },
2837 { "/Align Right", GTK_STOCK_JUSTIFY_RIGHT, "Align Right", NULL, NULL, G_CALLBACK(packet_list_heading_align_right_cb) },
2838 { "/Column Preferences", GTK_STOCK_PREFERENCES, "Column Preferences...", NULL, NULL, G_CALLBACK(packet_list_heading_col_pref_cb) },
2839 { "/Edit Column Details", WIRESHARK_STOCK_EDIT, "Edit Column Details...", NULL, NULL, G_CALLBACK(packet_list_heading_change_col_cb) },
2840 { "/Resize Column", WIRESHARK_STOCK_RESIZE_COLUMNS, "Resize Column", NULL, NULL, G_CALLBACK(packet_list_heading_resize_col_cb) },
2841 { "/Displayed Columns", NULL, "Displayed Columns", NULL, NULL, NULL },
2842 { "/Displayed Columns/Display All", NULL, "Display All", NULL, NULL, G_CALLBACK(packet_list_heading_activate_all_columns_cb) },
2843 { "/Hide Column", NULL, "Hide Column", NULL, NULL, G_CALLBACK(packet_list_heading_hide_col_cb) },
2844 { "/Remove Column", GTK_STOCK_DELETE, "Remove Column", NULL, NULL, G_CALLBACK(packet_list_heading_remove_col_cb) },
2847 static const GtkToggleActionEntry packet_list_heading_menu_toggle_action_entries[] =
2849 /* name, stock id, label, accel, tooltip, callback, is_active */
2850 {"/Show Resolved", NULL, "Show Resolved", NULL, NULL, G_CALLBACK(packet_list_heading_show_resolved_cb), FALSE},
2853 static const char *ui_desc_packet_list_menu_popup =
2855 " <popup name='PacketListMenuPopup' action='PopupAction'>\n"
2856 " <menuitem name='MarkPacket' action='/MarkPacket'/>\n"
2857 " <menuitem name='IgnorePacket' action='/IgnorePacket'/>\n"
2858 " <menuitem name='SetTimeReference' action='/Set Time Reference'/>\n"
2860 " <menuitem name='ManuallyResolveAddress' action='/ManuallyResolveAddress'/>\n"
2862 " <menu name= 'ApplyAsFilter' action='/Apply as Filter'>\n"
2863 " <menuitem name='Selected' action='/Apply as Filter/Selected'/>\n"
2864 " <menuitem name='NotSelected' action='/Apply as Filter/Not Selected'/>\n"
2865 " <menuitem name='AndSelected' action='/Apply as Filter/AndSelected'/>\n"
2866 " <menuitem name='OrSelected' action='/Apply as Filter/OrSelected'/>\n"
2867 " <menuitem name='AndNotSelected' action='/Apply as Filter/AndNotSelected'/>\n"
2868 " <menuitem name='OrNotSelected' action='/Apply as Filter/OrNotSelected'/>\n"
2870 " <menu name= 'PrepareaFilter' action='/Prepare a Filter'>\n"
2871 " <menuitem name='Selected' action='/Prepare a Filter/Selected'/>\n"
2872 " <menuitem name='NotSelected' action='/Prepare a Filter/Not Selected'/>\n"
2873 " <menuitem name='AndSelected' action='/Prepare a Filter/AndSelected'/>\n"
2874 " <menuitem name='OrSelected' action='/Prepare a Filter/OrSelected'/>\n"
2875 " <menuitem name='AndNotSelected' action='/Prepare a Filter/AndNotSelected'/>\n"
2876 " <menuitem name='OrNotSelected' action='/Prepare a Filter/OrNotSelected'/>\n"
2878 " <menu name= 'ConversationFilter' action='/Conversation Filter'>\n"
2879 " <menuitem name='Ethernet' action='/Conversation Filter/Ethernet'/>\n"
2880 " <menuitem name='IP' action='/Conversation Filter/IP'/>\n"
2881 " <menuitem name='TCP' action='/Conversation Filter/TCP'/>\n"
2882 " <menuitem name='UDP' action='/Conversation Filter/UDP'/>\n"
2883 " <menuitem name='PN-CBA' action='/Conversation Filter/PN-CBA'/>\n"
2885 " <menu name= 'ColorizeConversation' action='/Colorize Conversation'>\n"
2886 " <menu name= 'Ethernet' action='/Colorize Conversation/Ethernet'>\n"
2887 " <menuitem name='Color1' action='/Colorize Conversation/Ethernet/Color 1'/>\n"
2888 " <menuitem name='Color2' action='/Colorize Conversation/Ethernet/Color 2'/>\n"
2889 " <menuitem name='Color3' action='/Colorize Conversation/Ethernet/Color 3'/>\n"
2890 " <menuitem name='Color4' action='/Colorize Conversation/Ethernet/Color 4'/>\n"
2891 " <menuitem name='Color5' action='/Colorize Conversation/Ethernet/Color 5'/>\n"
2892 " <menuitem name='Color6' action='/Colorize Conversation/Ethernet/Color 6'/>\n"
2893 " <menuitem name='Color7' action='/Colorize Conversation/Ethernet/Color 7'/>\n"
2894 " <menuitem name='Color8' action='/Colorize Conversation/Ethernet/Color 8'/>\n"
2895 " <menuitem name='Color9' action='/Colorize Conversation/Ethernet/Color 9'/>\n"
2896 " <menuitem name='Color10' action='/Colorize Conversation/Ethernet/Color 10'/>\n"
2897 " <menuitem name='NewColoringRule' action='/Colorize Conversation/Ethernet/New Coloring Rule'/>\n"
2899 " <menu name= 'IP' action='/Colorize Conversation/IP'>\n"
2900 " <menuitem name='Color1' action='/Colorize Conversation/IP/Color 1'/>\n"
2901 " <menuitem name='Color2' action='/Colorize Conversation/IP/Color 2'/>\n"
2902 " <menuitem name='Color3' action='/Colorize Conversation/IP/Color 3'/>\n"
2903 " <menuitem name='Color4' action='/Colorize Conversation/IP/Color 4'/>\n"
2904 " <menuitem name='Color5' action='/Colorize Conversation/IP/Color 5'/>\n"
2905 " <menuitem name='Color6' action='/Colorize Conversation/IP/Color 6'/>\n"
2906 " <menuitem name='Color7' action='/Colorize Conversation/IP/Color 7'/>\n"
2907 " <menuitem name='Color8' action='/Colorize Conversation/IP/Color 8'/>\n"
2908 " <menuitem name='Color9' action='/Colorize Conversation/IP/Color 9'/>\n"
2909 " <menuitem name='Color10' action='/Colorize Conversation/IP/Color 10'/>\n"
2910 " <menuitem name='NewColoringRule' action='/Colorize Conversation/IP/New Coloring Rule'/>\n"
2912 " <menu name= 'TCP' action='/Colorize Conversation/TCP'>\n"
2913 " <menuitem name='Color1' action='/Colorize Conversation/TCP/Color 1'/>\n"
2914 " <menuitem name='Color2' action='/Colorize Conversation/TCP/Color 2'/>\n"
2915 " <menuitem name='Color3' action='/Colorize Conversation/TCP/Color 3'/>\n"
2916 " <menuitem name='Color4' action='/Colorize Conversation/TCP/Color 4'/>\n"
2917 " <menuitem name='Color5' action='/Colorize Conversation/TCP/Color 5'/>\n"
2918 " <menuitem name='Color6' action='/Colorize Conversation/TCP/Color 6'/>\n"
2919 " <menuitem name='Color7' action='/Colorize Conversation/TCP/Color 7'/>\n"
2920 " <menuitem name='Color8' action='/Colorize Conversation/TCP/Color 8'/>\n"
2921 " <menuitem name='Color9' action='/Colorize Conversation/TCP/Color 9'/>\n"
2922 " <menuitem name='Color10' action='/Colorize Conversation/TCP/Color 10'/>\n"
2923 " <menuitem name='NewColoringRule' action='/Colorize Conversation/TCP/New Coloring Rule'/>\n"
2925 " <menu name= 'UDP' action='/Colorize Conversation/UDP'>\n"
2926 " <menuitem name='Color1' action='/Colorize Conversation/UDP/Color 1'/>\n"
2927 " <menuitem name='Color2' action='/Colorize Conversation/UDP/Color 2'/>\n"
2928 " <menuitem name='Color3' action='/Colorize Conversation/UDP/Color 3'/>\n"
2929 " <menuitem name='Color4' action='/Colorize Conversation/UDP/Color 4'/>\n"
2930 " <menuitem name='Color5' action='/Colorize Conversation/UDP/Color 5'/>\n"
2931 " <menuitem name='Color6' action='/Colorize Conversation/UDP/Color 6'/>\n"
2932 " <menuitem name='Color7' action='/Colorize Conversation/UDP/Color 7'/>\n"
2933 " <menuitem name='Color8' action='/Colorize Conversation/UDP/Color 8'/>\n"
2934 " <menuitem name='Color9' action='/Colorize Conversation/UDP/Color 9'/>\n"
2935 " <menuitem name='Color10' action='/Colorize Conversation/UDP/Color 10'/>\n"
2936 " <menuitem name='NewColoringRule' action='/Colorize Conversation/UDP/New Coloring Rule'/>\n"
2938 " <menu name= 'PN-CBA' action='/Colorize Conversation/PN-CBA'>\n"
2939 " <menuitem name='Color1' action='/Colorize Conversation/PN-CBA/Color 1'/>\n"
2940 " <menuitem name='Color2' action='/Colorize Conversation/PN-CBA/Color 2'/>\n"
2941 " <menuitem name='Color3' action='/Colorize Conversation/PN-CBA/Color 3'/>\n"
2942 " <menuitem name='Color4' action='/Colorize Conversation/PN-CBA/Color 4'/>\n"
2943 " <menuitem name='Color5' action='/Colorize Conversation/PN-CBA/Color 5'/>\n"
2944 " <menuitem name='Color6' action='/Colorize Conversation/PN-CBA/Color 6'/>\n"
2945 " <menuitem name='Color7' action='/Colorize Conversation/PN-CBA/Color 7'/>\n"
2946 " <menuitem name='Color8' action='/Colorize Conversation/PN-CBA/Color 8'/>\n"
2947 " <menuitem name='Color9' action='/Colorize Conversation/PN-CBA/Color 9'/>\n"
2948 " <menuitem name='Color10' action='/Colorize Conversation/PN-CBA/Color 10'/>\n"
2949 " <menuitem name='NewColoringRule' action='/Colorize Conversation/PN-CBA/New Coloring Rule'/>\n"
2952 " <menu name= 'SCTP' action='/SCTP'>\n"
2953 " <menuitem name='AnalysethisAssociation' action='/SCTP/Analyse this Association'/>\n"
2954 " <menuitem name='PrepareFilterforthisAssociation' action='/SCTP/Prepare Filter for this Association'/>\n"
2956 " <menuitem name='FollowTCPStream' action='/Follow TCP Stream'/>\n"
2957 " <menuitem name='FollowUDPStream' action='/Follow UDP Stream'/>\n"
2958 " <menuitem name='FollowSSLStream' action='/Follow SSL Stream'/>\n"
2960 " <menu name= 'Copy' action='/Copy'>\n"
2961 " <menuitem name='SummaryTxt' action='/Copy/SummaryTxt'/>\n"
2962 " <menuitem name='SummaryCSV' action='/Copy/SummaryCSV'/>\n"
2963 " <menuitem name='AsFilter' action='/Copy/AsFilter'/>\n"
2965 " <menu name= 'Bytes' action='/Copy/Bytes'>\n"
2966 " <menuitem name='OffsetHexText' action='/Copy/Bytes/OffsetHexText'/>\n"
2967 " <menuitem name='OffsetHex' action='/Copy/Bytes/OffsetHex'/>\n"
2968 " <menuitem name='PrintableTextOnly' action='/Copy/Bytes/PrintableTextOnly'/>\n"
2970 " <menuitem name='HexStream' action='/Copy/Bytes/HexStream'/>\n"
2971 " <menuitem name='BinaryStream' action='/Copy/Bytes/BinaryStream'/>\n"
2975 " <menuitem name='DecodeAs' action='/DecodeAs'/>\n"
2976 " <menuitem name='Print' action='/Print'/>\n"
2977 " <menuitem name='ShowPacketinNewWindow' action='/ShowPacketinNewWindow'/>\n"
2981 static const GtkActionEntry packet_list_menu_popup_action_entries[] = {
2982 { "/MarkPacket", NULL, "Mark Packet (toggle)", NULL, NULL, G_CALLBACK(new_packet_list_mark_frame_cb) },
2983 { "/IgnorePacket", NULL, "Ignore Packet (toggle)", NULL, NULL, G_CALLBACK(new_packet_list_ignore_frame_cb) },
2984 { "/Set Time Reference", WIRESHARK_STOCK_TIME, "Set Time Reference (toggle)", NULL, NULL, G_CALLBACK(packet_list_menu_set_ref_time_cb) },
2985 { "/ManuallyResolveAddress", NULL, "Manually Resolve Address", NULL, NULL, G_CALLBACK(manual_addr_resolv_dlg) },
2986 { "/Apply as Filter", NULL, "Apply as Filter", NULL, NULL, NULL },
2988 { "/Apply as Filter/Selected", NULL, "_Selected" , NULL, NULL, G_CALLBACK(packet_list_menu_apply_selected_cb) },
2989 { "/Apply as Filter/Not Selected", NULL, "_Not Selected", NULL, NULL, G_CALLBACK(packet_list_menu_apply_not_selected_cb) },
2990 { "/Apply as Filter/AndSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _and Selected", NULL, NULL, G_CALLBACK(packet_list_menu_apply_and_selected_cb) },
2991 { "/Apply as Filter/OrSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _or Selected", NULL, NULL, G_CALLBACK(packet_list_menu_apply_or_selected_cb) },
2992 { "/Apply as Filter/AndNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " a_nd not Selected", NULL, NULL, G_CALLBACK(packet_list_menu_apply_and_not_selected_cb) },
2993 { "/Apply as Filter/OrNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " o_r not Selected", NULL, NULL, G_CALLBACK(packet_list_menu_apply_or_not_selected_cb) },
2995 { "/Prepare a Filter", NULL, "Prepare a Filter", NULL, NULL, NULL },
2996 { "/Prepare a Filter/Selected", NULL, "_Selected" , NULL, NULL, G_CALLBACK(packet_list_menu_prepare_selected_cb) },
2997 { "/Prepare a Filter/Not Selected", NULL, "_Not Selected", NULL, NULL, G_CALLBACK(packet_list_menu_prepare_not_selected_cb) },
2998 { "/Prepare a Filter/AndSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _and Selected", NULL, NULL, G_CALLBACK(packet_list_menu_prepare_and_selected_cb) },
2999 { "/Prepare a Filter/OrSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _or Selected", NULL, NULL, G_CALLBACK(packet_list_menu_prepare_or_selected_cb) },
3000 { "/Prepare a Filter/AndNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " a_nd not Selected", NULL, NULL, G_CALLBACK(packet_list_menu_prepare_and_not_selected_cb) },
3001 { "/Prepare a Filter/OrNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " o_r not Selected", NULL, NULL, G_CALLBACK(packet_list_menu_prepare_or_not_selected_cb) },
3003 { "/Conversation Filter", NULL, "Conversation Filter", NULL, NULL, NULL },
3004 { "/Conversation Filter/Ethernet", NULL, "Ethernet", NULL, NULL, G_CALLBACK(packet_list_menu_conversation_ethernet_cb) },
3005 { "/Conversation Filter/IP", NULL, "IP", NULL, NULL, G_CALLBACK(packet_list_menu_conversation_ip_cb) },
3006 { "/Conversation Filter/TCP", NULL, "TCP", NULL, NULL, G_CALLBACK(packet_list_menu_conversation_tcp_cb) },
3007 { "/Conversation Filter/UDP", NULL, "UDP", NULL, NULL, G_CALLBACK(packet_list_menu_conversation_udp_cb) },
3008 { "/Conversation Filter/PN-CBA", NULL, "PN-CBA", NULL, NULL, G_CALLBACK(packet_list_menu_conversation_pn_cba_cb) },
3010 { "/Colorize Conversation", NULL, "Colorize Conversation", NULL, NULL, NULL },
3012 { "/Colorize Conversation/Ethernet", NULL, "Ethernet", NULL, NULL, NULL },
3014 { "/Colorize Conversation/Ethernet/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color1_cb) },
3015 { "/Colorize Conversation/Ethernet/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color2_cb) },
3016 { "/Colorize Conversation/Ethernet/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color3_cb) },
3017 { "/Colorize Conversation/Ethernet/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color4_cb) },
3018 { "/Colorize Conversation/Ethernet/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color5_cb) },
3019 { "/Colorize Conversation/Ethernet/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color6_cb) },
3020 { "/Colorize Conversation/Ethernet/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color7_cb) },
3021 { "/Colorize Conversation/Ethernet/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color8_cb) },
3022 { "/Colorize Conversation/Ethernet/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color9_cb) },
3023 { "/Colorize Conversation/Ethernet/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color10_cb) },
3024 { "/Colorize Conversation/Ethernet/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_new_rule_cb) },
3026 { "/Colorize Conversation/IP", NULL, "IP", NULL, NULL, NULL },
3028 { "/Colorize Conversation/IP/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color1_cb) },
3029 { "/Colorize Conversation/IP/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color2_cb) },
3030 { "/Colorize Conversation/IP/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color3_cb) },
3031 { "/Colorize Conversation/IP/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color4_cb) },
3032 { "/Colorize Conversation/IP/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color5_cb) },
3033 { "/Colorize Conversation/IP/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color6_cb) },
3034 { "/Colorize Conversation/IP/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color7_cb) },
3035 { "/Colorize Conversation/IP/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color8_cb) },
3036 { "/Colorize Conversation/IP/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color9_cb) },
3037 { "/Colorize Conversation/IP/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color10_cb) },
3038 { "/Colorize Conversation/IP/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_new_rule_cb) },
3040 { "/Colorize Conversation/TCP", NULL, "TCP", NULL, NULL, NULL },
3042 { "/Colorize Conversation/TCP/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color1_cb) },
3043 { "/Colorize Conversation/TCP/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color2_cb) },
3044 { "/Colorize Conversation/TCP/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color3_cb) },
3045 { "/Colorize Conversation/TCP/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color4_cb) },
3046 { "/Colorize Conversation/TCP/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color5_cb) },
3047 { "/Colorize Conversation/TCP/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color6_cb) },
3048 { "/Colorize Conversation/TCP/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color7_cb) },
3049 { "/Colorize Conversation/TCP/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color8_cb) },
3050 { "/Colorize Conversation/TCP/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color9_cb) },
3051 { "/Colorize Conversation/TCP/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color10_cb) },
3052 { "/Colorize Conversation/TCP/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_new_rule_cb) },
3054 { "/Colorize Conversation/UDP", NULL, "UDP", NULL, NULL, NULL },
3056 { "/Colorize Conversation/UDP/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color1_cb) },
3057 { "/Colorize Conversation/UDP/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color2_cb) },
3058 { "/Colorize Conversation/UDP/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color3_cb) },
3059 { "/Colorize Conversation/UDP/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color4_cb) },
3060 { "/Colorize Conversation/UDP/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color5_cb) },
3061 { "/Colorize Conversation/UDP/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color6_cb) },
3062 { "/Colorize Conversation/UDP/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color7_cb) },
3063 { "/Colorize Conversation/UDP/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color8_cb) },
3064 { "/Colorize Conversation/UDP/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color9_cb) },
3065 { "/Colorize Conversation/UDP/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color10_cb) },
3066 { "/Colorize Conversation/UDP/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_new_rule_cb) },
3068 { "/Colorize Conversation/PN-CBA", NULL, "PN-CBA Server", NULL, NULL, NULL },
3070 { "/Colorize Conversation/PN-CBA/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color1_cb) },
3071 { "/Colorize Conversation/PN-CBA/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color2_cb) },
3072 { "/Colorize Conversation/PN-CBA/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color3_cb) },
3073 { "/Colorize Conversation/PN-CBA/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color4_cb) },
3074 { "/Colorize Conversation/PN-CBA/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color5_cb) },
3075 { "/Colorize Conversation/PN-CBA/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color6_cb) },
3076 { "/Colorize Conversation/PN-CBA/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color7_cb) },
3077 { "/Colorize Conversation/PN-CBA/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color8_cb) },
3078 { "/Colorize Conversation/PN-CBA/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color9_cb) },
3079 { "/Colorize Conversation/PN-CBA/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color10_cb) },
3080 { "/Colorize Conversation/PN-CBA/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_new_rule_cb) },
3082 { "/SCTP", NULL, "SCTP", NULL, NULL, NULL },
3083 { "/SCTP/Analyse this Association", NULL, "Analyse this Association", NULL, NULL, G_CALLBACK(sctp_analyse_start) },
3084 { "/SCTP/Prepare Filter for this Association", NULL, "Prepare Filter for this Association", NULL, NULL, G_CALLBACK(sctp_set_assoc_filter) },
3087 { "/Follow TCP Stream", NULL, "Follow TCP Stream", NULL, NULL, G_CALLBACK(follow_tcp_stream_cb) },
3088 { "/Follow UDP Stream", NULL, "Follow UDP Stream", NULL, NULL, G_CALLBACK(follow_udp_stream_cb) },
3089 { "/Follow SSL Stream", NULL, "Follow SSL Stream", NULL, NULL, G_CALLBACK(follow_ssl_stream_cb) },
3091 { "/Copy", NULL, "Copy", NULL, NULL, NULL },
3092 { "/Copy/SummaryTxt", NULL, "Summary (Text)", NULL, NULL, G_CALLBACK(packet_list_menu_copy_sum_txt) },
3093 { "/Copy/SummaryCSV", NULL, "Summary (CSV)", NULL, NULL, G_CALLBACK(packet_list_menu_copy_sum_csv) },
3094 { "/Copy/AsFilter", NULL, "As Filter", NULL, NULL, G_CALLBACK(packet_list_menu_copy_as_flt) },
3097 { "/Copy/Bytes", NULL, "Bytes", NULL, NULL, NULL },
3098 { "/Copy/Bytes/OffsetHexText", NULL, "Offset Hex Text", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_oht_cb) },
3099 { "/Copy/Bytes/OffsetHex", NULL, "Offset Hex", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_oh_cb) },
3100 { "/Copy/Bytes/PrintableTextOnly", NULL, "Printable Text Only", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_text_cb) },
3102 { "/Copy/Bytes/HexStream", NULL, "Hex Stream", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_hex_strm_cb) },
3103 { "/Copy/Bytes/BinaryStream", NULL, "Binary Stream", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_bin_strm_cb) },
3105 { "/DecodeAs", WIRESHARK_STOCK_DECODE_AS, "Decode As...", NULL, NULL, G_CALLBACK(decode_as_cb) },
3106 { "/Print", GTK_STOCK_PRINT, "Print...", NULL, NULL, G_CALLBACK(file_print_selected_cmd_cb) },
3107 { "/ShowPacketinNewWindow", NULL, "Show Packet in New Window", NULL, NULL, G_CALLBACK(new_window_cb) },
3111 static const char *ui_desc_tree_view_menu_popup =
3113 " <popup name='TreeViewPopup' action='PopupAction'>\n"
3114 " <menuitem name='ExpandSubtrees' action='/ExpandSubtrees'/>\n"
3115 " <menuitem name='ExpandAll' action='/ExpandAll'/>\n"
3116 " <menuitem name='CollapseAll' action='/CollapseAll'/>\n"
3118 " <menuitem name='ApplyasColumn' action='/Apply as Column'/>\n"
3120 " <menu name= 'ApplyAsFilter' action='/Apply as Filter'>\n"
3121 " <menuitem name='Selected' action='/Apply as Filter/Selected'/>\n"
3122 " <menuitem name='NotSelected' action='/Apply as Filter/Not Selected'/>\n"
3123 " <menuitem name='AndSelected' action='/Apply as Filter/AndSelected'/>\n"
3124 " <menuitem name='OrSelected' action='/Apply as Filter/OrSelected'/>\n"
3125 " <menuitem name='AndNotSelected' action='/Apply as Filter/AndNotSelected'/>\n"
3126 " <menuitem name='OrNotSelected' action='/Apply as Filter/OrNotSelected'/>\n"
3128 " <menu name= 'PrepareaFilter' action='/Prepare a Filter'>\n"
3129 " <menuitem name='Selected' action='/Prepare a Filter/Selected'/>\n"
3130 " <menuitem name='NotSelected' action='/Prepare a Filter/Not Selected'/>\n"
3131 " <menuitem name='AndSelected' action='/Prepare a Filter/AndSelected'/>\n"
3132 " <menuitem name='OrSelected' action='/Prepare a Filter/OrSelected'/>\n"
3133 " <menuitem name='AndNotSelected' action='/Prepare a Filter/AndNotSelected'/>\n"
3134 " <menuitem name='OrNotSelected' action='/Prepare a Filter/OrNotSelected'/>\n"
3136 " <menu name= 'ColorizewithFilter' action='/Colorize with Filter'>\n"
3137 " <menuitem name='Color1' action='/Colorize with Filter/Color 1'/>\n"
3138 " <menuitem name='Color2' action='/Colorize with Filter/Color 2'/>\n"
3139 " <menuitem name='Color3' action='/Colorize with Filter/Color 3'/>\n"
3140 " <menuitem name='Color4' action='/Colorize with Filter/Color 4'/>\n"
3141 " <menuitem name='Color5' action='/Colorize with Filter/Color 5'/>\n"
3142 " <menuitem name='Color6' action='/Colorize with Filter/Color 6'/>\n"
3143 " <menuitem name='Color7' action='/Colorize with Filter/Color 7'/>\n"
3144 " <menuitem name='Color8' action='/Colorize with Filter/Color 8'/>\n"
3145 " <menuitem name='Color9' action='/Colorize with Filter/Color 9'/>\n"
3146 " <menuitem name='Color10' action='/Colorize with Filter/Color 10'/>\n"
3147 " <menuitem name='NewColoringRule' action='/Colorize with Filter/New Coloring Rule'/>\n"
3149 " <menuitem name='FollowTCPStream' action='/Follow TCP Stream'/>\n"
3150 " <menuitem name='FollowUDPStream' action='/Follow UDP Stream'/>\n"
3151 " <menuitem name='FollowSSLStream' action='/Follow SSL Stream'/>\n"
3153 " <menu name= 'Copy' action='/Copy'>\n"
3154 " <menuitem name='Description' action='/Copy/Description'/>\n"
3155 " <menuitem name='Fieldname' action='/Copy/Fieldname'/>\n"
3156 " <menuitem name='Value' action='/Copy/Value'/>\n"
3158 " <menuitem name='AsFilter' action='/Copy/AsFilter'/>\n"
3160 " <menu name= 'Bytes' action='/Copy/Bytes'>\n"
3161 " <menuitem name='OffsetHexText' action='/Copy/Bytes/OffsetHexText'/>\n"
3162 " <menuitem name='OffsetHex' action='/Copy/Bytes/OffsetHex'/>\n"
3163 " <menuitem name='PrintableTextOnly' action='/Copy/Bytes/PrintableTextOnly'/>\n"
3165 " <menuitem name='HexStream' action='/Copy/Bytes/HexStream'/>\n"
3166 " <menuitem name='BinaryStream' action='/Copy/Bytes/BinaryStream'/>\n"
3169 " <menuitem name='ExportSelectedPacketBytes' action='/ExportSelectedPacketBytes'/>\n"
3171 " <menuitem name='WikiProtocolPage' action='/WikiProtocolPage'/>\n"
3172 " <menuitem name='FilterFieldReference' action='/FilterFieldReference'/>\n"
3173 #if GLIB_CHECK_VERSION(2,14,0) /* GRegex */
3174 " <menuitem name='ProtocolHelp' action='/ProtocolHelp'/>\n"
3175 #endif /* GLIB_CHECK_VERSION(2,14,0) */
3176 " <menuitem name='ProtocolPreferences' action='/ProtocolPreferences'/>\n"
3178 " <menuitem name='DecodeAs' action='/DecodeAs'/>\n"
3179 " <menuitem name='DisableProtocol' action='/DisableProtocol'/>\n"
3180 " <menuitem name='ResolveName' action='/ResolveName'/>\n"
3181 " <menuitem name='GotoCorrespondingPacket' action='/GotoCorrespondingPacket'/>\n"
3185 static const GtkActionEntry tree_view_menu_popup_action_entries[] = {
3186 { "/ExpandSubtrees", NULL, "Expand Subtrees", NULL, NULL, G_CALLBACK(expand_tree_cb) },
3187 { "/ExpandAll", NULL, "Expand All", NULL, NULL, G_CALLBACK(expand_all_cb) },
3188 { "/CollapseAll", NULL, "Collapse All", NULL, NULL, G_CALLBACK(collapse_all_cb) },
3189 { "/Apply as Column", NULL, "Apply as Column", NULL, NULL, G_CALLBACK(apply_as_custom_column_cb) },
3190 { "/Apply as Filter", NULL, "Apply as Filter", NULL, NULL, NULL },
3192 { "/Apply as Filter/Selected", NULL, "_Selected" , NULL, NULL, G_CALLBACK(tree_view_menu_apply_selected_cb) },
3193 { "/Apply as Filter/Not Selected", NULL, "_Not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_not_selected_cb) },
3194 { "/Apply as Filter/AndSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _and Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_and_selected_cb) },
3195 { "/Apply as Filter/OrSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _or Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_or_selected_cb) },
3196 { "/Apply as Filter/AndNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " a_nd not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_and_not_selected_cb) },
3197 { "/Apply as Filter/OrNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " o_r not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_or_not_selected_cb) },
3199 { "/Prepare a Filter", NULL, "Prepare a Filter", NULL, NULL, NULL },
3200 { "/Prepare a Filter/Selected", NULL, "_Selected" , NULL, NULL, G_CALLBACK(tree_view_menu_prepare_selected_cb) },
3201 { "/Prepare a Filter/Not Selected", NULL, "_Not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_not_selected_cb) },
3202 { "/Prepare a Filter/AndSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _and Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_and_selected_cb) },
3203 { "/Prepare a Filter/OrSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _or Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_or_selected_cb) },
3204 { "/Prepare a Filter/AndNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " a_nd not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_and_not_selected_cb) },
3205 { "/Prepare a Filter/OrNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " o_r not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_or_not_selected_cb) },
3207 { "/Colorize with Filter", NULL, "Colorize with Filter", NULL, NULL, NULL },
3208 { "/Colorize with Filter/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color1_cb) },
3209 { "/Colorize with Filter/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color2_cb) },
3210 { "/Colorize with Filter/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color3_cb) },
3211 { "/Colorize with Filter/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color4_cb) },
3212 { "/Colorize with Filter/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color5_cb) },
3213 { "/Colorize with Filter/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color6_cb) },
3214 { "/Colorize with Filter/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color7_cb) },
3215 { "/Colorize with Filter/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color8_cb) },
3216 { "/Colorize with Filter/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color9_cb) },
3217 { "/Colorize with Filter/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color10_cb) },
3218 { "/Colorize with Filter/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_new_rule_cb) },
3220 { "/Follow TCP Stream", NULL, "Follow TCP Stream", NULL, NULL, G_CALLBACK(follow_tcp_stream_cb) },
3221 { "/Follow UDP Stream", NULL, "Follow UDP Stream", NULL, NULL, G_CALLBACK(follow_udp_stream_cb) },
3222 { "/Follow SSL Stream", NULL, "Follow SSL Stream", NULL, NULL, G_CALLBACK(follow_ssl_stream_cb) },
3224 { "/Copy", NULL, "Copy", NULL, NULL, NULL },
3225 { "/Copy/Description", NULL, "Description", NULL, NULL, G_CALLBACK(tree_view_menu_copy_desc) },
3226 { "/Copy/Fieldname", NULL, "Fieldname", NULL, NULL, G_CALLBACK(tree_view_menu_copy_field) },
3227 { "/Copy/Value", NULL, "Value", NULL, NULL, G_CALLBACK(tree_view_menu_copy_value) },
3229 { "/Copy/AsFilter", NULL, "As Filter", NULL, NULL, G_CALLBACK(tree_view_menu_copy_as_flt) },
3231 { "/Copy/Bytes", NULL, "Bytes", NULL, NULL, NULL },
3232 { "/Copy/Bytes/OffsetHexText", NULL, "Offset Hex Text", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_oht_cb) },
3233 { "/Copy/Bytes/OffsetHex", NULL, "Offset Hex", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_oh_cb) },
3234 { "/Copy/Bytes/PrintableTextOnly", NULL, "Printable Text Only", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_text_cb) },
3236 { "/Copy/Bytes/HexStream", NULL, "Hex Stream", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_hex_strm_cb) },
3237 { "/Copy/Bytes/BinaryStream", NULL, "Binary Stream", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_bin_strm_cb) },
3239 { "/ExportSelectedPacketBytes", NULL, "Export Selected Packet Bytes...", NULL, NULL, G_CALLBACK(savehex_cb) },
3241 { "/WikiProtocolPage", WIRESHARK_STOCK_WIKI, "Wiki Protocol Page", NULL, NULL, G_CALLBACK(selected_ptree_info_cb) },
3242 { "/FilterFieldReference", WIRESHARK_STOCK_INTERNET, "Filter Field Reference", NULL, NULL, G_CALLBACK(selected_ptree_ref_cb) },
3243 #if GLIB_CHECK_VERSION(2,14,0) /* GRegex */
3244 { "/ProtocolHelp", NULL, "Protocol Help", NULL, NULL, NULL },
3245 #endif /* GLIB_CHECK_VERSION(2,14,0) */
3246 { "/ProtocolPreferences", NULL, "Protocol Preferences", NULL, NULL, NULL },
3247 { "/DecodeAs", WIRESHARK_STOCK_DECODE_AS, "Decode As...", NULL, NULL, G_CALLBACK(decode_as_cb) },
3248 { "/DisableProtocol", WIRESHARK_STOCK_CHECKBOX, "Disable Protocol...", NULL, NULL, G_CALLBACK(proto_disable_cb) },
3249 { "/ResolveName", NULL, "_Resolve Name", NULL, NULL, G_CALLBACK(resolve_name_cb) },
3250 { "/GotoCorrespondingPacket", NULL, "_Go to Corresponding Packet", NULL, NULL, G_CALLBACK(goto_framenum_cb) },
3253 static const char *ui_desc_bytes_menu_popup =
3255 " <popup name='BytesMenuPopup' action='PopupAction'>\n"
3256 " <menuitem name='HexView' action='/HexView'/>\n"
3257 " <menuitem name='BitsView' action='/BitsView'/>\n"
3260 static const GtkRadioActionEntry bytes_menu_radio_action_entries [] =
3262 /* name, stock id, label, accel, tooltip, value */
3263 { "/HexView", NULL, "Hex View", NULL, NULL, BYTES_HEX },
3264 { "/BitsView", NULL, "Bits View", NULL, NULL, BYTES_BITS },
3267 static const char *ui_statusbar_profiles_menu_popup =
3269 " <popup name='ProfilesMenuPopup' action='PopupAction'>\n"
3270 " <menuitem name='Profiles' action='/Profiles'/>\n"
3272 " <menuitem name='New' action='/New'/>\n"
3273 " <menuitem name='Copy' action='/Copy'/>\n"
3274 " <menuitem name='Delete' action='/Delete'/>\n"
3275 " <menuitem name='Rename' action='/Rename'/>\n"
3277 " <menu name='Change' action='/Change'>\n"
3278 " <menuitem name='Default' action='/Change/Default'/>\n"
3282 static const GtkActionEntry statusbar_profiles_menu_action_entries [] =
3284 { "/Profiles", NULL, "Configuration Profiles...", NULL, NULL, G_CALLBACK(profile_dialog_cb) },
3285 { "/New", GTK_STOCK_NEW, "New...", NULL, NULL, G_CALLBACK(profile_new_cb) },
3286 { "/Copy", GTK_STOCK_COPY, "Copy...", NULL, NULL, G_CALLBACK(profile_copy_cb) },
3287 { "/Delete", GTK_STOCK_DELETE, "Delete", NULL, NULL, G_CALLBACK(profile_delete_cb) },
3288 #if GLIB_CHECK_VERSION(2,6,0)
3289 { "/Rename", GTK_STOCK_EDIT, "Rename...", NULL, NULL, G_CALLBACK(profile_rename_cb) },
3291 { "/Rename", NULL, "Rename...", NULL, NULL, G_CALLBACK(profile_rename_cb) },
3293 { "/Change", NULL, "Change", NULL, NULL, NULL },
3294 { "/Change/Default", NULL, "Default", NULL, NULL, NULL },
3298 main_menu_new(GtkAccelGroup ** table) {
3300 #ifdef HAVE_IGE_MAC_INTEGRATION
3301 GtkWidget *quit_item, *about_item, *preferences_item;
3302 IgeMacMenuGroup *group;
3304 #ifdef HAVE_GTKOSXAPPLICATION
3305 GtkOSXApplication *theApp;
3307 GtkOSXApplicationMenuGroup *group;
3308 GtkWidget * dock_menu;
3311 grp = gtk_accel_group_new();
3316 #ifdef MAIN_MENU_USE_UIMANAGER
3317 menubar = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar");
3319 menubar = main_menu_factory->widget;
3321 #ifdef HAVE_IGE_MAC_INTEGRATION
3322 if(prefs.gui_macosx_style) {
3323 ige_mac_menu_set_menu_bar(GTK_MENU_SHELL(menubar));
3324 ige_mac_menu_set_global_key_handler_enabled(TRUE);
3326 /* Create menu items to populate the application menu with. We have to
3327 * do this because we are still using the old GtkItemFactory API for
3329 group = ige_mac_menu_add_app_menu_group();
3330 about_item = gtk_menu_item_new_with_label("About");
3331 g_signal_connect(about_item, "activate", G_CALLBACK(about_wireshark_cb),
3333 ige_mac_menu_add_app_menu_item(group, GTK_MENU_ITEM(about_item), NULL);
3335 group = ige_mac_menu_add_app_menu_group();
3336 preferences_item = gtk_menu_item_new_with_label("Preferences");
3337 g_signal_connect(preferences_item, "activate", G_CALLBACK(prefs_cb),
3339 ige_mac_menu_add_app_menu_item(group, GTK_MENU_ITEM(preferences_item),
3343 /* The quit item in the application menu shows up whenever ige mac
3344 * integration is enabled, even if the OS X UI style in Wireshark isn't
3346 quit_item = gtk_menu_item_new_with_label("Quit");
3347 g_signal_connect(quit_item, "activate", G_CALLBACK(file_quit_cmd_cb), NULL);
3348 ige_mac_menu_set_quit_menu_item(GTK_MENU_ITEM(quit_item));
3351 #ifdef HAVE_GTKOSXAPPLICATION
3352 theApp = g_object_new(GTK_TYPE_OSX_APPLICATION, NULL);
3354 if(prefs.gui_macosx_style) {
3355 gtk_osxapplication_set_menu_bar(theApp, GTK_MENU_SHELL(menubar));
3356 gtk_osxapplication_set_use_quartz_accelerators(theApp, TRUE);
3358 group = gtk_osxapplication_add_app_menu_group (theApp);
3359 item = gtk_item_factory_get_item(main_menu_factory,"/Help/About Wireshark");
3360 gtk_osxapplication_add_app_menu_item(theApp, group,GTK_MENU_ITEM (item));
3362 group = gtk_osxapplication_add_app_menu_group (theApp);
3363 item = gtk_item_factory_get_item(main_menu_factory,"/Edit/Preferences...");
3364 gtk_osxapplication_add_app_menu_item(theApp, group,GTK_MENU_ITEM (item));
3366 group = gtk_osxapplication_add_app_menu_group (theApp);
3367 item = gtk_item_factory_get_item(main_menu_factory,"/Help");
3368 gtk_osxapplication_set_help_menu(theApp,GTK_MENU_ITEM(item));
3370 /* Quit item is not needed */
3371 gtk_item_factory_delete_item(main_menu_factory,"/File/Quit");
3374 /* generate dock menu */
3375 dock_menu = gtk_menu_new();
3377 item = gtk_menu_item_new_with_label("Start");
3378 g_signal_connect(item, "activate", G_CALLBACK (capture_start_cb), NULL);
3379 gtk_menu_shell_append(GTK_MENU_SHELL(dock_menu), item);
3381 item = gtk_menu_item_new_with_label("Stop");
3382 g_signal_connect(item, "activate", G_CALLBACK (capture_stop_cb), NULL);
3383 gtk_menu_shell_append(GTK_MENU_SHELL(dock_menu), item);
3385 item = gtk_menu_item_new_with_label("Restart");
3386 g_signal_connect(item, "activate", G_CALLBACK (capture_restart_cb), NULL);
3387 gtk_menu_shell_append(GTK_MENU_SHELL(dock_menu), item);
3389 gtk_osxapplication_set_dock_menu(theApp, GTK_MENU_SHELL(dock_menu));
3399 void menu_dissector_filter_cb( GtkWidget *widget _U_,
3400 gpointer callback_data,
3401 guint callback_action _U_)
3403 dissector_filter_t *filter_entry = callback_data;
3404 GtkWidget *filter_te;
3407 filter_te = gtk_bin_get_child(GTK_BIN(g_object_get_data(G_OBJECT(top_level), E_DFILTER_CM_KEY)));
3409 /* XXX - this gets the packet_info of the last dissected packet, */
3410 /* which is not necessarily the last selected packet */
3411 /* e.g. "Update list of packets in real time" won't work correct */
3412 buf = filter_entry->build_filter_string(&cfile.edt->pi);
3414 gtk_entry_set_text(GTK_ENTRY(filter_te), buf);
3416 /* Run the display filter so it goes in effect - even if it's the
3417 same as the previous display filter. */
3418 main_filter_packets(&cfile, buf, TRUE);
3420 g_free( (void *) buf);
3423 gboolean menu_dissector_filter_spe_cb(frame_data *fd _U_, epan_dissect_t *edt, gpointer callback_data) {
3424 dissector_filter_t *filter_entry = callback_data;
3426 /* XXX - this gets the packet_info of the last dissected packet, */
3427 /* which is not necessarily the last selected packet */
3428 /* e.g. "Update list of packets in real time" won't work correct */
3429 return (edt != NULL) ? filter_entry->is_filter_valid(&edt->pi) : FALSE;
3432 void menu_dissector_filter(void) {
3433 GList *list_entry = dissector_filter_list;
3434 dissector_filter_t *filter_entry;
3436 while(list_entry != NULL) {
3437 filter_entry = list_entry->data;
3439 register_stat_menu_item(filter_entry->name, REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER,
3440 menu_dissector_filter_cb,
3441 menu_dissector_filter_spe_cb,
3442 NULL /* selected_tree_row_enabled */,
3445 list_entry = g_list_next(list_entry);
3452 GtkActionGroup *packet_list_heading_action_group, *packet_list_action_group,
3453 *packet_list_details_action_group, *packet_list_byte_menu_action_group,
3454 *statusbar_profiles_action_group;
3455 GError *error = NULL;
3456 #ifdef MAIN_MENU_USE_UIMANAGER
3458 #endif /* MAIN_MENU_USE_UIMANAGER */
3464 popup_menu_object = gtk_menu_new();
3466 /* packet list heading pop-up menu */
3467 packet_list_heading_action_group = gtk_action_group_new ("PacketListHeadingPopUpMenuActionGroup");
3469 gtk_action_group_add_actions (packet_list_heading_action_group, /* the action group */
3470 packet_list_heading_menu_popup_action_entries, /* an array of action descriptions */
3471 G_N_ELEMENTS(packet_list_heading_menu_popup_action_entries), /* the number of entries */
3472 popup_menu_object); /* data to pass to the action callbacks */
3474 gtk_action_group_add_toggle_actions(packet_list_heading_action_group, /* the action group */
3475 packet_list_heading_menu_toggle_action_entries, /* an array of action descriptions */
3476 G_N_ELEMENTS(packet_list_heading_menu_toggle_action_entries), /* the number of entries */
3477 NULL); /* data to pass to the action callbacks */
3479 ui_manager_packet_list_heading = gtk_ui_manager_new ();
3480 gtk_ui_manager_insert_action_group (ui_manager_packet_list_heading,
3481 packet_list_heading_action_group,
3482 0); /* the position at which the group will be inserted. */
3484 gtk_ui_manager_add_ui_from_string (ui_manager_packet_list_heading,ui_desc_packet_list_heading_menu_popup, -1, &error);
3487 fprintf (stderr, "Warning: building Packet List Heading Pop-Up failed: %s\n",
3489 g_error_free (error);
3493 g_object_set_data(G_OBJECT(popup_menu_object), PM_PACKET_LIST_COL_KEY,
3494 gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup"));
3496 popup_menu_list = g_slist_append((GSList *)popup_menu_list, ui_manager_packet_list_heading);
3498 /* packet list pop-up menu */
3499 packet_list_action_group = gtk_action_group_new ("PacketListPopUpMenuActionGroup");
3501 gtk_action_group_add_actions (packet_list_action_group, /* the action group */
3502 packet_list_menu_popup_action_entries, /* an array of action descriptions */
3503 G_N_ELEMENTS(packet_list_menu_popup_action_entries), /* the number of entries */
3504 popup_menu_object); /* data to pass to the action callbacks */
3506 ui_manager_packet_list_menu = gtk_ui_manager_new ();
3508 gtk_ui_manager_insert_action_group (ui_manager_packet_list_menu,
3509 packet_list_action_group,
3510 0); /* the position at which the group will be inserted. */
3512 gtk_ui_manager_add_ui_from_string (ui_manager_packet_list_menu, ui_desc_packet_list_menu_popup, -1, &error);
3515 fprintf (stderr, "Warning: building Packet List Pop-Up menu failed: %s\n",
3517 g_error_free (error);
3521 g_object_set_data(G_OBJECT(popup_menu_object), PM_PACKET_LIST_KEY,
3522 gtk_ui_manager_get_widget(ui_manager_packet_list_menu, "/PacketListMenuPopup"));
3524 popup_menu_list = g_slist_append((GSList *)popup_menu_list, ui_manager_packet_list_menu);
3527 /* packet detail pop-up menu */
3528 packet_list_details_action_group = gtk_action_group_new ("PacketListDetailsMenuPopUpActionGroup");
3530 gtk_action_group_add_actions (packet_list_details_action_group, /* the action group */
3531 tree_view_menu_popup_action_entries, /* an array of action descriptions */
3532 G_N_ELEMENTS(tree_view_menu_popup_action_entries), /* the number of entries */
3533 popup_menu_object); /* data to pass to the action callbacks */
3535 ui_manager_tree_view_menu = gtk_ui_manager_new ();
3537 gtk_ui_manager_insert_action_group (ui_manager_tree_view_menu,
3538 packet_list_details_action_group,
3539 0); /* the position at which the group will be inserted. */
3541 gtk_ui_manager_add_ui_from_string (ui_manager_tree_view_menu, ui_desc_tree_view_menu_popup, -1, &error);
3544 fprintf (stderr, "Warning: building TreeWiew Pop-Up menu failed: %s\n",
3546 g_error_free (error);
3550 g_object_set_data(G_OBJECT(popup_menu_object), PM_TREE_VIEW_KEY,
3551 gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup"));
3553 popup_menu_list = g_slist_append((GSList *)popup_menu_list, ui_manager_tree_view_menu);
3556 * Hex dump pop-up menu.
3557 * We provide our own empty menu to suppress the default pop-up menu
3560 packet_list_byte_menu_action_group = gtk_action_group_new ("PacketListByteMenuPopUpActionGroup");
3563 gtk_action_group_add_radio_actions (packet_list_byte_menu_action_group, /* the action group */
3564 bytes_menu_radio_action_entries, /* an array of radio action descriptions */
3565 G_N_ELEMENTS(bytes_menu_radio_action_entries), /* the number of entries */
3566 recent.gui_bytes_view, /* the value of the action to activate initially, or -1 if no action should be activated */
3567 G_CALLBACK(select_bytes_view_cb), /* the callback to connect to the changed signal */
3568 popup_menu_object); /* data to pass to the action callbacks */
3570 ui_manager_bytes_menu = gtk_ui_manager_new ();
3572 gtk_ui_manager_insert_action_group (ui_manager_bytes_menu,
3573 packet_list_byte_menu_action_group,
3574 0); /* the position at which the group will be inserted. */
3576 gtk_ui_manager_add_ui_from_string (ui_manager_bytes_menu, ui_desc_bytes_menu_popup, -1, &error);
3579 fprintf (stderr, "Warning: building Bytes Pop-Up menu failed: %s\n",
3581 g_error_free (error);
3585 g_object_unref(packet_list_byte_menu_action_group);
3587 g_object_set_data(G_OBJECT(popup_menu_object), PM_BYTES_VIEW_KEY,
3588 gtk_ui_manager_get_widget(ui_manager_bytes_menu, "/BytesMenuPopup"));
3590 popup_menu_list = g_slist_append((GSList *)popup_menu_list, ui_manager_bytes_menu);
3593 #ifdef MAIN_MENU_USE_UIMANAGER
3594 main_menu_bar_action_group = gtk_action_group_new ("MenuActionGroup");
3595 gtk_action_group_add_actions (main_menu_bar_action_group, /* the action group */
3596 main_menu_bar_entries, /* an array of action descriptions */
3597 G_N_ELEMENTS(main_menu_bar_entries), /* the number of entries */
3598 NULL); /* data to pass to the action callbacks */
3600 gtk_action_group_add_toggle_actions(main_menu_bar_action_group, /* the action group */
3601 main_menu_bar_toggle_action_entries, /* an array of action descriptions */
3602 G_N_ELEMENTS(main_menu_bar_toggle_action_entries), /* the number of entries */
3603 NULL); /* data to pass to the action callbacks */
3605 gtk_action_group_add_radio_actions (main_menu_bar_action_group, /* the action group */
3606 main_menu_bar_radio_view_time_entries, /* an array of radio action descriptions */
3607 G_N_ELEMENTS(main_menu_bar_radio_view_time_entries), /* the number of entries */
3608 recent.gui_time_format, /* the value of the action to activate initially, or -1 if no action should be activated */
3609 G_CALLBACK(timestamp_format_new_cb), /* the callback to connect to the changed signal */
3610 NULL); /* data to pass to the action callbacks */
3612 gtk_action_group_add_radio_actions (main_menu_bar_action_group, /* the action group */
3613 main_menu_bar_radio_view_time_fileformat_prec_entries, /* an array of radio action descriptions */
3614 G_N_ELEMENTS(main_menu_bar_radio_view_time_fileformat_prec_entries), /* the number of entries */
3615 recent.gui_time_precision, /* the value of the action to activate initially, or -1 if no action should be activated */
3616 G_CALLBACK(timestamp_precision_new_cb), /* the callback to connect to the changed signal */
3617 NULL); /* data to pass to the action callbacks */
3621 ui_manager_main_menubar = gtk_ui_manager_new ();
3622 gtk_ui_manager_insert_action_group (ui_manager_main_menubar, main_menu_bar_action_group, 0);
3623 gtk_ui_manager_add_ui_from_string (ui_manager_main_menubar,ui_desc_menubar, -1, &error);
3626 fprintf (stderr, "Warning: building main menubar failed: %s\n",
3628 g_error_free (error);
3631 g_object_unref(main_menu_bar_action_group);
3632 gtk_window_add_accel_group (GTK_WINDOW(top_level),
3633 gtk_ui_manager_get_accel_group(ui_manager_main_menubar));
3637 /* Add the recent files items to the menu
3638 * use place holders and
3639 * gtk_ui_manager_add_ui().
3641 merge_id = gtk_ui_manager_new_merge_id (ui_manager_main_menubar);
3642 add_recent_items (merge_id, ui_manager_main_menubar);
3643 #else /* MAIN_MENU_USE_UIMANAGER */
3644 main_menu_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", grp);
3645 gtk_item_factory_create_items_ac(main_menu_factory, nmenu_items, menu_items, NULL, 2);
3646 #endif /* MAIN_MENU_USE_UIMANAGER */
3648 statusbar_profiles_action_group = gtk_action_group_new ("StatusBarProfilesPopUpMenuActionGroup");
3650 gtk_action_group_add_actions (statusbar_profiles_action_group, /* the action group */
3651 statusbar_profiles_menu_action_entries, /* an array of action descriptions */
3652 G_N_ELEMENTS(statusbar_profiles_menu_action_entries), /* the number of entries */
3653 popup_menu_object); /* data to pass to the action callbacks */
3655 ui_manager_statusbar_profiles_menu = gtk_ui_manager_new ();
3656 gtk_ui_manager_insert_action_group (ui_manager_statusbar_profiles_menu,
3657 statusbar_profiles_action_group,
3658 0); /* the position at which the group will be inserted. */
3660 gtk_ui_manager_add_ui_from_string (ui_manager_statusbar_profiles_menu,ui_statusbar_profiles_menu_popup, -1, &error);
3663 fprintf (stderr, "Warning: building Statusbar Profiles Pop-Up failed: %s\n",
3665 g_error_free (error);
3669 g_object_unref(statusbar_profiles_action_group);
3671 g_object_set_data(G_OBJECT(popup_menu_object), PM_STATUSBAR_PROFILES_KEY,
3672 gtk_ui_manager_get_widget(ui_manager_statusbar_profiles_menu, "/ProfilesMenuPopup"));
3674 popup_menu_list = g_slist_append((GSList *)popup_menu_list, ui_manager_statusbar_profiles_menu);
3676 menu_dissector_filter();
3677 merge_all_tap_menus(tap_menu_tree_root);
3679 /* Initialize enabled/disabled state of menu items */
3680 set_menus_for_capture_file(NULL);
3682 /* Un-#if this when we actually implement Cut/Copy/Paste.
3683 Then make sure you enable them when they can be done. */
3684 set_menu_sensitivity_old("/Edit/Cut", FALSE);
3685 set_menu_sensitivity_old("/Edit/Copy", FALSE);
3686 set_menu_sensitivity_old("/Edit/Paste", FALSE);
3689 set_menus_for_captured_packets(FALSE);
3690 set_menus_for_selected_packet(&cfile);
3691 set_menus_for_selected_tree_row(&cfile);
3692 set_menus_for_capture_in_progress(FALSE);
3693 set_menus_for_file_set(/* dialog */TRUE, /* previous file */ FALSE, /* next_file */ FALSE);
3695 #ifndef MAIN_MENU_USE_UIMANAGER
3696 /* Init with an empty recent files list */
3697 clear_menu_recent_capture_file_cmd_cb(NULL, NULL);
3698 #endif /* MAIN_MENU_USE_UIMANAGER */
3699 /* Protocol help links */
3700 proto_help_menu_init(gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup"));
3705 static gint tap_menu_item_add_compare(gconstpointer a, gconstpointer b)
3708 ((const menu_item_t *) a)->name,
3709 ((const menu_item_t *) b)->name);
3713 /* add a menuitem below the current node */
3714 static GList * tap_menu_item_add(
3718 const char *stock_id,
3719 GtkItemFactoryCallback callback,
3720 gboolean (*selected_packet_enabled)(frame_data *, epan_dissect_t *, gpointer callback_data),
3721 gboolean (*selected_tree_row_enabled)(field_info *, gpointer callback_data),
3722 gpointer callback_data,
3729 child = g_malloc(sizeof (menu_item_t));
3731 child->group = group;
3732 child->label = label;
3733 child->stock_id = stock_id;
3734 child->callback = callback;
3735 child->selected_packet_enabled = selected_packet_enabled;
3736 child->selected_tree_row_enabled = selected_tree_row_enabled;
3737 child->callback_data = callback_data;
3738 child->enabled = FALSE;
3739 child->children = NULL;
3741 /* insert the new child node into the parent */
3742 curr = curnode->data;
3743 curr->children = g_list_insert_sorted(curr->children, child, tap_menu_item_add_compare);
3745 /* return the new node */
3746 /* XXX: improve this */
3747 return g_list_find(curr->children, child);
3751 * Add a new menu item for a tap.
3752 * This must be called after we've created the main menu, so it can't
3753 * be called from the routine that registers taps - we have to introduce
3754 * another per-tap registration routine.
3756 * "callback" gets called when the menu item is selected; it should do
3757 * the work of creating the tap window.
3759 * "selected_packet_enabled" gets called by "set_menus_for_selected_packet()";
3760 * it's passed a Boolean that's TRUE if a packet is selected and FALSE
3761 * otherwise, and should return TRUE if the tap will work now (which
3762 * might depend on whether a packet is selected and, if one is, on the
3763 * packet) and FALSE if not.
3765 * "selected_tree_row_enabled" gets called by
3766 * "set_menus_for_selected_tree_row()"; it's passed a Boolean that's TRUE if
3767 * a protocol tree row is selected and FALSE otherwise, and should return
3768 * TRUE if the tap will work now (which might depend on whether a tree row
3769 * is selected and, if one is, on the tree row) and FALSE if not.
3773 register_stat_menu_item_stock(
3775 register_stat_group_t group,
3776 const char *stock_id,
3777 GtkItemFactoryCallback callback,
3778 gboolean (*selected_packet_enabled)(frame_data *, epan_dissect_t *, gpointer callback_data),
3779 gboolean (*selected_tree_row_enabled)(field_info *, gpointer callback_data),
3780 gpointer callback_data)
3782 /*static const char toolspath[] = "/Statistics/";*/
3783 const char *toolspath;
3792 * The menu path must be relative.
3794 g_assert(*name != '/');
3795 #ifdef MAIN_MENU_USE_UIMANAGER
3797 case(REGISTER_STAT_GROUP_GENERIC): toolspath = "/Statistics/"; break;
3798 case(REGISTER_STAT_GROUP_CONVERSATION_LIST): toolspath = "/Statistics/ConversationList/"; break;
3799 case(REGISTER_STAT_GROUP_ENDPOINT_LIST): toolspath = "/Statistics/EndpointList/"; break;
3800 case(REGISTER_STAT_GROUP_RESPONSE_TIME): toolspath = "/Statistics/ServiceResponseTime/"; break;
3801 case(REGISTER_STAT_GROUP_UNSORTED): toolspath = "/Statistics/"; break;
3802 case(REGISTER_ANALYZE_GROUP_UNSORTED): toolspath = "/Analyze/"; break;
3803 case(REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER): toolspath = "Analyze/ConversationFilter/"; break;
3804 case(REGISTER_STAT_GROUP_TELEPHONY): toolspath = "/Telephony/"; break;
3805 case(REGISTER_TOOLS_GROUP_UNSORTED): toolspath = "/Tools/"; break;
3807 g_assert(!"no such menu group");
3812 case(REGISTER_STAT_GROUP_GENERIC): toolspath = "/Statistics/"; break;
3813 case(REGISTER_STAT_GROUP_CONVERSATION_LIST): toolspath = "/Statistics/_Conversation List/"; break;
3814 case(REGISTER_STAT_GROUP_ENDPOINT_LIST): toolspath = "/Statistics/_Endpoint List/"; break;
3815 case(REGISTER_STAT_GROUP_RESPONSE_TIME): toolspath = "/Statistics/Service _Response Time/"; break;
3816 case(REGISTER_STAT_GROUP_UNSORTED): toolspath = "/Statistics/"; break;
3817 case(REGISTER_ANALYZE_GROUP_UNSORTED): toolspath = "/Analyze/"; break;
3818 case(REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER): toolspath = "/Analyze/Conversation Filter/"; break;
3819 case(REGISTER_STAT_GROUP_TELEPHONY): toolspath = "/Telephony/"; break;
3820 case(REGISTER_TOOLS_GROUP_UNSORTED): toolspath = "/Tools/"; break;
3822 g_assert(!"no such menu group");
3826 /* add the (empty) root node, if not already done */
3827 if(tap_menu_tree_root == NULL) {
3828 child = g_malloc0(sizeof (menu_item_t));
3829 tap_menu_tree_root = g_list_append(NULL, child);
3833 * Create any submenus required.
3835 curnode = tap_menu_tree_root;
3837 while ((p = strchr(p, '/')) != NULL) {
3839 * OK, everything between "name" and "p" is
3840 * a menu relative subtree into which the menu item
3843 * Construct the absolute path name of that subtree.
3845 menupathlen = strlen(toolspath) + 1 + (p - name);
3846 menupath = g_malloc(menupathlen);
3847 g_strlcpy(menupath, toolspath, menupathlen);
3848 g_strlcat(menupath, name, menupathlen);
3851 * Does there exist an entry with that path at this
3852 * level of the Analyze menu tree?
3854 child = curnode->data;
3855 for (childnode = child->children; childnode != NULL; childnode = childnode->next) {
3856 child = childnode->data;
3857 if (strcmp(child->name, menupath) == 0)
3860 if (childnode == NULL) {
3862 * No. Create such an item as a subtree, and
3863 * add it to the Tools menu tree.
3865 childnode = tap_menu_item_add(
3866 menupath, group, name, "", NULL, NULL ,NULL, NULL, curnode);
3869 * Yes. We don't need this "menupath" any longer.
3873 curnode = childnode;
3876 * Skip over the '/' we found.
3882 * Construct the main menu path for the menu item.
3884 menupathlen = strlen(toolspath) + 1 + strlen(name);
3885 menupath = g_malloc(menupathlen);
3886 g_strlcpy(menupath, toolspath, menupathlen);
3887 g_strlcat(menupath, name, menupathlen);
3890 * Construct an item factory entry for the item, and add it to
3894 menupath, group, name, stock_id, callback,
3895 selected_packet_enabled, selected_tree_row_enabled,
3896 callback_data, curnode);
3900 * Add a new menu item for a stat.
3901 * This must be called after we've created the main menu, so it can't
3902 * be called from the routine that registers stats - we have to introduce
3903 * another per-stat registration routine.
3905 * @param name the menu label
3907 * @param group the menu group this stat should be registered to
3909 * @param callback gets called when the menu item is selected; it should do
3910 * the work of creating the stat window.
3912 * @param selected_packet_enabled gets called by set_menus_for_selected_packet();
3913 * it's passed a pointer to the "frame_data" structure for the current frame,
3914 * if any, and to the "epan_dissect_t" structure for that frame, if any, and
3915 * should return TRUE if the stat will work now (which might depend on whether
3916 * a frame is selected and, if one is, on the frame) and FALSE if not.
3918 * @param selected_tree_row_enabled gets called by
3919 * set_menus_for_selected_tree_row(); it's passed a pointer to the
3920 * "field_info" structure for the currently selected field, if any,
3921 * and should return TRUE if the stat will work now (which might depend on
3922 * whether a tree row is selected and, if one is, on the tree row) and
3925 * @param callback_data data for callback function
3928 register_stat_menu_item(
3930 register_stat_group_t group,
3931 GtkItemFactoryCallback callback,
3932 gboolean (*selected_packet_enabled)(frame_data *, epan_dissect_t *, gpointer callback_data),
3933 gboolean (*selected_tree_row_enabled)(field_info *, gpointer callback_data),
3934 gpointer callback_data)
3936 register_stat_menu_item_stock(
3941 selected_packet_enabled,
3942 selected_tree_row_enabled,
3946 #ifdef MAIN_MENU_USE_UIMANAGER
3947 static guint merge_tap_menus_layered(GList *node, gint group) {
3948 GtkItemFactoryEntry *entry;
3954 GtkActionGroup *action_group;
3957 menu_item_t *node_data = node->data;
3958 gchar *action_grp_name;
3961 * Is this a leaf node or an interior node?
3963 if (node_data->children == NULL) {
3969 * The root node doesn't correspond to a menu tree item; it
3970 * has a null name pointer.
3972 if (node_data->name != NULL && group == node_data->group) {
3973 entry = g_malloc0(sizeof (GtkItemFactoryEntry));
3974 entry->path = node_data->name;
3975 entry->callback = node_data->callback;
3977 case(REGISTER_STAT_GROUP_UNSORTED):
3979 case(REGISTER_STAT_GROUP_GENERIC):
3981 case(REGISTER_STAT_GROUP_CONVERSATION_LIST):
3982 entry->item_type = "<StockItem>";
3983 entry->extra_data = WIRESHARK_STOCK_CONVERSATIONS;
3985 case(REGISTER_STAT_GROUP_ENDPOINT_LIST):
3986 entry->item_type = "<StockItem>";
3987 entry->extra_data = WIRESHARK_STOCK_ENDPOINTS;
3989 case(REGISTER_STAT_GROUP_RESPONSE_TIME):
3990 entry->item_type = "<StockItem>";
3991 entry->extra_data = WIRESHARK_STOCK_TIME;
3993 case(REGISTER_STAT_GROUP_TELEPHONY):
3995 case(REGISTER_ANALYZE_GROUP_UNSORTED):
3997 case(REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER):
3999 case(REGISTER_TOOLS_GROUP_UNSORTED):
4002 g_assert_not_reached();
4004 if(node_data->stock_id!= NULL) {
4005 entry->item_type = "<StockItem>";
4006 entry->extra_data = node_data->stock_id;
4009 gtk_item_factory_create_item(main_menu_factory, entry, node_data->callback_data, /* callback_type */ 2);
4010 set_menu_sensitivity_old(main_menu_factory, node_data->name, FALSE); /* no capture file yet */
4017 * It's an interior node; call
4018 * "merge_tap_menus_layered()" on all its children
4022 * The root node doesn't correspond to a menu tree item; it
4023 * has a null name pointer.
4025 if (node_data->name != NULL && group == node_data->group) {
4029 /* the underscore character regularly confuses things, as it will prevent finding
4030 * the menu_item, so it has to be removed first
4032 dup = g_strdup(node_data->name);
4034 while(*node_data->name) {
4035 if (*node_data->name != '_') {
4036 *dest = *node_data->name;
4043 entry = g_malloc0(sizeof (GtkItemFactoryEntry));
4044 entry->path = node_data->name;
4045 entry->item_type = "<Branch>";
4046 /* use the node_data->name(path) with the slashes replaced by "-" as the action group name */
4047 action_grp_name = g_strdup(dup+1);
4048 g_strdelimit(action_grp_name, "/", '-');
4050 g_warning("<Branch> %s",action_grp_name);
4053 action_group = gtk_action_group_new (action_grp_name);
4055 case(REGISTER_STAT_GROUP_UNSORTED):
4056 merge_id = gtk_ui_manager_new_merge_id (ui_manager_main_menubar);
4057 gtk_ui_manager_insert_action_group (ui_manager_main_menubar, action_group, 0);
4058 g_object_set_data (G_OBJECT (ui_manager_main_menubar),
4059 "Menubar-StatisticsMenu-merge-id", GUINT_TO_POINTER (merge_id));
4061 action = gtk_action_new(node_data->name, /* name */
4062 strrchr(node_data->name,'/'), /* label */
4064 node_data->stock_id); /* stock_id */
4066 gtk_action_group_add_action (action_group, action);
4067 g_object_unref (action);
4069 gtk_ui_manager_add_ui (ui_manager_main_menubar, merge_id,
4070 "/Menubar/StatisticsMenu", /* path */
4071 strrchr(node_data->name,'/'), /* name */
4072 node_data->name, /* action */
4073 GTK_UI_MANAGER_MENU, /* type */
4074 FALSE); /* "top" if TRUE, the UI element is added before its siblings */
4077 g_warning("<Stat unsorted> %s",action_grp_name);
4078 g_warning("label %s",node_data->label);
4080 case(REGISTER_STAT_GROUP_GENERIC):
4083 case(REGISTER_STAT_GROUP_ENDPOINT_LIST):
4085 case(REGISTER_STAT_GROUP_RESPONSE_TIME):
4087 case(REGISTER_STAT_GROUP_TELEPHONY):
4089 case(REGISTER_ANALYZE_GROUP_UNSORTED):
4091 case(REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER):
4093 case(REGISTER_TOOLS_GROUP_UNSORTED):
4094 g_warning("<Tools> %s",action_grp_name);
4095 g_warning("label %s",node_data->label);
4098 g_assert_not_reached();
4102 gtk_item_factory_create_item(main_menu_factory, entry,
4104 set_menu_sensitivity_old(main_menu_factory, node_data->name,
4105 FALSE); /* no children yet */
4111 for (child = node_data->children; child != NULL; child =
4113 added += merge_tap_menus_layered(child, group);
4121 static guint merge_tap_menus_layered(GList *node, gint group) {
4122 GtkItemFactoryEntry *entry;
4126 menu_item_t *node_data = node->data;
4129 * Is this a leaf node or an interior node?
4131 if (node_data->children == NULL) {
4137 * The root node doesn't correspond to a menu tree item; it
4138 * has a null name pointer.
4140 if (node_data->name != NULL && group == node_data->group) {
4141 entry = g_malloc0(sizeof (GtkItemFactoryEntry));
4142 entry->path = node_data->name;
4143 entry->callback = node_data->callback;
4145 case(REGISTER_STAT_GROUP_UNSORTED):
4147 case(REGISTER_STAT_GROUP_GENERIC):
4149 case(REGISTER_STAT_GROUP_CONVERSATION_LIST):
4150 entry->item_type = "<StockItem>";
4151 entry->extra_data = WIRESHARK_STOCK_CONVERSATIONS;
4153 case(REGISTER_STAT_GROUP_ENDPOINT_LIST):
4154 entry->item_type = "<StockItem>";
4155 entry->extra_data = WIRESHARK_STOCK_ENDPOINTS;
4157 case(REGISTER_STAT_GROUP_RESPONSE_TIME):
4158 entry->item_type = "<StockItem>";
4159 entry->extra_data = WIRESHARK_STOCK_TIME;
4161 case(REGISTER_STAT_GROUP_TELEPHONY):
4163 case(REGISTER_ANALYZE_GROUP_UNSORTED):
4165 case(REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER):
4167 case(REGISTER_TOOLS_GROUP_UNSORTED):
4170 g_assert_not_reached();
4172 if(node_data->stock_id!= NULL) {
4173 entry->item_type = "<StockItem>";
4174 entry->extra_data = node_data->stock_id;
4176 gtk_item_factory_create_item(main_menu_factory, entry, node_data->callback_data, /* callback_type */ 2);
4177 set_menu_sensitivity_old(node_data->name, FALSE); /* no capture file yet */
4183 * It's an interior node; call
4184 * "merge_tap_menus_layered()" on all its children
4188 * The root node doesn't correspond to a menu tree item; it
4189 * has a null name pointer.
4191 if (node_data->name != NULL && group == node_data->group) {
4192 entry = g_malloc0(sizeof (GtkItemFactoryEntry));
4193 entry->path = node_data->name;
4194 entry->item_type = "<Branch>";
4196 gtk_item_factory_create_item(main_menu_factory, entry,
4198 set_menu_sensitivity_old(node_data->name, FALSE); /* no children yet */
4203 for (child = node_data->children; child != NULL; child =
4205 added += merge_tap_menus_layered(child, group);
4211 #endif /* MAIN_MENU_USE_UIMANAGER */
4215 g_warning("entry->path = %s",entry->path);
4216 action = gtk_action_new(entry->path, /* name */
4217 const gchar *label, /* label */
4219 node_data->stock_id); /* stock_id */
4220 gtk_action_group_add_action_with_accel(main_menu_bar_action_group,
4222 NULL); /*the accelerator for the action,
4223 * in the format understood by gtk_accelerator_parse(),
4224 * or "" for no accelerator, or NULL to use the stock accelerator.
4227 g_signal_connect (action, "activate",
4228 G_CALLBACK (node_data->callback),
4229 node_data->callback_data);
4232 g_warning("Group: %s", node_data->name);
4233 p = strrchr(node_data->name,'/');
4236 action = gtk_action_new(entry->path, /* name */
4239 node_data->stock_id); /* stock_id */
4240 gtk_action_group_add_action_with_accel(main_menu_bar_action_group,
4242 NULL); /*the accelerator for the action,
4243 * in the format understood by gtk_accelerator_parse(),
4244 * or "" for no accelerator, or NULL to use the stock accelerator.
4247 if(group==REGISTER_STAT_GROUP_RESPONSE_TIME){
4248 gtk_ui_manager_add_ui (ui_manager_main_menubar, merge_id,
4249 "/Menubar/StatisticsMenu", /* path */
4251 entry->path, /* action */
4252 GTK_UI_MANAGER_MENU, /* type */
4253 FALSE); /* "top" if TRUE, the UI element is added before its siblings */
4260 static void merge_all_tap_menus(GList *node) {
4261 GtkItemFactoryEntry *sep_entry;
4263 sep_entry = g_malloc0(sizeof (GtkItemFactoryEntry));
4264 sep_entry->item_type = "<Separator>";
4265 sep_entry->path = "/Statistics/";
4266 #ifdef MAIN_MENU_USE_UIMANAGER
4267 /* build the new menus */
4269 merge_id = gtk_ui_manager_new_merge_id (ui_manager_main_menubar);
4273 * merge only the menu items of the specific group,
4274 * and then append a seperator
4276 if (merge_tap_menus_layered(node, REGISTER_STAT_GROUP_GENERIC)) {
4277 #ifdef MAIN_MENU_USE_UIMANAGER
4280 gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);
4281 #endif /* MAIN_MENU_USE_UIMANAGER */
4283 if (merge_tap_menus_layered(node, REGISTER_STAT_GROUP_CONVERSATION_LIST)) {
4284 /*gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);*/
4286 if (merge_tap_menus_layered(node, REGISTER_STAT_GROUP_ENDPOINT_LIST)) {
4287 /*gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);*/
4289 if (merge_tap_menus_layered(node, REGISTER_STAT_GROUP_RESPONSE_TIME)) {
4290 #ifdef MAIN_MENU_USE_UIMANAGER
4293 gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);
4294 #endif /* MAIN_MENU_USE_UIMANAGER */
4296 if (merge_tap_menus_layered(node, REGISTER_STAT_GROUP_TELEPHONY)) {
4297 /*gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);*/
4299 if (merge_tap_menus_layered(node, REGISTER_STAT_GROUP_UNSORTED)) {
4300 /*gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);*/
4302 if (merge_tap_menus_layered(node, REGISTER_ANALYZE_GROUP_UNSORTED)) {
4303 sep_entry->path = "/Analyze/";
4304 /*gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);*/
4306 if (merge_tap_menus_layered(node, REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER)) {
4307 sep_entry->path = "/Analyze/Conversation Filter/";
4308 /*gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);*/
4310 if (merge_tap_menus_layered(node, REGISTER_TOOLS_GROUP_UNSORTED)) {
4311 /*gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);*/
4318 * Enable/disable menu sensitivity.
4321 set_menu_sensitivity(GtkUIManager *ui_manager, const gchar *path, gint val)
4325 action = gtk_ui_manager_get_action(ui_manager, path);
4328 fprintf (stderr, "Warning: couldn't find action path= %s\n",
4333 #if GLIB_CHECK_VERSION(2,6,0)
4334 gtk_action_set_sensitive (action,
4335 val); /* TRUE to make the action sensitive */
4337 g_object_set (G_OBJECT (action), "sensitive", val, NULL);
4341 #ifndef MAIN_MENU_USE_UIMANAGER
4343 * Enable/disable menu sensitivity for the old menubar code.
4346 set_menu_sensitivity_old(const gchar *path, gint val)
4348 GtkWidget *menu_item;
4351 /* the underscore character regularly confuses things, as it will prevent finding
4352 * the menu_item, so it has to be removed first */
4353 dup = g_strdup(path);
4364 if ((menu_item = gtk_item_factory_get_widget(main_menu_factory, dup)) != NULL) {
4365 if (GTK_IS_MENU(menu_item)) {
4367 * "dup" refers to a submenu; "gtk_item_factory_get_widget()"
4368 * gets the menu, not the item that, when selected, pops up
4371 * We have to change the latter item's sensitivity, so that
4372 * it shows up normally if sensitive and grayed-out if
4375 menu_item = gtk_menu_get_attach_widget(GTK_MENU(menu_item));
4377 gtk_widget_set_sensitive(menu_item, val);
4379 #ifndef NEW_PACKET_LIST
4380 /* be sure this menu item *is* existing */
4381 g_assert_not_reached();
4388 #endif /* MAIN_MENU_USE_UIMANAGER */
4391 set_menu_object_data_meat(GtkUIManager *ui_manager, const gchar *path, const gchar *key, gpointer data)
4393 GtkWidget *menu = NULL;
4395 if ((menu = gtk_ui_manager_get_widget(ui_manager, path)) != NULL){
4396 g_object_set_data(G_OBJECT(menu), key, data);
4399 g_warning("set_menu_object_data_meat: no menu, path: %s",path);
4404 #ifndef MAIN_MENU_USE_UIMANAGER
4406 set_menu_object_data_meat_old(const gchar *path, const gchar *key, gpointer data)
4408 GtkWidget *menu = NULL;
4410 if ((menu = gtk_item_factory_get_widget(main_menu_factory, path)) != NULL){
4411 g_object_set_data(G_OBJECT(menu), key, data);
4417 set_menu_object_data_old (const gchar *path, const gchar *key, gpointer data) {
4419 set_menu_object_data_meat_old(path, key, data);
4423 set_menu_object_data (const gchar *path, const gchar *key, gpointer data) {
4425 if (strncmp (path,"/Menubar",8) == 0){
4426 set_menu_object_data_meat(ui_manager_main_menubar, path, key, data);
4427 }else if (strncmp (path,"/PacketListMenuPopup",20) == 0){
4428 set_menu_object_data_meat(ui_manager_packet_list_menu, path, key, data);
4429 }else if (strncmp (path,"/TreeViewPopup",14) == 0){
4430 set_menu_object_data_meat(ui_manager_tree_view_menu, path, key, data);
4431 }else if (strncmp (path,"/BytesMenuPopup",15) == 0){
4432 set_menu_object_data_meat(ui_manager_bytes_menu, path, key, data);
4433 }else if (strncmp (path,"/ProfilesMenuPopup",18) == 0){
4434 set_menu_object_data_meat(ui_manager_statusbar_profiles_menu, path, key, data);
4439 /* Recently used capture files submenu:
4440 * Submenu containing the recently used capture files.
4441 * The capture filenames are always kept with the absolute path, to be independant
4442 * of the current path.
4443 * They are only stored inside the labels of the submenu (no separate list). */
4445 #define MENU_RECENT_FILES_PATH_OLD "/File/Open Recent"
4446 #define MENU_RECENT_FILES_PATH "/Menubar/FileMenu/OpenRecent"
4447 #define MENU_RECENT_FILES_KEY "Recent File Name"
4450 #ifndef MAIN_MENU_USE_UIMANAGER
4452 update_menu_recent_capture_file1(GtkWidget *widget, gpointer cnt) {
4453 gchar *widget_cf_name;
4455 widget_cf_name = g_object_get_data(G_OBJECT(widget), MENU_RECENT_FILES_KEY);
4457 /* if this menu item is a file, count it */
4458 if (widget_cf_name) {
4460 main_welcome_add_recent_capture_files(widget_cf_name);
4464 /* update the menu */
4466 update_menu_recent_capture_file(GtkWidget *submenu_recent_files) {
4468 GtkWidget *menu_item;
4471 main_welcome_reset_recent_capture_files();
4473 gtk_container_foreach(GTK_CONTAINER(submenu_recent_files),
4474 update_menu_recent_capture_file1, &cnt);
4478 menu_item = gtk_menu_item_new_with_label("No recently used files");
4479 gtk_menu_shell_append (GTK_MENU_SHELL(submenu_recent_files), menu_item);
4480 gtk_widget_show (menu_item);
4483 /* make parent menu item sensitive only, if we have any valid files in the list */
4484 set_menu_sensitivity_old(MENU_RECENT_FILES_PATH_OLD, cnt);
4487 #endif /* MAIN_MENU_USE_UIMANAGER */
4489 #ifndef MAIN_MENU_USE_UIMANAGER
4490 /* remove the capture filename from the "Recent Files" menu */
4492 remove_menu_recent_capture_filename(gchar *cf_name) {
4493 GtkWidget *submenu_recent_files;
4495 GList* child_list_item;
4496 GtkWidget *menu_item_child;
4497 const gchar *menu_item_cf_name;
4499 /* get the submenu container item */
4500 #ifdef MAIN_MENU_USE_UIMANAGER
4501 submenu_recent_files = gtk_ui_manager_get_widget(ui_manager_main_menubar, MENU_RECENT_FILES_PATH);
4502 if(!submenu_recent_files){
4503 g_warning("remove_menu_recent_capture_filename: No submenu_recent_files found, path= MENU_RECENT_FILES_PATH");
4506 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH_OLD);
4508 /* find the corresponding menu item to be removed */
4509 child_list = gtk_container_get_children(GTK_CONTAINER(submenu_recent_files));
4510 child_list_item = child_list;
4511 while(child_list_item) {
4512 menu_item_child = (GTK_BIN(child_list_item->data))->child;
4513 if (menu_item_child != NULL) { /* Note: there are two "extra" items on the end of the child_list: */
4514 /* - a separator (with no menu_item_child and thus no text label) */
4515 /* - a 2nd item with a menu_child with text label "Clear" */
4516 /* [See add_menu_recent_capture_file_absolute() ] */
4517 /* 'if (menu_item_child != NULL)' skips the separator item; */
4518 /* An absolute filename in cf_name will never match "Clear". */
4519 menu_item_cf_name = gtk_label_get_text(GTK_LABEL(menu_item_child));
4520 if(strcmp(menu_item_cf_name, cf_name) == 0) {
4521 /* XXX: is this all we need to do, to free the menu item and its label?
4522 The reference count of widget will go to 0, so it'll be freed;
4523 will that free the label? */
4524 gtk_container_remove(GTK_CONTAINER(submenu_recent_files), child_list_item->data);
4527 child_list_item = g_list_next(child_list_item);
4529 g_list_free(child_list);
4531 update_menu_recent_capture_file(submenu_recent_files);
4534 /* remove the capture filename from the "Recent Files" menu */
4536 remove_menu_recent_capture_file(GtkWidget *widget, gpointer unused _U_) {
4537 GtkWidget *submenu_recent_files;
4538 gchar *widget_cf_name;
4541 widget_cf_name = g_object_get_data(G_OBJECT(widget), MENU_RECENT_FILES_KEY);
4542 g_free(widget_cf_name);
4544 /* get the submenu container item */
4545 #ifdef MAIN_MENU_USE_UIMANAGER
4546 submenu_recent_files = gtk_ui_manager_get_widget(ui_manager_main_menubar, MENU_RECENT_FILES_PATH);
4547 if(!submenu_recent_files){
4548 g_warning("remove_menu_recent_capture_file: No submenu_recent_files found, path= MENU_RECENT_FILES_PATH");
4551 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH_OLD);
4553 /* XXX: is this all we need to do, to free the menu item and its label?
4554 The reference count of widget will go to 0, so it'll be freed;
4555 will that free the label? */
4556 gtk_container_remove(GTK_CONTAINER(submenu_recent_files), widget);
4560 #ifdef MAIN_MENU_USE_UIMANAGER
4561 /* Add a file name to the top of the list, if its allrady present remove it first */
4563 remove_present_file_name(GList *recent_files_list, const gchar *cf_name){
4565 gchar *widget_cf_name;
4567 for (li = g_list_first(recent_files_list); li; li = li->next) {
4568 widget_cf_name = li->data;
4571 /* do a case insensitive compare on win32 */
4572 g_ascii_strncasecmp(widget_cf_name, cf_name, 1000) == 0){
4574 /* do a case sensitive compare on unix */
4575 strncmp(widget_cf_name, cf_name, 1000) == 0 ){
4577 recent_files_list = g_list_remove(recent_files_list,widget_cf_name);
4581 return recent_files_list;
4585 recent_changed_cb (GtkUIManager *ui_manager,
4586 gpointer user_data _U_)
4589 GList *action_groups, *l;
4592 merge_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (ui_manager),
4593 "recent-files-merge-id"));
4596 gtk_ui_manager_remove_ui (ui_manager, merge_id);
4598 /* remove the action group; gtk_ui_manager_remove_action_group()
4599 * should really take the action group's name instead of its
4602 action_groups = gtk_ui_manager_get_action_groups (ui_manager);
4603 for (l = action_groups; l != NULL; l = l->next)
4605 GtkActionGroup *group = l->data;
4607 if (strcmp (gtk_action_group_get_name (group), "recent-files-group") == 0){
4608 /* this unrefs the action group and all of its actions */
4609 gtk_ui_manager_remove_action_group (ui_manager, group);
4614 /* generate a new merge id and re-add everything */
4615 merge_id = gtk_ui_manager_new_merge_id (ui_manager);
4616 add_recent_items (merge_id, ui_manager);
4620 recent_clear_cb(GtkAction *action _U_, gpointer user_data _U_)
4622 GtkWidget *submenu_recent_files;
4623 GList *recent_files_list;
4625 /* Get the list of recent files, free the list and store the empty list with the widget */
4626 submenu_recent_files = gtk_ui_manager_get_widget(ui_manager_main_menubar, MENU_RECENT_FILES_PATH);
4627 recent_files_list = g_object_get_data(G_OBJECT(submenu_recent_files), "recent-files-list");
4628 /* Free the name strings ?? */
4629 g_list_free(recent_files_list);
4630 recent_files_list = NULL;
4631 g_object_set_data(G_OBJECT(submenu_recent_files), "recent-files-list", recent_files_list);
4632 /* Calling recent_changed_cb will rebuild the GUI call add_recent_items which will in turn call
4633 * main_welcome_reset_recent_capture_files
4635 recent_changed_cb(ui_manager_main_menubar, NULL);
4639 add_recent_items (guint merge_id, GtkUIManager *ui_manager)
4641 GtkActionGroup *action_group;
4643 GtkWidget *submenu_recent_files;
4649 /* Reset the recent files list in the welcome screen */
4650 main_welcome_reset_recent_capture_files();
4652 action_group = gtk_action_group_new ("recent-files-group");
4654 submenu_recent_files = gtk_ui_manager_get_widget(ui_manager_main_menubar, MENU_RECENT_FILES_PATH);
4655 if(!submenu_recent_files){
4656 g_warning("add_recent_items: No submenu_recent_files found, path= MENU_RECENT_FILES_PATH");
4658 items = g_object_get_data(G_OBJECT(submenu_recent_files), "recent-files-list");
4660 gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
4661 g_object_set_data (G_OBJECT (ui_manager),
4662 "recent-files-merge-id", GUINT_TO_POINTER (merge_id));
4667 action = g_object_new (GTK_TYPE_ACTION,
4668 "name", "recent-info-empty",
4669 "label", "No recently used files",
4672 gtk_action_group_add_action (action_group, action);
4673 g_object_unref (action);
4675 gtk_ui_manager_add_ui (ui_manager, merge_id,
4676 "/Menubar/FileMenu/OpenRecent/RecentFiles",
4677 "recent-info-empty",
4678 "recent-info-empty",
4679 GTK_UI_MANAGER_MENUITEM,
4685 for (i = 0, l = items;
4686 i < prefs.gui_recent_files_count_max && l != NULL;
4689 gchar *item_name = l->data;
4690 name = g_strdup_printf ("recent-info-%u", i);
4691 action_name = g_strdup (name);
4693 action = g_object_new (GTK_TYPE_ACTION,
4694 "name", action_name,
4696 "stock_id", WIRESHARK_STOCK_FILE,
4698 g_signal_connect (action, "activate",
4699 G_CALLBACK (menu_open_recent_file_cmd_cb), NULL);
4700 gtk_action_group_add_action (action_group, action);
4701 g_object_unref (action);
4703 gtk_ui_manager_add_ui (ui_manager, merge_id,
4704 "/Menubar/FileMenu/OpenRecent/RecentFiles",
4707 GTK_UI_MANAGER_MENUITEM,
4710 /* Add the file name to the recent files list on the Welcome screen */
4711 main_welcome_add_recent_capture_files(item_name);
4713 g_free (action_name);
4716 /* Add a Separator */
4717 gtk_ui_manager_add_ui (ui_manager, merge_id,
4718 "/Menubar/FileMenu/OpenRecent/RecentFiles",
4719 "separator-recent-info",
4721 GTK_UI_MANAGER_SEPARATOR,
4724 /* Add a clear Icon */
4725 action = g_object_new (GTK_TYPE_ACTION,
4726 "name", "clear-recent-info",
4727 "label", "Clear the recent files list",
4728 "stock_id", GTK_STOCK_CLEAR,
4731 g_signal_connect (action, "activate",
4732 G_CALLBACK (recent_clear_cb), NULL);
4734 gtk_action_group_add_action (action_group, action);
4735 g_object_unref (action);
4737 gtk_ui_manager_add_ui (ui_manager, merge_id,
4738 "/Menubar/FileMenu/OpenRecent/RecentFiles",
4739 "clear-recent-info",
4740 "clear-recent-info",
4741 GTK_UI_MANAGER_MENUITEM,
4745 #endif /* MAIN_MENU_USE_UIMANAGER */
4747 #ifndef MAIN_MENU_USE_UIMANAGER
4748 /* callback, if the user pushed the <Clear> menu item */
4750 clear_menu_recent_capture_file_cmd_cb(GtkWidget *w _U_, gpointer unused _U_) {
4751 GtkWidget *submenu_recent_files;
4753 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH_OLD);
4755 gtk_container_foreach(GTK_CONTAINER(submenu_recent_files),
4756 remove_menu_recent_capture_file, NULL);
4758 update_menu_recent_capture_file(submenu_recent_files);
4760 #endif /* MAIN_MENU_USE_UIMANAGER */
4762 /* Open a file by it's name
4763 (Beware: will not ask to close existing capture file!) */
4765 menu_open_filename(gchar *cf_name)
4767 GtkWidget *submenu_recent_files;
4769 #ifdef MAIN_MENU_USE_UIMANAGER
4770 GList *recent_files_list;
4773 submenu_recent_files = gtk_ui_manager_get_widget(ui_manager_main_menubar, MENU_RECENT_FILES_PATH);
4774 if(!submenu_recent_files){
4775 g_warning("menu_open_filename: No submenu_recent_files found, path= MENU_RECENT_FILES_PATH");
4777 recent_files_list = g_object_get_data(G_OBJECT(submenu_recent_files), "recent-files-list");
4778 /* XXX: ask user to remove item, it's maybe only a temporary problem */
4779 /* open and read the capture file (this will close an existing file) */
4780 if (cf_open(&cfile, cf_name, FALSE, &err) == CF_OK) {
4781 cf_read(&cfile, FALSE);
4783 recent_files_list = remove_present_file_name(recent_files_list, cf_name);
4784 g_object_set_data(G_OBJECT(submenu_recent_files), "recent-files-list", recent_files_list);
4785 /* Calling recent_changed_cb will rebuild the GUI call add_recent_items which will in turn call
4786 * main_welcome_reset_recent_capture_files
4788 recent_changed_cb(ui_manager_main_menubar, NULL);
4791 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH_OLD);
4792 /* open and read the capture file (this will close an existing file) */
4793 if (cf_open(&cfile, cf_name, FALSE, &err) == CF_OK) {
4794 cf_read(&cfile, FALSE);
4796 /* the capture file apparently no longer exists; remove menu item */
4797 /* XXX: ask user to remove item, it's maybe only a temporary problem */
4798 remove_menu_recent_capture_filename(cf_name);
4801 update_menu_recent_capture_file(submenu_recent_files);
4802 #endif /* MAIN_MENU_USE_UIMANAGER */
4805 #ifdef MAIN_MENU_USE_UIMANAGER
4807 menu_open_recent_file_cmd(GtkAction *action)
4809 GtkWidget *submenu_recent_files;
4810 GList *recent_files_list;
4811 const gchar *cf_name;
4814 cf_name = gtk_action_get_label(action);
4816 /* open and read the capture file (this will close an existing file) */
4817 if (cf_open(&cfile, cf_name, FALSE, &err) == CF_OK) {
4818 cf_read(&cfile, FALSE);
4820 submenu_recent_files = gtk_ui_manager_get_widget(ui_manager_main_menubar, MENU_RECENT_FILES_PATH);
4821 recent_files_list = g_object_get_data(G_OBJECT(submenu_recent_files), "recent-files-list");
4823 recent_files_list = remove_present_file_name(recent_files_list, cf_name);
4824 g_object_set_data(G_OBJECT(submenu_recent_files), "recent-files-list", recent_files_list);
4825 /* Calling recent_changed_cb will rebuild the GUI call add_recent_items which will in turn call
4826 * main_welcome_reset_recent_capture_files
4828 recent_changed_cb(ui_manager_main_menubar, NULL);
4832 /* callback, if the user pushed a recent file submenu item */
4834 menu_open_recent_file_cmd(GtkWidget *w)
4836 GtkWidget *submenu_recent_files;
4837 GtkWidget *menu_item_child;
4838 const gchar *cf_name;
4842 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH_OLD);
4844 /* get capture filename from the menu item label */
4845 menu_item_child = (GTK_BIN(w))->child;
4846 cf_name = gtk_label_get_text(GTK_LABEL(menu_item_child));
4848 /* open and read the capture file (this will close an existing file) */
4849 if (cf_open(&cfile, cf_name, FALSE, &err) == CF_OK) {
4850 cf_read(&cfile, FALSE);
4852 /* the capture file apparently no longer exists; remove menu item */
4853 /* XXX: ask user to remove item, it's maybe only a temporary problem */
4854 remove_menu_recent_capture_file(w, NULL);
4857 update_menu_recent_capture_file(submenu_recent_files);
4859 #endif /* MAIN_MENU_USE_UIMANAGER */
4861 static void menu_open_recent_file_answered_cb(gpointer dialog _U_, gint btn, gpointer data)
4865 /* save file first */
4866 file_save_as_cmd(after_save_open_recent_file, data);
4870 menu_open_recent_file_cmd(data);
4872 case(ESD_BTN_CANCEL):
4875 g_assert_not_reached();
4878 #ifdef MAIN_MENU_USE_UIMANAGER
4880 menu_open_recent_file_cmd_cb(GtkAction *action, gpointer data _U_) {
4884 if((cfile.state != FILE_CLOSED) && !cfile.user_saved && prefs.gui_ask_unsaved) {
4885 /* user didn't saved his current file, ask him */
4886 dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_YES_NO_CANCEL,
4887 "%sSave capture file before opening a new one?%s\n\n"
4888 "If you open a new capture file without saving, your current capture data will be discarded.",
4889 simple_dialog_primary_start(), simple_dialog_primary_end());
4890 simple_dialog_set_cb(dialog, menu_open_recent_file_answered_cb, action);
4892 /* unchanged file */
4893 menu_open_recent_file_cmd(action);
4898 menu_open_recent_file_cmd_cb(GtkWidget *widget, gpointer data _U_) {
4902 if((cfile.state != FILE_CLOSED) && !cfile.user_saved && prefs.gui_ask_unsaved) {
4903 /* user didn't saved his current file, ask him */
4904 dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_YES_NO_CANCEL,
4905 "%sSave capture file before opening a new one?%s\n\n"
4906 "If you open a new capture file without saving, your current capture data will be discarded.",
4907 simple_dialog_primary_start(), simple_dialog_primary_end());
4908 simple_dialog_set_cb(dialog, menu_open_recent_file_answered_cb, widget);
4910 /* unchanged file */
4911 menu_open_recent_file_cmd(widget);
4914 #endif /* MAIN_MENU_USE_UIMANAGER */
4916 #ifdef MAIN_MENU_USE_UIMANAGER
4918 add_menu_recent_capture_file_absolute(gchar *cf_name) {
4919 GtkWidget *submenu_recent_files;
4921 gchar *widget_cf_name;
4922 gchar *normalized_cf_name;
4924 GList *recent_files_list;
4926 normalized_cf_name = g_strdup(cf_name);
4928 /* replace all slashes by backslashes */
4929 g_strdelimit(normalized_cf_name, "/", '\\');
4932 /* get the submenu container item */
4933 submenu_recent_files = gtk_ui_manager_get_widget(ui_manager_main_menubar, MENU_RECENT_FILES_PATH);
4934 if(!submenu_recent_files){
4935 g_warning("add_menu_recent_capture_file_absolute: No submenu_recent_files found, path= MENU_RECENT_FILES_PATH");
4938 recent_files_list = g_object_get_data(G_OBJECT(submenu_recent_files), "recent-files-list");
4940 for (li = g_list_first(recent_files_list); li; li = li->next, cnt++) {
4941 widget_cf_name = li->data;
4944 /* do a case insensitive compare on win32 */
4945 g_ascii_strncasecmp(widget_cf_name, normalized_cf_name, 1000) == 0 ||
4947 /* do a case sensitive compare on unix */
4948 strncmp(widget_cf_name, normalized_cf_name, 1000) == 0 ||
4950 cnt >= prefs.gui_recent_files_count_max) {
4951 recent_files_list = g_list_remove(recent_files_list,widget_cf_name);
4955 recent_files_list = g_list_prepend(recent_files_list, normalized_cf_name);
4956 g_object_set_data(G_OBJECT(submenu_recent_files), "recent-files-list", recent_files_list);
4957 recent_changed_cb( ui_manager_main_menubar, NULL);
4960 #else /* MAIN_MENU_USE_UIMANAGER */
4962 /* add the capture filename (with an absolute path) to the "Recent Files" menu */
4964 add_menu_recent_capture_file_absolute(gchar *cf_name) {
4965 GtkWidget *submenu_recent_files;
4966 GList *menu_item_list_old;
4968 gchar *widget_cf_name;
4969 gchar *normalized_cf_name;
4970 GtkWidget *menu_item;
4973 normalized_cf_name = g_strdup(cf_name);
4975 /* replace all slashes by backslashes */
4976 g_strdelimit(normalized_cf_name, "/", '\\');
4978 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH_OLD);
4979 /* convert container to a GList */
4980 menu_item_list_old = gtk_container_get_children(GTK_CONTAINER(submenu_recent_files));
4982 /* iterate through list items of menu_item_list,
4983 * removing special items, a maybe duplicate entry and every item above count_max */
4985 for (li = g_list_first(menu_item_list_old); li; li = li->next, cnt++) {
4986 /* get capture filename */
4987 menu_item = GTK_WIDGET(li->data);
4988 widget_cf_name = g_object_get_data(G_OBJECT(menu_item), MENU_RECENT_FILES_KEY);
4990 /* if this element string is one of our special items (seperator, ...) or
4991 * already in the list or
4992 * this element is above maximum count (too old), remove it
4994 if (!widget_cf_name ||
4996 /* do a case insensitive compare on win32 */
4997 g_ascii_strncasecmp(widget_cf_name, normalized_cf_name, 1000) == 0 ||
4999 /* do a case sensitive compare on unix */
5000 strncmp(widget_cf_name, normalized_cf_name, 1000) == 0 ||
5002 cnt >= prefs.gui_recent_files_count_max) {
5003 remove_menu_recent_capture_file(li->data, NULL);
5008 g_list_free(menu_item_list_old);
5010 /* add new item at latest position */
5011 menu_item = gtk_menu_item_new_with_label(normalized_cf_name);
5012 g_object_set_data(G_OBJECT(menu_item), MENU_RECENT_FILES_KEY, normalized_cf_name);
5013 gtk_menu_shell_prepend (GTK_MENU_SHELL(submenu_recent_files), menu_item);
5014 g_signal_connect_swapped(GTK_OBJECT(menu_item), "activate",
5015 G_CALLBACK(menu_open_recent_file_cmd_cb), (GtkObject *) menu_item);
5016 gtk_widget_show (menu_item);
5018 /* add seperator at last position */
5019 menu_item = gtk_menu_item_new();
5020 gtk_menu_shell_append (GTK_MENU_SHELL(submenu_recent_files), menu_item);
5021 gtk_widget_show (menu_item);
5023 /* add new "clear list" item at last position */
5024 menu_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_CLEAR, NULL);
5025 gtk_menu_shell_append (GTK_MENU_SHELL(submenu_recent_files), menu_item);
5026 g_signal_connect_swapped(GTK_OBJECT(menu_item), "activate",
5027 G_CALLBACK(clear_menu_recent_capture_file_cmd_cb), (GtkObject *) menu_item);
5028 gtk_widget_show (menu_item);
5030 update_menu_recent_capture_file(submenu_recent_files);
5032 #endif /* MAIN_MENU_USE_UIMANAGER */
5034 /* add the capture filename to the "Recent Files" menu */
5035 /* (will change nothing, if this filename is already in the menu) */
5037 * XXX - We might want to call SHAddToRecentDocs under Windows 7:
5038 * http://stackoverflow.com/questions/437212/how-do-you-register-a-most-recently-used-list-with-windows-in-preparation-for-win
5041 add_menu_recent_capture_file(gchar *cf_name) {
5046 /* if this filename is an absolute path, we can use it directly */
5047 if (g_path_is_absolute(cf_name)) {
5048 add_menu_recent_capture_file_absolute(cf_name);
5052 /* this filename is not an absolute path, prepend the current dir */
5053 curr = g_get_current_dir();
5054 absolute = g_strdup_printf("%s%s%s", curr, G_DIR_SEPARATOR_S, cf_name);
5055 add_menu_recent_capture_file_absolute(absolute);
5061 /* write all capture filenames of the menu to the user's recent file */
5063 menu_recent_file_write_all(FILE *rf) {
5064 GtkWidget *submenu_recent_files;
5068 #ifdef MAIN_MENU_USE_UIMANAGER
5069 GList *recent_files_list, *list;
5071 submenu_recent_files = gtk_ui_manager_get_widget(ui_manager_main_menubar, MENU_RECENT_FILES_PATH);
5072 if(!submenu_recent_files){
5073 g_warning("menu_recent_file_write_all: No submenu_recent_files found, path= MENU_RECENT_FILES_PATH");
5075 recent_files_list = g_object_get_data(G_OBJECT(submenu_recent_files), "recent-files-list");
5076 list = g_list_last(recent_files_list);
5077 while(list != NULL) {
5078 cf_name = list->data;
5081 fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", u3_contract_device_path(cf_name));
5083 fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", cf_name);
5085 list = g_list_previous(list);
5087 g_list_free(recent_files_list);
5091 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH_OLD);
5093 /* we have to iterate backwards through the children's list,
5094 * so we get the latest item last in the file.
5095 * (don't use gtk_container_foreach() here, it will return the wrong iteration order) */
5096 children = gtk_container_get_children(GTK_CONTAINER(submenu_recent_files));
5097 child = g_list_last(children);
5098 while(child != NULL) {
5099 /* get capture filename from the menu item label */
5100 cf_name = g_object_get_data(G_OBJECT(child->data), MENU_RECENT_FILES_KEY);
5103 fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", u3_contract_device_path(cf_name));
5105 fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", cf_name);
5108 child = g_list_previous(child);
5111 g_list_free(children);
5116 show_hide_cb(GtkWidget *w, gpointer data _U_, gint action)
5119 /* save current setting in recent */
5121 case(SHOW_HIDE_MAIN_TOOLBAR):
5122 recent.main_toolbar_show = GTK_CHECK_MENU_ITEM(w)->active;
5124 case(SHOW_HIDE_FILTER_TOOLBAR):
5125 recent.filter_toolbar_show = GTK_CHECK_MENU_ITEM(w)->active;
5128 case(SHOW_HIDE_AIRPCAP_TOOLBAR):
5129 recent.airpcap_toolbar_show = GTK_CHECK_MENU_ITEM(w)->active;
5132 case(SHOW_HIDE_STATUSBAR):
5133 recent.statusbar_show = GTK_CHECK_MENU_ITEM(w)->active;
5135 case(SHOW_HIDE_PACKET_LIST):
5136 recent.packet_list_show = GTK_CHECK_MENU_ITEM(w)->active;
5138 case(SHOW_HIDE_TREE_VIEW):
5139 recent.tree_view_show = GTK_CHECK_MENU_ITEM(w)->active;
5141 case(SHOW_HIDE_BYTE_VIEW):
5142 recent.byte_view_show = GTK_CHECK_MENU_ITEM(w)->active;
5145 g_assert_not_reached();
5148 main_widgets_show_or_hide();
5151 #ifndef MAIN_MENU_USE_UIMANAGER
5153 timestamp_format_cb(GtkWidget *w _U_, gpointer d _U_, gint action)
5155 if (recent.gui_time_format != action) {
5156 timestamp_set_type(action);
5157 recent.gui_time_format = action;
5158 #ifdef NEW_PACKET_LIST
5159 /* This call adjusts column width */
5160 cf_timestamp_auto_precision(&cfile);
5161 new_packet_list_queue_draw();
5163 cf_change_time_formats(&cfile);
5170 timestamp_precision_cb(GtkWidget *w _U_, gpointer d _U_, gint action)
5172 if (recent.gui_time_precision != action) {
5173 /* the actual precision will be set in cf_change_time_formats() below */
5174 if (action == TS_PREC_AUTO) {
5175 timestamp_set_precision(TS_PREC_AUTO_SEC);
5177 timestamp_set_precision(action);
5179 recent.gui_time_precision = action;
5180 #ifdef NEW_PACKET_LIST
5181 /* This call adjusts column width */
5182 cf_timestamp_auto_precision(&cfile);
5183 new_packet_list_queue_draw();
5185 cf_change_time_formats(&cfile);
5192 timestamp_seconds_time_cb(GtkWidget *w, gpointer d _U_, gint action _U_)
5194 if (GTK_CHECK_MENU_ITEM(w)->active) {
5195 recent.gui_seconds_format = TS_SECONDS_HOUR_MIN_SEC;
5197 recent.gui_seconds_format = TS_SECONDS_DEFAULT;
5199 timestamp_set_seconds_type (recent.gui_seconds_format);
5201 #ifdef NEW_PACKET_LIST
5202 /* This call adjusts column width */
5203 cf_timestamp_auto_precision(&cfile);
5204 new_packet_list_queue_draw();
5206 cf_change_time_formats(&cfile);
5211 menu_name_resolution_changed(void)
5213 GtkWidget *menu = NULL;
5214 #ifdef MAIN_MENU_USE_UIMANAGER
5215 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/EnableforMACLayer");
5217 g_warning("menu_name_resolution_changed: No menu found, path= /Menubar/ViewMenu/NameResolution/EnableforMACLayer");
5219 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), gbl_resolv_flags & RESOLV_MAC);
5221 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/EnableforNetworkLayer");
5223 g_warning("menu_name_resolution_changed: No menu found, path= /Menubar/ViewMenu/NameResolution/EnableforNetworkLayer");
5225 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), gbl_resolv_flags & RESOLV_NETWORK);
5227 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/EnableforTransportLayer");
5229 g_warning("menu_name_resolution_changed: No menu found, path= /Menubar/ViewMenu/NameResolution/EnableforTransportLayer");
5231 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), gbl_resolv_flags & RESOLV_TRANSPORT);
5234 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Name Resolution/Enable for MAC Layer");
5235 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), gbl_resolv_flags & RESOLV_MAC);
5237 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Name Resolution/Enable for Network Layer");
5238 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), gbl_resolv_flags & RESOLV_NETWORK);
5240 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Name Resolution/Enable for Transport Layer");
5241 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), gbl_resolv_flags & RESOLV_TRANSPORT);
5242 #endif /* MAIN_MENU_USE_UIMANAGER */
5246 name_resolution_cb(GtkWidget *w, gpointer d _U_, gint action)
5248 if (GTK_CHECK_MENU_ITEM(w)->active) {
5249 gbl_resolv_flags |= action;
5251 gbl_resolv_flags &= ~action;
5257 menu_auto_scroll_live_changed(gboolean auto_scroll_live_in) {
5261 /* tell menu about it */
5262 #ifdef MAIN_MENU_USE_UIMANAGER
5263 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/AutoScrollinLiveCapture");
5265 g_warning("menu_auto_scroll_live_changed: No menu found, path= /Menubar/ViewMenu/AutoScrollinLiveCapture");
5268 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Auto Scroll in Live Capture");
5269 #endif /* MAIN_MENU_USE_UIMANAGER */
5270 if( ((gboolean) GTK_CHECK_MENU_ITEM(menu)->active) != auto_scroll_live_in) {
5271 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), auto_scroll_live_in);
5274 /* tell toolbar about it */
5275 toolbar_auto_scroll_live_changed(auto_scroll_live_in);
5277 /* change auto scroll */
5278 if(auto_scroll_live_in != auto_scroll_live) {
5279 auto_scroll_live = auto_scroll_live_in;
5283 #ifndef MAIN_MENU_USE_UIMANAGER
5285 auto_scroll_live_cb(GtkWidget *w _U_, gpointer d _U_)
5287 menu_auto_scroll_live_changed(GTK_CHECK_MENU_ITEM(w)->active);
5289 #endif /* MAIN_MENU_USE_UIMANAGER */
5291 #endif /*HAVE_LIBPCAP */
5295 menu_colorize_changed(gboolean packet_list_colorize) {
5299 /* tell menu about it */
5300 #ifdef MAIN_MENU_USE_UIMANAGER
5301 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/ColorizePacketList");
5303 g_warning("menu_colorize_changed: No menu found, path= /Menubar/ViewMenu/ColorizePacketList");
5306 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Colorize Packet List");
5307 #endif /* MAIN_MENU_USE_UIMANAGER */
5308 if( ((gboolean) GTK_CHECK_MENU_ITEM(menu)->active) != packet_list_colorize) {
5309 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), packet_list_colorize);
5312 /* tell toolbar about it */
5313 toolbar_colorize_changed(packet_list_colorize);
5315 /* change colorization */
5316 if(packet_list_colorize != recent.packet_list_colorize) {
5317 recent.packet_list_colorize = packet_list_colorize;
5318 color_filters_enable(packet_list_colorize);
5319 #ifdef NEW_PACKET_LIST
5320 new_packet_list_colorize_packets();
5322 cf_colorize_packets(&cfile);
5328 colorize_cb(GtkWidget *w, gpointer d _U_)
5330 menu_colorize_changed(GTK_CHECK_MENU_ITEM(w)->active);
5334 /* the recent file read has finished, update the menu corresponding */
5336 menu_recent_read_finished(void) {
5337 GtkWidget *menu = NULL;
5339 #ifdef MAIN_MENU_USE_UIMANAGER
5340 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/MainToolbar");
5342 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/MainToolbar");
5344 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.main_toolbar_show);
5346 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/FilterToolbar");
5348 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/FilterToolbar");
5350 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.filter_toolbar_show);
5352 #else /* MAIN_MENU_USE_UIMANAGER */
5353 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Main Toolbar");
5354 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.main_toolbar_show);
5356 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Filter Toolbar");
5357 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.filter_toolbar_show);
5358 #endif /* MAIN_MENU_USE_UIMANAGER*/
5360 #ifdef MAIN_MENU_USE_UIMANAGER
5361 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/WirelessToolbar");
5363 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/WirelessToolbar");
5365 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.airpcap_toolbar_show);
5367 #else /* MAIN_MENU_USE_UIMANAGER */
5368 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Wireless Toolbar");
5369 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.airpcap_toolbar_show);
5370 #endif /* MAIN_MENU_USE_UIMANAGER */
5371 #endif /* HAVE_AIRPCAP */
5373 #ifdef MAIN_MENU_USE_UIMANAGER
5375 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/Statusbar");
5377 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/Statusbar");
5379 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.statusbar_show);
5382 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/PacketList");
5384 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/PacketList");
5386 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.packet_list_show);
5389 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/PacketDetails");
5391 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/PacketDetails");
5393 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.tree_view_show);
5396 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/PacketBytes");
5398 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/PacketBytes");
5400 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.byte_view_show);
5403 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/ColorizePacketList");
5405 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/ColorizePacketList");
5407 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.packet_list_colorize);
5409 #else /* MAIN_MENU_USE_UIMANAGER */
5410 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Statusbar");
5411 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.statusbar_show);
5413 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Packet List");
5414 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.packet_list_show);
5416 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Packet Details");
5417 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.tree_view_show);
5419 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Packet Bytes");
5420 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.byte_view_show);
5422 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Colorize Packet List");
5423 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.packet_list_colorize);
5424 #endif /* MAIN_MENU_USE_UIMANAGER*/
5426 menu_name_resolution_changed();
5429 #ifdef MAIN_MENU_USE_UIMANAGER
5430 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/AutoScrollinLiveCapture");
5432 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/AutoScrollinLiveCapture");
5434 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), auto_scroll_live);
5436 #else /* MAIN_MENU_USE_UIMANAGER */
5437 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Auto Scroll in Live Capture");
5438 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), auto_scroll_live);
5439 #endif /* MAIN_MENU_USE_UIMANAGER*/
5440 #endif /* HAVE_LIBPCAP */
5442 main_widgets_rearrange();
5444 /* don't change the time format, if we had a command line value */
5445 if (timestamp_get_type() != TS_NOT_SET) {
5446 recent.gui_time_format = timestamp_get_type();
5449 #ifdef MAIN_MENU_USE_UIMANAGER
5451 timestamp_set_type(recent.gui_time_format);
5452 #ifdef NEW_PACKET_LIST
5453 /* This call adjusts column width */
5454 cf_timestamp_auto_precision(&cfile);
5455 new_packet_list_queue_draw();
5456 #else /* NEW_PACKET_LIST */
5457 cf_change_time_formats(&cfile);
5458 #endif /* NEW_PACKET_LIST */
5460 /* This should not be needed as we set the active radioItem when we crate the actiongroup */
5461 switch(recent.gui_time_format) {
5462 case(TS_ABSOLUTE_WITH_DATE):
5463 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/TimeDisplayFormat/DateandTimeofDay");
5465 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/TimeDisplayFormat/DateandTimeofDay");
5469 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/TimeDisplayFormat/TimeofDay");
5471 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/TimeDisplayFormat/TimeofDay");
5475 g_warning("TS_RELATIVE");
5476 action = gtk_ui_manager_get_action(ui_manager_main_menubar, "/Menubar/ViewMenu/TimeDisplayFormat/SecondsSinceBeginningofCapture");
5477 gtk_action_activate(action);
5478 if(gtk_action_is_sensitive(action))
5479 g_warning("ACTION IS SENSIBLE");
5481 g_warning("NO ACTION");
5484 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/TimeDisplayFormat/SecondsSinceBeginningofCapture");
5486 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/TimeDisplayFormat/SecondsSinceBeginningofCapture");
5490 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/TimeDisplayFormat/SecondsSincePreviousCapturedPacket");
5492 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/TimeDisplayFormat/SecondsSincePreviousCapturedPacket");
5496 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/TimeDisplayFormat/SecondsSincePreviousDisplayedPacket");
5498 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/TimeDisplayFormat/SecondsSincePreviousDisplayedPacket");
5502 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/TimeDisplayFormat/SecondsSinceEpoch");
5504 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/TimeDisplayFormat/SecondsSinceEpoch");
5508 g_assert_not_reached();
5510 /* set_active will not trigger the callback when activating an active item! */
5511 recent.gui_time_format = -1;
5512 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), FALSE);
5513 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
5515 #else /* MAIN_MENU_USE_UIMANAGER */
5516 switch(recent.gui_time_format) {
5517 case(TS_ABSOLUTE_WITH_DATE):
5518 menu = gtk_item_factory_get_widget(main_menu_factory,
5519 "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456");
5522 menu = gtk_item_factory_get_widget(main_menu_factory,
5523 "/View/Time Display Format/Time of Day: 01:02:03.123456");
5526 menu = gtk_item_factory_get_widget(main_menu_factory,
5527 "/View/Time Display Format/Seconds Since Beginning of Capture: 123.123456");
5530 menu = gtk_item_factory_get_widget(main_menu_factory,
5531 "/View/Time Display Format/Seconds Since Previous Captured Packet: 1.123456");
5534 menu = gtk_item_factory_get_widget(main_menu_factory,
5535 "/View/Time Display Format/Seconds Since Previous Displayed Packet: 1.123456");
5538 menu = gtk_item_factory_get_widget(main_menu_factory,
5539 "/View/Time Display Format/Seconds Since Epoch (1970-01-01): 1234567890.123456");
5542 g_assert_not_reached();
5544 /* set_active will not trigger the callback when activating an active item! */
5545 recent.gui_time_format = -1;
5546 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), FALSE);
5547 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
5548 #endif /* MAIN_MENU_USE_UIMANAGER */
5549 #ifdef MAIN_MENU_USE_UIMANAGER
5550 /* the actual precision will be set in cf_change_time_formats() below */
5551 if (recent.gui_time_precision == TS_PREC_AUTO) {
5552 timestamp_set_precision(TS_PREC_AUTO_SEC);
5554 timestamp_set_precision(recent.gui_time_precision);
5556 #ifdef NEW_PACKET_LIST
5557 /* This call adjusts column width */
5558 cf_timestamp_auto_precision(&cfile);
5559 new_packet_list_queue_draw();
5560 #else /* NEW_PACKET_LIST */
5561 cf_change_time_formats(&cfile);
5562 #endif /* NEW_PACKET_LIST */
5563 #else /* MAIN_MENU_USE_UIMANAGER */
5564 switch(recent.gui_time_precision) {
5566 menu = gtk_item_factory_get_widget(main_menu_factory,
5567 "/View/Time Display Format/Automatic (File Format Precision)");
5569 case(TS_PREC_FIXED_SEC):
5570 menu = gtk_item_factory_get_widget(main_menu_factory,
5571 "/View/Time Display Format/Seconds: 0");
5573 case(TS_PREC_FIXED_DSEC):
5574 menu = gtk_item_factory_get_widget(main_menu_factory,
5575 "/View/Time Display Format/Deciseconds: 0.1");
5577 case(TS_PREC_FIXED_CSEC):
5578 menu = gtk_item_factory_get_widget(main_menu_factory,
5579 "/View/Time Display Format/Centiseconds: 0.12");
5581 case(TS_PREC_FIXED_MSEC):
5582 menu = gtk_item_factory_get_widget(main_menu_factory,
5583 "/View/Time Display Format/Milliseconds: 0.123");
5585 case(TS_PREC_FIXED_USEC):
5586 menu = gtk_item_factory_get_widget(main_menu_factory,
5587 "/View/Time Display Format/Microseconds: 0.123456");
5589 case(TS_PREC_FIXED_NSEC):
5590 menu = gtk_item_factory_get_widget(main_menu_factory,
5591 "/View/Time Display Format/Nanoseconds: 0.123456789");
5594 g_assert_not_reached();
5597 /* set_active will not trigger the callback when activating an active item! */
5598 recent.gui_time_precision = -1;
5599 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), FALSE);
5600 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
5601 #endif /* MAIN_MENU_USE_UIMANAGER */
5603 /* don't change the seconds format, if we had a command line value */
5604 if (timestamp_get_seconds_type() != TS_SECONDS_NOT_SET) {
5605 recent.gui_seconds_format = timestamp_get_seconds_type();
5607 #ifdef MAIN_MENU_USE_UIMANAGER
5608 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/TimeDisplayFormat/DisplaySecondsWithHoursAndMinutes");
5610 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/TimeDisplayFormat/DisplaySecondsWithHoursAndMinutes");
5612 #else /* MAIN_MENU_USE_UIMANAGER */
5613 menu = gtk_item_factory_get_widget(main_menu_factory,
5614 "/View/Time Display Format/Display Seconds with hours and minutes");
5615 #endif /* MAIN_MENU_USE_UIMANAGER */
5617 switch (recent.gui_seconds_format) {
5618 case TS_SECONDS_DEFAULT:
5619 recent.gui_seconds_format = -1;
5620 /* set_active will not trigger the callback when deactivating an inactive item! */
5621 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
5622 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), FALSE);
5624 case TS_SECONDS_HOUR_MIN_SEC:
5625 recent.gui_seconds_format = -1;
5626 /* set_active will not trigger the callback when activating an active item! */
5627 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), FALSE);
5628 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
5631 g_assert_not_reached();
5634 menu_colorize_changed(recent.packet_list_colorize);
5639 popup_menu_handler(GtkWidget *widget, GdkEvent *event, gpointer data)
5641 GtkWidget *menu = (GtkWidget *)data;
5642 GdkEventButton *event_button = NULL;
5645 if(widget == NULL || event == NULL || data == NULL) {
5650 * If we ever want to make the menu differ based on what row
5651 * and/or column we're above, we'd use "eth_clist_get_selection_info()"
5652 * to find the row and column number for the coordinates; a CTree is,
5653 * I guess, like a CList with one column(?) and the expander widget
5656 /* Check if we are on packet_list object */
5657 if (widget == g_object_get_data(G_OBJECT(popup_menu_object), E_MPACKET_LIST_KEY) &&
5658 ((GdkEventButton *)event)->button != 1) {
5659 #ifdef NEW_PACKET_LIST
5661 if (new_packet_list_get_event_row_column((GdkEventButton *)event, &physical_row, &row, &column)) {
5663 if (packet_list_get_event_row_column(widget, (GdkEventButton *)event, &row, &column)) {
5665 g_object_set_data(G_OBJECT(popup_menu_object), E_MPACKET_LIST_ROW_KEY,
5666 #ifdef NEW_PACKET_LIST
5667 GINT_TO_POINTER(row));
5669 GINT_TO_POINTER(row));
5671 g_object_set_data(G_OBJECT(popup_menu_object), E_MPACKET_LIST_COL_KEY,
5672 GINT_TO_POINTER(column));
5673 #ifdef NEW_PACKET_LIST
5674 new_packet_list_set_selected_row(row);
5676 packet_list_set_selected_row(row);
5681 /* Check if we are on tree_view object */
5682 if (widget == tree_view_gbl) {
5683 tree_view_select(widget, (GdkEventButton *) event);
5686 /* context menu handler */
5687 if(event->type == GDK_BUTTON_PRESS) {
5688 event_button = (GdkEventButton *) event;
5690 /* To quote the "Gdk Event Structures" doc:
5691 * "Normally button 1 is the left mouse button, 2 is the middle button, and 3 is the right button" */
5692 if(event_button->button == 3) {
5693 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
5694 event_button->button,
5695 event_button->time);
5696 g_signal_stop_emission_by_name(widget, "button_press_event");
5701 /* Check if we are on byte_view object */
5702 if(widget == get_notebook_bv_ptr(byte_nb_ptr_gbl)) {
5703 byte_view_select(widget, (GdkEventButton *) event);
5706 /* GDK_2BUTTON_PRESS is a doubleclick -> expand/collapse tree row */
5707 /* GTK version 1 seems to be doing this automatically */
5708 if (widget == tree_view_gbl && event->type == GDK_2BUTTON_PRESS) {
5711 if (gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(widget),
5712 (gint) (((GdkEventButton *)event)->x),
5713 (gint) (((GdkEventButton *)event)->y),
5714 &path, NULL, NULL, NULL))
5716 if (gtk_tree_view_row_expanded(GTK_TREE_VIEW(widget), path))
5717 gtk_tree_view_collapse_row(GTK_TREE_VIEW(widget), path);
5719 gtk_tree_view_expand_row(GTK_TREE_VIEW(widget), path,
5721 gtk_tree_path_free(path);
5727 /* Enable or disable menu items based on whether you have a capture file
5728 you've finished reading and, if you have one, whether it's been saved
5729 and whether it could be saved except by copying the raw packet data. */
5731 set_menus_for_capture_file(capture_file *cf)
5734 /* We have no capture file */
5735 #ifdef MAIN_MENU_USE_UIMANAGER
5736 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Merge", FALSE);
5737 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Close", FALSE);
5738 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Save", FALSE);
5739 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/SaveAs", FALSE);
5740 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Export", FALSE);
5741 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/Reload", FALSE);
5742 #else /* MAIN_MENU_USE_UIMANAGER */
5743 set_menu_sensitivity_old("/File/Merge...", FALSE);
5744 set_menu_sensitivity_old("/File/Close", FALSE);
5745 set_menu_sensitivity_old("/File/Save", FALSE);
5746 set_menu_sensitivity_old("/File/Save As...", FALSE);
5747 set_menu_sensitivity_old("/File/Export", FALSE);
5748 set_menu_sensitivity_old("/View/Reload", FALSE);
5749 #endif /* MAIN_MENU_USE_UIMANAGER */
5751 set_toolbar_for_capture_file(FALSE);
5752 set_toolbar_for_unsaved_capture_file(FALSE);
5754 #ifdef MAIN_MENU_USE_UIMANAGER
5755 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Merge", TRUE);
5756 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Close", TRUE);
5757 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Save", !cf->user_saved);
5759 * "Save As..." works only if we can write the file out in at least
5760 * one format (so we can save the whole file or just a subset) or
5761 * if we have an unsaved capture (so writing the whole file out
5762 * with a raw data copy makes sense).
5764 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/SaveAs",
5765 cf_can_save_as(cf) || !cf->user_saved);
5766 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Export", TRUE);
5767 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/Reload", TRUE);
5768 #else /* MAIN_MENU_USE_UIMANAGER */
5769 set_menu_sensitivity_old("/File/Merge...", TRUE);
5770 set_menu_sensitivity_old("/File/Close", TRUE);
5771 set_menu_sensitivity_old("/File/Save", !cf->user_saved);
5773 * "Save As..." works only if we can write the file out in at least
5774 * one format (so we can save the whole file or just a subset) or
5775 * if we have an unsaved capture (so writing the whole file out
5776 * with a raw data copy makes sense).
5778 set_menu_sensitivity_old("/File/Save As...",
5779 cf_can_save_as(cf) || !cf->user_saved);
5780 set_menu_sensitivity_old("/File/Export", TRUE);
5781 set_menu_sensitivity_old("/View/Reload", TRUE);
5782 #endif /* MAIN_MENU_USE_UIMANAGER */
5783 set_toolbar_for_unsaved_capture_file(!cf->user_saved);
5784 set_toolbar_for_capture_file(TRUE);
5788 /* Enable or disable menu items based on whether there's a capture in
5791 set_menus_for_capture_in_progress(gboolean capture_in_progress)
5793 #ifdef MAIN_MENU_USE_UIMANAGER
5794 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Open",
5795 !capture_in_progress);
5796 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/OpenRecent",
5797 !capture_in_progress);
5798 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Export",
5799 capture_in_progress);
5800 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Set",
5801 !capture_in_progress);
5802 #else /* MAIN_MENU_USE_UIMANAGER */
5803 set_menu_sensitivity_old("/File/Open...",
5804 !capture_in_progress);
5805 set_menu_sensitivity_old("/File/Open Recent",
5806 !capture_in_progress);
5807 set_menu_sensitivity_old("/File/Export",
5808 capture_in_progress);
5809 set_menu_sensitivity_old("/File/File Set",
5810 !capture_in_progress);
5811 #endif /* MAIN_MENU_USE_UIMANAGER */
5812 set_menu_sensitivity(ui_manager_packet_list_heading, "/PacketListHeadingPopup/SortAscending",
5813 !capture_in_progress);
5814 set_menu_sensitivity(ui_manager_packet_list_heading, "/PacketListHeadingPopup/SortDescending",
5815 !capture_in_progress);
5816 set_menu_sensitivity(ui_manager_packet_list_heading, "/PacketListHeadingPopup/NoSorting",
5817 !capture_in_progress);
5820 #ifdef MAIN_MENU_USE_UIMANAGER
5821 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/CaptureMenu/Options",
5822 !capture_in_progress);
5823 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/CaptureMenu/Start",
5824 !capture_in_progress);
5825 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/CaptureMenu/Stop",
5826 capture_in_progress);
5827 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/CaptureMenu/Restart",
5828 capture_in_progress);
5829 #else /* MAIN_MENU_USE_UIMANAGER */
5830 set_menu_sensitivity_old("/Capture/Options...",
5831 !capture_in_progress);
5832 set_menu_sensitivity_old("/Capture/Start",
5833 !capture_in_progress);
5834 set_menu_sensitivity_old("/Capture/Stop",
5835 capture_in_progress);
5836 set_menu_sensitivity_old("/Capture/Restart",
5837 capture_in_progress);
5838 #endif /* MAIN_MENU_USE_UIMANAGER */
5839 set_toolbar_for_capture_in_progress(capture_in_progress);
5841 set_capture_if_dialog_for_capture_in_progress(capture_in_progress);
5842 #endif /* HAVE_LIBPCAP */
5845 /* Enable or disable menu items based on whether you have some captured
5848 walk_menu_tree_for_captured_packets(GList *node,
5849 gboolean have_captured_packets)
5851 gboolean is_enabled;
5853 menu_item_t *node_data = node->data;
5856 * Is this a leaf node or an interior node?
5858 if (node_data->children == NULL) {
5862 * If it has no "selected_packet_enabled()" or
5863 * "selected_tree_row_enabled()" routines, we enable
5864 * it. This allows tap windows to be popped up even
5865 * if you have no capture file; this is done to let
5866 * the user pop up multiple tap windows before reading
5867 * in a capture file, so that they can be processed in
5868 * parallel while the capture file is being read rather
5869 * than one at at time as you pop up the windows, and to
5870 * let the user pop up tap windows before starting an
5871 * "Update list of packets in real time" capture, so that
5872 * the statistics can be displayed while the capture is
5875 * If it has either of those routines, we disable it for
5876 * now - as long as, when a capture is first available,
5877 * we don't get called after a packet or tree row is
5878 * selected, that's OK.
5879 * XXX - that should be done better.
5881 if (node_data->selected_packet_enabled == NULL &&
5882 node_data->selected_tree_row_enabled == NULL)
5883 node_data->enabled = TRUE;
5885 node_data->enabled = FALSE;
5888 * It's an interior node; call
5889 * "walk_menu_tree_for_captured_packets()" on all its
5890 * children and, if any of them are enabled, enable
5891 * this node, otherwise disable it.
5893 * XXX - should we just leave all interior nodes enabled?
5894 * Which is a better UI choice?
5897 for (child = node_data->children; child != NULL; child =
5899 if (walk_menu_tree_for_captured_packets(child,
5900 have_captured_packets))
5903 node_data->enabled = is_enabled;
5907 * The root node doesn't correspond to a menu tree item; it
5908 * has a null name pointer.
5910 if (node_data->name != NULL) {
5911 #ifdef MAIN_MENU_USE_UIMANAGER
5912 set_menu_sensitivity(ui_manager_main_menubar, node_data->name,
5913 node_data->enabled);
5915 set_menu_sensitivity_old(node_data->name,
5916 node_data->enabled);
5919 return node_data->enabled;
5923 set_menus_for_captured_packets(gboolean have_captured_packets)
5925 #ifdef MAIN_MENU_USE_UIMANAGER
5926 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Print",
5927 have_captured_packets);
5928 #else /* MAIN_MENU_USE_UIMANAGER */
5929 set_menu_sensitivity_old("/File/Print...",
5930 have_captured_packets);
5931 #endif /* MAIN_MENU_USE_UIMANAGER */
5932 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/Print",
5933 have_captured_packets);
5935 #ifdef MAIN_MENU_USE_UIMANAGER
5936 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/FindPacket",
5937 have_captured_packets);
5938 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/FindNext",
5939 have_captured_packets);
5940 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/FindPrevious",
5941 have_captured_packets);
5942 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ZoomIn",
5943 have_captured_packets);
5944 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ZoomOut",
5945 have_captured_packets);
5946 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/NormalSize",
5947 have_captured_packets);
5948 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/GotoCorrespondingPacket",
5949 have_captured_packets);
5950 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/PreviousPacket",
5951 have_captured_packets);
5952 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/NextPacket",
5953 have_captured_packets);
5954 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/FirstPacket",
5955 have_captured_packets);
5956 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/LastPacket",
5957 have_captured_packets);
5958 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/PreviousPacketInConversation",
5959 have_captured_packets);
5960 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/NextPacketInConversation",
5961 have_captured_packets);
5962 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/StatisticsMenu/Summary",
5963 have_captured_packets);
5964 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/StatisticsMenu/ProtocolHierarchy",
5965 have_captured_packets);
5966 #else /* MAIN_MENU_USE_UIMANAGER */
5967 set_menu_sensitivity_old("/Edit/Find Packet...",
5968 have_captured_packets);
5969 set_menu_sensitivity_old("/Edit/Find Next",
5970 have_captured_packets);
5971 set_menu_sensitivity_old("/Edit/Find Previous",
5972 have_captured_packets);
5973 set_menu_sensitivity_old("/View/Zoom In",
5974 have_captured_packets);
5975 set_menu_sensitivity_old("/View/Zoom Out",
5976 have_captured_packets);
5977 set_menu_sensitivity_old("/View/Normal Size",
5978 have_captured_packets);
5979 set_menu_sensitivity_old("/Go/Go to Packet...",
5980 have_captured_packets);
5981 set_menu_sensitivity_old("/Go/Previous Packet",
5982 have_captured_packets);
5983 set_menu_sensitivity_old("/Go/Next Packet",
5984 have_captured_packets);
5985 set_menu_sensitivity_old("/Go/First Packet",
5986 have_captured_packets);
5987 set_menu_sensitivity_old("/Go/Last Packet",
5988 have_captured_packets);
5989 set_menu_sensitivity_old("/Go/Previous Packet In Conversation",
5990 have_captured_packets);
5991 set_menu_sensitivity_old("/Go/Next Packet In Conversation",
5992 have_captured_packets);
5993 set_menu_sensitivity_old("/Statistics/Summary",
5994 have_captured_packets);
5995 set_menu_sensitivity_old("/Statistics/Protocol Hierarchy",
5996 have_captured_packets);
5997 #endif /* MAIN_MENU_USE_UIMANAGER */
5998 walk_menu_tree_for_captured_packets(tap_menu_tree_root,
5999 have_captured_packets);
6000 set_toolbar_for_captured_packets(have_captured_packets);
6003 /* Enable or disable menu items based on whether a packet is selected and,
6004 if so, on the properties of the packet. */
6006 walk_menu_tree_for_selected_packet(GList *node, frame_data *fd,
6007 epan_dissect_t *edt)
6009 gboolean is_enabled;
6011 menu_item_t *node_data = node->data;
6014 * Is this a leaf node or an interior node?
6016 if (node_data->children == NULL) {
6020 * If it has no "selected_packet_enabled()" routine,
6021 * leave its enabled/disabled status alone - it
6022 * doesn't depend on whether we have a packet selected
6023 * or not or on the selected packet.
6025 * If it has a "selected_packet_enabled()" routine,
6026 * call it and set the item's enabled/disabled status
6027 * based on its return value.
6029 if (node_data->selected_packet_enabled != NULL)
6030 node_data->enabled = node_data->selected_packet_enabled(fd, edt, node_data->callback_data);
6033 * It's an interior node; call
6034 * "walk_menu_tree_for_selected_packet()" on all its
6035 * children and, if any of them are enabled, enable
6036 * this node, otherwise disable it.
6038 * XXX - should we just leave all interior nodes enabled?
6039 * Which is a better UI choice?
6042 for (child = node_data->children; child != NULL; child =
6044 if (walk_menu_tree_for_selected_packet(child, fd, edt))
6047 node_data->enabled = is_enabled;
6051 * The root node doesn't correspond to a menu tree item; it
6052 * has a null name pointer.
6054 if (node_data->name != NULL) {
6055 #ifdef MAIN_MENU_USE_UIMANAGER
6056 set_menu_sensitivity(ui_manager_main_menubar, node_data->name,
6057 node_data->enabled);
6058 #else /* MAIN_MENU_USE_UIMANAGER */
6059 set_menu_sensitivity_old(node_data->name,
6060 node_data->enabled);
6061 #endif /* MAIN_MENU_USE_UIMANAGER */
6063 return node_data->enabled;
6067 packet_is_ssl(epan_dissect_t* edt)
6073 if (!edt || !edt->tree)
6075 ssl_id = proto_get_id_by_filter_name("ssl");
6078 array = proto_find_finfo(edt->tree, ssl_id);
6079 is_ssl = (array->len > 0) ? TRUE : FALSE;
6080 g_ptr_array_free(array, TRUE);
6085 set_menus_for_selected_packet(capture_file *cf)
6087 /* Making the menu context-sensitive allows for easier selection of the
6088 desired item and has the added benefit, with large captures, of
6089 avoiding needless looping through huge lists for marked, ignored,
6090 or time-referenced packets. */
6091 gboolean is_ssl = packet_is_ssl(cf->edt);
6092 gboolean frame_selected = cf->current_frame != NULL;
6093 /* A frame is selected */
6094 gboolean have_marked = frame_selected && cf->marked_count > 0;
6095 /* We have marked frames. (XXX - why check frame_selected?) */
6096 gboolean another_is_marked = have_marked &&
6097 !(cf->marked_count == 1 && cf->current_frame->flags.marked);
6098 /* We have a marked frame other than the current frame (i.e.,
6099 we have at least one marked frame, and either there's more
6100 than one marked frame or the current frame isn't marked). */
6101 gboolean have_time_ref = cf->ref_time_count > 0;
6102 gboolean another_is_time_ref = frame_selected && have_time_ref &&
6103 !(cf->ref_time_count == 1 && cf->current_frame->flags.ref_time);
6104 /* We have a time reference frame other than the current frame (i.e.,
6105 we have at least one time reference frame, and either there's more
6106 than one time reference frame or the current frame isn't a
6107 time reference frame). (XXX - why check frame_selected?) */
6109 #ifdef MAIN_MENU_USE_UIMANAGER
6110 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/MarkPacket",
6112 #else /* MAIN_MENU_USE_UIMANAGER */
6113 set_menu_sensitivity_old("/Edit/Mark Packet (toggle)",
6115 #endif /* MAIN_MENU_USE_UIMANAGER */
6116 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/MarkPacket",
6118 #ifdef MAIN_MENU_USE_UIMANAGER
6119 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/MarkAllDisplayedPackets",
6120 cf->displayed_count > 0);
6121 /* Unlike un-ignore, do not allow unmark of all frames when no frames are displayed */
6122 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/UnmarkAllPackets",
6124 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/FindNextMark",
6126 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/FindPreviousMark",
6129 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/IgnorePacket",
6131 #else /* MAIN_MENU_USE_UIMANAGER */
6132 set_menu_sensitivity_old("/Edit/Mark All Displayed Packets (toggle)",
6133 cf->displayed_count > 0);
6134 /* Unlike un-ignore, do not allow unmark of all frames when no frames are displayed */
6135 set_menu_sensitivity_old("/Edit/Unmark All Packets",
6137 set_menu_sensitivity_old("/Edit/Find Next Mark",
6139 set_menu_sensitivity_old("/Edit/Find Previous Mark",
6142 set_menu_sensitivity_old("/Edit/Ignore Packet (toggle)",
6144 #endif /* MAIN_MENU_USE_UIMANAGER */
6145 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/IgnorePacket",
6147 #ifdef MAIN_MENU_USE_UIMANAGER
6148 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/IgnoreAllDisplayedPackets",
6149 cf->displayed_count > 0 && cf->displayed_count != cf->count);
6150 /* Allow un-ignore of all frames even with no frames currently displayed */
6151 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Un-IgnoreAllPackets",
6152 cf->ignored_count > 0);
6154 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/SetTimeReference",
6156 #else /* MAIN_MENU_USE_UIMANAGER */
6157 set_menu_sensitivity_old("/Edit/Ignore All Displayed Packets (toggle)",
6158 cf->displayed_count > 0 && cf->displayed_count != cf->count);
6159 /* Allow un-ignore of all frames even with no frames currently displayed */
6160 set_menu_sensitivity_old("/Edit/Un-Ignore All Packets",
6161 cf->ignored_count > 0);
6163 set_menu_sensitivity_old("/Edit/Set Time Reference (toggle)",
6165 #endif /* MAIN_MENU_USE_UIMANAGER */
6166 #ifdef NEW_PACKET_LIST
6167 #ifdef MAIN_MENU_USE_UIMANAGER
6168 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Un-TimeReferenceAllPackets",
6170 #else /* MAIN_MENU_USE_UIMANAGER */
6171 set_menu_sensitivity_old("/Edit/Un-Time Reference All Packets",
6173 #endif /* MAIN_MENU_USE_UIMANAGER */
6174 #endif /* NEW_PACKET_LIST */
6175 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/SetTimeReference",
6177 #ifdef MAIN_MENU_USE_UIMANAGER
6178 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/FindNextTimeReference",
6179 another_is_time_ref);
6180 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/FindPreviousTimeReference",
6181 another_is_time_ref);
6183 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ResizeAllColumns",
6185 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/CollapseAll",
6187 #else /* MAIN_MENU_USE_UIMANAGER */
6188 set_menu_sensitivity_old("/Edit/Find Next Time Reference",
6189 another_is_time_ref);
6190 set_menu_sensitivity_old("/Edit/Find Previous Time Reference",
6191 another_is_time_ref);
6193 set_menu_sensitivity_old("/View/Resize All Columns",
6195 set_menu_sensitivity_old("/View/Collapse All",
6197 #endif /* MAIN_MENU_USE_UIMANAGER */
6198 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/CollapseAll",
6200 #ifdef MAIN_MENU_USE_UIMANAGER
6201 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ExpandAll",
6203 #else /* MAIN_MENU_USE_UIMANAGER */
6204 set_menu_sensitivity_old("/View/Expand All",
6206 #endif /* MAIN_MENU_USE_UIMANAGER */
6207 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ExpandAll",
6209 #ifdef MAIN_MENU_USE_UIMANAGER
6210 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ColorizeConversation",
6212 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ResetColoring1-10",
6213 tmp_color_filters_used());
6214 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ShowPacketinNewWindow",
6216 #else /* MAIN_MENU_USE_UIMANAGER */
6217 set_menu_sensitivity_old("/View/Colorize Conversation",
6219 set_menu_sensitivity_old("/View/Reset Coloring 1-10",
6220 tmp_color_filters_used());
6221 set_menu_sensitivity_old("/View/Show Packet in New Window",
6223 #endif /* MAIN_MENU_USE_UIMANAGER */
6224 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ShowPacketinNewWindow",
6226 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ManuallyResolveAddress",
6227 frame_selected ? ((cf->edt->pi.ethertype == ETHERTYPE_IP)||(cf->edt->pi.ethertype == ETHERTYPE_IPv6)) : FALSE);
6228 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/SCTP",
6229 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_SCTP) : FALSE);
6230 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/FollowTCPStream",
6231 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
6232 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FollowTCPStream",
6233 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
6234 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/FollowUDPStream",
6235 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
6236 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/FollowSSLStream",
6237 frame_selected ? is_ssl : FALSE);
6238 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FollowSSLStream",
6239 frame_selected ? is_ssl : FALSE);
6240 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter",
6242 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/Ethernet",
6243 frame_selected ? (cf->edt->pi.dl_src.type == AT_ETHER) : FALSE);
6244 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/IP",
6245 frame_selected ? ((cf->edt->pi.ethertype == ETHERTYPE_IP)||(cf->edt->pi.ethertype == ETHERTYPE_IPv6)) : FALSE);
6246 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/TCP",
6247 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
6248 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/UDP",
6249 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
6250 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FollowUDPStream",
6251 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
6252 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/PN-CBA",
6253 frame_selected ? (cf->edt->pi.profinet_type != 0 && cf->edt->pi.profinet_type < 10) : FALSE);
6254 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation",
6256 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/Ethernet",
6257 frame_selected ? (cf->edt->pi.dl_src.type == AT_ETHER) : FALSE);
6258 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/IP",
6259 frame_selected ? ((cf->edt->pi.ethertype == ETHERTYPE_IP)||(cf->edt->pi.ethertype == ETHERTYPE_IPv6)) : FALSE);
6260 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/TCP",
6261 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
6262 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/UDP",
6263 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
6264 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/PN-CBA",
6265 frame_selected ? (cf->edt->pi.profinet_type != 0 && cf->edt->pi.profinet_type < 10) : FALSE);
6266 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/DecodeAs",
6267 frame_selected && decode_as_ok());
6268 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/DecodeAs",
6269 frame_selected && decode_as_ok());
6270 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/Copy",
6272 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ApplyAsFilter",
6274 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/PrepareaFilter",
6276 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ResolveName",
6277 frame_selected && (gbl_resolv_flags & RESOLV_ALL_ADDRS) != RESOLV_ALL_ADDRS);
6278 #ifdef MAIN_MENU_USE_UIMANAGER
6279 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/FollowTCPStream",
6280 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
6281 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/FollowUDPStream",
6282 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
6283 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/FollowSSLStream",
6284 frame_selected ? is_ssl : FALSE);
6285 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/DecodeAs",
6286 frame_selected && decode_as_ok());
6287 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/ResolveName",
6288 frame_selected && (gbl_resolv_flags & RESOLV_ALL_ADDRS) != RESOLV_ALL_ADDRS);
6289 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ToolsMenu/FirewallACLRules",
6292 #else /* MAIN_MENU_USE_UIMANAGER */
6293 set_menu_sensitivity_old("/Analyze/Follow TCP Stream",
6294 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
6295 set_menu_sensitivity_old("/Analyze/Follow UDP Stream",
6296 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
6297 set_menu_sensitivity_old("/Analyze/Follow SSL Stream",
6298 frame_selected ? is_ssl : FALSE);
6299 set_menu_sensitivity_old("/Analyze/Decode As...",
6300 frame_selected && decode_as_ok());
6301 set_menu_sensitivity_old("/View/Name Resolution/Resolve Name",
6302 frame_selected && (gbl_resolv_flags & RESOLV_ALL_ADDRS) != RESOLV_ALL_ADDRS);
6303 set_menu_sensitivity_old("/Tools/Firewall ACL Rules",
6305 #endif /* MAIN_MENU_USE_UIMANAGER */
6306 walk_menu_tree_for_selected_packet(tap_menu_tree_root, cf->current_frame,
6310 /* Enable or disable menu items based on whether a tree row is selected
6311 and, if so, on the properties of the tree row. */
6313 walk_menu_tree_for_selected_tree_row(GList *node, field_info *fi)
6315 gboolean is_enabled;
6317 menu_item_t *node_data = node->data;
6320 * Is this a leaf node or an interior node?
6322 if (node_data->children == NULL) {
6326 * If it has no "selected_tree_row_enabled()" routine,
6327 * leave its enabled/disabled status alone - it
6328 * doesn't depend on whether we have a tree row selected
6329 * or not or on the selected tree row.
6331 * If it has a "selected_tree_row_enabled()" routine,
6332 * call it and set the item's enabled/disabled status
6333 * based on its return value.
6335 if (node_data->selected_tree_row_enabled != NULL)
6336 node_data->enabled = node_data->selected_tree_row_enabled(fi, node_data->callback_data);
6339 * It's an interior node; call
6340 * "walk_menu_tree_for_selected_tree_row()" on all its
6341 * children and, if any of them are enabled, enable
6342 * this node, otherwise disable it.
6344 * XXX - should we just leave all interior nodes enabled?
6345 * Which is a better UI choice?
6348 for (child = node_data->children; child != NULL; child =
6350 if (walk_menu_tree_for_selected_tree_row(child, fi))
6353 node_data->enabled = is_enabled;
6357 * The root node doesn't correspond to a menu tree item; it
6358 * has a null name pointer.
6360 if (node_data->name != NULL) {
6361 #ifdef MAIN_MENU_USE_UIMANAGER
6362 set_menu_sensitivity(ui_manager_main_menubar, node_data->name,
6363 node_data->enabled);
6364 #else /* MAIN_MENU_USE_UIMANAGER */
6365 set_menu_sensitivity_old(node_data->name,
6366 node_data->enabled);
6367 #endif /* MAIN_MENU_USE_UIMANAGER */
6369 return node_data->enabled;
6373 menu_prefs_toggle_bool (GtkWidget *w, gpointer data)
6375 gboolean *value = data;
6376 module_t *module = g_object_get_data (G_OBJECT(w), "module");
6378 module->prefs_changed = TRUE;
6381 prefs_apply (module);
6382 if (!prefs.gui_use_pref_save) {
6385 redissect_packets();
6389 menu_prefs_change_enum (GtkWidget *w, gpointer data)
6392 module_t *module = g_object_get_data (G_OBJECT(w), "module");
6393 gint new_value = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(w), "enumval"));
6395 if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM(w)))
6398 if (*value != new_value) {
6399 module->prefs_changed = TRUE;
6402 prefs_apply (module);
6403 if (!prefs.gui_use_pref_save) {
6406 redissect_packets();
6411 menu_prefs_reset(void)
6413 g_free (g_object_get_data(G_OBJECT(ui_manager_tree_view_menu), "menu_abbrev"));
6414 g_object_set_data(G_OBJECT(ui_manager_tree_view_menu), "menu_abbrev", NULL);
6418 menu_prefs_change_ok (GtkWidget *w, gpointer parent_w)
6420 GtkWidget *entry = g_object_get_data (G_OBJECT(w), "entry");
6421 module_t *module = g_object_get_data (G_OBJECT(w), "module");
6422 pref_t *pref = g_object_get_data (G_OBJECT(w), "pref");
6423 const gchar *new_value = gtk_entry_get_text(GTK_ENTRY(entry));
6428 switch (pref->type) {
6430 uval = strtoul(new_value, &p, pref->info.base);
6431 if (p == new_value || *p != '\0') {
6432 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
6433 "The value \"%s\" isn't a valid number.",
6437 if (*pref->varp.uint != uval) {
6438 module->prefs_changed = TRUE;
6439 *pref->varp.uint = uval;
6443 if (strcmp (*pref->varp.string, new_value) != 0) {
6444 module->prefs_changed = TRUE;
6445 g_free((void*)*pref->varp.string);
6446 *pref->varp.string = g_strdup(new_value);
6450 if (range_convert_str(&newrange, new_value, pref->info.max_value) != CVT_NO_ERROR) {
6451 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
6452 "The value \"%s\" isn't a valid range.",
6456 if (!ranges_are_equal(*pref->varp.range, newrange)) {
6457 module->prefs_changed = TRUE;
6458 g_free(*pref->varp.range);
6459 *pref->varp.range = newrange;
6465 g_assert_not_reached();
6469 if (module->prefs_changed) {
6470 /* Ensure we reload the sub menu */
6472 prefs_apply (module);
6473 if (!prefs.gui_use_pref_save) {
6476 redissect_packets();
6479 window_destroy(GTK_WIDGET(parent_w));
6483 menu_prefs_change_cancel (GtkWidget *w _U_, gpointer parent_w)
6485 window_destroy(GTK_WIDGET(parent_w));
6489 menu_prefs_edit_dlg (GtkWidget *w, gpointer data)
6491 pref_t *pref = data;
6492 module_t *module = g_object_get_data (G_OBJECT(w), "module");
6493 gchar *value = NULL;
6495 GtkWidget *win, *main_tb, *main_vb, *bbox, *cancel_bt, *ok_bt;
6496 GtkWidget *entry, *label;
6497 GtkTooltips *tooltips;
6499 switch (pref->type) {
6501 switch (pref->info.base) {
6503 value = g_strdup_printf("%o", *pref->varp.uint);
6506 value = g_strdup_printf("%u", *pref->varp.uint);
6509 value = g_strdup_printf("%x", *pref->varp.uint);
6512 g_assert_not_reached();
6517 value = g_strdup(*pref->varp.string);
6520 value = g_strdup(range_convert_range (*pref->varp.range));
6523 g_assert_not_reached();
6527 tooltips = gtk_tooltips_new();
6529 win = dlg_window_new(module->description);
6531 gtk_window_set_resizable(GTK_WINDOW(win),FALSE);
6532 gtk_window_resize(GTK_WINDOW(win), 400, 100);
6534 main_vb = gtk_vbox_new(FALSE, 5);
6535 gtk_container_add(GTK_CONTAINER(win), main_vb);
6536 gtk_container_set_border_width(GTK_CONTAINER(main_vb), 6);
6538 main_tb = gtk_table_new(2, 2, FALSE);
6539 gtk_box_pack_start(GTK_BOX(main_vb), main_tb, FALSE, FALSE, 0);
6540 gtk_table_set_col_spacings(GTK_TABLE(main_tb), 10);
6542 label = gtk_label_new(ep_strdup_printf("%s:", pref->title));
6543 gtk_table_attach_defaults(GTK_TABLE(main_tb), label, 0, 1, 1, 2);
6544 gtk_misc_set_alignment(GTK_MISC(label), 1.0f, 0.5f);
6545 if (pref->description)
6546 gtk_tooltips_set_tip(tooltips, label, pref->description, NULL);
6548 entry = gtk_entry_new();
6549 gtk_table_attach_defaults(GTK_TABLE(main_tb), entry, 1, 2, 1, 2);
6550 gtk_entry_set_text(GTK_ENTRY(entry), value);
6551 if (pref->description)
6552 gtk_tooltips_set_tip(tooltips, entry, pref->description, NULL);
6554 bbox = dlg_button_row_new(GTK_STOCK_CANCEL,GTK_STOCK_OK, NULL);
6555 gtk_box_pack_end(GTK_BOX(main_vb), bbox, FALSE, FALSE, 0);
6557 ok_bt = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_OK);
6558 g_object_set_data (G_OBJECT(ok_bt), "module", module);
6559 g_object_set_data (G_OBJECT(ok_bt), "entry", entry);
6560 g_object_set_data (G_OBJECT(ok_bt), "pref", pref);
6561 g_signal_connect(ok_bt, "clicked", G_CALLBACK(menu_prefs_change_ok), win);
6563 dlg_set_activate(entry, ok_bt);
6565 cancel_bt = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_CANCEL);
6566 g_signal_connect(cancel_bt, "clicked", G_CALLBACK(menu_prefs_change_cancel), win);
6567 window_set_cancel_button(win, cancel_bt, NULL);
6569 gtk_widget_grab_default(ok_bt);
6570 gtk_widget_show_all(win);
6575 add_protocol_prefs_menu (pref_t *pref, gpointer data)
6577 GtkWidget *menu_preferences;
6578 GtkWidget *menu_item, *menu_sub_item, *sub_menu;
6579 GSList *group = NULL;
6580 module_t *module = data;
6581 const enum_val_t *enum_valp;
6582 gchar *label = NULL;
6584 switch (pref->type) {
6586 switch (pref->info.base) {
6588 label = g_strdup_printf ("%s: %o", pref->title, *pref->varp.uint);
6591 label = g_strdup_printf ("%s: %u", pref->title, *pref->varp.uint);
6594 label = g_strdup_printf ("%s: %x", pref->title, *pref->varp.uint);
6597 g_assert_not_reached();
6600 menu_item = gtk_menu_item_new_with_label(label);
6601 g_object_set_data (G_OBJECT(menu_item), "module", module);
6602 g_signal_connect(menu_item, "activate", G_CALLBACK(menu_prefs_edit_dlg), pref);
6606 menu_item = gtk_check_menu_item_new_with_label(pref->title);
6607 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menu_item), *pref->varp.boolp);
6608 g_object_set_data (G_OBJECT(menu_item), "module", module);
6609 g_signal_connect(menu_item, "activate", G_CALLBACK(menu_prefs_toggle_bool), pref->varp.boolp);
6612 menu_item = gtk_menu_item_new_with_label(pref->title);
6613 sub_menu = gtk_menu_new();
6614 gtk_menu_item_set_submenu (GTK_MENU_ITEM(menu_item), sub_menu);
6615 enum_valp = pref->info.enum_info.enumvals;
6616 while (enum_valp->name != NULL) {
6617 menu_sub_item = gtk_radio_menu_item_new_with_label(group, enum_valp->description);
6618 group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_sub_item));
6619 if (enum_valp->value == *pref->varp.enump) {
6620 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menu_sub_item), TRUE);
6622 g_object_set_data (G_OBJECT(menu_sub_item), "module", module);
6623 g_object_set_data (G_OBJECT(menu_sub_item), "enumval", GINT_TO_POINTER(enum_valp->value));
6624 g_signal_connect(menu_sub_item, "activate", G_CALLBACK(menu_prefs_change_enum), pref->varp.enump);
6625 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_sub_item);
6626 gtk_widget_show (menu_sub_item);
6631 label = g_strdup_printf ("%s: %s", pref->title, *pref->varp.string);
6632 menu_item = gtk_menu_item_new_with_label(label);
6633 g_object_set_data (G_OBJECT(menu_item), "module", module);
6634 g_signal_connect(menu_item, "activate", G_CALLBACK(menu_prefs_edit_dlg), pref);
6638 label = g_strdup_printf ("%s: %s", pref->title, range_convert_range (*pref->varp.range));
6639 menu_item = gtk_menu_item_new_with_label(label);
6640 g_object_set_data (G_OBJECT(menu_item), "module", module);
6641 g_signal_connect(menu_item, "activate", G_CALLBACK(menu_prefs_edit_dlg), pref);
6645 label = g_strdup_printf ("%s...", pref->title);
6646 menu_item = gtk_menu_item_new_with_label(label);
6647 g_signal_connect (menu_item, "activate", G_CALLBACK(uat_window_cb), pref->varp.uat);
6650 case PREF_STATIC_TEXT:
6653 /* Nothing to add */
6657 menu_preferences = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/ProtocolPreferences");
6658 if(!menu_preferences)
6659 g_warning("menu_preferences Not found path:TreeViewPopup/ProtocolPreferences");
6660 sub_menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM(menu_preferences));
6661 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
6662 gtk_widget_show (menu_item);
6668 rebuild_protocol_prefs_menu (module_t *prefs_module_p, gboolean preferences)
6670 GtkWidget *menu_preferences, *menu_item;
6671 GtkWidget *sub_menu;
6674 menu_preferences = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/ProtocolPreferences");
6676 sub_menu = gtk_menu_new();
6677 gtk_menu_item_set_submenu (GTK_MENU_ITEM(menu_preferences), sub_menu);
6679 label = g_strdup_printf ("%s Preferences...", prefs_module_p->description);
6680 menu_item = gtk_image_menu_item_new_with_label (label);
6681 gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM(menu_item),
6682 gtk_image_new_from_stock(GTK_STOCK_PREFERENCES, GTK_ICON_SIZE_MENU));
6683 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
6684 g_signal_connect_swapped(GTK_OBJECT(menu_item), "activate",
6685 G_CALLBACK(properties_cb), (GtkObject *) menu_item);
6686 gtk_widget_show (menu_item);
6689 menu_item = gtk_menu_item_new();
6690 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
6691 gtk_widget_show (menu_item);
6693 prefs_pref_foreach(prefs_module_p, add_protocol_prefs_menu, prefs_module_p);
6695 /* No preferences, remove sub menu */
6696 gtk_menu_item_set_submenu (GTK_MENU_ITEM(menu_preferences), NULL);
6701 #ifdef NEW_PACKET_LIST
6703 menu_visible_column_toggle (GtkWidget *w _U_, gpointer data)
6705 new_packet_list_toggle_visible_column (GPOINTER_TO_INT(data));
6709 rebuild_visible_columns_menu (void)
6711 GtkWidget *menu_columns[2], *menu_item;
6712 GtkWidget *sub_menu;
6716 gint i, col_id, cur_fmt;
6717 #ifdef MAIN_MENU_USE_UIMANAGER
6718 menu_columns[0] = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/DisplayedColumns");
6719 if(! menu_columns[0]){
6720 fprintf (stderr, "Warning: couldn't find menu_columns[0] path=/Menubar/ViewMenu/DisplayedColumns");
6722 #else /* MAIN_MENU_USE_UIMANAGER */
6723 menu_columns[0] = gtk_item_factory_get_widget(main_menu_factory, "/View/Displayed Columns");
6724 #endif /* MAIN_MENU_USE_UIMANAGER */
6725 menu_columns[1] = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/DisplayedColumns");
6727 if(! menu_columns[1]){
6728 fprintf (stderr, "Warning: couldn't find menu_columns[1] path=/PacketListHeadingPopup/DisplayedColumns");
6731 for (i = 0; i < 2; i++) {
6732 sub_menu = gtk_menu_new();
6733 gtk_menu_item_set_submenu (GTK_MENU_ITEM(menu_columns[i]), sub_menu);
6735 clp = g_list_first (prefs.col_list);
6738 cfmt = (fmt_data *) clp->data;
6739 cur_fmt = get_column_format_from_str(cfmt->fmt);
6740 if (cfmt->title[0]) {
6741 if (cur_fmt == COL_CUSTOM) {
6742 title = g_strdup_printf ("%s (%s)", cfmt->title, cfmt->custom_field);
6744 title = g_strdup_printf ("%s (%s)", cfmt->title, col_format_desc (cur_fmt));
6747 if (cur_fmt == COL_CUSTOM) {
6748 title = g_strdup_printf ("(%s)", cfmt->custom_field);
6750 title = g_strdup_printf ("(%s)", col_format_desc (cur_fmt));
6753 menu_item = gtk_check_menu_item_new_with_label(title);
6755 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menu_item), cfmt->visible);
6756 g_signal_connect(menu_item, "activate", G_CALLBACK(menu_visible_column_toggle), GINT_TO_POINTER(col_id));
6757 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
6758 gtk_widget_show (menu_item);
6759 clp = g_list_next (clp);
6763 menu_item = gtk_menu_item_new();
6764 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
6765 gtk_widget_show (menu_item);
6767 menu_item = gtk_menu_item_new_with_label ("Display All");
6768 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
6769 g_signal_connect(menu_item, "activate", G_CALLBACK(packet_list_heading_activate_all_columns_cb), NULL);
6770 gtk_widget_show (menu_item);
6773 #endif /* NEW_PACKET_LIST */
6776 menus_set_column_resolved (gboolean resolved, gboolean can_resolve)
6780 menu = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/ShowResolved");
6782 fprintf (stderr, "Warning: couldn't find menu path=/PacketListHeadingPopup/ShowResolved");
6784 g_object_set_data(G_OBJECT(menu), "skip-update", (void *)1);
6785 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), resolved && can_resolve);
6786 set_menu_sensitivity(ui_manager_packet_list_heading, "/PacketListHeadingPopup/ShowResolved", can_resolve);
6787 g_object_set_data(G_OBJECT(menu), "skip-update", NULL);
6791 menus_set_column_align_default (gboolean right_justify)
6793 GtkWidget *submenu, *menu_item_child;
6794 GList *child_list, *child_list_item;
6795 const gchar *menu_item_name;
6796 size_t menu_item_len;
6798 /* get the submenu container item */
6799 submenu = gtk_ui_manager_get_widget (ui_manager_packet_list_heading, "/PacketListHeadingPopup");
6801 fprintf (stderr, "Warning: couldn't find submenu path=/PacketListHeadingPopup");
6804 /* find the corresponding menu items to update */
6805 child_list = gtk_container_get_children(GTK_CONTAINER(submenu));
6806 child_list_item = child_list;
6807 while(child_list_item) {
6808 menu_item_child = (GTK_BIN(child_list_item->data))->child;
6809 if (menu_item_child != NULL) {
6810 menu_item_name = gtk_label_get_text(GTK_LABEL(menu_item_child));
6811 menu_item_len = strlen (menu_item_name);
6812 if(strncmp(menu_item_name, "Align Left", 10) == 0) {
6813 if (!right_justify && menu_item_len == 10) {
6814 gtk_label_set_text(GTK_LABEL(menu_item_child), "Align Left\t(default)");
6815 } else if (right_justify && menu_item_len > 10) {
6816 gtk_label_set_text(GTK_LABEL(menu_item_child), "Align Left");
6818 } else if (strncmp (menu_item_name, "Align Right", 11) == 0) {
6819 if (right_justify && menu_item_len == 11) {
6820 gtk_label_set_text(GTK_LABEL(menu_item_child), "Align Right\t(default)");
6821 } else if (!right_justify && menu_item_len > 11) {
6822 gtk_label_set_text(GTK_LABEL(menu_item_child), "Align Right");
6826 child_list_item = g_list_next(child_list_item);
6828 g_list_free(child_list);
6832 set_menus_for_selected_tree_row(capture_file *cf)
6834 gboolean properties;
6837 if (cf->finfo_selected != NULL) {
6838 header_field_info *hfinfo = cf->finfo_selected->hfinfo;
6842 if (hfinfo->parent == -1) {
6843 abbrev = hfinfo->abbrev;
6844 id = (hfinfo->type == FT_PROTOCOL) ? proto_get_id((protocol_t *)hfinfo->strings) : -1;
6846 abbrev = proto_registrar_get_abbrev(hfinfo->parent);
6847 id = hfinfo->parent;
6849 properties = prefs_is_registered_protocol(abbrev);
6850 set_menu_sensitivity(ui_manager_tree_view_menu,
6851 "/TreeViewPopup/GotoCorrespondingPacket", hfinfo->type == FT_FRAMENUM);
6852 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/Copy",
6854 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/Copy/AsFilter",
6855 proto_can_match_selected(cf->finfo_selected, cf->edt));
6856 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyasColumn",
6857 hfinfo->type != FT_NONE);
6858 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter",
6859 proto_can_match_selected(cf->finfo_selected, cf->edt));
6860 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter",
6861 proto_can_match_selected(cf->finfo_selected, cf->edt));
6862 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ColorizewithFilter",
6863 proto_can_match_selected(cf->finfo_selected, cf->edt));
6864 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ProtocolPreferences",
6866 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/DisableProtocol",
6867 (id == -1) ? FALSE : proto_can_toggle_protocol(id));
6868 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ExpandSubtrees",
6869 cf->finfo_selected->tree_type != -1);
6870 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/WikiProtocolPage",
6871 (id == -1) ? FALSE : TRUE);
6872 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FilterFieldReference",
6873 (id == -1) ? FALSE : TRUE);
6874 #ifdef MAIN_MENU_USE_UIMANAGER
6875 set_menu_sensitivity(ui_manager_tree_view_menu,
6876 "/Menubar/MenuFile/Export/SelectedPacketBytes", TRUE);
6877 set_menu_sensitivity(ui_manager_tree_view_menu,
6878 "/Menubar/MenuGo/GotoCorrespondingPacket", hfinfo->type == FT_FRAMENUM);
6879 set_menu_sensitivity(ui_manager_tree_view_menu, "/Menubar/MenuEdit/Copy/Description",
6880 proto_can_match_selected(cf->finfo_selected, cf->edt));
6881 set_menu_sensitivity(ui_manager_tree_view_menu, "/Menubar/MenuEdit/Copy/Fieldname",
6882 proto_can_match_selected(cf->finfo_selected, cf->edt));
6883 set_menu_sensitivity(ui_manager_tree_view_menu, "/Menubar/MenuEdit/Copy/Value",
6884 proto_can_match_selected(cf->finfo_selected, cf->edt));
6885 set_menu_sensitivity(ui_manager_tree_view_menu, "/Menubar/MenuEdit/Copy/AsFilter",
6886 proto_can_match_selected(cf->finfo_selected, cf->edt));
6887 set_menu_sensitivity(ui_manager_tree_view_menu, "/Menubar/MenuAnalyze/ApplyasColumn",
6888 hfinfo->type != FT_NONE);
6889 set_menu_sensitivity(ui_manager_tree_view_menu, "/Menubar/MenuAnalyze/ApplyAsFilter",
6890 proto_can_match_selected(cf->finfo_selected, cf->edt));
6891 set_menu_sensitivity(ui_manager_tree_view_menu, "/Menubar/MenuAnalyze/PrepareaFilter",
6892 proto_can_match_selected(cf->finfo_selected, cf->edt));
6893 set_menu_sensitivity(ui_manager_tree_view_menu, "/Menubar/MenuView/ExpandSubtrees",
6894 cf->finfo_selected->tree_type != -1);
6896 set_menu_sensitivity_old(
6897 "/File/Export/Selected Packet Bytes...", TRUE);
6898 set_menu_sensitivity_old(
6899 "/Go/Go to Corresponding Packet", hfinfo->type == FT_FRAMENUM);
6900 set_menu_sensitivity_old("/Edit/Copy/Description",
6901 proto_can_match_selected(cf->finfo_selected, cf->edt));
6902 set_menu_sensitivity_old("/Edit/Copy/Fieldname",
6903 proto_can_match_selected(cf->finfo_selected, cf->edt));
6904 set_menu_sensitivity_old("/Edit/Copy/Value",
6905 proto_can_match_selected(cf->finfo_selected, cf->edt));
6906 set_menu_sensitivity_old("/Edit/Copy/As Filter",
6907 proto_can_match_selected(cf->finfo_selected, cf->edt));
6908 set_menu_sensitivity_old("/Analyze/Apply as Column",
6909 hfinfo->type != FT_NONE);
6910 set_menu_sensitivity_old("/Analyze/Apply as Filter",
6911 proto_can_match_selected(cf->finfo_selected, cf->edt));
6912 set_menu_sensitivity_old("/Analyze/Prepare a Filter",
6913 proto_can_match_selected(cf->finfo_selected, cf->edt));
6914 set_menu_sensitivity_old("/View/Expand Subtrees",
6915 cf->finfo_selected->tree_type != -1);
6917 prev_abbrev = g_object_get_data(G_OBJECT(ui_manager_tree_view_menu), "menu_abbrev");
6918 if (!prev_abbrev || (strcmp (prev_abbrev, abbrev) != 0)) {
6919 /* No previous protocol or protocol changed - update Protocol Preferences menu */
6920 module_t *prefs_module_p = prefs_find_module(abbrev);
6921 rebuild_protocol_prefs_menu (prefs_module_p, properties);
6923 g_object_set_data(G_OBJECT(ui_manager_tree_view_menu), "menu_abbrev", g_strdup(abbrev));
6924 g_free (prev_abbrev);
6927 set_menu_sensitivity(ui_manager_tree_view_menu,
6928 "/TreeViewPopup/GotoCorrespondingPacket", FALSE);
6929 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/Copy", FALSE);
6930 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyasColumn", FALSE);
6931 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter", FALSE);
6932 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter", FALSE);
6933 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ColorizewithFilter", FALSE);
6934 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ProtocolPreferences",
6936 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/DisableProtocol", FALSE);
6937 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ExpandSubtrees", FALSE);
6938 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/WikiProtocolPage",
6940 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FilterFieldReference",
6942 #ifdef MAIN_MENU_USE_UIMANAGER
6943 set_menu_sensitivity(ui_manager_main_menubar,
6944 "/Menubar/FileMenu/Export/SelectedPacketBytes", FALSE);
6945 set_menu_sensitivity(ui_manager_main_menubar,
6946 "/Menubar/GoMenu/GotoCorrespondingPacket", FALSE);
6947 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Copy/Description", FALSE);
6948 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Copy/Fieldname", FALSE);
6949 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Copy/Value", FALSE);
6950 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Copy/AsFilter", FALSE);
6951 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/ApplyasColumn", FALSE);
6952 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/ApplyAsFilter", FALSE);
6953 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/PrepareaFilter", FALSE);
6954 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ExpandSubtrees", FALSE);
6955 #else /* MAIN_MENU_USE_UIMANAGER */
6956 set_menu_sensitivity_old("/File/Export/Selected Packet Bytes...", FALSE);
6957 set_menu_sensitivity_old("/Go/Go to Corresponding Packet", FALSE);
6958 set_menu_sensitivity_old("/Edit/Copy/Description", FALSE);
6959 set_menu_sensitivity_old("/Edit/Copy/Fieldname", FALSE);
6960 set_menu_sensitivity_old("/Edit/Copy/Value", FALSE);
6961 set_menu_sensitivity_old("/Edit/Copy/As Filter", FALSE);
6962 set_menu_sensitivity_old("/Analyze/Apply as Column", FALSE);
6963 set_menu_sensitivity_old("/Analyze/Apply as Filter", FALSE);
6964 set_menu_sensitivity_old("/Analyze/Prepare a Filter", FALSE);
6965 set_menu_sensitivity_old("/View/Expand Subtrees", FALSE);
6966 #endif /* MAIN_MENU_USE_UIMANAGER */
6969 walk_menu_tree_for_selected_tree_row(tap_menu_tree_root, cf->finfo_selected);
6972 void set_menus_for_packet_history(gboolean back_history, gboolean forward_history) {
6973 #ifdef MAIN_MENU_USE_UIMANAGER
6974 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/Back", back_history);
6975 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/Forward", forward_history);
6976 #else /* MAIN_MENU_USE_UIMANAGER */
6977 set_menu_sensitivity_old("/Go/Back", back_history);
6978 set_menu_sensitivity_old("/Go/Forward", forward_history);
6979 #endif /* MAIN_MENU_USE_UIMANAGER */
6980 set_toolbar_for_packet_history(back_history, forward_history);
6984 void set_menus_for_file_set(gboolean file_set, gboolean previous_file, gboolean next_file) {
6985 #ifdef MAIN_MENU_USE_UIMANAGER
6986 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Set/ListFiles", file_set);
6987 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Set/PreviousFile", previous_file);
6988 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Set/NextFile", next_file);
6989 #else /* MAIN_MENU_USE_UIMANAGER */
6990 set_menu_sensitivity_old("/File/File Set/List Files", file_set);
6991 set_menu_sensitivity_old("/File/File Set/Previous File", previous_file);
6992 set_menu_sensitivity_old("/File/File Set/Next File", next_file);
6993 #endif /* MAIN_MENU_USE_UIMANAGER */
6996 GtkWidget *menus_get_profiles_menu (void)
6998 return gtk_ui_manager_get_widget(ui_manager_statusbar_profiles_menu, "/ProfilesMenuPopup/Change");
7001 void set_menus_for_profiles(gboolean default_profile)
7003 set_menu_sensitivity(ui_manager_statusbar_profiles_menu, "/ProfilesMenuPopup/Delete", !default_profile);
7004 set_menu_sensitivity(ui_manager_statusbar_profiles_menu, "/ProfilesMenuPopup/Rename", !default_profile);
7013 * indent-tabs-mode: nil
7016 * ex: set shiftwidth=4 tabstop=8 expandtab
7017 * :indentSize=4:tabSize=8:noTabs=true: