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 "../color_filters.h"
52 #include "../stat_menu.h"
54 #include "gtk/about_dlg.h"
55 #include "gtk/capture_dlg.h"
56 #include "gtk/capture_if_dlg.h"
57 #include "gtk/color_dlg.h"
58 #include "gtk/filter_dlg.h"
59 #include "gtk/profile_dlg.h"
60 #include "gtk/dlg_utils.h"
61 #include "gtk/capture_file_dlg.h"
62 #include "gtk/fileset_dlg.h"
63 #include "gtk/find_dlg.h"
64 #include "gtk/goto_dlg.h"
65 #include "gtk/summary_dlg.h"
66 #include "gtk/prefs_dlg.h"
67 #include "gtk/packet_win.h"
68 #include "gtk/follow_tcp.h"
69 #include "gtk/follow_udp.h"
70 #include "gtk/follow_ssl.h"
71 #include "gtk/decode_as_dlg.h"
72 #include "gtk/help_dlg.h"
73 #include "gtk/supported_protos_dlg.h"
74 #include "gtk/proto_dlg.h"
75 #include "gtk/proto_hier_stats_dlg.h"
77 #include "gtk/stock_icons.h"
78 #include "gtk/gtkglobals.h"
79 #include "gtk/recent.h"
80 #include "gtk/main_proto_draw.h"
81 #include "gtk/conversations_table.h"
82 #include "gtk/hostlist_table.h"
83 #include "gtk/packet_history.h"
84 #include "gtk/sctp_stat.h"
85 #include "gtk/firewall_dlg.h"
87 #include "gtk/macros_dlg.h"
88 #include "gtk/export_object.h"
89 #include "gtk/gui_stat_menu.h"
91 #include "gtk/menus.h"
92 #include "gtk/main_toolbar.h"
93 #include "gtk/main_welcome.h"
94 #include "gtk/uat_gui.h"
95 #include "gtk/gui_utils.h"
96 #include "gtk/manual_addr_resolv.h"
97 #include "gtk/proto_help.h"
98 #include "gtk/dissector_tables_dlg.h"
99 #include "gtk/utf8_entities.h"
101 #ifdef NEW_PACKET_LIST
102 #include "gtk/new_packet_list.h"
104 #include "gtk/main_packet_list.h"
107 #ifdef HAVE_IGE_MAC_INTEGRATION
108 #include <ige-mac-menu.h>
111 #ifdef HAVE_GTKOSXAPPLICATION
112 #include <igemacintegration/gtkosxapplication.h>
115 typedef struct _menu_item {
118 const char *stock_id;
120 GtkItemFactoryCallback callback;
121 gpointer callback_data;
122 gboolean (*selected_packet_enabled)(frame_data *, epan_dissect_t *, gpointer callback_data);
123 gboolean (*selected_tree_row_enabled)(field_info *, gpointer callback_data);
127 static GList *tap_menu_tree_root = NULL;
129 GtkWidget *popup_menu_object;
132 #define GTK_MENU_FUNC(a) ((GtkItemFactoryCallback)(a))
134 static void merge_all_tap_menus(GList *node);
135 static void clear_menu_recent_capture_file_cmd_cb(GtkWidget *w, gpointer unused _U_);
137 static void menus_init(void);
138 static void set_menu_sensitivity (GtkUIManager *ui_manager, const gchar *, gint);
139 #ifndef MAIN_MENU_USE_UIMANAGER
140 static void set_menu_sensitivity_old (const gchar *, gint);
141 #endif /* MAIN_MENU_USE_UIMANAGER */
142 static void show_hide_cb(GtkWidget *w, gpointer data, gint action);
143 #ifndef MAIN_MENU_USE_UIMANAGER
144 static void timestamp_format_cb(GtkWidget *w, gpointer d, gint action);
145 static void timestamp_precision_cb(GtkWidget *w, gpointer d, gint action);
147 static void timestamp_seconds_time_cb(GtkWidget *w, gpointer d, gint action);
148 static void name_resolution_cb(GtkWidget *w, gpointer d, gint action);
150 #ifndef MAIN_MENU_USE_UIMANAGER
151 static void auto_scroll_live_cb(GtkWidget *w, gpointer d);
154 static void colorize_cb(GtkWidget *w, gpointer d);
157 /* As a general GUI guideline, we try to follow the Gnome Human Interface Guidelines, which can be found at:
158 http://developer.gnome.org/projects/gup/hig/1.0/index.html
160 Please note: there are some differences between the Gnome HIG menu suggestions and our implementation:
162 File/Open Recent: the Gnome HIG suggests putting the list of recently used files as elements into the File menuitem.
163 As this is ok for only a few items, this will become unhandy for 10 or even more list entries.
164 For this reason, we use a submenu for this.
166 File/Close: the Gnome HIG suggests putting this item just above the Quit item.
167 This results in unintuitive behaviour as both Close and Quit items are very near together.
168 By putting the Close item near the open item(s), it better suggests that it will close the
169 currently opened/captured file only.
173 SHOW_HIDE_MAIN_TOOLBAR = 1,
174 SHOW_HIDE_FILTER_TOOLBAR,
175 SHOW_HIDE_AIRPCAP_TOOLBAR,
177 SHOW_HIDE_PACKET_LIST,
180 } show_hide_values_e;
191 build_conversation_filter(int action, gboolean show_dialog)
193 packet_info *pi = &cfile.edt->pi;
199 if (pi->profinet_type == 0) {
201 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
202 "Error filtering conversation. Please make\n"
203 "sure you have a PROFINET CBA packet selected.");
208 if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4
209 && pi->ipproto == IP_PROTO_TCP ) {
211 switch(pi->profinet_type) {
213 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)",
214 ip_to_str( pi->net_dst.data),
215 ip_to_str( pi->net_src.data),
216 ip_to_str( pi->net_src.data),
217 ip_to_str( pi->net_dst.data));
220 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)",
221 ip_to_str( pi->net_src.data),
222 ip_to_str( pi->net_dst.data),
223 ip_to_str( pi->net_dst.data),
224 ip_to_str( pi->net_src.data));
227 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)",
228 ip_to_str( pi->net_dst.data),
229 ip_to_str( pi->net_src.data),
230 ip_to_str( pi->net_src.data),
231 ip_to_str( pi->net_dst.data));
234 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)",
235 ip_to_str( pi->net_src.data),
236 ip_to_str( pi->net_dst.data),
237 ip_to_str( pi->net_dst.data),
238 ip_to_str( pi->net_src.data));
248 if (pi->ipproto != IP_PROTO_TCP) {
250 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
251 "Error filtering conversation. Please make\n"
252 "sure you have a TCP packet selected.");
257 if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4 ) {
259 buf = g_strdup_printf("(ip.addr eq %s and ip.addr eq %s) and (tcp.port eq %d and tcp.port eq %d)",
260 ip_to_str( pi->net_src.data),
261 ip_to_str( pi->net_dst.data),
262 pi->srcport, pi->destport );
263 } else if( pi->net_src.type == AT_IPv6 && pi->net_dst.type == AT_IPv6 ) {
265 buf = g_strdup_printf("(ipv6.addr eq %s and ipv6.addr eq %s) and (tcp.port eq %d and tcp.port eq %d)",
266 ip6_to_str((const struct e_in6_addr *)pi->net_src.data),
267 ip6_to_str((const struct e_in6_addr *)pi->net_dst.data),
268 pi->srcport, pi->destport );
274 if (pi->ipproto != IP_PROTO_UDP) {
276 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
277 "Error filtering conversation. Please make\n"
278 "sure you have a UDP packet selected.");
283 if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4 ) {
285 buf = g_strdup_printf("(ip.addr eq %s and ip.addr eq %s) and (udp.port eq %d and udp.port eq %d)",
286 ip_to_str( pi->net_src.data),
287 ip_to_str( pi->net_dst.data),
288 pi->srcport, pi->destport );
289 } else if( pi->net_src.type == AT_IPv6 && pi->net_dst.type == AT_IPv6 ) {
291 buf = g_strdup_printf("(ipv6.addr eq %s and ipv6.addr eq %s) and (udp.port eq %d and udp.port eq %d)",
292 ip6_to_str((const struct e_in6_addr *)pi->net_src.data),
293 ip6_to_str((const struct e_in6_addr *)pi->net_dst.data),
294 pi->srcport, pi->destport );
300 if ((pi->ethertype != ETHERTYPE_IP) && (pi->ethertype != ETHERTYPE_IPv6)) {
302 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
303 "Error filtering conversation. Please make\n"
304 "sure you have a IP packet selected.");
309 if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4 ) {
311 buf = g_strdup_printf("ip.addr eq %s and ip.addr eq %s",
312 ip_to_str( pi->net_src.data),
313 ip_to_str( pi->net_dst.data));
314 } else if( pi->net_src.type == AT_IPv6 && pi->net_dst.type == AT_IPv6 ) {
316 buf = g_strdup_printf("ipv6.addr eq %s and ipv6.addr eq %s",
317 ip6_to_str((const struct e_in6_addr *)pi->net_src.data),
318 ip6_to_str((const struct e_in6_addr *)pi->net_dst.data));
324 /* XXX - is this the right way to check for Ethernet? */
325 /* check for the data link address type */
326 /* (ethertype will be 0 when used as length field) */
327 if (pi->dl_src.type != AT_ETHER) {
329 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
330 "Error filtering conversation. Please make\n"
331 "sure you have a Ethernet packet selected.");
336 if( pi->dl_src.type == AT_ETHER && pi->dl_dst.type == AT_ETHER ) {
338 buf = g_strdup_printf("eth.addr eq %s and eth.addr eq %s",
339 ether_to_str( pi->dl_src.data),
340 ether_to_str( pi->dl_dst.data));
353 conversation_cb(GtkWidget * w, gpointer data _U_, int action)
356 GtkWidget *filter_te;
358 if (cfile.current_frame) {
359 /* create a filter-string based on the selected packet and action */
360 filter = build_conversation_filter(action, TRUE);
362 /* Run the display filter so it goes in effect - even if it's the
363 same as the previous display filter. */
364 filter_te = g_object_get_data(G_OBJECT(w), E_DFILTER_TE_KEY);
365 gtk_entry_set_text(GTK_ENTRY(filter_te), filter);
366 main_filter_packets(&cfile, filter, TRUE);
373 colorize_conversation_cb(GtkWidget * w _U_, gpointer data _U_, int action)
375 gchar *filter = NULL;
377 if( (action>>8) == 255 ) {
378 color_filters_reset_tmp();
379 #ifdef NEW_PACKET_LIST
380 new_packet_list_colorize_packets();
382 cf_colorize_packets(&cfile);
384 } else if (cfile.current_frame) {
385 if( (action&0xff) == 0 ) {
386 /* colorize_conversation_cb was called from the window-menu
387 * or through an accelerator key. Try to build a conversation
388 * filter in the order TCP, UDP, IP, Ethernet and apply the
390 filter = build_conversation_filter(CONV_TCP,FALSE);
392 filter = build_conversation_filter(CONV_UDP,FALSE);
394 filter = build_conversation_filter(CONV_IP,FALSE);
396 filter = build_conversation_filter(CONV_ETHER,FALSE);
397 if( filter == NULL ) {
398 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Unable to build conversation filter.");
402 /* create a filter-string based on the selected packet and action */
403 filter = build_conversation_filter(action&0xff, TRUE);
406 if( (action>>8) == 0) {
407 /* Open the "new coloring filter" dialog with the filter */
408 color_display_with_filter(filter);
410 /* Set one of the temporary coloring filters */
411 color_filters_set_tmp((guint8)(action>>8),filter,FALSE);
412 #ifdef NEW_PACKET_LIST
413 new_packet_list_colorize_packets();
415 cf_colorize_packets(&cfile);
424 goto_conversation_frame(gboolean dir)
427 dfilter_t *dfcode = NULL;
428 gboolean found_packet=FALSE;
430 filter = build_conversation_filter(CONV_TCP,FALSE);
432 filter = build_conversation_filter(CONV_UDP,FALSE);
434 filter = build_conversation_filter(CONV_IP,FALSE);
435 if( filter == NULL ) {
436 simple_status("Unable to build conversation filter.");
441 if (!dfilter_compile(filter, &dfcode)) {
442 /* The attempt failed; report an error. */
443 simple_status("Error compiling filter for this conversation.");
448 found_packet = cf_find_packet_dfilter(&cfile, dfcode, dir);
451 /* We didn't find a packet */
452 simple_status("No previous/next packet in conversation.");
455 dfilter_free(dfcode);
460 goto_next_frame_conversation_cb(GtkWidget *w _U_, gpointer d _U_)
462 goto_conversation_frame(FALSE);
466 goto_previous_frame_conversation_cb(GtkWidget *w _U_, gpointer d _U_)
468 goto_conversation_frame(TRUE);
474 tree_view_menu_apply_selected_cb(GtkWidget *widget, gpointer user_data)
476 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_REPLACE|MATCH_SELECTED_APPLY_NOW);
480 tree_view_menu_apply_not_selected_cb(GtkWidget *widget, gpointer user_data)
482 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_NOT|MATCH_SELECTED_APPLY_NOW);
486 tree_view_menu_apply_and_selected_cb(GtkWidget *widget, gpointer user_data)
488 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_AND|MATCH_SELECTED_APPLY_NOW);
492 tree_view_menu_apply_or_selected_cb(GtkWidget *widget, gpointer user_data)
494 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_OR|MATCH_SELECTED_APPLY_NOW);
498 tree_view_menu_apply_and_not_selected_cb(GtkWidget *widget, gpointer user_data)
500 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_AND_NOT|MATCH_SELECTED_APPLY_NOW);
504 tree_view_menu_apply_or_not_selected_cb(GtkWidget *widget, gpointer user_data)
506 match_selected_ptree_cb( widget , user_data,MATCH_SELECTED_OR_NOT|MATCH_SELECTED_APPLY_NOW);
508 /* Prepare a filter */
510 tree_view_menu_prepare_selected_cb(GtkWidget *widget, gpointer user_data)
512 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_REPLACE);
516 tree_view_menu_prepare_not_selected_cb(GtkWidget *widget, gpointer user_data)
518 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_NOT);
522 tree_view_menu_prepare_and_selected_cb(GtkWidget *widget, gpointer user_data)
524 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_AND);
528 tree_view_menu_prepare_or_selected_cb(GtkWidget *widget, gpointer user_data)
530 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_OR);
534 tree_view_menu_prepare_and_not_selected_cb(GtkWidget *widget, gpointer user_data)
536 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_AND_NOT);
540 tree_view_menu_prepare_or_not_selected_cb(GtkWidget *widget, gpointer user_data)
542 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_OR_NOT);
545 #ifdef MAIN_MENU_USE_UIMANAGER
546 /* Prepare for use of GTKUImanager */
547 GtkUIManager *ui_manager_main_menubar = NULL;
551 copy_description_cb(GtkWidget *widget, gpointer user_data)
553 copy_selected_plist_cb( widget , user_data, COPY_SELECTED_DESCRIPTION);
557 copy_fieldname_cb(GtkWidget *widget, gpointer user_data)
559 copy_selected_plist_cb( widget , user_data, COPY_SELECTED_FIELDNAME);
563 copy_value_cb(GtkWidget *widget, gpointer user_data)
565 copy_selected_plist_cb( widget , user_data, COPY_SELECTED_VALUE);
569 copy_as_filter_cb(GtkWidget *widget, gpointer user_data)
571 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_REPLACE|MATCH_SELECTED_COPY_ONLY);
575 set_reftime_cb(GtkWidget *widget, gpointer user_data)
577 reftime_frame_cb( widget , user_data, REFTIME_TOGGLE);
581 find_next_ref_time_cb(GtkWidget *widget, gpointer user_data)
583 reftime_frame_cb( widget , user_data, REFTIME_FIND_NEXT);
587 find_previous_ref_time_cb(GtkWidget *widget, gpointer user_data)
589 reftime_frame_cb( widget , user_data, REFTIME_FIND_PREV);
593 menus_prefs_cb(GtkWidget *widget, gpointer user_data)
595 prefs_page_cb( widget , user_data, PREFS_PAGE_USER_INTERFACE);
599 main_toolbar_show_hide_cb(GtkAction *action _U_, gpointer user_data)
601 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/MainToolbar");
604 g_warning("main_toolbar_show_hide_cb: No widget found");
606 show_hide_cb( widget, user_data, SHOW_HIDE_MAIN_TOOLBAR);
611 filter_toolbar_show_hide_cb(GtkAction * action _U_, gpointer user_data)
613 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/FilterToolbar");
615 g_warning("filter_toolbar_show_hide_cb: No widget found");
617 show_hide_cb( widget, user_data, SHOW_HIDE_FILTER_TOOLBAR);
623 wireless_toolbar_show_hide_cb(GtkAction *action _U_, gpointer user_data)
625 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/WirelessToolbar");
627 g_warning("wireless_toolbar_show_hide_cb: No widget found");
629 show_hide_cb( widget, user_data, SHOW_HIDE_AIRPCAP_TOOLBAR);
632 #endif /* HAVE_AIRPCAP */
635 status_bar_show_hide_cb(GtkAction *action _U_, gpointer user_data)
637 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/Statusbar");
639 g_warning("status_bar_show_hide_cb: No widget found");
641 show_hide_cb( widget, user_data, SHOW_HIDE_STATUSBAR);
645 packet_list_show_hide_cb(GtkAction *action _U_, gpointer user_data)
647 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/PacketList");
649 g_warning("packet_list_show_hide_cb: No widget found");
651 show_hide_cb( widget, user_data, SHOW_HIDE_PACKET_LIST);
655 packet_details_show_hide_cb(GtkAction *action _U_, gpointer user_data)
657 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/PacketDetails");
659 g_warning("packet_details_show_hide_cb: No widget found");
661 show_hide_cb( widget, user_data, SHOW_HIDE_TREE_VIEW);
665 packet_bytes_show_hide_cb(GtkAction *action _U_, gpointer user_data)
667 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/PacketBytes");
669 g_warning("packet_bytes_show_hide_cb: No widget found");
671 show_hide_cb( widget, user_data, SHOW_HIDE_BYTE_VIEW);
676 timestamp_format_new_cb (GtkRadioAction *action, GtkRadioAction *current _U_, gpointer user_data _U_)
680 value = gtk_radio_action_get_current_value (action);
681 g_warning("timestamp_format_new_cb, value %u, recent.gui_time_format %u",value, recent.gui_time_format);
682 if (recent.gui_time_format != value) {
683 timestamp_set_type(value);
684 recent.gui_time_format = value;
685 #ifdef NEW_PACKET_LIST
686 /* This call adjusts column width */
687 cf_timestamp_auto_precision(&cfile);
688 new_packet_list_queue_draw();
690 cf_change_time_formats(&cfile);
697 timestamp_precision_new_cb (GtkRadioAction *action, GtkRadioAction *current _U_, gpointer user_data _U_)
701 value = gtk_radio_action_get_current_value (action);
702 g_warning("timestamp_precision_new_cb, value %u, recent.gui_time_precision %u",value, recent.gui_time_precision);
703 if (recent.gui_time_precision != value) {
704 /* the actual precision will be set in cf_change_time_formats() below */
705 if (value == TS_PREC_AUTO) {
706 timestamp_set_precision(TS_PREC_AUTO_SEC);
708 timestamp_set_precision(value);
710 recent.gui_time_precision = value;
711 #ifdef NEW_PACKET_LIST
712 /* This call adjusts column width */
713 cf_timestamp_auto_precision(&cfile);
714 new_packet_list_queue_draw();
716 cf_change_time_formats(&cfile);
723 view_menu_seconds_time_cb(GtkAction *action _U_, gpointer user_data)
725 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/TimeDisplayFormat/DisplaySecondsWithHoursAndMinutes");
727 g_warning("view_menu_seconds_time_cb: No widget found");
729 timestamp_seconds_time_cb(widget, user_data, 0);
734 view_menu_en_for_MAC_cb(GtkAction *action _U_, gpointer user_data)
736 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/EnableforMACLayer");
738 g_warning("view_menu_en_for_MAC_cb: No widget found");
740 name_resolution_cb( widget , user_data, RESOLV_MAC);
745 view_menu_en_for_network_cb(GtkAction *action _U_, gpointer user_data)
747 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/EnableforNetworkLayer");
749 g_warning("view_menu_en_for_network_cb: No widget found");
751 name_resolution_cb( widget , user_data, RESOLV_NETWORK);
756 view_menu_en_for_transport_cb(GtkAction *action _U_, gpointer user_data)
758 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/EnableforTransportLayer");
760 g_warning("view_menu_en_for_transport_cb: No widget found");
762 name_resolution_cb( widget , user_data, RESOLV_TRANSPORT);
767 view_menu_colorize_pkt_lst_cb(GtkAction *action _U_, gpointer user_data)
769 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/ColorizePacketList");
771 g_warning("view_menu_colorize_pkt_lst_cb: No widget found");
773 colorize_cb( widget , user_data);
779 view_menu_colorize_auto_scroll_live_cb(GtkAction *action _U_, gpointer user_data _U_)
781 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/AutoScrollinLiveCapture");
784 g_warning("view_menu_colorize_auto_scroll_live_cb: No widget found");
786 menu_auto_scroll_live_changed(GTK_CHECK_MENU_ITEM(widget)->active);
791 view_menu_color_conv_color1_cb(GtkWidget *widget, gpointer user_data)
793 colorize_conversation_cb( widget , user_data, 1*256);
798 view_menu_color_conv_color2_cb(GtkWidget *widget, gpointer user_data)
800 colorize_conversation_cb( widget , user_data, 2*256);
804 view_menu_color_conv_color3_cb(GtkWidget *widget, gpointer user_data)
806 colorize_conversation_cb( widget , user_data, 3*256);
810 view_menu_color_conv_color4_cb(GtkWidget *widget, gpointer user_data)
812 colorize_conversation_cb( widget , user_data, 4*256);
816 view_menu_color_conv_color5_cb(GtkWidget *widget, gpointer user_data)
818 colorize_conversation_cb( widget , user_data, 5*256);
822 view_menu_color_conv_color6_cb(GtkWidget *widget, gpointer user_data)
824 colorize_conversation_cb( widget , user_data, 6*256);
828 view_menu_color_conv_color7_cb(GtkWidget *widget, gpointer user_data)
830 colorize_conversation_cb( widget , user_data, 7*256);
834 view_menu_color_conv_color8_cb(GtkWidget *widget, gpointer user_data)
836 colorize_conversation_cb( widget , user_data, 8*256);
840 view_menu_color_conv_color9_cb(GtkWidget *widget, gpointer user_data)
842 colorize_conversation_cb( widget , user_data, 9*256);
846 view_menu_color_conv_color10_cb(GtkWidget *widget, gpointer user_data)
848 colorize_conversation_cb( widget , user_data, 10*256);
853 view_menu_color_conv_new_rule_cb(GtkWidget *widget, gpointer user_data)
855 colorize_conversation_cb( widget , user_data, 0);
860 view_menu_reset_coloring_cb(GtkWidget *widget, gpointer user_data)
862 colorize_conversation_cb( widget , user_data, 255*256);
867 help_menu_cont_cb(GtkWidget *widget, gpointer user_data _U_)
869 topic_menu_cb(widget/* _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(HELP_CONTENT));
873 help_menu_faq_cb(GtkWidget *widget, gpointer user_data _U_)
875 topic_menu_cb(widget/* _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(ONLINEPAGE_FAQ));
879 help_menu_wireshark_cb(GtkWidget *widget, gpointer user_data _U_)
881 topic_menu_cb(widget/* _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_WIRESHARK));
885 help_menu_wireshark_flt_cb(GtkWidget *widget, gpointer user_data _U_)
887 topic_menu_cb(widget/* _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_WIRESHARK_FILTER));
891 help_menu_Tshark_cb(GtkWidget *widget, gpointer user_data _U_)
893 topic_menu_cb(widget/* _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_TSHARK));
897 help_menu_RawShark_cb(GtkWidget *widget, gpointer user_data _U_)
899 topic_menu_cb(widget/* _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_RAWSHARK));
903 help_menu_Dumpcap_cb(GtkWidget *widget, gpointer user_data _U_)
905 topic_menu_cb(widget/* _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_DUMPCAP));
909 help_menu_Mergecap_cb(GtkWidget *widget, gpointer user_data _U_)
911 topic_menu_cb(widget/* _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_MERGECAP));
915 help_menu_Editcap_cb(GtkWidget *widget, gpointer user_data _U_)
917 topic_menu_cb(widget/* _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_EDITCAP));
921 help_menu_Text2pcap_cb(GtkWidget *widget, gpointer user_data _U_)
923 topic_menu_cb(widget/* _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_TEXT2PCAP));
927 help_menu_Website_cb(GtkWidget *widget, gpointer user_data _U_)
929 topic_menu_cb(widget/* _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(ONLINEPAGE_HOME));
933 help_menu_Wiki_cb(GtkWidget *widget, gpointer user_data _U_)
935 topic_menu_cb(widget/* _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(ONLINEPAGE_WIKI));
939 help_menu_Downloads_cb(GtkWidget *widget, gpointer user_data _U_)
941 topic_menu_cb(widget/* _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(ONLINEPAGE_DOWNLOAD));
945 help_menu_SampleCaptures_cb(GtkWidget *widget, gpointer user_data _U_)
947 topic_menu_cb(widget/* _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(ONLINEPAGE_SAMPLE_FILES));
950 static const char *ui_desc_menubar =
952 " <menubar name ='Menubar'>\n"
953 " <menu name= 'FileMenu' action='/File'>\n"
954 " <menuitem name='Open' action='/File/Open'/>\n"
955 " <menuitem name='OpenRecent' action='/File/OpenRecent'/>\n"
956 " <menuitem name='Merge' action='/File/Merge'/>\n"
957 " <menuitem name='Close' action='/File/Close'/>\n"
959 " <menuitem name='Save' action='/File/Save'/>\n"
960 " <menuitem name='SaveAs' action='/File/SaveAs'/>\n"
962 " <menu name= 'Set' action='/File/Set'>\n"
963 " <menuitem name='ListFiles' action='/File/Set/ListFiles'/>\n"
964 " <menuitem name='NextFile' action='/File/Set/NextFile'/>\n"
965 " <menuitem name='PreviousFile' action='/File/Set/PreviousFile'/>\n"
968 " <menu name= 'Export' action='/File/Export'>\n"
970 " <menuitem name='File' action='/File/Export/File'/>\n"
972 " <menu name= 'File' action='/File/Export/File'>\n"
973 " <menuitem name='AsTxt' action='/File/Export/File/Text'/>\n"
974 " <menuitem name='AsPostScript' action='/File/Export/File/PostScript'/>\n"
975 " <menuitem name='AsCSV' action='/File/Export/File/CSV'/>\n"
976 " <menuitem name='AsCArrays' action='/File/Export/File/CArrays'/>\n"
978 " <menuitem name='AsPSML' action='/File/Export/File/PSML'/>\n"
979 " <menuitem name='AsPDML' action='/File/Export/File/PDML'/>\n"
983 " <menuitem name='SelectedPacketBytes' action='/File/Export/SelectedPacketBytes'/>\n"
984 " <menu name= 'Objects' action='/File/Export/Objects'>\n"
985 " <menuitem name='HTTP' action='/File/Export/Objects/HTTP'/>\n"
986 " <menuitem name='DICOM' action='/File/Export/Objects/DICOM'/>\n"
987 " <menuitem name='SMB' action='/File/Export/Objects/SMB'/>\n"
991 " <menuitem name='Print' action='/File/Print'/>\n"
993 " <menuitem name='Quit' action='/File/Quit'/>\n"
995 " <menu name= 'EditMenu' action='/Edit'>\n"
996 " <menu name= 'Copy' action='/Edit/Copy'>\n"
997 " <menuitem name='Description' action='/Edit/Copy/Description'/>\n"
998 " <menuitem name='Fieldname' action='/Edit/Copy/Fieldname'/>\n"
999 " <menuitem name='Value' action='/Edit/Copy/Value'/>\n"
1001 " <menuitem name='AsFilter' action='/Edit/Copy/AsFilter'/>\n"
1003 " <menuitem name='FindPacket' action='/Edit/FindPacket'/>\n"
1004 " <menuitem name='FindNext' action='/Edit/FindNext'/>\n"
1005 " <menuitem name='FindPrevious' action='/Edit/FindPrevious'/>\n"
1007 #ifdef NEW_PACKET_LIST
1008 " <menuitem name='MarkPacket' action='/Edit/MarkPacket'/>\n"
1009 " <menuitem name='MarkAllDisplayedPackets' action='/Edit/MarkAllDisplayedPackets'/>\n"
1010 " <menuitem name='UnmarkAllPackets' action='/Edit/UnmarkAllPackets'/>\n"
1011 " <menuitem name='FindNextMark' action='/Edit/FindNextMark'/>\n"
1012 " <menuitem name='FindPreviousMark' action='/Edit/FindPreviousMark'/>\n"
1014 " <menuitem name='IgnorePacket' action='/Edit/IgnorePacket'/>\n"
1015 " <menuitem name='IgnoreAllDisplayedPackets' action='/Edit/IgnoreAllDisplayedPackets'/>\n"
1016 " <menuitem name='Un-IgnoreAllPackets' action='/Edit/Un-IgnoreAllPackets'/>\n"
1018 " <menuitem name='SetTimeReference' action='/Edit/SetTimeReference'/>\n"
1019 " <menuitem name='Un-TimeReferenceAllPackets' action='/Edit/Un-TimeReferenceAllPackets'/>\n"
1020 " <menuitem name='FindNextTimeReference' action='/Edit/FindNextTimeReference'/>\n"
1021 " <menuitem name='FindPreviousTimeReference' action='/Edit/FindPreviousTimeReference'/>\n"
1023 #else /* NEW_PACKET_LIST */
1024 #error "You must use the new packet list if you are using GTKUIManager for menus"
1026 " <menuitem name='ConfigurationProfiles' action='/Edit/ConfigurationProfiles'/>\n"
1027 " <menuitem name='Preferences' action='/Edit/Preferences'/>\n"
1029 " <menu name= 'ViewMenu' action='/View'>\n"
1030 " <menuitem name='MainToolbar' action='/View/MainToolbar'/>\n"
1031 " <menuitem name='FilterToolbar' action='/View/FilterToolbar'/>\n"
1033 " <menuitem name='WirelessToolbar' action='/View/WirelessToolbar'/>\n"
1035 " <menuitem name='Statusbar' action='/View/Statusbar'/>\n"
1037 " <menuitem name='PacketList' action='/View/PacketList'/>\n"
1038 " <menuitem name='PacketDetails' action='/View/PacketDetails'/>\n"
1039 " <menuitem name='PacketBytes' action='/View/PacketBytes'/>\n"
1041 " <menu name= 'TimeDisplayFormat' action='/View/TimeDisplayFormat'>\n"
1042 " <menuitem name='DateandTimeofDay' action='/View/TimeDisplayFormat/DateandTimeofDay'/>\n"
1043 " <menuitem name='TimeofDay' action='/View/TimeDisplayFormat/TimeofDay'/>\n"
1044 " <menuitem name='SecondsSinceEpoch' action='/View/TimeDisplayFormat/SecondsSinceEpoch'/>\n"
1045 " <menuitem name='SecondsSinceBeginningofCapture' action='/View/TimeDisplayFormat/SecondsSinceBeginningofCapture'/>\n"
1046 " <menuitem name='SecondsSincePreviousCapturedPacket' action='/View/TimeDisplayFormat/SecondsSincePreviousCapturedPacket'/>\n"
1047 " <menuitem name='SecondsSincePreviousDisplayedPacket' action='/View/TimeDisplayFormat/SecondsSincePreviousDisplayedPacket'/>\n"
1049 " <menuitem name='FileFormatPrecision-Automatic' action='/View/TimeDisplayFormat/FileFormatPrecision-Automatic'/>\n"
1050 " <menuitem name='FileFormatPrecision-Seconds' action='/View/TimeDisplayFormat/FileFormatPrecision-Seconds'/>\n"
1051 " <menuitem name='FileFormatPrecision-Deciseconds' action='/View/TimeDisplayFormat/FileFormatPrecision-Deciseconds'/>\n"
1052 " <menuitem name='FileFormatPrecision-Centiseconds' action='/View/TimeDisplayFormat/FileFormatPrecision-Centiseconds'/>\n"
1053 " <menuitem name='FileFormatPrecision-Milliseconds' action='/View/TimeDisplayFormat/FileFormatPrecision-Milliseconds'/>\n"
1054 " <menuitem name='FileFormatPrecision-Microseconds' action='/View/TimeDisplayFormat/FileFormatPrecision-Microseconds'/>\n"
1055 " <menuitem name='FileFormatPrecision-Nanoseconds' action='/View/TimeDisplayFormat/FileFormatPrecision-Nanoseconds'/>\n"
1057 " <menuitem name='DisplaySecondsWithHoursAndMinutes' action='/View/TimeDisplayFormat/DisplaySecondsWithHoursAndMinutes'/>\n"
1059 " <menu name= 'NameResolution' action='/View/NameResolution'>\n"
1060 " <menuitem name='ResolveName' action='/View/NameResolution/ResolveName'/>\n"
1062 " <menuitem name='EnableforMACLayer' action='/View/NameResolution/EnableforMACLayer'/>\n"
1063 " <menuitem name='EnableforNetworkLayer' action='/View/NameResolution/EnableforNetworkLayer'/>\n"
1064 " <menuitem name='EnableforTransportLayer' action='/View/NameResolution/EnableforTransportLayer'/>\n"
1066 " <menuitem name='ColorizePacketList' action='/View/ColorizePacketList'/>\n"
1067 " <menuitem name='AutoScrollinLiveCapture' action='/View/AutoScrollinLiveCapture'/>\n"
1069 " <menuitem name='ZoomIn' action='/View/ZoomIn'/>\n"
1070 " <menuitem name='ZoomOut' action='/View/ZoomOut'/>\n"
1071 " <menuitem name='NormalSize' action='/View/NormalSize'/>\n"
1073 " <menuitem name='ResizeAllColumns' action='/View/ResizeAllColumns'/>\n"
1074 " <menuitem name='DisplayedColumns' action='/View/DisplayedColumns'/>\n"
1076 " <menuitem name='ExpandSubtrees' action='/View/ExpandSubtrees'/>\n"
1077 " <menuitem name='ExpandAll' action='/View/ExpandAll'/>\n"
1078 " <menuitem name='CollapseAll' action='/View/CollapseAll'/>\n"
1080 " <menu name= 'ColorizeConversation' action='/View/ColorizeConversation'>\n"
1081 " <menuitem name='Color1' action='/View/ColorizeConversation/Color 1'/>\n"
1082 " <menuitem name='Color2' action='/View/ColorizeConversation/Color 2'/>\n"
1083 " <menuitem name='Color3' action='/View/ColorizeConversation/Color 3'/>\n"
1084 " <menuitem name='Color4' action='/View/ColorizeConversation/Color 4'/>\n"
1085 " <menuitem name='Color5' action='/View/ColorizeConversation/Color 5'/>\n"
1086 " <menuitem name='Color6' action='/View/ColorizeConversation/Color 6'/>\n"
1087 " <menuitem name='Color7' action='/View/ColorizeConversation/Color 7'/>\n"
1088 " <menuitem name='Color8' action='/View/ColorizeConversation/Color 8'/>\n"
1089 " <menuitem name='Color9' action='/View/ColorizeConversation/Color 9'/>\n"
1090 " <menuitem name='Color10' action='/View/ColorizeConversation/Color 10'/>\n"
1091 " <menuitem name='NewColoringRule' action='/View/ColorizeConversation/NewColoringRule'/>\n"
1094 " <menuitem name='ResetColoring1-10' action='/View/ResetColoring1-10'/>\n"
1095 " <menuitem name='ColoringRules' action='/View/ColoringRules'/>\n"
1097 " <menuitem name='ShowPacketinNewWindow' action='/View/ShowPacketinNewWindow'/>\n"
1098 " <menuitem name='Reload' action='/View/Reload'/>\n"
1100 " <menu name= 'GoMenu' action='/Go'>\n"
1101 " <menuitem name='Back' action='/Go/Back'/>\n"
1102 " <menuitem name='Forward' action='/Go/Forward'/>\n"
1103 " <menuitem name='GotoCorrespondingPacket' action='/Go/GotoCorrespondingPacket'/>\n"
1105 " <menuitem name='PreviousPacket' action='/Go/PreviousPacket'/>\n"
1106 " <menuitem name='NextPacket' action='/Go/NextPacket'/>\n"
1107 " <menuitem name='FirstPacket' action='/Go/FirstPacket'/>\n"
1108 " <menuitem name='LastPacket' action='/Go/LastPacket'/>\n"
1109 " <menuitem name='PreviousPacketInConversation' action='/Go/PreviousPacketInConversation'/>\n"
1110 " <menuitem name='NextPacketInConversation' action='/Go/NextPacketInConversation'/>\n"
1113 " <menu name= 'CaptureMenu' action='/Capture'>\n"
1114 " <menuitem name='Interfaces' action='/Capture/Interfaces'/>\n"
1115 " <menuitem name='Options' action='/Capture/Options'/>\n"
1116 " <menuitem name='Start' action='/Capture/Start'/>\n"
1117 " <menuitem name='Stop' action='/Capture/Stop'/>\n"
1118 " <menuitem name='Restart' action='/Capture/Restart'/>\n"
1119 " <menuitem name='CaptureFilters' action='/Capture/CaptureFilters'/>\n"
1121 #endif /* HAVE_LIBPCAP */
1122 " <menu name= 'AnalyzeMenu' action='/Analyze'>\n"
1123 " <menuitem name='DisplayFilters' action='/Analyze/DisplayFilters'/>\n"
1125 " <menuitem name='ApplyasColumn' action='/Analyze/ApplyasColumn'/>\n"
1126 " <menu name= 'ApplyAsFilter' action='/Analyze/ApplyasFilter'>\n"
1127 " <menuitem name='Selected' action='/Analyze/ApplyasFilter/Selected'/>\n"
1128 " <menuitem name='NotSelected' action='/Analyze/ApplyasFilter/NotSelected'/>\n"
1129 " <menuitem name='AndSelected' action='/Analyze/ApplyasFilter/AndSelected'/>\n"
1130 " <menuitem name='OrSelected' action='/Analyze/ApplyasFilter/OrSelected'/>\n"
1131 " <menuitem name='AndNotSelected' action='/Analyze/ApplyasFilter/AndNotSelected'/>\n"
1132 " <menuitem name='OrNotSelected' action='/Analyze/ApplyasFilter/OrNotSelected'/>\n"
1134 " <menu name= 'PrepareaFilter' action='/Analyze/PrepareaFilter'>\n"
1135 " <menuitem name='Selected' action='/Analyze/PrepareaFilter/Selected'/>\n"
1136 " <menuitem name='NotSelected' action='/Analyze/PrepareaFilter/NotSelected'/>\n"
1137 " <menuitem name='AndSelected' action='/Analyze/PrepareaFilter/AndSelected'/>\n"
1138 " <menuitem name='OrSelected' action='/Analyze/PrepareaFilter/OrSelected'/>\n"
1139 " <menuitem name='AndNotSelected' action='/Analyze/PrepareaFilter/AndNotSelected'/>\n"
1140 " <menuitem name='OrNotSelected' action='/Analyze/PrepareaFilter/OrNotSelected'/>\n"
1142 " <menuitem name='EnabledProtocols' action='/Analyze/EnabledProtocols'/>\n"
1143 " <menuitem name='DecodeAs' action='/Analyze/DecodeAs'/>\n"
1144 " <menuitem name='UserSpecifiedDecodes' action='/Analyze/UserSpecifiedDecodes'/>\n"
1146 " <menuitem name='FollowTCPStream' action='/Analyze/FollowTCPStream'/>\n"
1147 " <menuitem name='FollowUDPStream' action='/Analyze/FollowUDPStream'/>\n"
1148 " <menuitem name='FollowSSLStream' action='/Analyze/FollowSSLStream'/>\n"
1150 " <menu name= 'StatisticsMenu' action='/Statistics'>\n"
1151 " <menuitem name='Summary' action='/Statistics/Summary'/>\n"
1152 " <menuitem name='ProtocolHierarchy' action='/Statistics/ProtocolHierarchy'/>\n"
1153 " <menuitem name='Conversations' action='/Statistics/Conversations'/>\n"
1154 " <menuitem name='Endpoints' action='/Statistics/Endpoints'/>\n"
1156 " <menu name= 'TelephonyMenu' action='/Telephony'>\n"
1158 " <menu name= 'ToolsMenu' action='/Tools'>\n"
1159 " <menuitem name='FirewallACLRules' action='/Tools/FirewallACLRules'/>\n"
1161 " <menu name= 'WSinternalMenu' action='/WSinternal'>\n"
1162 " <menuitem name='Dissectortables' action='/WSinternal/Dissectortables'/>\n"
1164 " <menu name= 'HelpMenu' action='/Help'>\n"
1165 " <menuitem name='Contents' action='/Help/Contents'/>\n"
1166 " <menuitem name='FAQs' action='/Help/FAQs'/>\n"
1167 " <menu name= 'ManualPages' action='/Help/ManualPages'>\n"
1168 " <menuitem name='Wireshark' action='/Help/ManualPages/Wireshark'/>\n"
1169 " <menuitem name='WiresharkFilter' action='/Help/ManualPages/WiresharkFilter'/>\n"
1171 " <menuitem name='TShark' action='/Help/ManualPages/TShark'/>\n"
1172 " <menuitem name='RawShark' action='/Help/ManualPages/RawShark'/>\n"
1173 " <menuitem name='Dumpcap' action='/Help/ManualPages/Dumpcap'/>\n"
1174 " <menuitem name='Mergecap' action='/Help/ManualPages/Mergecap'/>\n"
1175 " <menuitem name='Editcap' action='/Help/ManualPages/Editcap'/>\n"
1176 " <menuitem name='Text2pcap' action='/Help/ManualPages/Text2pcap'/>\n"
1179 " <menuitem name='Website' action='/Help/Website'/>\n"
1180 " <menuitem name='Wiki' action='/Help/Wiki'/>\n"
1181 " <menuitem name='Downloads' action='/Help/Downloads'/>\n"
1182 " <menuitem name='SampleCaptures' action='/Help/SampleCaptures'/>\n"
1184 " <menuitem name='SupportedProtocols' action='/Help/SupportedProtocols'/>\n"
1186 " <menuitem name='AboutWireshark' action='/Help/AboutWireshark'/>\n"
1195 * Please do not use keystrokes that are used as "universal" shortcuts in
1196 * various desktop environments:
1199 * http://support.microsoft.com/kb/126449
1202 * http://library.gnome.org/users/user-guide/nightly/keyboard-skills.html.en
1205 * http://developer.kde.org/documentation/standards/kde/style/keys/shortcuts.html
1207 * In particular, do not use the following <control> sequences for anything
1208 * other than their standard purposes:
1210 * <control>O File->Open
1211 * <control>S File->Save
1212 * <control>P File->Print
1213 * <control>W File->Close
1214 * <control>Q File->Quit
1215 * <control>Z Edit->Undo (which we don't currently have)
1216 * <control>X Edit->Cut (which we don't currently have)
1217 * <control>C Edit->Copy (which we don't currently have)
1218 * <control>V Edit->Paste (which we don't currently have)
1219 * <control>A Edit->Select All (which we don't currently have)
1221 * Note that some if not all of the Edit keys above already perform those
1222 * functions in text boxes, such as the Filter box. Do no, under any
1223 * circumstances, make a change that keeps them from doing so.
1229 * const gchar *name;
1230 * const gchar *stock_id;
1231 * const gchar *label;
1232 * const gchar *accelerator;
1233 * const gchar *tooltip;
1234 * GCallback callback;
1236 * const gchar *name; The name of the action.
1237 * const gchar *stock_id; The stock id for the action, or the name of an icon from the icon theme.
1238 * const gchar *label; The label for the action. This field should typically be marked for translation,
1239 * see gtk_action_group_set_translation_domain().
1240 * If label is NULL, the label of the stock item with id stock_id is used.
1241 * const gchar *accelerator; The accelerator for the action, in the format understood by gtk_accelerator_parse().
1242 * const gchar *tooltip; The tooltip for the action. This field should typically be marked for translation,
1243 * see gtk_action_group_set_translation_domain().
1244 * GCallback callback; The function to call when the action is activated.
1247 static const GtkActionEntry main_menu_bar_entries[] = {
1249 { "/File", NULL, "_File", NULL, NULL, NULL },
1250 { "/Edit", NULL, "_Edit", NULL, NULL, NULL },
1251 { "/View", NULL, "_View", NULL, NULL, NULL },
1252 { "/Go", NULL, "_Go", NULL, NULL, NULL },
1254 { "/Capture", NULL, "_Capture", NULL, NULL, NULL },
1256 { "/Analyze", NULL, "_Analyze", NULL, NULL, NULL },
1257 { "/Statistics", NULL, "_Statistics", NULL, NULL, NULL },
1258 { "/Telephony", NULL, "Telephon_y", NULL, NULL, NULL },
1259 { "/Tools", NULL, "_Tools", NULL, NULL, NULL },
1260 { "/WSinternal", NULL, "WS internal", NULL, NULL, NULL },
1261 { "/Help", NULL, "_Help", NULL, NULL, NULL },
1263 { "/File/Open", GTK_STOCK_OPEN, "_Open...", "<control>O", "Open a file", G_CALLBACK(file_open_cmd_cb) },
1264 { "/File/OpenRecent", NULL, "Open _Recent", NULL, NULL, NULL },
1265 { "/File/Merge", NULL, "_Merge...", NULL, NULL, G_CALLBACK(file_merge_cmd_cb) },
1266 { "/File/Close", GTK_STOCK_CLOSE, "_Close", "<control>W", NULL, G_CALLBACK(file_close_cmd_cb) },
1268 { "/File/Save", GTK_STOCK_SAVE, "_Save", "<control>S", NULL, G_CALLBACK(file_save_cmd_cb) },
1269 { "/File/SaveAs", GTK_STOCK_SAVE_AS, "Save _As...", "<shift><control>S", NULL, G_CALLBACK(file_save_as_cmd_cb) },
1271 { "/File/Set", NULL, "File Set", NULL, NULL, NULL },
1272 { "/File/Export", NULL, "Export", NULL, NULL, NULL },
1273 { "/File/Print", GTK_STOCK_PRINT, "_Print...", "<control>P", NULL, G_CALLBACK(file_print_cmd_cb) },
1274 { "/File/Quit", GTK_STOCK_QUIT, "_Quit", "<control>Q", NULL, G_CALLBACK(file_quit_cmd_cb) },
1276 { "/File/Set/ListFiles", WIRESHARK_STOCK_FILE_SET_LIST, "List Files", NULL, NULL, G_CALLBACK(fileset_cb) },
1277 { "/File/Set/NextFile", WIRESHARK_STOCK_FILE_SET_NEXT, "Next File", NULL, NULL, G_CALLBACK(fileset_next_cb) },
1278 { "/File/Set/PreviousFile",WIRESHARK_STOCK_FILE_SET_PREVIOUS, "Previous File", NULL, NULL, G_CALLBACK(fileset_previous_cb) },
1281 { "/File/Export/File", NULL, "File...", NULL, NULL, G_CALLBACK(export_text_cmd_cb) },
1283 { "/File/Export/File", NULL, "File...", NULL, NULL, NULL },
1284 { "/File/Export/File/Text", NULL, "as \"Plain _Text\" file...", NULL, NULL, G_CALLBACK(export_text_cmd_cb) },
1285 { "/File/Export/File/PostScript", NULL, "as \"_PostScript\" file...", NULL, NULL, G_CALLBACK(export_ps_cmd_cb) },
1286 { "/File/Export/File/CSV", NULL, "as \"_CSV\" (Comma Separated Values packet summary) file...",
1287 NULL, NULL, G_CALLBACK(export_csv_cmd_cb) },
1288 { "/File/Export/File/CArrays", NULL, "as \"C _Arrays\" (packet bytes) file...",
1289 NULL, NULL, G_CALLBACK(export_carrays_cmd_cb) },
1290 { "/File/Export/File/PSML", NULL, "as XML - \"P_SML\" (packet summary) file...",
1291 NULL, NULL, G_CALLBACK(export_psml_cmd_cb) },
1292 { "/File/Export/File/PDML", NULL, "as XML - \"P_DML\" (packet details) file...",
1293 NULL, NULL, G_CALLBACK(export_pdml_cmd_cb) },
1295 { "/File/Export/SelectedPacketBytes", NULL, "Selected Packet _Bytes...", "<control>H", NULL, G_CALLBACK(savehex_cb) },
1296 { "/File/Export/Objects", NULL, "Objects", NULL, NULL, NULL },
1297 { "/File/Export/Objects/HTTP", NULL, "_HTTP", NULL, NULL, G_CALLBACK(eo_http_cb) },
1298 { "/File/Export/Objects/DICOM", NULL, "_DICOM", NULL, NULL, G_CALLBACK(eo_dicom_cb) },
1299 { "/File/Export/Objects/SMB", NULL, "_SMB", NULL, NULL, G_CALLBACK(eo_smb_cb) },
1302 { "/Edit/Copy", NULL, "Copy", NULL, NULL, NULL },
1304 { "/Edit/Copy/Description", NULL, "Description", "<shift><control>D", NULL, G_CALLBACK(copy_description_cb) },
1305 { "/Edit/Copy/Fieldname", NULL, "Fieldname", "<shift><control>F", NULL, G_CALLBACK(copy_fieldname_cb) },
1306 { "/Edit/Copy/Value", NULL, "Value", "<shift><control>V", NULL, G_CALLBACK(copy_value_cb) },
1307 { "/Edit/Copy/AsFilter", NULL, "As Filter", "<shift><control>C", NULL, G_CALLBACK(copy_as_filter_cb) },
1311 * Un-#if this when we actually implement Cut/Copy/Paste for the
1312 * packet list and packet detail windows.
1314 * Note: when we implement Cut/Copy/Paste in those windows, we
1315 * will almost certainly want to allow multiple packets to be
1316 * selected in the packet list pane and multiple packet detail
1317 * items to be selected in the packet detail pane, so that
1318 * the user can, for example, copy the summaries of multiple
1319 * packets to the clipboard from the packet list pane and multiple
1320 * packet detail items - perhaps *all* packet detail items - from
1321 * the packet detail pane. Given that, we'll also want to
1322 * implement Select All.
1324 * If multiple packets are selected, we would probably display nothing
1325 * in the packet detail pane, just as we do if no packet is selected,
1326 * and any menu items etc. that would pertain only to a single packet
1327 * would be disabled.
1329 * If multiple packet detail items are selected, we would probably
1330 * disable all items that pertain only to a single packet detail
1331 * item, such as some items in the status bar.
1333 * XXX - the actions for these will be different depending on what
1334 * widget we're in; ^C should copy from the filter text widget if
1335 * we're in that widget, the packet list if we're in that widget
1336 * (presumably copying the summaries of selected packets to the
1337 * clipboard, e.g. the text copy would be the text of the columns),
1338 * the packet detail if we're in that widget (presumably copying
1339 * the contents of selected protocol tree items to the clipboard,
1340 * e.g. the text copy would be the text displayed for those items),
1343 * Given that those menu items should also affect text widgets
1344 * such as the filter box, we would again want Select All, and,
1345 * at least for the filter box, we would also want Undo and Redo.
1346 * We would only want Cut, Paste, Undo, and Redo for the packet
1347 * list and packet detail panes if we support modifying them.
1349 {"/Edit/_Undo", "<control>Z", NULL,
1350 0, "<StockItem>", GTK_STOCK_UNDO,},
1351 {"/Edit/_Redo", "<shift><control>Z", NULL,
1352 0, "<StockItem>", GTK_STOCK_REDO,},
1353 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1354 {"/Edit/Cu_t", "<control>X", NULL,
1355 0, "<StockItem>", GTK_STOCK_CUT,},
1356 {"/Edit/_Copy", "<control>C", NULL,
1357 0, "<StockItem>", GTK_STOCK_COPY,},
1358 {"/Edit/_Paste", "<control>V", NULL,
1359 0, "<StockItem>", GTK_STOCK_PASTE,},
1360 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1361 {"/Edit/Select _All", "<control>A", NULL, 0,
1362 #ifdef GTK_STOCK_SELECT_ALL /* first appeared in 2.10 */
1363 "<StockItem>", GTK_STOCK_SELECT_ALL,
1366 #endif /* GTK_STOCK_SELECT_ALL */
1368 { "/Edit/FindPacket", GTK_STOCK_FIND, "_Find Packet...", "<control>F", NULL, G_CALLBACK(find_frame_cb) },
1369 { "/Edit/FindNext", NULL, "Find Ne_xt", "<control>N", NULL, G_CALLBACK(find_next_cb) },
1370 { "/Edit/FindPrevious", NULL, "Find Pre_vious", "<control>B", NULL, G_CALLBACK(find_previous_cb) },
1372 #ifdef NEW_PACKET_LIST
1373 { "/Edit/MarkPacket", NULL, "_Mark Packet (toggle)", "<control>M", NULL, G_CALLBACK(new_packet_list_mark_frame_cb) },
1374 { "/Edit/FindNextMark", NULL, "Find Next Mark", "<shift><control>N", NULL, G_CALLBACK(find_next_mark_cb) },
1375 { "/Edit/FindPreviousMark", NULL, "Find Next Mark", "<shift><control>B", NULL, G_CALLBACK(find_prev_mark_cb) },
1376 { "/Edit/MarkAllDisplayedPackets", NULL, "Mark All Displayed Packets (toggle)", "<control>A", NULL, G_CALLBACK(new_packet_list_mark_all_displayed_frames_cb) },
1377 { "/Edit/UnmarkAllPackets", NULL, "_Unmark All Packets", "<control>D", NULL, G_CALLBACK(new_packet_list_unmark_all_frames_cb) },
1379 { "/Edit/IgnorePacket", NULL, "_Ignore Packet (toggle)", "<control>X", NULL, G_CALLBACK(new_packet_list_ignore_frame_cb) },
1381 * XXX - this next one overrides /Edit/Copy/Description
1383 { "/Edit/IgnoreAllDisplayedPackets", NULL, "_Ignore All Displayed Packets (toggle)","<alt><shift><control>X", NULL, G_CALLBACK(new_packet_list_ignore_all_displayed_frames_cb) },
1384 { "/Edit/Un-IgnoreAllPackets", NULL, "U_n-Ignore All Packets", "<shift><control>X", NULL, G_CALLBACK(new_packet_list_unignore_all_frames_cb) },
1385 { "/Edit/SetTimeReference", WIRESHARK_STOCK_TIME, "Set Time Reference (toggle)", "<control>T", NULL, G_CALLBACK(set_reftime_cb) },
1386 { "/Edit/Un-TimeReferenceAllPackets",NULL, "Un-Time Reference All Packets", "<alt><control>T", NULL, G_CALLBACK(new_packet_list_untime_reference_all_frames_cb) },
1387 { "/Edit/FindNextTimeReference", NULL, "Find Next Time Reference", "<alt><control>N", NULL, G_CALLBACK(find_next_ref_time_cb) },
1388 { "/Edit/FindPreviousTimeReference", NULL, "Find Previous Time Reference", "<alt><control>B", NULL, G_CALLBACK(find_previous_ref_time_cb) },
1390 #else /* NEW_PACKET_LIST */
1391 #error "You must use the new packet list if you are using GTKUIManager for menus"
1392 #endif /* NEW_PACKET_LIST */
1393 { "/Edit/ConfigurationProfiles", NULL, "_Configuration Profiles...", "<shift><control>A", NULL, G_CALLBACK(profile_dialog_cb) },
1394 { "/Edit/Preferences", GTK_STOCK_PREFERENCES, "_Preferences...", "<shift><control>P", NULL, G_CALLBACK(menus_prefs_cb) },
1397 { "/View/TimeDisplayFormat", NULL, "_Time Display Format", NULL, NULL, NULL },
1399 { "/View/NameResolution", NULL, "Name Resol_ution", NULL, NULL, NULL },
1400 { "/View/NameResolution/ResolveName", NULL, "_Resolve Name", NULL, NULL, G_CALLBACK(resolve_name_cb) },
1401 { "/View/ZoomIn", GTK_STOCK_ZOOM_IN, "_Zoom In", "<control>plus", NULL, G_CALLBACK(view_zoom_in_cb) },
1402 { "/View/ZoomOut", GTK_STOCK_ZOOM_OUT, "Zoom _Out", "<control>minus", NULL, G_CALLBACK(view_zoom_out_cb) },
1403 { "/View/NormalSize", GTK_STOCK_ZOOM_100, "_Normal Size", "<control>equal", NULL, G_CALLBACK(view_zoom_100_cb) },
1404 #ifdef NEW_PACKET_LIST
1405 { "/View/ResizeAllColumns", WIRESHARK_STOCK_RESIZE_COLUMNS, "Resize All Columns", "<shift><control>R", NULL, G_CALLBACK(new_packet_list_resize_columns_cb) },
1406 { "/View/DisplayedColumns", NULL, "Displayed Columns", NULL, NULL, NULL },
1408 #error "You must use the new packet list if you are using GTKUIManager for menus"
1409 #endif /* NEW_PACKET_LIST */
1410 { "/View/ExpandSubtrees", NULL, "Expand Subtrees", NULL, NULL, G_CALLBACK(expand_tree_cb) },
1411 { "/View/ExpandAll", NULL, "Expand All", NULL, NULL, G_CALLBACK(expand_all_cb) },
1412 { "/View/CollapseAll", NULL, "Collapse All", NULL, NULL, G_CALLBACK(collapse_all_cb) },
1413 { "/View/ColorizeConversation", NULL, "Colorize Conversation",NULL, NULL, NULL },
1415 { "/View/ColorizeConversation/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(view_menu_color_conv_color1_cb) },
1416 { "/View/ColorizeConversation/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(view_menu_color_conv_color2_cb) },
1417 { "/View/ColorizeConversation/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(view_menu_color_conv_color3_cb) },
1418 { "/View/ColorizeConversation/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(view_menu_color_conv_color4_cb) },
1419 { "/View/ColorizeConversation/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(view_menu_color_conv_color5_cb) },
1420 { "/View/ColorizeConversation/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(view_menu_color_conv_color6_cb) },
1421 { "/View/ColorizeConversation/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(view_menu_color_conv_color7_cb) },
1422 { "/View/ColorizeConversation/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(view_menu_color_conv_color8_cb) },
1423 { "/View/ColorizeConversation/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(view_menu_color_conv_color9_cb) },
1424 { "/View/ColorizeConversation/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(view_menu_color_conv_color10_cb) },
1425 { "/View/ColorizeConversation/NewColoringRule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(view_menu_color_conv_new_rule_cb) },
1427 { "/View/ResetColoring1-10", NULL, "Reset Coloring 1-10", "<control>space", NULL, G_CALLBACK(view_menu_reset_coloring_cb) },
1428 { "/View/ColoringRules", GTK_STOCK_SELECT_COLOR, "_Coloring Rules...", NULL, NULL, G_CALLBACK(color_display_cb) },
1429 { "/View/ShowPacketinNewWindow", NULL, "Show Packet in New _Window", NULL, NULL, G_CALLBACK(new_window_cb) },
1430 { "/View/Reload", GTK_STOCK_REFRESH, "_Reload", "<control>R", NULL, G_CALLBACK(file_reload_cmd_cb) },
1433 { "/Go/Back", GTK_STOCK_GO_BACK, "_Back", "<alt>Left", NULL, G_CALLBACK(history_back_cb) },
1434 { "/Go/Forward", GTK_STOCK_JUMP_TO, "_Forward", "<control>G", NULL, G_CALLBACK(goto_frame_cb) },
1435 { "/Go/GotoCorrespondingPacket", NULL, "Go to _Corresponding Packet", NULL, NULL, G_CALLBACK(goto_framenum_cb) },
1437 { "/Go/PreviousPacket", GTK_STOCK_GO_UP, "Previous Packet", "<control>Up", NULL, G_CALLBACK(goto_previous_frame_cb) },
1438 { "/Go/NextPacket", GTK_STOCK_GO_DOWN, "Next Packet", "<control>Down", NULL, G_CALLBACK(goto_next_frame_cb) },
1439 { "/Go/FirstPacket", GTK_STOCK_GOTO_TOP, "F_irst Packet", "<control>Home", NULL, G_CALLBACK(goto_top_frame_cb) },
1440 { "/Go/LastPacket", GTK_STOCK_GOTO_BOTTOM, "_Last Packet", "<control>End", NULL, G_CALLBACK(goto_bottom_frame_cb) },
1441 { "/Go/PreviousPacketInConversation", GTK_STOCK_GO_UP, "Previous Packet In Conversation", "<control>bracketleft", NULL, G_CALLBACK(goto_previous_frame_conversation_cb) },
1442 { "/Go/NextPacketInConversation", GTK_STOCK_GO_DOWN, "Next Packet In Conversation", "<control>bracketright", NULL, G_CALLBACK(goto_next_frame_conversation_cb) },
1445 { "/Capture/Interfaces", WIRESHARK_STOCK_CAPTURE_INTERFACES, "_Interfaces...", "<control>I", NULL, G_CALLBACK(capture_if_cb) },
1446 { "/Capture/Options", WIRESHARK_STOCK_CAPTURE_OPTIONS, "_Options...", "<control>K", NULL, G_CALLBACK(capture_prep_cb) },
1447 { "/Capture/Start", WIRESHARK_STOCK_CAPTURE_START, "_Start", "<control>E", NULL, G_CALLBACK(capture_start_cb) },
1448 { "/Capture/Stop", WIRESHARK_STOCK_CAPTURE_STOP, "S_top", "<control>E", NULL, G_CALLBACK(capture_stop_cb) },
1449 { "/Capture/Restart", WIRESHARK_STOCK_CAPTURE_RESTART, "_Restart", "<control>R", NULL, G_CALLBACK(capture_restart_cb) },
1450 { "/Capture/CaptureFilters", WIRESHARK_STOCK_CAPTURE_FILTER, "Capture _Filters...", NULL, NULL, G_CALLBACK(cfilter_dialog_cb) },
1452 #endif /* HAVE_LIBPCAP */
1453 { "/Analyze/DisplayFilters", WIRESHARK_STOCK_DISPLAY_FILTER, "_Display Filters...", NULL, NULL, G_CALLBACK(dfilter_dialog_cb) },
1455 { "/Analyze/DisplayFilterMacros", NULL, "Display Filter _Macros...", NULL, NULL, G_CALLBACK(macros_dialog_cb) },
1456 { "/Analyze/ApplyasColumn", NULL, "Apply as Column", NULL, NULL, G_CALLBACK(apply_as_custom_column_cb) },
1457 { "/Analyze/ApplyasFilter", NULL, "Apply as Filter", NULL, NULL, NULL },
1459 { "/Analyze/ApplyasFilter/Selected", NULL, "_Selected" , NULL, NULL, G_CALLBACK(tree_view_menu_apply_selected_cb) },
1460 { "/Analyze/ApplyasFilter/NotSelected", NULL, "_Not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_not_selected_cb) },
1461 { "/Analyze/ApplyasFilter/AndSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _and Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_and_selected_cb) },
1462 { "/Analyze/ApplyasFilter/OrSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _or Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_or_selected_cb) },
1463 { "/Analyze/ApplyasFilter/AndNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " a_nd not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_and_not_selected_cb) },
1464 { "/Analyze/ApplyasFilter/OrNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " o_r not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_or_not_selected_cb) },
1466 { "/Analyze/PrepareaFilter", NULL, "Prepare a Filter", NULL, NULL, NULL },
1467 { "/Analyze/PrepareaFilter/Selected", NULL, "_Selected" , NULL, NULL, G_CALLBACK(tree_view_menu_prepare_selected_cb) },
1468 { "/Analyze/PrepareaFilter/NotSelected", NULL, "_Not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_not_selected_cb) },
1469 { "/Analyze/PrepareaFilter/AndSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _and Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_and_selected_cb) },
1470 { "/Analyze/PrepareaFilter/OrSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _or Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_or_selected_cb) },
1471 { "/Analyze/PrepareaFilter/AndNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " a_nd not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_and_not_selected_cb) },
1472 { "/Analyze/PrepareaFilter/OrNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " o_r not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_or_not_selected_cb) },
1474 { "/Analyze/EnabledProtocols", WIRESHARK_STOCK_CHECKBOX, "_Enabled Protocols...", "<shift><control>E", NULL, G_CALLBACK(proto_cb) },
1475 { "/Analyze/DecodeAs", WIRESHARK_STOCK_DECODE_AS, "Decode _As...", NULL, NULL, G_CALLBACK(decode_as_cb) },
1476 { "/Analyze/UserSpecifiedDecodes", WIRESHARK_STOCK_DECODE_AS, "_User Specified Decodes...", NULL, NULL, G_CALLBACK(decode_show_cb) },
1478 { "/Analyze/FollowTCPStream", NULL, "Follow TCP Stream", NULL, NULL, G_CALLBACK(follow_tcp_stream_cb) },
1479 { "/Analyze/FollowUDPStream", NULL, "Follow UDP Stream", NULL, NULL, G_CALLBACK(follow_udp_stream_cb) },
1480 { "/Analyze/FollowSSLStream", NULL, "Follow SSL Stream", NULL, NULL, G_CALLBACK(follow_ssl_stream_cb) },
1483 { "/Statistics/Summary", GTK_STOCK_PROPERTIES, "_Summary", NULL, NULL, G_CALLBACK(summary_open_cb) },
1484 { "/Statistics/ProtocolHierarchy", NULL, "_Protocol Hierarchy", NULL, NULL, G_CALLBACK(proto_hier_stats_cb) },
1485 { "/Statistics/Conversations", WIRESHARK_STOCK_CONVERSATIONS, "Conversations", NULL, NULL, G_CALLBACK(init_conversation_notebook_cb) },
1486 { "/Statistics/Endpoints", WIRESHARK_STOCK_ENDPOINTS, "Endpoints", NULL, NULL, G_CALLBACK(init_hostlist_notebook_cb) },
1488 { "/Tools/FirewallACLRules", NULL, "Firewall ACL Rules", NULL, NULL, G_CALLBACK(firewall_rule_cb) },
1490 { "/WSinternal/Dissectortables", NULL, "Dissector tables", NULL, NULL, G_CALLBACK(dissector_tables_dlg_cb) },
1492 { "/Help/Contents", GTK_STOCK_HELP, "_Contents", "F1", NULL, G_CALLBACK(help_menu_cont_cb) },
1493 { "/Help/FAQs", NULL, "FAQ's", NULL, NULL, G_CALLBACK(help_menu_faq_cb) },
1494 { "/Help/ManualPages", NULL, "ManualPages", NULL, NULL, NULL },
1495 { "/Help/ManualPages/Wireshark", NULL, "Wireshark", NULL, NULL, G_CALLBACK(help_menu_wireshark_cb) },
1496 { "/Help/ManualPages/WiresharkFilter", NULL, "Wireshark Filter", NULL, NULL, G_CALLBACK(help_menu_wireshark_flt_cb) },
1497 { "/Help/ManualPages/TShark", NULL, "Wireshark", NULL, NULL, G_CALLBACK(help_menu_Tshark_cb) },
1498 { "/Help/ManualPages/RawShark", NULL, "RawShark", NULL, NULL, G_CALLBACK(help_menu_RawShark_cb) },
1499 { "/Help/ManualPages/Dumpcap", NULL, "Dumpcap", NULL, NULL, G_CALLBACK(help_menu_Dumpcap_cb) },
1500 { "/Help/ManualPages/Mergecap", NULL, "Mergecap", NULL, NULL, G_CALLBACK(help_menu_Mergecap_cb) },
1501 { "/Help/ManualPages/Editcap", NULL, "Editcap", NULL, NULL, G_CALLBACK(help_menu_Editcap_cb) },
1502 { "/Help/ManualPages/Text2pcap", NULL, "Text2pcap", NULL, NULL, G_CALLBACK(help_menu_Text2pcap_cb) },
1504 { "/Help/Website", GTK_STOCK_HOME, "Website", NULL, NULL, G_CALLBACK(help_menu_Website_cb) },
1505 { "/Help/Wiki", WIRESHARK_STOCK_WIKI, "Wiki", NULL, NULL, G_CALLBACK(help_menu_Wiki_cb) },
1506 { "/Help/Downloads", NULL, "Downloads", NULL, NULL, G_CALLBACK(help_menu_Downloads_cb) },
1507 { "/Help/SampleCaptures", NULL, "Sample Captures", NULL, NULL, G_CALLBACK(help_menu_SampleCaptures_cb) },
1508 { "/Help/SupportedProtocols", NULL, "_Supported Protocols (slow!)", NULL, NULL, G_CALLBACK(supported_cb) },
1509 { "/Help/AboutWireshark", WIRESHARK_STOCK_ABOUT, "_About Wireshark", NULL, NULL, G_CALLBACK(about_wireshark_cb) },
1512 static const GtkToggleActionEntry main_menu_bar_toggle_action_entries[] =
1514 /* name, stock id, label, accel, tooltip, callback, is_active */
1515 {"/View/MainToolbar", NULL, "_Main Toolbar", NULL, NULL, G_CALLBACK(main_toolbar_show_hide_cb), TRUE},
1516 {"/View/FilterToolbar", NULL, "_FilterToolbar", NULL, NULL, G_CALLBACK(filter_toolbar_show_hide_cb), TRUE},
1518 {"/View/WirelessToolbar", NULL, "_WirelessToolbar", NULL, NULL, G_CALLBACK(wireless_toolbar_show_hide_cb), TRUE},
1519 #endif /* HAVE_AIRPCAP */
1520 {"/View/Statusbar", NULL, "_Statusbar", NULL, NULL, G_CALLBACK(status_bar_show_hide_cb), TRUE},
1521 {"/View/PacketList", NULL, "Packet _List", NULL, NULL, G_CALLBACK(packet_list_show_hide_cb), TRUE},
1522 {"/View/PacketDetails", NULL, "Packet _Details", NULL, NULL, G_CALLBACK(packet_details_show_hide_cb), TRUE},
1523 {"/View/PacketBytes", NULL, "Packet _Bytes", NULL, NULL, G_CALLBACK(packet_bytes_show_hide_cb), TRUE},
1524 {"/View/TimeDisplayFormat/DisplaySecondsWithHoursAndMinutes", NULL, "Display Seconds with hours and minutes", NULL, NULL, G_CALLBACK(view_menu_seconds_time_cb), FALSE},
1525 {"/View/NameResolution/EnableforMACLayer", NULL, "Enable for _MAC Layer", NULL, NULL, G_CALLBACK(view_menu_en_for_MAC_cb), TRUE},
1526 {"/View/NameResolution/EnableforNetworkLayer", NULL, "Enable for _Network Layer", NULL, NULL, G_CALLBACK(view_menu_en_for_network_cb), TRUE },
1527 {"/View/NameResolution/EnableforTransportLayer", NULL, "Enable for _Transport Layer", NULL, NULL, G_CALLBACK(view_menu_en_for_transport_cb), TRUE },
1528 {"/View/ColorizePacketList", NULL, "Colorize Packet List", NULL, NULL, G_CALLBACK(view_menu_colorize_pkt_lst_cb), TRUE },
1530 {"/View/AutoScrollinLiveCapture", NULL, "Auto Scroll in Li_ve Capture", NULL, NULL, G_CALLBACK(view_menu_colorize_auto_scroll_live_cb), TRUE },
1536 static const GtkRadioActionEntry main_menu_bar_radio_view_time_entries [] =
1538 /* name, stock id, label, accel, tooltip, value */
1539 { "/View/TimeDisplayFormat/DateandTimeofDay", NULL, "Date and Time of Day: 1970-01-01 01:02:03.123456", "<alt><control>1", NULL, TS_ABSOLUTE_WITH_DATE },
1540 { "/View/TimeDisplayFormat/TimeofDay", NULL, "Time of Day: 01:02:03.123456", "<alt><control>2", NULL, TS_ABSOLUTE },
1541 { "/View/TimeDisplayFormat/SecondsSinceEpoch", NULL, "Seconds Since Epoch (1970-01-01): 1234567890.123456", "<alt><control>3", NULL, TS_EPOCH },
1542 { "/View/TimeDisplayFormat/SecondsSinceBeginningofCapture", NULL, "Seconds Since Beginning of Capture: 123.123456", "<alt><control>4", NULL, TS_RELATIVE },
1543 { "/View/TimeDisplayFormat/SecondsSincePreviousCapturedPacket", NULL, "Seconds Since Previous Captured Packet: 1.123456", "<alt><control>5", NULL, TS_DELTA },
1544 { "/View/TimeDisplayFormat/SecondsSincePreviousDisplayedPacket",NULL, "Seconds Since Previous Displayed Packet: 1.123456", "<alt><control>6", NULL, TS_DELTA_DIS },
1547 static const GtkRadioActionEntry main_menu_bar_radio_view_time_fileformat_prec_entries [] =
1549 /* name, stock id, label, accel, tooltip, value */
1550 { "/View/TimeDisplayFormat/FileFormatPrecision-Automatic", NULL, "Automatic (File Format Precision)", NULL, NULL, TS_PREC_AUTO },
1551 { "/View/TimeDisplayFormat/FileFormatPrecision-Seconds", NULL, "Seconds: 0", NULL, NULL, TS_PREC_FIXED_SEC },
1552 { "/View/TimeDisplayFormat/FileFormatPrecision-Deciseconds", NULL, "Deciseconds: 0.1", NULL, NULL, TS_PREC_FIXED_DSEC },
1553 { "/View/TimeDisplayFormat/FileFormatPrecision-Centiseconds", NULL, "Centiseconds: 0.12", NULL, NULL, TS_PREC_FIXED_CSEC },
1554 { "/View/TimeDisplayFormat/FileFormatPrecision-Milliseconds", NULL, "Milliseconds: 0.123", NULL, NULL, TS_PREC_FIXED_MSEC },
1555 { "/View/TimeDisplayFormat/FileFormatPrecision-Microseconds", NULL, "Microseconds: 0.123456", NULL, NULL, TS_PREC_FIXED_USEC },
1556 { "/View/TimeDisplayFormat/FileFormatPrecision-Nanoseconds", NULL, "Nanoseconds: 0.123456789", NULL, NULL, TS_PREC_FIXED_NSEC },
1558 #else /* MAIN_MENU_USE_UIMANAGER */
1562 * Please do not use keystrokes that are used as "universal" shortcuts in
1563 * various desktop environments:
1566 * http://support.microsoft.com/kb/126449
1569 * http://library.gnome.org/users/user-guide/nightly/keyboard-skills.html.en
1572 * http://developer.kde.org/documentation/standards/kde/style/keys/shortcuts.html
1574 * In particular, do not use the following <control> sequences for anything
1575 * other than their standard purposes:
1577 * <control>O File->Open
1578 * <control>S File->Save
1579 * <control>P File->Print
1580 * <control>W File->Close
1581 * <control>Q File->Quit
1582 * <control>Z Edit->Undo (which we don't currently have)
1583 * <control>X Edit->Cut (which we don't currently have)
1584 * <control>C Edit->Copy (which we don't currently have)
1585 * <control>V Edit->Paste (which we don't currently have)
1586 * <control>A Edit->Select All (which we don't currently have)
1588 * Note that some if not all of the Edit keys above already perform those
1589 * functions in text boxes, such as the Filter box. Do no, under any
1590 * circumstances, make a change that keeps them from doing so.
1593 /* This is the GtkItemFactoryEntry structure used to generate new menus.
1594 Item 1: The menu path. The letter after the underscore indicates an
1595 accelerator key once the menu is open.
1596 Item 2: The accelerator key for the entry
1597 Item 3: The callback function.
1598 Item 4: The callback action. This changes the parameters with
1599 which the function is called. The default is 0.
1600 Item 5: The item type, used to define what kind of an item it is.
1601 Here are the possible values:
1605 "<Title>" -> create a title item
1606 "<Item>" -> create a simple item
1607 "<ImageItem>" -> create an item holding an image
1608 "<StockItem>" -> create an item holding a stock image
1609 "<CheckItem>" -> create a check item
1610 "<ToggleItem>" -> create a toggle item
1611 "<RadioItem>" -> create a radio item
1612 <path> -> path of a radio item to link against
1613 "<Separator>" -> create a separator
1614 "<Tearoff>" -> create a tearoff separator
1615 "<Branch>" -> create an item to hold sub items (optional)
1616 "<LastBranch>" -> create a right justified branch
1617 Item 6: extra data needed for ImageItem and StockItem
1619 static GtkItemFactoryEntry menu_items[] =
1621 {"/_File", NULL, NULL, 0, "<Branch>", NULL,},
1622 {"/File/_Open...", "<control>O", GTK_MENU_FUNC(file_open_cmd_cb),
1623 0, "<StockItem>", GTK_STOCK_OPEN,},
1624 {"/File/Open _Recent", NULL, NULL, 0, "<Branch>", NULL,},
1625 {"/File/_Merge...", NULL, GTK_MENU_FUNC(file_merge_cmd_cb), 0, NULL, NULL,},
1626 {"/File/_Close", "<control>W", GTK_MENU_FUNC(file_close_cmd_cb),
1627 0, "<StockItem>", GTK_STOCK_CLOSE,},
1628 {"/File/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1629 {"/File/_Save", "<control>S", GTK_MENU_FUNC(file_save_cmd_cb),
1630 0, "<StockItem>", GTK_STOCK_SAVE,},
1631 {"/File/Save _As...", "<shift><control>S", GTK_MENU_FUNC(file_save_as_cmd_cb),
1632 0, "<StockItem>", GTK_STOCK_SAVE_AS,},
1633 {"/File/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1634 {"/File/File Set", NULL, NULL, 0, "<Branch>", NULL,},
1635 {"/File/File Set/List Files", NULL, GTK_MENU_FUNC(fileset_cb), 0, "<StockItem>", WIRESHARK_STOCK_FILE_SET_LIST,},
1636 {"/File/File Set/Next File", NULL, GTK_MENU_FUNC(fileset_next_cb), 0, "<StockItem>", WIRESHARK_STOCK_FILE_SET_NEXT,},
1637 {"/File/File Set/Previous File", NULL, GTK_MENU_FUNC(fileset_previous_cb), 0, "<StockItem>", WIRESHARK_STOCK_FILE_SET_PREVIOUS,},
1638 {"/File/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1639 {"/File/_Export", NULL, NULL, 0, "<Branch>", NULL,},
1641 {"/File/Export/File...", NULL, GTK_MENU_FUNC(export_text_cmd_cb),
1644 {"/File/Export/as \"Plain _Text\" file...", NULL, GTK_MENU_FUNC(export_text_cmd_cb),
1646 {"/File/Export/as \"_PostScript\" file...", NULL, GTK_MENU_FUNC(export_ps_cmd_cb),
1648 {"/File/Export/as \"_CSV\" (Comma Separated Values packet summary) file...",
1649 NULL, GTK_MENU_FUNC(export_csv_cmd_cb), 0, NULL, NULL,},
1650 {"/File/Export/as \"C _Arrays\" (packet bytes) file...", NULL, GTK_MENU_FUNC(export_carrays_cmd_cb),
1652 {"/File/Export/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1653 {"/File/Export/as XML - \"P_SML\" (packet summary) file...", NULL, GTK_MENU_FUNC(export_psml_cmd_cb),
1655 {"/File/Export/as XML - \"P_DML\" (packet details) file...", NULL, GTK_MENU_FUNC(export_pdml_cmd_cb),
1657 {"/File/Export/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1659 {"/File/Export/Selected Packet _Bytes...", "<control>H", GTK_MENU_FUNC(savehex_cb),
1661 {"/File/Export/_Objects/_HTTP", NULL, GTK_MENU_FUNC(eo_http_cb), 0, NULL, NULL,},
1662 {"/File/Export/_Objects/_DICOM", NULL, GTK_MENU_FUNC(eo_dicom_cb), 0, NULL, NULL,},
1663 {"/File/Export/_Objects/_SMB", NULL, GTK_MENU_FUNC(eo_smb_cb), 0, NULL, NULL,},
1664 {"/File/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1665 {"/File/_Print...", "<control>P", GTK_MENU_FUNC(file_print_cmd_cb),
1666 0, "<StockItem>", GTK_STOCK_PRINT,},
1667 {"/File/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1668 {"/File/_Quit", "<control>Q", GTK_MENU_FUNC(file_quit_cmd_cb),
1669 0, "<StockItem>", GTK_STOCK_QUIT,},
1670 {"/_Edit", NULL, NULL, 0, "<Branch>", NULL,},
1671 {"/Edit/Copy", NULL, NULL, 0, "<Branch>", NULL,},
1672 {"/Edit/Copy/Description", "<shift><control>D", GTK_MENU_FUNC(copy_selected_plist_cb), COPY_SELECTED_DESCRIPTION, NULL, NULL,},
1673 {"/Edit/Copy/Fieldname", "<shift><control>F", GTK_MENU_FUNC(copy_selected_plist_cb), COPY_SELECTED_FIELDNAME, NULL, NULL,},
1674 {"/Edit/Copy/Value", "<shift><control>V", GTK_MENU_FUNC(copy_selected_plist_cb), COPY_SELECTED_VALUE, NULL, NULL,},
1675 {"/Edit/Copy/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1676 {"/Edit/Copy/As Filter", "<shift><control>C", GTK_MENU_FUNC(match_selected_ptree_cb),
1677 MATCH_SELECTED_REPLACE|MATCH_SELECTED_COPY_ONLY, NULL, NULL,},
1680 * Un-#if this when we actually implement Cut/Copy/Paste for the
1681 * packet list and packet detail windows.
1683 * Note: when we implement Cut/Copy/Paste in those windows, we
1684 * will almost certainly want to allow multiple packets to be
1685 * selected in the packet list pane and multiple packet detail
1686 * items to be selected in the packet detail pane, so that
1687 * the user can, for example, copy the summaries of multiple
1688 * packets to the clipboard from the packet list pane and multiple
1689 * packet detail items - perhaps *all* packet detail items - from
1690 * the packet detail pane. Given that, we'll also want to
1691 * implement Select All.
1693 * If multiple packets are selected, we would probably display nothing
1694 * in the packet detail pane, just as we do if no packet is selected,
1695 * and any menu items etc. that would pertain only to a single packet
1696 * would be disabled.
1698 * If multiple packet detail items are selected, we would probably
1699 * disable all items that pertain only to a single packet detail
1700 * item, such as some items in the status bar.
1702 * XXX - the actions for these will be different depending on what
1703 * widget we're in; ^C should copy from the filter text widget if
1704 * we're in that widget, the packet list if we're in that widget
1705 * (presumably copying the summaries of selected packets to the
1706 * clipboard, e.g. the text copy would be the text of the columns),
1707 * the packet detail if we're in that widget (presumably copying
1708 * the contents of selected protocol tree items to the clipboard,
1709 * e.g. the text copy would be the text displayed for those items),
1712 * Given that those menu items should also affect text widgets
1713 * such as the filter box, we would again want Select All, and,
1714 * at least for the filter box, we would also want Undo and Redo.
1715 * We would only want Cut, Paste, Undo, and Redo for the packet
1716 * list and packet detail panes if we support modifying them.
1718 {"/Edit/_Undo", "<control>Z", NULL,
1719 0, "<StockItem>", GTK_STOCK_UNDO,},
1720 {"/Edit/_Redo", "<shift><control>Z", NULL,
1721 0, "<StockItem>", GTK_STOCK_REDO,},
1722 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1723 {"/Edit/Cu_t", "<control>X", NULL,
1724 0, "<StockItem>", GTK_STOCK_CUT,},
1725 {"/Edit/_Copy", "<control>C", NULL,
1726 0, "<StockItem>", GTK_STOCK_COPY,},
1727 {"/Edit/_Paste", "<control>V", NULL,
1728 0, "<StockItem>", GTK_STOCK_PASTE,},
1729 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1730 {"/Edit/Select _All", "<control>A", NULL, 0,
1731 #ifdef GTK_STOCK_SELECT_ALL /* first appeared in 2.10 */
1732 "<StockItem>", GTK_STOCK_SELECT_ALL,
1735 #endif /* GTK_STOCK_SELECT_ALL */
1738 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1739 {"/Edit/_Find Packet...", "<control>F", GTK_MENU_FUNC(find_frame_cb), 0, "<StockItem>", GTK_STOCK_FIND,},
1740 {"/Edit/Find Ne_xt", "<control>N", GTK_MENU_FUNC(find_next_cb), 0, NULL, NULL,},
1741 {"/Edit/Find Pre_vious", "<control>B", GTK_MENU_FUNC(find_previous_cb), 0, NULL, NULL,},
1742 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1743 #ifdef NEW_PACKET_LIST
1744 {"/Edit/_Mark Packet (toggle)", "<control>M", GTK_MENU_FUNC(new_packet_list_mark_frame_cb),0, NULL, NULL,},
1745 {"/Edit/Mark All Displayed Packets (toggle)", "<shift><control>M", GTK_MENU_FUNC(new_packet_list_mark_all_displayed_frames_cb), 0, NULL, NULL,},
1746 {"/Edit/Unmark All Packets", "<alt><control>M", GTK_MENU_FUNC(new_packet_list_unmark_all_frames_cb), 0, NULL, NULL,},
1747 {"/Edit/Find Next Mark", "<shift><control>N", GTK_MENU_FUNC(find_next_mark_cb), 0, NULL, NULL,},
1748 {"/Edit/Find Previous Mark", "<shift><control>B", GTK_MENU_FUNC(find_prev_mark_cb), 0, NULL, NULL,},
1749 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1750 {"/Edit/_Ignore Packet (toggle)", "<control>D", GTK_MENU_FUNC(new_packet_list_ignore_frame_cb), 0, NULL, NULL,},
1752 * XXX - this next one overrides /Edit/Copy/Description
1754 {"/Edit/Ignore All Displayed Packets (toggle)","<shift><control>D", GTK_MENU_FUNC(new_packet_list_ignore_all_displayed_frames_cb), 0, NULL, NULL,},
1755 {"/Edit/U_n-Ignore All Packets", "<alt><control>D", GTK_MENU_FUNC(new_packet_list_unignore_all_frames_cb), 0, NULL, NULL,},
1756 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1757 {"/Edit/Set Time Reference (toggle)", "<control>T", GTK_MENU_FUNC(reftime_frame_cb), REFTIME_TOGGLE, "<StockItem>", WIRESHARK_STOCK_TIME,},
1758 {"/Edit/Un-Time Reference All Packets", "<alt><control>T", GTK_MENU_FUNC(new_packet_list_untime_reference_all_frames_cb), 0, NULL, NULL,},
1759 {"/Edit/Find Next Time Reference", "<alt><control>N", GTK_MENU_FUNC(reftime_frame_cb), REFTIME_FIND_NEXT, NULL, NULL,},
1760 {"/Edit/Find Previous Time Reference", "<alt><control>B", GTK_MENU_FUNC(reftime_frame_cb), REFTIME_FIND_PREV, NULL, NULL,},
1761 #else /* NEW_PACKET_LIST */
1763 * XXX - this should be changed to match the list used with the new
1764 * packet list, assuming we don't just drop the old packet list
1767 {"/Edit/_Mark Packet (toggle)", "<control>M", GTK_MENU_FUNC(packet_list_mark_frame_cb),
1769 {"/Edit/Find Next Mark", "<shift><control>N", GTK_MENU_FUNC(find_next_mark_cb),
1771 {"/Edit/Find Previous Mark", "<shift><control>B", GTK_MENU_FUNC(find_prev_mark_cb),
1773 {"/Edit/Mark _All Displayed Packets (toggle)", "<shift><control>M", GTK_MENU_FUNC(packet_list_mark_all_frames_cb), 0, NULL, NULL,},
1774 {"/Edit/_Unmark All Packets", "<alt><control>M", GTK_MENU_FUNC(packet_list_unmark_all_frames_cb), 0, NULL, NULL,},
1775 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1776 {"/Edit/_Ignore Packet (toggle)", "<control>D", GTK_MENU_FUNC(packet_list_ignore_frame_cb),
1778 {"/Edit/Ignore All Displayed Packets (toggle)", "<shift><control>D", GTK_MENU_FUNC(packet_list_ignore_all_frames_cb),
1780 {"/Edit/U_n-Ignore All Packets", "<alt><control>D", GTK_MENU_FUNC(packet_list_unignore_all_frames_cb),
1782 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1783 {"/Edit/Set Time Reference (toggle)", "<control>T", GTK_MENU_FUNC(reftime_frame_cb),
1784 REFTIME_TOGGLE, "<StockItem>", WIRESHARK_STOCK_TIME,},
1785 {"/Edit/Find Next Time Reference", "<alt><shift><control>N", GTK_MENU_FUNC(reftime_frame_cb), REFTIME_FIND_NEXT, NULL, NULL,},
1786 {"/Edit/Find Previous Time Reference", "<alt><shift><control>B", GTK_MENU_FUNC(reftime_frame_cb), REFTIME_FIND_PREV, NULL, NULL,},
1787 #endif /* NEW_PACKET_LIST */
1788 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1789 {"/Edit/_Configuration Profiles...", "<shift><control>A", GTK_MENU_FUNC(profile_dialog_cb), 0, NULL, NULL,},
1790 {"/Edit/_Preferences...", "<shift><control>P", GTK_MENU_FUNC(prefs_page_cb),
1791 PREFS_PAGE_USER_INTERFACE, "<StockItem>", GTK_STOCK_PREFERENCES,},
1792 {"/_View", NULL, NULL, 0, "<Branch>", NULL,},
1793 {"/View/_Main Toolbar", NULL, GTK_MENU_FUNC(show_hide_cb), SHOW_HIDE_MAIN_TOOLBAR, "<CheckItem>", NULL,},
1794 {"/View/_Filter Toolbar", NULL, GTK_MENU_FUNC(show_hide_cb), SHOW_HIDE_FILTER_TOOLBAR, "<CheckItem>", NULL,},
1796 {"/View/_Wireless Toolbar", NULL, GTK_MENU_FUNC(show_hide_cb), SHOW_HIDE_AIRPCAP_TOOLBAR, "<CheckItem>", NULL,},
1798 {"/View/_Statusbar", NULL, GTK_MENU_FUNC(show_hide_cb), SHOW_HIDE_STATUSBAR, "<CheckItem>", NULL,},
1799 {"/View/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1800 {"/View/Packet _List", NULL, GTK_MENU_FUNC(show_hide_cb), SHOW_HIDE_PACKET_LIST, "<CheckItem>", NULL,},
1801 {"/View/Packet _Details", NULL, GTK_MENU_FUNC(show_hide_cb), SHOW_HIDE_TREE_VIEW, "<CheckItem>", NULL,},
1802 {"/View/Packet _Bytes", NULL, GTK_MENU_FUNC(show_hide_cb), SHOW_HIDE_BYTE_VIEW, "<CheckItem>", NULL,},
1803 {"/View/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1804 {"/View/_Time Display Format", NULL, NULL, 0, "<Branch>", NULL,},
1805 {"/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),
1806 TS_ABSOLUTE_WITH_DATE, "<RadioItem>", NULL,},
1807 {"/View/Time Display Format/Time of Day: 01:02:03.123456", "<alt><control>2", GTK_MENU_FUNC(timestamp_format_cb),
1808 TS_ABSOLUTE, "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456", NULL,},
1809 {"/View/Time Display Format/Seconds Since Epoch (1970-01-01): 1234567890.123456", "<alt><control>3", GTK_MENU_FUNC(timestamp_format_cb),
1810 TS_EPOCH, "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456", NULL,},
1811 {"/View/Time Display Format/Seconds Since Beginning of Capture: 123.123456", "<alt><control>4", GTK_MENU_FUNC(timestamp_format_cb),
1812 TS_RELATIVE, "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456", NULL,},
1813 {"/View/Time Display Format/Seconds Since Previous Captured Packet: 1.123456", "<alt><control>5", GTK_MENU_FUNC(timestamp_format_cb),
1814 TS_DELTA, "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456", NULL,},
1815 {"/View/Time Display Format/Seconds Since Previous Displayed Packet: 1.123456", "<alt><control>6", GTK_MENU_FUNC(timestamp_format_cb),
1816 TS_DELTA_DIS, "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456", NULL,},
1817 {"/View/Time Display Format/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1818 {"/View/Time Display Format/Automatic (File Format Precision)", NULL, GTK_MENU_FUNC(timestamp_precision_cb),
1819 TS_PREC_AUTO, "<RadioItem>", NULL,},
1820 {"/View/Time Display Format/Seconds: 0", NULL, GTK_MENU_FUNC(timestamp_precision_cb),
1821 TS_PREC_FIXED_SEC, "/View/Time Display Format/Automatic (File Format Precision)", NULL,},
1822 {"/View/Time Display Format/Deciseconds: 0.1", NULL, GTK_MENU_FUNC(timestamp_precision_cb),
1823 TS_PREC_FIXED_DSEC, "/View/Time Display Format/Automatic (File Format Precision)", NULL,},
1824 {"/View/Time Display Format/Centiseconds: 0.12", NULL, GTK_MENU_FUNC(timestamp_precision_cb),
1825 TS_PREC_FIXED_CSEC, "/View/Time Display Format/Automatic (File Format Precision)", NULL,},
1826 {"/View/Time Display Format/Milliseconds: 0.123", NULL, GTK_MENU_FUNC(timestamp_precision_cb),
1827 TS_PREC_FIXED_MSEC, "/View/Time Display Format/Automatic (File Format Precision)", NULL,},
1828 {"/View/Time Display Format/Microseconds: 0.123456", NULL, GTK_MENU_FUNC(timestamp_precision_cb),
1829 TS_PREC_FIXED_USEC, "/View/Time Display Format/Automatic (File Format Precision)", NULL,},
1830 {"/View/Time Display Format/Nanoseconds: 0.123456789", NULL, GTK_MENU_FUNC(timestamp_precision_cb),
1831 TS_PREC_FIXED_NSEC, "/View/Time Display Format/Automatic (File Format Precision)", NULL,},
1832 {"/View/Time Display Format/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1833 {"/View/Time Display Format/Display Seconds with hours and minutes", "<alt><control>0", GTK_MENU_FUNC(timestamp_seconds_time_cb), 0, "<CheckItem>", NULL,},
1834 {"/View/Name Resol_ution", NULL, NULL, 0, "<Branch>", NULL,},
1835 {"/View/Name Resolution/_Resolve Name", NULL, GTK_MENU_FUNC(resolve_name_cb), 0, NULL, NULL,},
1836 {"/View/Name Resolution/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1837 {"/View/Name Resolution/Enable for _MAC Layer", NULL, GTK_MENU_FUNC(name_resolution_cb), RESOLV_MAC, "<CheckItem>", NULL,},
1838 {"/View/Name Resolution/Enable for _Network Layer", NULL, GTK_MENU_FUNC(name_resolution_cb), RESOLV_NETWORK, "<CheckItem>", NULL,},
1839 {"/View/Name Resolution/Enable for _Transport Layer", NULL, GTK_MENU_FUNC(name_resolution_cb), RESOLV_TRANSPORT, "<CheckItem>", NULL,},
1840 {"/View/Colorize Packet List", NULL, colorize_cb, 0, "<CheckItem>", NULL,},
1842 {"/View/Auto Scroll in Li_ve Capture", NULL, GTK_MENU_FUNC(auto_scroll_live_cb), 0, "<CheckItem>", NULL,},
1844 {"/View/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1845 {"/View/_Zoom In", "<control>plus", GTK_MENU_FUNC(view_zoom_in_cb),
1846 0, "<StockItem>", GTK_STOCK_ZOOM_IN,},
1847 {"/View/Zoom _Out", "<control>minus", GTK_MENU_FUNC(view_zoom_out_cb),
1848 0, "<StockItem>", GTK_STOCK_ZOOM_OUT,},
1849 {"/View/_Normal Size", "<control>equal", GTK_MENU_FUNC(view_zoom_100_cb),
1850 0, "<StockItem>", GTK_STOCK_ZOOM_100,},
1851 #ifdef NEW_PACKET_LIST
1852 {"/View/Resize All Columns", "<shift><control>R", GTK_MENU_FUNC(new_packet_list_resize_columns_cb),
1853 0, "<StockItem>", WIRESHARK_STOCK_RESIZE_COLUMNS,},
1854 {"/View/Displayed Columns", NULL, NULL, 0, NULL, NULL,},
1856 {"/View/Resize All Columns", "<shift><control>R", GTK_MENU_FUNC(packet_list_resize_columns_cb),
1857 0, "<StockItem>", WIRESHARK_STOCK_RESIZE_COLUMNS,},
1858 #endif /* NEW_PACKET_LIST */
1859 {"/View/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1860 {"/View/E_xpand Subtrees", "<shift>Right", GTK_MENU_FUNC(expand_tree_cb), 0, NULL, NULL,},
1861 {"/View/_Expand All", "<control>Right", GTK_MENU_FUNC(expand_all_cb),
1863 {"/View/Collapse _All", "<control>Left", GTK_MENU_FUNC(collapse_all_cb),
1865 {"/View/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1866 {"/View/Colorize Conversation", NULL, NULL, 0, "<Branch>",NULL,},
1867 {"/View/Colorize Conversation/Color 1", "<control>1",
1868 GTK_MENU_FUNC(colorize_conversation_cb), 1*256, "<StockItem>", WIRESHARK_STOCK_COLOR1,},
1869 {"/View/Colorize Conversation/Color 2", "<control>2",
1870 GTK_MENU_FUNC(colorize_conversation_cb), 2*256, "<StockItem>", WIRESHARK_STOCK_COLOR2,},
1871 {"/View/Colorize Conversation/Color 3", "<control>3",
1872 GTK_MENU_FUNC(colorize_conversation_cb), 3*256, "<StockItem>", WIRESHARK_STOCK_COLOR3,},
1873 {"/View/Colorize Conversation/Color 4", "<control>4",
1874 GTK_MENU_FUNC(colorize_conversation_cb), 4*256, "<StockItem>", WIRESHARK_STOCK_COLOR4,},
1875 {"/View/Colorize Conversation/Color 5", "<control>5",
1876 GTK_MENU_FUNC(colorize_conversation_cb), 5*256, "<StockItem>", WIRESHARK_STOCK_COLOR5,},
1877 {"/View/Colorize Conversation/Color 6", "<control>6",
1878 GTK_MENU_FUNC(colorize_conversation_cb), 6*256, "<StockItem>", WIRESHARK_STOCK_COLOR6,},
1879 {"/View/Colorize Conversation/Color 7", "<control>7",
1880 GTK_MENU_FUNC(colorize_conversation_cb), 7*256, "<StockItem>", WIRESHARK_STOCK_COLOR7,},
1881 {"/View/Colorize Conversation/Color 8", "<control>8",
1882 GTK_MENU_FUNC(colorize_conversation_cb), 8*256, "<StockItem>", WIRESHARK_STOCK_COLOR8,},
1883 {"/View/Colorize Conversation/Color 9", "<control>9",
1884 GTK_MENU_FUNC(colorize_conversation_cb), 9*256, "<StockItem>", WIRESHARK_STOCK_COLOR9,},
1885 {"/View/Colorize Conversation/Color 10", "<control>0",
1886 GTK_MENU_FUNC(colorize_conversation_cb), 10*256, "<StockItem>", WIRESHARK_STOCK_COLOR0,},
1887 {"/View/Colorize Conversation/<separator>", NULL,
1888 NULL, 0, "<Separator>",NULL,},
1889 {"/View/Colorize Conversation/New Coloring Rule...", NULL,
1890 GTK_MENU_FUNC(colorize_conversation_cb), 0, "<StockItem>", GTK_STOCK_SELECT_COLOR,},
1891 {"/View/Reset Coloring 1-10", "<control>space",
1892 GTK_MENU_FUNC(colorize_conversation_cb), 255*256, NULL, NULL,},
1893 {"/View/_Coloring Rules...", NULL, color_display_cb,
1894 0, "<StockItem>", GTK_STOCK_SELECT_COLOR,},
1895 {"/View/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1898 {"/View/Show Packet in New _Window", NULL,
1899 GTK_MENU_FUNC(new_window_cb), 0, NULL, NULL,},
1900 {"/View/_Reload", "<control>R", GTK_MENU_FUNC(file_reload_cmd_cb),
1901 0, "<StockItem>", GTK_STOCK_REFRESH,},
1902 {"/_Go", NULL, NULL, 0, "<Branch>", NULL,},
1903 {"/Go/_Back", "<alt>Left",
1904 GTK_MENU_FUNC(history_back_cb), 0, "<StockItem>", GTK_STOCK_GO_BACK,},
1905 {"/Go/_Forward", "<alt>Right",
1906 GTK_MENU_FUNC(history_forward_cb), 0, "<StockItem>", GTK_STOCK_GO_FORWARD,},
1907 {"/Go/_Go to Packet...", "<control>G",
1908 GTK_MENU_FUNC(goto_frame_cb), 0, "<StockItem>", GTK_STOCK_JUMP_TO,},
1909 {"/Go/Go to _Corresponding Packet", NULL, GTK_MENU_FUNC(goto_framenum_cb),
1911 {"/Go/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1912 {"/Go/Previous Packet", "<control>Up",
1913 GTK_MENU_FUNC(goto_previous_frame_cb), 0, "<StockItem>", GTK_STOCK_GO_UP,},
1914 {"/Go/Next Packet", "<control>Down",
1915 GTK_MENU_FUNC(goto_next_frame_cb), 0, "<StockItem>", GTK_STOCK_GO_DOWN,},
1916 {"/Go/F_irst Packet", "<control>Home",
1917 GTK_MENU_FUNC(goto_top_frame_cb), 0, "<StockItem>", GTK_STOCK_GOTO_TOP,},
1918 {"/Go/_Last Packet", "<control>End",
1919 GTK_MENU_FUNC(goto_bottom_frame_cb), 0, "<StockItem>", GTK_STOCK_GOTO_BOTTOM,},
1920 {"/Go/Previous Packet In Conversation", "<control>bracketleft",
1921 GTK_MENU_FUNC(goto_previous_frame_conversation_cb), 0, NULL, NULL,},
1922 {"/Go/Next Packet In Conversation", "<control>bracketright",
1923 GTK_MENU_FUNC(goto_next_frame_conversation_cb), 0, NULL, NULL,},
1925 {"/_Capture", NULL, NULL, 0, "<Branch>", NULL,},
1926 {"/Capture/_Interfaces...", "<control>I",
1927 GTK_MENU_FUNC(capture_if_cb), 0, "<StockItem>", WIRESHARK_STOCK_CAPTURE_INTERFACES,},
1928 {"/Capture/_Options...", "<control>K",
1929 GTK_MENU_FUNC(capture_prep_cb), 0, "<StockItem>", WIRESHARK_STOCK_CAPTURE_OPTIONS,},
1930 {"/Capture/_Start", "<control>E",
1931 GTK_MENU_FUNC(capture_start_cb), 0, "<StockItem>", WIRESHARK_STOCK_CAPTURE_START,},
1932 {"/Capture/S_top", "<control>E", GTK_MENU_FUNC(capture_stop_cb),
1933 0, "<StockItem>", WIRESHARK_STOCK_CAPTURE_STOP,},
1934 {"/Capture/_Restart", "<control>R", GTK_MENU_FUNC(capture_restart_cb),
1935 0, "<StockItem>", WIRESHARK_STOCK_CAPTURE_RESTART,},
1936 {"/Capture/Capture _Filters...", NULL, GTK_MENU_FUNC(cfilter_dialog_cb),
1937 0, "<StockItem>", WIRESHARK_STOCK_CAPTURE_FILTER,},
1938 #endif /* HAVE_LIBPCAP */
1939 {"/_Analyze", NULL, NULL, 0, "<Branch>", NULL,},
1940 {"/Analyze/_Display Filters...", NULL, GTK_MENU_FUNC(dfilter_dialog_cb),
1941 0, "<StockItem>", WIRESHARK_STOCK_DISPLAY_FILTER,},
1942 {"/Analyze/Display Filter _Macros...", NULL, GTK_MENU_FUNC(macros_dialog_cb), 0, NULL, NULL,},
1943 {"/Analyze/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1944 {"/Analyze/Apply as Column", NULL, GTK_MENU_FUNC(apply_as_custom_column_cb), 0, NULL, NULL},
1945 {"/Analyze/Appl_y as Filter", NULL, NULL, 0, "<Branch>", NULL,},
1946 {"/Analyze/Apply as Filter/_Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
1947 MATCH_SELECTED_REPLACE|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
1948 {"/Analyze/Apply as Filter/_Not Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
1949 MATCH_SELECTED_NOT|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
1950 {"/Analyze/Apply as Filter/" UTF8_HORIZONTAL_ELLIPSIS " _and Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
1951 MATCH_SELECTED_AND|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
1952 {"/Analyze/Apply as Filter/" UTF8_HORIZONTAL_ELLIPSIS " _or Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
1953 MATCH_SELECTED_OR|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
1954 {"/Analyze/Apply as Filter/" UTF8_HORIZONTAL_ELLIPSIS " a_nd not Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
1955 MATCH_SELECTED_AND_NOT|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
1956 {"/Analyze/Apply as Filter/" UTF8_HORIZONTAL_ELLIPSIS " o_r not Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
1957 MATCH_SELECTED_OR_NOT|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
1958 {"/Analyze/_Prepare a Filter", NULL, NULL, 0, "<Branch>", NULL,},
1959 {"/Analyze/Prepare a Filter/_Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
1960 MATCH_SELECTED_REPLACE, NULL, NULL,},
1961 {"/Analyze/Prepare a Filter/_Not Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
1962 MATCH_SELECTED_NOT, NULL, NULL,},
1963 {"/Analyze/Prepare a Filter/" UTF8_HORIZONTAL_ELLIPSIS " _and Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
1964 MATCH_SELECTED_AND, NULL, NULL,},
1965 {"/Analyze/Prepare a Filter/" UTF8_HORIZONTAL_ELLIPSIS " _or Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
1966 MATCH_SELECTED_OR, NULL, NULL,},
1967 {"/Analyze/Prepare a Filter/" UTF8_HORIZONTAL_ELLIPSIS " a_nd not Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
1968 MATCH_SELECTED_AND_NOT, NULL, NULL,},
1969 {"/Analyze/Prepare a Filter/" UTF8_HORIZONTAL_ELLIPSIS " o_r not Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
1970 MATCH_SELECTED_OR_NOT, NULL, NULL,},
1971 {"/Analyze/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1972 {"/Analyze/_Enabled Protocols...", "<shift><control>E", GTK_MENU_FUNC(proto_cb),
1973 0, "<StockItem>", WIRESHARK_STOCK_CHECKBOX,},
1974 {"/Analyze/Decode _As...", NULL, GTK_MENU_FUNC(decode_as_cb),
1975 0, "<StockItem>", WIRESHARK_STOCK_DECODE_AS,},
1976 {"/Analyze/_User Specified Decodes...", NULL,
1977 GTK_MENU_FUNC(decode_show_cb), 0, "<StockItem>", WIRESHARK_STOCK_DECODE_AS,},
1978 {"/Analyze/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1979 {"/Analyze/_Follow TCP Stream", NULL,
1980 GTK_MENU_FUNC(follow_tcp_stream_cb), 0, NULL, NULL,},
1981 {"/Analyze/_Follow UDP Stream", NULL,
1982 GTK_MENU_FUNC(follow_udp_stream_cb), 0, NULL, NULL,},
1983 {"/Analyze/_Follow SSL Stream", NULL,
1984 GTK_MENU_FUNC(follow_ssl_stream_cb), 0, NULL, NULL,},
1985 {"/_Statistics", NULL, NULL, 0, "<Branch>", NULL,},
1986 {"/Statistics/_Summary", NULL, GTK_MENU_FUNC(summary_open_cb), 0, "<StockItem>", GTK_STOCK_PROPERTIES,},
1987 {"/Statistics/_Protocol Hierarchy", NULL,
1988 GTK_MENU_FUNC(proto_hier_stats_cb), 0, NULL, NULL,},
1989 {"/Statistics/Conversations", NULL,
1990 GTK_MENU_FUNC(init_conversation_notebook_cb), 0, "<StockItem>", WIRESHARK_STOCK_CONVERSATIONS,},
1991 {"/Statistics/Endpoints", NULL,
1992 GTK_MENU_FUNC(init_hostlist_notebook_cb), 0, "<StockItem>", WIRESHARK_STOCK_ENDPOINTS,},
1993 {"/Telephon_y", NULL, NULL, 0, "<Branch>", NULL,},
1994 {"/_Tools", NULL, NULL, 0, "<Branch>", NULL,},
1995 {"/Tools/Firewall ACL Rules", NULL,
1996 firewall_rule_cb, 0, NULL, NULL,},
1997 {"/WS internal", NULL, NULL, 0, "<Branch>", NULL,},
1998 {"/WS internal/Dissector tables", NULL, GTK_MENU_FUNC(dissector_tables_dlg_cb),
2000 {"/_Help", NULL, NULL, 0, "<Branch>", NULL,},
2001 {"/Help/_Contents", "F1", GTK_MENU_FUNC(topic_menu_cb), HELP_CONTENT, "<StockItem>", GTK_STOCK_HELP,},
2002 {"/Help/FAQ's", NULL, GTK_MENU_FUNC(topic_menu_cb), ONLINEPAGE_FAQ, NULL, NULL,},
2003 {"/Help/Manual Pages", NULL, NULL, 0, "<Branch>", NULL,},
2004 {"/Help/Manual Pages/Wireshark", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_WIRESHARK, NULL, NULL,},
2005 {"/Help/Manual Pages/Wireshark Filter", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_WIRESHARK_FILTER, NULL, NULL,},
2006 {"/Help/Manual Pages/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
2007 {"/Help/Manual Pages/TShark", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_TSHARK, NULL, NULL,},
2008 {"/Help/Manual Pages/RawShark", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_RAWSHARK, NULL, NULL,},
2009 {"/Help/Manual Pages/Dumpcap", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_DUMPCAP, NULL, NULL,},
2010 {"/Help/Manual Pages/Mergecap", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_MERGECAP, NULL, NULL,},
2011 {"/Help/Manual Pages/Editcap", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_EDITCAP, NULL, NULL,},
2012 {"/Help/Manual Pages/Text2pcap", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_TEXT2PCAP, NULL, NULL,},
2013 {"/Help/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
2014 {"/Help/Website", NULL, GTK_MENU_FUNC(topic_menu_cb), ONLINEPAGE_HOME, "<StockItem>", GTK_STOCK_HOME,},
2015 {"/Help/Wiki", NULL, GTK_MENU_FUNC(topic_menu_cb), ONLINEPAGE_WIKI, "<StockItem>", WIRESHARK_STOCK_WIKI,},
2016 {"/Help/Downloads", NULL, GTK_MENU_FUNC(topic_menu_cb), ONLINEPAGE_DOWNLOAD, NULL, NULL,},
2017 {"/Help/Sample Captures", NULL, GTK_MENU_FUNC(topic_menu_cb), ONLINEPAGE_SAMPLE_FILES, NULL, NULL,},
2018 {"/Help/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
2019 {"/Help/_Supported Protocols (slow!)", NULL, GTK_MENU_FUNC(supported_cb), 0, NULL, NULL,},
2020 {"/Help/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
2021 {"/Help/_About Wireshark", NULL, GTK_MENU_FUNC(about_wireshark_cb),
2022 0, "<StockItem>", WIRESHARK_STOCK_ABOUT}
2025 /* calculate the number of menu_items */
2026 static int nmenu_items = sizeof(menu_items) / sizeof(menu_items[0]);
2027 #endif /* MAIN_MENU_USE_UIMANAGER */
2029 static int initialize = TRUE;
2030 #ifdef MAIN_MENU_USE_UIMANAGER
2031 GtkActionGroup *main_menu_bar_action_group;
2033 static GtkItemFactory *main_menu_factory = NULL;
2035 static GtkUIManager *ui_manager_packet_list_heading = NULL;
2036 static GtkUIManager *ui_manager_packet_list_menu = NULL;
2037 static GtkUIManager *ui_manager_tree_view_menu = NULL;
2038 static GtkUIManager *ui_manager_bytes_menu = NULL;
2039 static GtkUIManager *ui_manager_statusbar_profiles_menu = NULL;
2040 static GSList *popup_menu_list = NULL;
2042 static GtkAccelGroup *grp;
2045 select_bytes_view_cb (GtkRadioAction *action, GtkRadioAction *current _U_, gpointer user_data _U_)
2049 value = gtk_radio_action_get_current_value (action);
2051 select_bytes_view( NULL, NULL, value);
2055 sort_ascending_cb(GtkWidget *widget, gpointer user_data)
2057 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_SORT_ASCENDING);
2061 sort_descending_cb(GtkWidget *widget, gpointer user_data)
2063 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_SORT_DESCENDING);
2067 no_sorting_cb(GtkWidget *widget, gpointer user_data)
2069 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_SORT_NONE);
2073 packet_list_heading_show_resolved_cb(GtkAction *action _U_, gpointer user_data _U_)
2075 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/ShowResolved");
2077 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_TOGGLE_RESOLVED);
2081 packet_list_heading_align_left_cb(GtkWidget *widget, gpointer user_data)
2083 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_ALIGN_LEFT);
2087 packet_list_heading_align_center_cb(GtkWidget *widget, gpointer user_data)
2089 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_ALIGN_CENTER);
2093 packet_list_heading_align_right_cb(GtkWidget *widget, gpointer user_data)
2095 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_ALIGN_RIGHT);
2099 packet_list_heading_col_pref_cb(GtkWidget *widget, gpointer user_data)
2101 prefs_page_cb( widget , user_data, PREFS_PAGE_COLUMNS);
2105 packet_list_heading_resize_col_cb(GtkWidget *widget, gpointer user_data)
2107 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_RESIZE);
2111 packet_list_heading_rename_col_cb(GtkWidget *widget, gpointer user_data)
2113 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_RENAME);
2117 packet_list_heading_activate_all_columns(GtkWidget *widget _U_, gpointer user_data _U_)
2119 new_packet_list_set_all_columns_visible ();
2123 packet_list_heading_hide_col_cb(GtkWidget *widget, gpointer user_data)
2125 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_HIDE);
2129 packet_list_heading_remove_col_cb(GtkWidget *widget, gpointer user_data)
2131 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_REMOVE);
2135 packet_list_menu_set_ref_time_cb(GtkWidget *widget, gpointer user_data)
2137 reftime_frame_cb( widget , user_data, REFTIME_TOGGLE);
2142 packet_list_menu_apply_selected_cb(GtkWidget *widget, gpointer user_data)
2144 match_selected_plist_cb( widget , user_data, MATCH_SELECTED_REPLACE|MATCH_SELECTED_APPLY_NOW);
2148 packet_list_menu_apply_not_selected_cb(GtkWidget *widget, gpointer user_data)
2150 match_selected_plist_cb( widget , user_data, MATCH_SELECTED_NOT|MATCH_SELECTED_APPLY_NOW);
2154 packet_list_menu_apply_and_selected_cb(GtkWidget *widget, gpointer user_data)
2156 match_selected_plist_cb( widget , user_data, MATCH_SELECTED_AND|MATCH_SELECTED_APPLY_NOW);
2160 packet_list_menu_apply_or_selected_cb(GtkWidget *widget, gpointer user_data)
2162 match_selected_plist_cb( widget , user_data, MATCH_SELECTED_OR|MATCH_SELECTED_APPLY_NOW);
2166 packet_list_menu_apply_and_not_selected_cb(GtkWidget *widget, gpointer user_data)
2168 match_selected_plist_cb( widget , user_data, MATCH_SELECTED_AND_NOT|MATCH_SELECTED_APPLY_NOW);
2172 packet_list_menu_apply_or_not_selected_cb(GtkWidget *widget, gpointer user_data)
2174 match_selected_plist_cb( widget , user_data,MATCH_SELECTED_OR_NOT|MATCH_SELECTED_APPLY_NOW);
2176 /* Prepare a filter */
2178 packet_list_menu_prepare_selected_cb(GtkWidget *widget, gpointer user_data)
2180 match_selected_plist_cb( widget , user_data, MATCH_SELECTED_REPLACE);
2184 packet_list_menu_prepare_not_selected_cb(GtkWidget *widget, gpointer user_data)
2186 match_selected_plist_cb( widget , user_data, MATCH_SELECTED_NOT);
2190 packet_list_menu_prepare_and_selected_cb(GtkWidget *widget, gpointer user_data)
2192 match_selected_plist_cb( widget , user_data, MATCH_SELECTED_AND);
2196 packet_list_menu_prepare_or_selected_cb(GtkWidget *widget, gpointer user_data)
2198 match_selected_plist_cb( widget , user_data, MATCH_SELECTED_OR);
2202 packet_list_menu_prepare_and_not_selected_cb(GtkWidget *widget, gpointer user_data)
2204 match_selected_plist_cb( widget , user_data, MATCH_SELECTED_AND_NOT);
2208 packet_list_menu_prepare_or_not_selected_cb(GtkWidget *widget, gpointer user_data)
2210 match_selected_plist_cb( widget , user_data, MATCH_SELECTED_OR_NOT);
2214 packet_list_menu_conversation_ethernet_cb(GtkWidget *widget, gpointer user_data)
2216 conversation_cb( widget , user_data, CONV_ETHER);
2220 packet_list_menu_conversation_ip_cb(GtkWidget *widget, gpointer user_data)
2222 conversation_cb( widget , user_data, CONV_IP);
2226 packet_list_menu_conversation_tcp_cb(GtkWidget *widget, gpointer user_data)
2228 conversation_cb( widget , user_data, CONV_TCP);
2232 packet_list_menu_conversation_udp_cb(GtkWidget *widget, gpointer user_data)
2234 conversation_cb( widget , user_data, CONV_UDP);
2238 packet_list_menu_conversation_pn_cba_cb(GtkWidget *widget, gpointer user_data)
2240 conversation_cb( widget , user_data, CONV_CBA);
2246 packet_list_menu_color_conv_ethernet_color1_cb(GtkWidget *widget, gpointer user_data)
2248 colorize_conversation_cb( widget , user_data, CONV_ETHER+1*256);
2253 packet_list_menu_color_conv_ethernet_color2_cb(GtkWidget *widget, gpointer user_data)
2255 colorize_conversation_cb( widget , user_data, CONV_ETHER+1*256);
2259 packet_list_menu_color_conv_ethernet_color3_cb(GtkWidget *widget, gpointer user_data)
2261 colorize_conversation_cb( widget , user_data, CONV_ETHER+3*256);
2265 packet_list_menu_color_conv_ethernet_color4_cb(GtkWidget *widget, gpointer user_data)
2267 colorize_conversation_cb( widget , user_data, CONV_ETHER+4*256);
2271 packet_list_menu_color_conv_ethernet_color5_cb(GtkWidget *widget, gpointer user_data)
2273 colorize_conversation_cb( widget , user_data, CONV_ETHER+5*256);
2277 packet_list_menu_color_conv_ethernet_color6_cb(GtkWidget *widget, gpointer user_data)
2279 colorize_conversation_cb( widget , user_data, CONV_ETHER+6*256);
2283 packet_list_menu_color_conv_ethernet_color7_cb(GtkWidget *widget, gpointer user_data)
2285 colorize_conversation_cb( widget , user_data, CONV_ETHER+7*256);
2289 packet_list_menu_color_conv_ethernet_color8_cb(GtkWidget *widget, gpointer user_data)
2291 colorize_conversation_cb( widget , user_data, CONV_ETHER+8*256);
2295 packet_list_menu_color_conv_ethernet_color9_cb(GtkWidget *widget, gpointer user_data)
2297 colorize_conversation_cb( widget , user_data, CONV_ETHER+9*256);
2301 packet_list_menu_color_conv_ethernet_color10_cb(GtkWidget *widget, gpointer user_data)
2303 colorize_conversation_cb( widget , user_data, CONV_ETHER+10*256);
2308 packet_list_menu_color_conv_ethernet_new_rule_cb(GtkWidget *widget, gpointer user_data)
2310 colorize_conversation_cb( widget , user_data, CONV_ETHER);
2317 packet_list_menu_color_conv_ip_color1_cb(GtkWidget *widget, gpointer user_data)
2319 colorize_conversation_cb( widget , user_data, CONV_IP+1*256);
2324 packet_list_menu_color_conv_ip_color2_cb(GtkWidget *widget, gpointer user_data)
2326 colorize_conversation_cb( widget , user_data, CONV_IP+1*256);
2330 packet_list_menu_color_conv_ip_color3_cb(GtkWidget *widget, gpointer user_data)
2332 colorize_conversation_cb( widget , user_data, CONV_IP+3*256);
2336 packet_list_menu_color_conv_ip_color4_cb(GtkWidget *widget, gpointer user_data)
2338 colorize_conversation_cb( widget , user_data, CONV_IP+4*256);
2342 packet_list_menu_color_conv_ip_color5_cb(GtkWidget *widget, gpointer user_data)
2344 colorize_conversation_cb( widget , user_data, CONV_IP+5*256);
2348 packet_list_menu_color_conv_ip_color6_cb(GtkWidget *widget, gpointer user_data)
2350 colorize_conversation_cb( widget , user_data, CONV_IP+6*256);
2354 packet_list_menu_color_conv_ip_color7_cb(GtkWidget *widget, gpointer user_data)
2356 colorize_conversation_cb( widget , user_data, CONV_IP+7*256);
2360 packet_list_menu_color_conv_ip_color8_cb(GtkWidget *widget, gpointer user_data)
2362 colorize_conversation_cb( widget , user_data, CONV_IP+8*256);
2366 packet_list_menu_color_conv_ip_color9_cb(GtkWidget *widget, gpointer user_data)
2368 colorize_conversation_cb( widget , user_data, CONV_IP+9*256);
2372 packet_list_menu_color_conv_ip_color10_cb(GtkWidget *widget, gpointer user_data)
2374 colorize_conversation_cb( widget , user_data, CONV_IP+10*256);
2379 packet_list_menu_color_conv_ip_new_rule_cb(GtkWidget *widget, gpointer user_data)
2381 colorize_conversation_cb( widget , user_data, CONV_TCP);
2387 packet_list_menu_color_conv_tcp_color1_cb(GtkWidget *widget, gpointer user_data)
2389 colorize_conversation_cb( widget , user_data, CONV_TCP+1*256);
2394 packet_list_menu_color_conv_tcp_color2_cb(GtkWidget *widget, gpointer user_data)
2396 colorize_conversation_cb( widget , user_data, CONV_TCP+1*256);
2400 packet_list_menu_color_conv_tcp_color3_cb(GtkWidget *widget, gpointer user_data)
2402 colorize_conversation_cb( widget , user_data, CONV_TCP+3*256);
2406 packet_list_menu_color_conv_tcp_color4_cb(GtkWidget *widget, gpointer user_data)
2408 colorize_conversation_cb( widget , user_data, CONV_TCP+4*256);
2412 packet_list_menu_color_conv_tcp_color5_cb(GtkWidget *widget, gpointer user_data)
2414 colorize_conversation_cb( widget , user_data, CONV_TCP+5*256);
2418 packet_list_menu_color_conv_tcp_color6_cb(GtkWidget *widget, gpointer user_data)
2420 colorize_conversation_cb( widget , user_data, CONV_TCP+6*256);
2424 packet_list_menu_color_conv_tcp_color7_cb(GtkWidget *widget, gpointer user_data)
2426 colorize_conversation_cb( widget , user_data, CONV_TCP+7*256);
2430 packet_list_menu_color_conv_tcp_color8_cb(GtkWidget *widget, gpointer user_data)
2432 colorize_conversation_cb( widget , user_data, CONV_TCP+8*256);
2436 packet_list_menu_color_conv_tcp_color9_cb(GtkWidget *widget, gpointer user_data)
2438 colorize_conversation_cb( widget , user_data, CONV_TCP+9*256);
2442 packet_list_menu_color_conv_tcp_color10_cb(GtkWidget *widget, gpointer user_data)
2444 colorize_conversation_cb( widget , user_data, CONV_TCP+10*256);
2449 packet_list_menu_color_conv_tcp_new_rule_cb(GtkWidget *widget, gpointer user_data)
2451 colorize_conversation_cb( widget , user_data, CONV_TCP);
2457 packet_list_menu_color_conv_udp_color1_cb(GtkWidget *widget, gpointer user_data)
2459 colorize_conversation_cb( widget , user_data, CONV_UDP+1*256);
2464 packet_list_menu_color_conv_udp_color2_cb(GtkWidget *widget, gpointer user_data)
2466 colorize_conversation_cb( widget , user_data, CONV_UDP+1*256);
2470 packet_list_menu_color_conv_udp_color3_cb(GtkWidget *widget, gpointer user_data)
2472 colorize_conversation_cb( widget , user_data, CONV_UDP+3*256);
2476 packet_list_menu_color_conv_udp_color4_cb(GtkWidget *widget, gpointer user_data)
2478 colorize_conversation_cb( widget , user_data, CONV_UDP+4*256);
2482 packet_list_menu_color_conv_udp_color5_cb(GtkWidget *widget, gpointer user_data)
2484 colorize_conversation_cb( widget , user_data, CONV_UDP+5*256);
2488 packet_list_menu_color_conv_udp_color6_cb(GtkWidget *widget, gpointer user_data)
2490 colorize_conversation_cb( widget , user_data, CONV_UDP+6*256);
2494 packet_list_menu_color_conv_udp_color7_cb(GtkWidget *widget, gpointer user_data)
2496 colorize_conversation_cb( widget , user_data, CONV_UDP+7*256);
2500 packet_list_menu_color_conv_udp_color8_cb(GtkWidget *widget, gpointer user_data)
2502 colorize_conversation_cb( widget , user_data, CONV_UDP+8*256);
2506 packet_list_menu_color_conv_udp_color9_cb(GtkWidget *widget, gpointer user_data)
2508 colorize_conversation_cb( widget , user_data, CONV_UDP+9*256);
2512 packet_list_menu_color_conv_udp_color10_cb(GtkWidget *widget, gpointer user_data)
2514 colorize_conversation_cb( widget , user_data, CONV_UDP+10*256);
2519 packet_list_menu_color_conv_udp_new_rule_cb(GtkWidget *widget, gpointer user_data)
2521 colorize_conversation_cb( widget , user_data, CONV_UDP);
2528 packet_list_menu_color_conv_cba_color1_cb(GtkWidget *widget, gpointer user_data)
2530 colorize_conversation_cb( widget , user_data, CONV_CBA+1*256);
2535 packet_list_menu_color_conv_cba_color2_cb(GtkWidget *widget, gpointer user_data)
2537 colorize_conversation_cb( widget , user_data, CONV_CBA+1*256);
2541 packet_list_menu_color_conv_cba_color3_cb(GtkWidget *widget, gpointer user_data)
2543 colorize_conversation_cb( widget , user_data, CONV_CBA+3*256);
2547 packet_list_menu_color_conv_cba_color4_cb(GtkWidget *widget, gpointer user_data)
2549 colorize_conversation_cb( widget , user_data, CONV_CBA+4*256);
2553 packet_list_menu_color_conv_cba_color5_cb(GtkWidget *widget, gpointer user_data)
2555 colorize_conversation_cb( widget , user_data, CONV_CBA+5*256);
2559 packet_list_menu_color_conv_cba_color6_cb(GtkWidget *widget, gpointer user_data)
2561 colorize_conversation_cb( widget , user_data, CONV_CBA+6*256);
2565 packet_list_menu_color_conv_cba_color7_cb(GtkWidget *widget, gpointer user_data)
2567 colorize_conversation_cb( widget , user_data, CONV_CBA+7*256);
2571 packet_list_menu_color_conv_cba_color8_cb(GtkWidget *widget, gpointer user_data)
2573 colorize_conversation_cb( widget , user_data, CONV_CBA+8*256);
2577 packet_list_menu_color_conv_cba_color9_cb(GtkWidget *widget, gpointer user_data)
2579 colorize_conversation_cb( widget , user_data, CONV_CBA+9*256);
2583 packet_list_menu_color_conv_cba_color10_cb(GtkWidget *widget, gpointer user_data)
2585 colorize_conversation_cb( widget , user_data, CONV_CBA+10*256);
2590 packet_list_menu_color_conv_cba_new_rule_cb(GtkWidget *widget, gpointer user_data)
2592 colorize_conversation_cb( widget , user_data, CONV_CBA);
2597 packet_list_menu_copy_sum_txt(GtkWidget *widget, gpointer user_data)
2599 copy_hex_cb( widget , user_data, CS_TEXT);
2604 packet_list_menu_copy_sum_csv(GtkWidget *widget, gpointer user_data)
2606 copy_hex_cb( widget , user_data, CS_CSV);
2611 packet_list_menu_copy_as_flt(GtkWidget *widget, gpointer user_data)
2613 copy_hex_cb( widget , user_data, MATCH_SELECTED_REPLACE|MATCH_SELECTED_COPY_ONLY);
2618 packet_list_menu_copy_bytes_oht_cb(GtkWidget *widget, gpointer user_data)
2620 copy_hex_cb( widget , user_data, CD_ALLINFO | CD_FLAGS_SELECTEDONLY);
2625 packet_list_menu_copy_bytes_oh_cb(GtkWidget *widget, gpointer user_data)
2627 copy_hex_cb( widget , user_data, CD_HEXCOLUMNS | CD_FLAGS_SELECTEDONLY);
2632 packet_list_menu_copy_bytes_text_cb(GtkWidget *widget, gpointer user_data)
2634 copy_hex_cb( widget , user_data, CD_TEXTONLY | CD_FLAGS_SELECTEDONLY);
2639 packet_list_menu_copy_bytes_hex_strm_cb(GtkWidget *widget, gpointer user_data)
2641 copy_hex_cb( widget , user_data, CD_HEX | CD_FLAGS_SELECTEDONLY);
2646 packet_list_menu_copy_bytes_bin_strm_cb(GtkWidget *widget, gpointer user_data)
2648 copy_hex_cb( widget , user_data, CD_BINARY | CD_FLAGS_SELECTEDONLY);
2656 tree_view_menu_color_with_flt_color1_cb(GtkWidget *widget, gpointer user_data)
2658 colorize_selected_ptree_cb( widget , user_data, 1);
2663 tree_view_menu_color_with_flt_color2_cb(GtkWidget *widget, gpointer user_data)
2665 colorize_selected_ptree_cb( widget , user_data, 2);
2669 tree_view_menu_color_with_flt_color3_cb(GtkWidget *widget, gpointer user_data)
2671 colorize_selected_ptree_cb( widget , user_data, 3);
2675 tree_view_menu_color_with_flt_color4_cb(GtkWidget *widget, gpointer user_data)
2677 colorize_selected_ptree_cb( widget , user_data, 4);
2681 tree_view_menu_color_with_flt_color5_cb(GtkWidget *widget, gpointer user_data)
2683 colorize_selected_ptree_cb( widget , user_data, 5);
2687 tree_view_menu_color_with_flt_color6_cb(GtkWidget *widget, gpointer user_data)
2689 colorize_selected_ptree_cb( widget , user_data, 6);
2693 tree_view_menu_color_with_flt_color7_cb(GtkWidget *widget, gpointer user_data)
2695 colorize_selected_ptree_cb( widget , user_data, 7);
2699 tree_view_menu_color_with_flt_color8_cb(GtkWidget *widget, gpointer user_data)
2701 colorize_selected_ptree_cb( widget , user_data, 8);
2705 tree_view_menu_color_with_flt_color9_cb(GtkWidget *widget, gpointer user_data)
2707 colorize_selected_ptree_cb( widget , user_data, 9);
2711 tree_view_menu_color_with_flt_color10_cb(GtkWidget *widget, gpointer user_data)
2713 colorize_selected_ptree_cb( widget , user_data, 10);
2718 tree_view_menu_color_with_flt_new_rule_cb(GtkWidget *widget, gpointer user_data)
2720 colorize_selected_ptree_cb( widget , user_data, 0);
2725 tree_view_menu_copy_desc(GtkWidget *widget, gpointer user_data)
2727 copy_selected_plist_cb( widget , user_data, COPY_SELECTED_DESCRIPTION);
2732 tree_view_menu_copy_field(GtkWidget *widget, gpointer user_data)
2734 copy_selected_plist_cb( widget , user_data, COPY_SELECTED_FIELDNAME);
2739 tree_view_menu_copy_value(GtkWidget *widget, gpointer user_data)
2741 copy_selected_plist_cb( widget , user_data, COPY_SELECTED_VALUE);
2746 tree_view_menu_copy_as_flt(GtkWidget *widget, gpointer user_data)
2748 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_REPLACE|MATCH_SELECTED_COPY_ONLY);
2752 static const char *ui_desc_packet_list_heading_menu_popup =
2754 " <popup name='PacketListHeadingPopup' action='PopupAction'>\n"
2755 " <menuitem name='SortAscending' action='/Sort Ascending'/>\n"
2756 " <menuitem name='SortDescending' action='/Sort Descending'/>\n"
2757 " <menuitem name='NoSorting' action='/No Sorting'/>\n"
2759 " <menuitem name='ShowResolved' action='/Show Resolved'/>\n"
2761 " <menuitem name='AlignLeft' action='/Align Left'/>\n"
2762 " <menuitem name='AlignCenter' action='/Align Center'/>\n"
2763 " <menuitem name='AlignRight' action='/Align Right'/>\n"
2765 " <menuitem name='ColumnPreferences' action='/Column Preferences'/>\n"
2766 " <menuitem name='ResizeColumn' action='/Resize Column'/>\n"
2767 " <menuitem name='RenameColumnTitle' action='/Rename Column Title'/>\n"
2769 " <menu name='DisplayedColumns' action='/Displayed Columns'>\n"
2770 " <menuitem name='Display All' action='/Displayed Columns/Display All'/>\n"
2772 " <menuitem name='HideColumn' action='/Hide Column'/>\n"
2773 " <menuitem name='RemoveColumn' action='/Remove Column'/>\n"
2777 static const GtkActionEntry packet_list_heading_menu_popup_action_entries[] = {
2778 { "/Sort Ascending", GTK_STOCK_SORT_ASCENDING, "Sort Ascending", NULL, NULL, G_CALLBACK(sort_ascending_cb) },
2779 { "/Sort Descending", GTK_STOCK_SORT_DESCENDING, "Sort Descending", NULL, NULL, G_CALLBACK(sort_descending_cb) },
2780 { "/No Sorting", NULL, "No Sorting", NULL, NULL, G_CALLBACK(no_sorting_cb) },
2781 { "/Align Left", GTK_STOCK_JUSTIFY_LEFT, "Align Left", NULL, NULL, G_CALLBACK(packet_list_heading_align_left_cb) },
2782 { "/Align Center", GTK_STOCK_JUSTIFY_CENTER, "Align Center", NULL, NULL, G_CALLBACK(packet_list_heading_align_center_cb) },
2783 { "/Align Right", GTK_STOCK_JUSTIFY_RIGHT, "Align Right", NULL, NULL, G_CALLBACK(packet_list_heading_align_right_cb) },
2784 { "/Column Preferences", GTK_STOCK_PREFERENCES, "Column Preferences...", NULL, NULL, G_CALLBACK(packet_list_heading_col_pref_cb) },
2785 { "/Resize Column", WIRESHARK_STOCK_RESIZE_COLUMNS, "Resize Column", NULL, NULL, G_CALLBACK(packet_list_heading_resize_col_cb) },
2786 { "/Rename Column Title", GTK_STOCK_BOLD, "Rename Column Title...", NULL, NULL, G_CALLBACK(packet_list_heading_rename_col_cb) },
2787 { "/Displayed Columns", NULL, "Displayed Columns", NULL, NULL, NULL },
2788 { "/Displayed Columns/Display All", NULL, "Display All", NULL, NULL, G_CALLBACK(packet_list_heading_activate_all_columns) },
2789 { "/Hide Column", NULL, "Hide Column", NULL, NULL, G_CALLBACK(packet_list_heading_hide_col_cb) },
2790 { "/Remove Column", GTK_STOCK_DELETE, "Remove Column", NULL, NULL, G_CALLBACK(packet_list_heading_remove_col_cb) },
2793 static const GtkToggleActionEntry packet_list_heading_menu_toggle_action_entries[] =
2795 /* name, stock id, label, accel, tooltip, callback, is_active */
2796 {"/Show Resolved", NULL, "Show Resolved", NULL, NULL, G_CALLBACK(packet_list_heading_show_resolved_cb), FALSE},
2799 static const char *ui_desc_packet_list_menu_popup =
2801 " <popup name='PacketListMenuPopup' action='PopupAction'>\n"
2802 " <menuitem name='MarkPacket' action='/MarkPacket'/>\n"
2803 " <menuitem name='IgnorePacket' action='/IgnorePacket'/>\n"
2804 " <menuitem name='SetTimeReference' action='/Set Time Reference'/>\n"
2806 " <menuitem name='ManuallyResolveAddress' action='/ManuallyResolveAddress'/>\n"
2808 " <menu name= 'ApplyAsFilter' action='/Apply as Filter'>\n"
2809 " <menuitem name='Selected' action='/Apply as Filter/Selected'/>\n"
2810 " <menuitem name='NotSelected' action='/Apply as Filter/Not Selected'/>\n"
2811 " <menuitem name='AndSelected' action='/Apply as Filter/AndSelected'/>\n"
2812 " <menuitem name='OrSelected' action='/Apply as Filter/OrSelected'/>\n"
2813 " <menuitem name='AndNotSelected' action='/Apply as Filter/AndNotSelected'/>\n"
2814 " <menuitem name='OrNotSelected' action='/Apply as Filter/OrNotSelected'/>\n"
2816 " <menu name= 'PrepareaFilter' action='/Prepare a Filter'>\n"
2817 " <menuitem name='Selected' action='/Prepare a Filter/Selected'/>\n"
2818 " <menuitem name='NotSelected' action='/Prepare a Filter/Not Selected'/>\n"
2819 " <menuitem name='AndSelected' action='/Prepare a Filter/AndSelected'/>\n"
2820 " <menuitem name='OrSelected' action='/Prepare a Filter/OrSelected'/>\n"
2821 " <menuitem name='AndNotSelected' action='/Prepare a Filter/AndNotSelected'/>\n"
2822 " <menuitem name='OrNotSelected' action='/Prepare a Filter/OrNotSelected'/>\n"
2824 " <menu name= 'ConversationFilter' action='/Conversation Filter'>\n"
2825 " <menuitem name='Ethernet' action='/Conversation Filter/Ethernet'/>\n"
2826 " <menuitem name='IP' action='/Conversation Filter/IP'/>\n"
2827 " <menuitem name='TCP' action='/Conversation Filter/TCP'/>\n"
2828 " <menuitem name='UDP' action='/Conversation Filter/UDP'/>\n"
2829 " <menuitem name='PN-CBA' action='/Conversation Filter/PN-CBA'/>\n"
2831 " <menu name= 'ColorizeConversation' action='/Colorize Conversation'>\n"
2832 " <menu name= 'Ethernet' action='/Colorize Conversation/Ethernet'>\n"
2833 " <menuitem name='Color1' action='/Colorize Conversation/Ethernet/Color 1'/>\n"
2834 " <menuitem name='Color2' action='/Colorize Conversation/Ethernet/Color 2'/>\n"
2835 " <menuitem name='Color3' action='/Colorize Conversation/Ethernet/Color 3'/>\n"
2836 " <menuitem name='Color4' action='/Colorize Conversation/Ethernet/Color 4'/>\n"
2837 " <menuitem name='Color5' action='/Colorize Conversation/Ethernet/Color 5'/>\n"
2838 " <menuitem name='Color6' action='/Colorize Conversation/Ethernet/Color 6'/>\n"
2839 " <menuitem name='Color7' action='/Colorize Conversation/Ethernet/Color 7'/>\n"
2840 " <menuitem name='Color8' action='/Colorize Conversation/Ethernet/Color 8'/>\n"
2841 " <menuitem name='Color9' action='/Colorize Conversation/Ethernet/Color 9'/>\n"
2842 " <menuitem name='Color10' action='/Colorize Conversation/Ethernet/Color 10'/>\n"
2843 " <menuitem name='NewColoringRule' action='/Colorize Conversation/Ethernet/New Coloring Rule'/>\n"
2845 " <menu name= 'IP' action='/Colorize Conversation/IP'>\n"
2846 " <menuitem name='Color1' action='/Colorize Conversation/IP/Color 1'/>\n"
2847 " <menuitem name='Color2' action='/Colorize Conversation/IP/Color 2'/>\n"
2848 " <menuitem name='Color3' action='/Colorize Conversation/IP/Color 3'/>\n"
2849 " <menuitem name='Color4' action='/Colorize Conversation/IP/Color 4'/>\n"
2850 " <menuitem name='Color5' action='/Colorize Conversation/IP/Color 5'/>\n"
2851 " <menuitem name='Color6' action='/Colorize Conversation/IP/Color 6'/>\n"
2852 " <menuitem name='Color7' action='/Colorize Conversation/IP/Color 7'/>\n"
2853 " <menuitem name='Color8' action='/Colorize Conversation/IP/Color 8'/>\n"
2854 " <menuitem name='Color9' action='/Colorize Conversation/IP/Color 9'/>\n"
2855 " <menuitem name='Color10' action='/Colorize Conversation/IP/Color 10'/>\n"
2856 " <menuitem name='NewColoringRule' action='/Colorize Conversation/IP/New Coloring Rule'/>\n"
2858 " <menu name= 'TCP' action='/Colorize Conversation/TCP'>\n"
2859 " <menuitem name='Color1' action='/Colorize Conversation/TCP/Color 1'/>\n"
2860 " <menuitem name='Color2' action='/Colorize Conversation/TCP/Color 2'/>\n"
2861 " <menuitem name='Color3' action='/Colorize Conversation/TCP/Color 3'/>\n"
2862 " <menuitem name='Color4' action='/Colorize Conversation/TCP/Color 4'/>\n"
2863 " <menuitem name='Color5' action='/Colorize Conversation/TCP/Color 5'/>\n"
2864 " <menuitem name='Color6' action='/Colorize Conversation/TCP/Color 6'/>\n"
2865 " <menuitem name='Color7' action='/Colorize Conversation/TCP/Color 7'/>\n"
2866 " <menuitem name='Color8' action='/Colorize Conversation/TCP/Color 8'/>\n"
2867 " <menuitem name='Color9' action='/Colorize Conversation/TCP/Color 9'/>\n"
2868 " <menuitem name='Color10' action='/Colorize Conversation/TCP/Color 10'/>\n"
2869 " <menuitem name='NewColoringRule' action='/Colorize Conversation/TCP/New Coloring Rule'/>\n"
2871 " <menu name= 'UDP' action='/Colorize Conversation/UDP'>\n"
2872 " <menuitem name='Color1' action='/Colorize Conversation/UDP/Color 1'/>\n"
2873 " <menuitem name='Color2' action='/Colorize Conversation/UDP/Color 2'/>\n"
2874 " <menuitem name='Color3' action='/Colorize Conversation/UDP/Color 3'/>\n"
2875 " <menuitem name='Color4' action='/Colorize Conversation/UDP/Color 4'/>\n"
2876 " <menuitem name='Color5' action='/Colorize Conversation/UDP/Color 5'/>\n"
2877 " <menuitem name='Color6' action='/Colorize Conversation/UDP/Color 6'/>\n"
2878 " <menuitem name='Color7' action='/Colorize Conversation/UDP/Color 7'/>\n"
2879 " <menuitem name='Color8' action='/Colorize Conversation/UDP/Color 8'/>\n"
2880 " <menuitem name='Color9' action='/Colorize Conversation/UDP/Color 9'/>\n"
2881 " <menuitem name='Color10' action='/Colorize Conversation/UDP/Color 10'/>\n"
2882 " <menuitem name='NewColoringRule' action='/Colorize Conversation/UDP/New Coloring Rule'/>\n"
2884 " <menu name= 'PN-CBA' action='/Colorize Conversation/PN-CBA'>\n"
2885 " <menuitem name='Color1' action='/Colorize Conversation/PN-CBA/Color 1'/>\n"
2886 " <menuitem name='Color2' action='/Colorize Conversation/PN-CBA/Color 2'/>\n"
2887 " <menuitem name='Color3' action='/Colorize Conversation/PN-CBA/Color 3'/>\n"
2888 " <menuitem name='Color4' action='/Colorize Conversation/PN-CBA/Color 4'/>\n"
2889 " <menuitem name='Color5' action='/Colorize Conversation/PN-CBA/Color 5'/>\n"
2890 " <menuitem name='Color6' action='/Colorize Conversation/PN-CBA/Color 6'/>\n"
2891 " <menuitem name='Color7' action='/Colorize Conversation/PN-CBA/Color 7'/>\n"
2892 " <menuitem name='Color8' action='/Colorize Conversation/PN-CBA/Color 8'/>\n"
2893 " <menuitem name='Color9' action='/Colorize Conversation/PN-CBA/Color 9'/>\n"
2894 " <menuitem name='Color10' action='/Colorize Conversation/PN-CBA/Color 10'/>\n"
2895 " <menuitem name='NewColoringRule' action='/Colorize Conversation/PN-CBA/New Coloring Rule'/>\n"
2898 " <menu name= 'SCTP' action='/SCTP'>\n"
2899 " <menuitem name='AnalysethisAssociation' action='/SCTP/Analyse this Association'/>\n"
2900 " <menuitem name='PrepareFilterforthisAssociation' action='/SCTP/Prepare Filter for this Association'/>\n"
2902 " <menuitem name='FollowTCPStream' action='/Follow TCP Stream'/>\n"
2903 " <menuitem name='FollowUDPStream' action='/Follow UDP Stream'/>\n"
2904 " <menuitem name='FollowSSLStream' action='/Follow SSL Stream'/>\n"
2906 " <menu name= 'Copy' action='/Copy'>\n"
2907 " <menuitem name='SummaryTxt' action='/Copy/SummaryTxt'/>\n"
2908 " <menuitem name='SummaryCSV' action='/Copy/SummaryCSV'/>\n"
2909 " <menuitem name='AsFilter' action='/Copy/AsFilter'/>\n"
2911 " <menu name= 'Bytes' action='/Copy/Bytes'>\n"
2912 " <menuitem name='OffsetHexText' action='/Copy/Bytes/OffsetHexText'/>\n"
2913 " <menuitem name='OffsetHex' action='/Copy/Bytes/OffsetHex'/>\n"
2914 " <menuitem name='PrintableTextOnly' action='/Copy/Bytes/PrintableTextOnly'/>\n"
2916 " <menuitem name='HexStream' action='/Copy/Bytes/HexStream'/>\n"
2917 " <menuitem name='BinaryStream' action='/Copy/Bytes/BinaryStream'/>\n"
2921 " <menuitem name='DecodeAs' action='/DecodeAs'/>\n"
2922 " <menuitem name='Print' action='/Print'/>\n"
2923 " <menuitem name='ShowPacketinNewWindow' action='/ShowPacketinNewWindow'/>\n"
2927 static const GtkActionEntry packet_list_menu_popup_action_entries[] = {
2928 { "/MarkPacket", NULL, "Mark Packet (toggle)", NULL, NULL, G_CALLBACK(new_packet_list_mark_frame_cb) },
2929 { "/IgnorePacket", NULL, "Ignore Packet (toggle)", NULL, NULL, G_CALLBACK(new_packet_list_ignore_frame_cb) },
2930 { "/Set Time Reference", WIRESHARK_STOCK_TIME, "Set Time Reference (toggle)", NULL, NULL, G_CALLBACK(packet_list_menu_set_ref_time_cb) },
2931 { "/ManuallyResolveAddress", NULL, "Manually Resolve Address", NULL, NULL, G_CALLBACK(manual_addr_resolv_dlg) },
2932 { "/Apply as Filter", NULL, "Apply as Filter", NULL, NULL, NULL },
2934 { "/Apply as Filter/Selected", NULL, "_Selected" , NULL, NULL, G_CALLBACK(packet_list_menu_apply_selected_cb) },
2935 { "/Apply as Filter/Not Selected", NULL, "_Not Selected", NULL, NULL, G_CALLBACK(packet_list_menu_apply_not_selected_cb) },
2936 { "/Apply as Filter/AndSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _and Selected", NULL, NULL, G_CALLBACK(packet_list_menu_apply_and_selected_cb) },
2937 { "/Apply as Filter/OrSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _or Selected", NULL, NULL, G_CALLBACK(packet_list_menu_apply_or_selected_cb) },
2938 { "/Apply as Filter/AndNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " a_nd not Selected", NULL, NULL, G_CALLBACK(packet_list_menu_apply_and_not_selected_cb) },
2939 { "/Apply as Filter/OrNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " o_r not Selected", NULL, NULL, G_CALLBACK(packet_list_menu_apply_or_not_selected_cb) },
2941 { "/Prepare a Filter", NULL, "Prepare a Filter", NULL, NULL, NULL },
2942 { "/Prepare a Filter/Selected", NULL, "_Selected" , NULL, NULL, G_CALLBACK(packet_list_menu_prepare_selected_cb) },
2943 { "/Prepare a Filter/Not Selected", NULL, "_Not Selected", NULL, NULL, G_CALLBACK(packet_list_menu_prepare_not_selected_cb) },
2944 { "/Prepare a Filter/AndSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _and Selected", NULL, NULL, G_CALLBACK(packet_list_menu_prepare_and_selected_cb) },
2945 { "/Prepare a Filter/OrSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _or Selected", NULL, NULL, G_CALLBACK(packet_list_menu_prepare_or_selected_cb) },
2946 { "/Prepare a Filter/AndNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " a_nd not Selected", NULL, NULL, G_CALLBACK(packet_list_menu_prepare_and_not_selected_cb) },
2947 { "/Prepare a Filter/OrNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " o_r not Selected", NULL, NULL, G_CALLBACK(packet_list_menu_prepare_or_not_selected_cb) },
2949 { "/Conversation Filter", NULL, "Conversation Filter", NULL, NULL, NULL },
2950 { "/Conversation Filter/Ethernet", NULL, "Ethernet", NULL, NULL, G_CALLBACK(packet_list_menu_conversation_ethernet_cb) },
2951 { "/Conversation Filter/IP", NULL, "IP", NULL, NULL, G_CALLBACK(packet_list_menu_conversation_ip_cb) },
2952 { "/Conversation Filter/TCP", NULL, "TCP", NULL, NULL, G_CALLBACK(packet_list_menu_conversation_tcp_cb) },
2953 { "/Conversation Filter/UDP", NULL, "UDP", NULL, NULL, G_CALLBACK(packet_list_menu_conversation_udp_cb) },
2954 { "/Conversation Filter/PN-CBA", NULL, "PN-CBA", NULL, NULL, G_CALLBACK(packet_list_menu_conversation_pn_cba_cb) },
2956 { "/Colorize Conversation", NULL, "Colorize Conversation", NULL, NULL, NULL },
2958 { "/Colorize Conversation/Ethernet", NULL, "Ethernet", NULL, NULL, NULL },
2960 { "/Colorize Conversation/Ethernet/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color1_cb) },
2961 { "/Colorize Conversation/Ethernet/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color2_cb) },
2962 { "/Colorize Conversation/Ethernet/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color3_cb) },
2963 { "/Colorize Conversation/Ethernet/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color4_cb) },
2964 { "/Colorize Conversation/Ethernet/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color5_cb) },
2965 { "/Colorize Conversation/Ethernet/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color6_cb) },
2966 { "/Colorize Conversation/Ethernet/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color7_cb) },
2967 { "/Colorize Conversation/Ethernet/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color8_cb) },
2968 { "/Colorize Conversation/Ethernet/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color9_cb) },
2969 { "/Colorize Conversation/Ethernet/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color10_cb) },
2970 { "/Colorize Conversation/Ethernet/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_new_rule_cb) },
2972 { "/Colorize Conversation/IP", NULL, "IP", NULL, NULL, NULL },
2974 { "/Colorize Conversation/IP/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color1_cb) },
2975 { "/Colorize Conversation/IP/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color2_cb) },
2976 { "/Colorize Conversation/IP/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color3_cb) },
2977 { "/Colorize Conversation/IP/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color4_cb) },
2978 { "/Colorize Conversation/IP/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color5_cb) },
2979 { "/Colorize Conversation/IP/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color6_cb) },
2980 { "/Colorize Conversation/IP/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color7_cb) },
2981 { "/Colorize Conversation/IP/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color8_cb) },
2982 { "/Colorize Conversation/IP/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color9_cb) },
2983 { "/Colorize Conversation/IP/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color10_cb) },
2984 { "/Colorize Conversation/IP/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_new_rule_cb) },
2986 { "/Colorize Conversation/TCP", NULL, "TCP", NULL, NULL, NULL },
2988 { "/Colorize Conversation/TCP/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color1_cb) },
2989 { "/Colorize Conversation/TCP/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color2_cb) },
2990 { "/Colorize Conversation/TCP/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color3_cb) },
2991 { "/Colorize Conversation/TCP/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color4_cb) },
2992 { "/Colorize Conversation/TCP/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color5_cb) },
2993 { "/Colorize Conversation/TCP/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color6_cb) },
2994 { "/Colorize Conversation/TCP/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color7_cb) },
2995 { "/Colorize Conversation/TCP/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color8_cb) },
2996 { "/Colorize Conversation/TCP/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color9_cb) },
2997 { "/Colorize Conversation/TCP/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color10_cb) },
2998 { "/Colorize Conversation/TCP/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_new_rule_cb) },
3000 { "/Colorize Conversation/UDP", NULL, "UDP", NULL, NULL, NULL },
3002 { "/Colorize Conversation/UDP/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color1_cb) },
3003 { "/Colorize Conversation/UDP/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color2_cb) },
3004 { "/Colorize Conversation/UDP/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color3_cb) },
3005 { "/Colorize Conversation/UDP/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color4_cb) },
3006 { "/Colorize Conversation/UDP/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color5_cb) },
3007 { "/Colorize Conversation/UDP/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color6_cb) },
3008 { "/Colorize Conversation/UDP/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color7_cb) },
3009 { "/Colorize Conversation/UDP/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color8_cb) },
3010 { "/Colorize Conversation/UDP/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color9_cb) },
3011 { "/Colorize Conversation/UDP/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color10_cb) },
3012 { "/Colorize Conversation/UDP/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_new_rule_cb) },
3014 { "/Colorize Conversation/PN-CBA", NULL, "PN-CBA Server", NULL, NULL, NULL },
3016 { "/Colorize Conversation/PN-CBA/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color1_cb) },
3017 { "/Colorize Conversation/PN-CBA/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color2_cb) },
3018 { "/Colorize Conversation/PN-CBA/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color3_cb) },
3019 { "/Colorize Conversation/PN-CBA/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color4_cb) },
3020 { "/Colorize Conversation/PN-CBA/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color5_cb) },
3021 { "/Colorize Conversation/PN-CBA/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color6_cb) },
3022 { "/Colorize Conversation/PN-CBA/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color7_cb) },
3023 { "/Colorize Conversation/PN-CBA/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color8_cb) },
3024 { "/Colorize Conversation/PN-CBA/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color9_cb) },
3025 { "/Colorize Conversation/PN-CBA/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color10_cb) },
3026 { "/Colorize Conversation/PN-CBA/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_new_rule_cb) },
3028 { "/SCTP", NULL, "SCTP", NULL, NULL, NULL },
3029 { "/SCTP/Analyse this Association", NULL, "Analyse this Association", NULL, NULL, G_CALLBACK(sctp_analyse_start) },
3030 { "/SCTP/Prepare Filter for this Association", NULL, "Prepare Filter for this Association", NULL, NULL, G_CALLBACK(sctp_set_assoc_filter) },
3033 { "/Follow TCP Stream", NULL, "Follow TCP Stream", NULL, NULL, G_CALLBACK(follow_tcp_stream_cb) },
3034 { "/Follow UDP Stream", NULL, "Follow UDP Stream", NULL, NULL, G_CALLBACK(follow_udp_stream_cb) },
3035 { "/Follow SSL Stream", NULL, "Follow SSL Stream", NULL, NULL, G_CALLBACK(follow_ssl_stream_cb) },
3037 { "/Copy", NULL, "Copy", NULL, NULL, NULL },
3038 { "/Copy/SummaryTxt", NULL, "Summary (Text)", NULL, NULL, G_CALLBACK(packet_list_menu_copy_sum_txt) },
3039 { "/Copy/SummaryCSV", NULL, "Summary (CSV)", NULL, NULL, G_CALLBACK(packet_list_menu_copy_sum_csv) },
3040 { "/Copy/AsFilter", NULL, "As Filter", NULL, NULL, G_CALLBACK(packet_list_menu_copy_as_flt) },
3043 { "/Copy/Bytes", NULL, "Bytes", NULL, NULL, NULL },
3044 { "/Copy/Bytes/OffsetHexText", NULL, "Offset Hex Text", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_oht_cb) },
3045 { "/Copy/Bytes/OffsetHex", NULL, "Offset Hex", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_oh_cb) },
3046 { "/Copy/Bytes/PrintableTextOnly", NULL, "Printable Text Only", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_text_cb) },
3048 { "/Copy/Bytes/HexStream", NULL, "Hex Stream", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_hex_strm_cb) },
3049 { "/Copy/Bytes/BinaryStream", NULL, "Binary Stream", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_bin_strm_cb) },
3051 { "/DecodeAs", WIRESHARK_STOCK_DECODE_AS, "Decode As...", NULL, NULL, G_CALLBACK(decode_as_cb) },
3052 { "/Print", GTK_STOCK_PRINT, "Print...", NULL, NULL, G_CALLBACK(file_print_selected_cmd_cb) },
3053 { "/ShowPacketinNewWindow", NULL, "Show Packet in New Window", NULL, NULL, G_CALLBACK(new_window_cb) },
3057 static const char *ui_desc_tree_view_menu_popup =
3059 " <popup name='TreeViewPopup' action='PopupAction'>\n"
3060 " <menuitem name='ExpandSubtrees' action='/ExpandSubtrees'/>\n"
3061 " <menuitem name='ExpandAll' action='/ExpandAll'/>\n"
3062 " <menuitem name='CollapseAll' action='/CollapseAll'/>\n"
3064 " <menuitem name='ApplyasColumn' action='/Apply as Column'/>\n"
3066 " <menu name= 'ApplyAsFilter' action='/Apply as Filter'>\n"
3067 " <menuitem name='Selected' action='/Apply as Filter/Selected'/>\n"
3068 " <menuitem name='NotSelected' action='/Apply as Filter/Not Selected'/>\n"
3069 " <menuitem name='AndSelected' action='/Apply as Filter/AndSelected'/>\n"
3070 " <menuitem name='OrSelected' action='/Apply as Filter/OrSelected'/>\n"
3071 " <menuitem name='AndNotSelected' action='/Apply as Filter/AndNotSelected'/>\n"
3072 " <menuitem name='OrNotSelected' action='/Apply as Filter/OrNotSelected'/>\n"
3074 " <menu name= 'PrepareaFilter' action='/Prepare a Filter'>\n"
3075 " <menuitem name='Selected' action='/Prepare a Filter/Selected'/>\n"
3076 " <menuitem name='NotSelected' action='/Prepare a Filter/Not Selected'/>\n"
3077 " <menuitem name='AndSelected' action='/Prepare a Filter/AndSelected'/>\n"
3078 " <menuitem name='OrSelected' action='/Prepare a Filter/OrSelected'/>\n"
3079 " <menuitem name='AndNotSelected' action='/Prepare a Filter/AndNotSelected'/>\n"
3080 " <menuitem name='OrNotSelected' action='/Prepare a Filter/OrNotSelected'/>\n"
3082 " <menu name= 'ColorizewithFilter' action='/Colorize with Filter'>\n"
3083 " <menuitem name='Color1' action='/Colorize with Filter/Color 1'/>\n"
3084 " <menuitem name='Color2' action='/Colorize with Filter/Color 2'/>\n"
3085 " <menuitem name='Color3' action='/Colorize with Filter/Color 3'/>\n"
3086 " <menuitem name='Color4' action='/Colorize with Filter/Color 4'/>\n"
3087 " <menuitem name='Color5' action='/Colorize with Filter/Color 5'/>\n"
3088 " <menuitem name='Color6' action='/Colorize with Filter/Color 6'/>\n"
3089 " <menuitem name='Color7' action='/Colorize with Filter/Color 7'/>\n"
3090 " <menuitem name='Color8' action='/Colorize with Filter/Color 8'/>\n"
3091 " <menuitem name='Color9' action='/Colorize with Filter/Color 9'/>\n"
3092 " <menuitem name='Color10' action='/Colorize with Filter/Color 10'/>\n"
3093 " <menuitem name='NewColoringRule' action='/Colorize with Filter/New Coloring Rule'/>\n"
3095 " <menuitem name='FollowTCPStream' action='/Follow TCP Stream'/>\n"
3096 " <menuitem name='FollowUDPStream' action='/Follow UDP Stream'/>\n"
3097 " <menuitem name='FollowSSLStream' action='/Follow SSL Stream'/>\n"
3099 " <menu name= 'Copy' action='/Copy'>\n"
3100 " <menuitem name='Description' action='/Copy/Description'/>\n"
3101 " <menuitem name='Fieldname' action='/Copy/Fieldname'/>\n"
3102 " <menuitem name='Value' action='/Copy/Value'/>\n"
3104 " <menuitem name='AsFilter' action='/Copy/AsFilter'/>\n"
3106 " <menu name= 'Bytes' action='/Copy/Bytes'>\n"
3107 " <menuitem name='OffsetHexText' action='/Copy/Bytes/OffsetHexText'/>\n"
3108 " <menuitem name='OffsetHex' action='/Copy/Bytes/OffsetHex'/>\n"
3109 " <menuitem name='PrintableTextOnly' action='/Copy/Bytes/PrintableTextOnly'/>\n"
3111 " <menuitem name='HexStream' action='/Copy/Bytes/HexStream'/>\n"
3112 " <menuitem name='BinaryStream' action='/Copy/Bytes/BinaryStream'/>\n"
3115 " <menuitem name='ExportSelectedPacketBytes' action='/ExportSelectedPacketBytes'/>\n"
3117 " <menuitem name='WikiProtocolPage' action='/WikiProtocolPage'/>\n"
3118 " <menuitem name='FilterFieldReference' action='/FilterFieldReference'/>\n"
3119 #if GLIB_CHECK_VERSION(2,14,0) /* GRegex */
3120 " <menuitem name='ProtocolHelp' action='/ProtocolHelp'/>\n"
3121 #endif /* GLIB_CHECK_VERSION(2,14,0) */
3122 " <menuitem name='ProtocolPreferences' action='/ProtocolPreferences'/>\n"
3124 " <menuitem name='DecodeAs' action='/DecodeAs'/>\n"
3125 " <menuitem name='DisableProtocol' action='/DisableProtocol'/>\n"
3126 " <menuitem name='ResolveName' action='/ResolveName'/>\n"
3127 " <menuitem name='GotoCorrespondingPacket' action='/GotoCorrespondingPacket'/>\n"
3131 static const GtkActionEntry tree_view_menu_popup_action_entries[] = {
3132 { "/ExpandSubtrees", NULL, "Expand Subtrees", NULL, NULL, G_CALLBACK(expand_tree_cb) },
3133 { "/ExpandAll", NULL, "Expand All", NULL, NULL, G_CALLBACK(expand_all_cb) },
3134 { "/CollapseAll", NULL, "Collapse All", NULL, NULL, G_CALLBACK(collapse_all_cb) },
3135 { "/Apply as Column", NULL, "Apply as Column", NULL, NULL, G_CALLBACK(apply_as_custom_column_cb) },
3136 { "/Apply as Filter", NULL, "Apply as Filter", NULL, NULL, NULL },
3138 { "/Apply as Filter/Selected", NULL, "_Selected" , NULL, NULL, G_CALLBACK(tree_view_menu_apply_selected_cb) },
3139 { "/Apply as Filter/Not Selected", NULL, "_Not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_not_selected_cb) },
3140 { "/Apply as Filter/AndSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _and Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_and_selected_cb) },
3141 { "/Apply as Filter/OrSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _or Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_or_selected_cb) },
3142 { "/Apply as Filter/AndNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " a_nd not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_and_not_selected_cb) },
3143 { "/Apply as Filter/OrNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " o_r not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_or_not_selected_cb) },
3145 { "/Prepare a Filter", NULL, "Prepare a Filter", NULL, NULL, NULL },
3146 { "/Prepare a Filter/Selected", NULL, "_Selected" , NULL, NULL, G_CALLBACK(tree_view_menu_prepare_selected_cb) },
3147 { "/Prepare a Filter/Not Selected", NULL, "_Not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_not_selected_cb) },
3148 { "/Prepare a Filter/AndSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _and Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_and_selected_cb) },
3149 { "/Prepare a Filter/OrSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _or Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_or_selected_cb) },
3150 { "/Prepare a Filter/AndNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " a_nd not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_and_not_selected_cb) },
3151 { "/Prepare a Filter/OrNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " o_r not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_or_not_selected_cb) },
3153 { "/Colorize with Filter", NULL, "Colorize with Filter", NULL, NULL, NULL },
3154 { "/Colorize with Filter/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color1_cb) },
3155 { "/Colorize with Filter/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color2_cb) },
3156 { "/Colorize with Filter/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color3_cb) },
3157 { "/Colorize with Filter/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color4_cb) },
3158 { "/Colorize with Filter/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color5_cb) },
3159 { "/Colorize with Filter/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color6_cb) },
3160 { "/Colorize with Filter/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color7_cb) },
3161 { "/Colorize with Filter/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color8_cb) },
3162 { "/Colorize with Filter/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color9_cb) },
3163 { "/Colorize with Filter/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color10_cb) },
3164 { "/Colorize with Filter/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_new_rule_cb) },
3166 { "/Follow TCP Stream", NULL, "Follow TCP Stream", NULL, NULL, G_CALLBACK(follow_tcp_stream_cb) },
3167 { "/Follow UDP Stream", NULL, "Follow UDP Stream", NULL, NULL, G_CALLBACK(follow_udp_stream_cb) },
3168 { "/Follow SSL Stream", NULL, "Follow SSL Stream", NULL, NULL, G_CALLBACK(follow_ssl_stream_cb) },
3170 { "/Copy", NULL, "Copy", NULL, NULL, NULL },
3171 { "/Copy/Description", NULL, "Description", NULL, NULL, G_CALLBACK(tree_view_menu_copy_desc) },
3172 { "/Copy/Fieldname", NULL, "Fieldname", NULL, NULL, G_CALLBACK(tree_view_menu_copy_field) },
3173 { "/Copy/Value", NULL, "Value", NULL, NULL, G_CALLBACK(tree_view_menu_copy_value) },
3175 { "/Copy/AsFilter", NULL, "As Filter", NULL, NULL, G_CALLBACK(tree_view_menu_copy_as_flt) },
3177 { "/Copy/Bytes", NULL, "Bytes", NULL, NULL, NULL },
3178 { "/Copy/Bytes/OffsetHexText", NULL, "Offset Hex Text", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_oht_cb) },
3179 { "/Copy/Bytes/OffsetHex", NULL, "Offset Hex", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_oh_cb) },
3180 { "/Copy/Bytes/PrintableTextOnly", NULL, "Printable Text Only", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_text_cb) },
3182 { "/Copy/Bytes/HexStream", NULL, "Hex Stream", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_hex_strm_cb) },
3183 { "/Copy/Bytes/BinaryStream", NULL, "Binary Stream", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_bin_strm_cb) },
3185 { "/ExportSelectedPacketBytes", NULL, "Export Selected Packet Bytes...", NULL, NULL, G_CALLBACK(savehex_cb) },
3187 { "/WikiProtocolPage", WIRESHARK_STOCK_WIKI, "Wiki Protocol Page", NULL, NULL, G_CALLBACK(selected_ptree_info_cb) },
3188 { "/FilterFieldReference", WIRESHARK_STOCK_INTERNET, "Filter Field Reference", NULL, NULL, G_CALLBACK(selected_ptree_ref_cb) },
3189 #if GLIB_CHECK_VERSION(2,14,0) /* GRegex */
3190 { "/ProtocolHelp", NULL, "Protocol Help", NULL, NULL, NULL },
3191 #endif /* GLIB_CHECK_VERSION(2,14,0) */
3192 { "/ProtocolPreferences", NULL, "Protocol Preferences", NULL, NULL, NULL },
3193 { "/DecodeAs", WIRESHARK_STOCK_DECODE_AS, "Decode As...", NULL, NULL, G_CALLBACK(decode_as_cb) },
3194 { "/DisableProtocol", WIRESHARK_STOCK_CHECKBOX, "Disable Protocol...", NULL, NULL, G_CALLBACK(proto_disable_cb) },
3195 { "/ResolveName", NULL, "_Resolve Name", NULL, NULL, G_CALLBACK(resolve_name_cb) },
3196 { "/GotoCorrespondingPacket", NULL, "_Go to Corresponding Packet", NULL, NULL, G_CALLBACK(goto_framenum_cb) },
3199 static const char *ui_desc_bytes_menu_popup =
3201 " <popup name='BytesMenuPopup' action='PopupAction'>\n"
3202 " <menuitem name='HexView' action='/HexView'/>\n"
3203 " <menuitem name='BitsView' action='/BitsView'/>\n"
3206 static const GtkRadioActionEntry bytes_menu_radio_action_entries [] =
3208 /* name, stock id, label, accel, tooltip, value */
3209 { "/HexView", NULL, "Hex View", NULL, NULL, BYTES_HEX },
3210 { "/BitsView", NULL, "Bits View", NULL, NULL, BYTES_BITS },
3213 static const char *ui_statusbar_profiles_menu_popup =
3215 " <popup name='ProfilesMenuPopup' action='PopupAction'>\n"
3216 " <menuitem name='Profiles' action='/Profiles'/>\n"
3218 " <menuitem name='New' action='/New'/>\n"
3219 " <menuitem name='Copy' action='/Copy'/>\n"
3220 " <menuitem name='Delete' action='/Delete'/>\n"
3221 " <menuitem name='Rename' action='/Rename'/>\n"
3223 " <menu name='Change' action='/Change'>\n"
3224 " <menuitem name='Default' action='/Change/Default'/>\n"
3228 static const GtkActionEntry statusbar_profiles_menu_action_entries [] =
3230 { "/Profiles", NULL, "Configuration Profiles...", NULL, NULL, G_CALLBACK(profile_dialog_cb) },
3231 { "/New", GTK_STOCK_NEW, "New...", NULL, NULL, G_CALLBACK(profile_new_cb) },
3232 { "/Copy", GTK_STOCK_COPY, "Copy...", NULL, NULL, G_CALLBACK(profile_copy_cb) },
3233 { "/Delete", GTK_STOCK_DELETE, "Delete", NULL, NULL, G_CALLBACK(profile_delete_cb) },
3234 #if GLIB_CHECK_VERSION(2,6,0)
3235 { "/Rename", GTK_STOCK_EDIT, "Rename...", NULL, NULL, G_CALLBACK(profile_rename_cb) },
3237 { "/Rename", NULL, "Rename...", NULL, NULL, G_CALLBACK(profile_rename_cb) },
3239 { "/Change", NULL, "Change", NULL, NULL, NULL },
3240 { "/Change/Default", NULL, "Default", NULL, NULL, NULL },
3244 main_menu_new(GtkAccelGroup ** table) {
3246 #ifdef HAVE_IGE_MAC_INTEGRATION
3247 GtkWidget *quit_item, *about_item, *preferences_item;
3248 IgeMacMenuGroup *group;
3250 #ifdef HAVE_GTKOSXAPPLICATION
3251 GtkOSXApplication *theApp;
3253 GtkOSXApplicationMenuGroup *group;
3254 GtkWidget * dock_menu;
3257 grp = gtk_accel_group_new();
3262 #ifdef MAIN_MENU_USE_UIMANAGER
3263 menubar = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar");
3265 menubar = main_menu_factory->widget;
3267 #ifdef HAVE_IGE_MAC_INTEGRATION
3268 if(prefs.gui_macosx_style) {
3269 ige_mac_menu_set_menu_bar(GTK_MENU_SHELL(menubar));
3270 ige_mac_menu_set_global_key_handler_enabled(TRUE);
3272 /* Create menu items to populate the application menu with. We have to
3273 * do this because we are still using the old GtkItemFactory API for
3275 group = ige_mac_menu_add_app_menu_group();
3276 about_item = gtk_menu_item_new_with_label("About");
3277 g_signal_connect(about_item, "activate", G_CALLBACK(about_wireshark_cb),
3279 ige_mac_menu_add_app_menu_item(group, GTK_MENU_ITEM(about_item), NULL);
3281 group = ige_mac_menu_add_app_menu_group();
3282 preferences_item = gtk_menu_item_new_with_label("Preferences");
3283 g_signal_connect(preferences_item, "activate", G_CALLBACK(prefs_cb),
3285 ige_mac_menu_add_app_menu_item(group, GTK_MENU_ITEM(preferences_item),
3289 /* The quit item in the application menu shows up whenever ige mac
3290 * integration is enabled, even if the OS X UI style in Wireshark isn't
3292 quit_item = gtk_menu_item_new_with_label("Quit");
3293 g_signal_connect(quit_item, "activate", G_CALLBACK(file_quit_cmd_cb), NULL);
3294 ige_mac_menu_set_quit_menu_item(GTK_MENU_ITEM(quit_item));
3297 #ifdef HAVE_GTKOSXAPPLICATION
3298 theApp = g_object_new(GTK_TYPE_OSX_APPLICATION, NULL);
3300 if(prefs.gui_macosx_style) {
3301 gtk_osxapplication_set_menu_bar(theApp, GTK_MENU_SHELL(menubar));
3302 gtk_osxapplication_set_use_quartz_accelerators(theApp, TRUE);
3304 group = gtk_osxapplication_add_app_menu_group (theApp);
3305 item = gtk_item_factory_get_item(main_menu_factory,"/Help/About Wireshark");
3306 gtk_osxapplication_add_app_menu_item(theApp, group,GTK_MENU_ITEM (item));
3308 group = gtk_osxapplication_add_app_menu_group (theApp);
3309 item = gtk_item_factory_get_item(main_menu_factory,"/Edit/Preferences...");
3310 gtk_osxapplication_add_app_menu_item(theApp, group,GTK_MENU_ITEM (item));
3312 group = gtk_osxapplication_add_app_menu_group (theApp);
3313 item = gtk_item_factory_get_item(main_menu_factory,"/Help");
3314 gtk_osxapplication_set_help_menu(theApp,GTK_MENU_ITEM(item));
3316 /* Quit item is not needed */
3317 gtk_item_factory_delete_item(main_menu_factory,"/File/Quit");
3320 /* generate dock menu */
3321 dock_menu = gtk_menu_new();
3323 item = gtk_menu_item_new_with_label("Start");
3324 g_signal_connect(item, "activate", G_CALLBACK (capture_start_cb), NULL);
3325 gtk_menu_shell_append(GTK_MENU_SHELL(dock_menu), item);
3327 item = gtk_menu_item_new_with_label("Stop");
3328 g_signal_connect(item, "activate", G_CALLBACK (capture_stop_cb), NULL);
3329 gtk_menu_shell_append(GTK_MENU_SHELL(dock_menu), item);
3331 item = gtk_menu_item_new_with_label("Restart");
3332 g_signal_connect(item, "activate", G_CALLBACK (capture_restart_cb), NULL);
3333 gtk_menu_shell_append(GTK_MENU_SHELL(dock_menu), item);
3335 gtk_osxapplication_set_dock_menu(theApp, GTK_MENU_SHELL(dock_menu));
3345 void menu_dissector_filter_cb( GtkWidget *widget _U_,
3346 gpointer callback_data,
3347 guint callback_action _U_)
3349 dissector_filter_t *filter_entry = callback_data;
3350 GtkWidget *filter_te;
3353 filter_te = g_object_get_data(G_OBJECT(popup_menu_object), E_DFILTER_TE_KEY);
3355 /* XXX - this gets the packet_info of the last dissected packet, */
3356 /* which is not necessarily the last selected packet */
3357 /* e.g. "Update list of packets in real time" won't work correct */
3358 buf = filter_entry->build_filter_string(&cfile.edt->pi);
3360 gtk_entry_set_text(GTK_ENTRY(filter_te), buf);
3362 /* Run the display filter so it goes in effect - even if it's the
3363 same as the previous display filter. */
3364 main_filter_packets(&cfile, buf, TRUE);
3366 g_free( (void *) buf);
3369 gboolean menu_dissector_filter_spe_cb(frame_data *fd _U_, epan_dissect_t *edt, gpointer callback_data) {
3370 dissector_filter_t *filter_entry = callback_data;
3372 /* XXX - this gets the packet_info of the last dissected packet, */
3373 /* which is not necessarily the last selected packet */
3374 /* e.g. "Update list of packets in real time" won't work correct */
3375 return (edt != NULL) ? filter_entry->is_filter_valid(&edt->pi) : FALSE;
3378 void menu_dissector_filter(void) {
3379 GList *list_entry = dissector_filter_list;
3380 dissector_filter_t *filter_entry;
3382 while(list_entry != NULL) {
3383 filter_entry = list_entry->data;
3385 register_stat_menu_item(filter_entry->name, REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER,
3386 menu_dissector_filter_cb,
3387 menu_dissector_filter_spe_cb,
3388 NULL /* selected_tree_row_enabled */,
3391 list_entry = g_list_next(list_entry);
3398 GtkActionGroup *packet_list_heading_action_group, *packet_list_action_group,
3399 *packet_list_details_action_group, *packet_list_byte_menu_action_group,
3400 *statusbar_profiles_action_group;
3401 GError *error = NULL;
3406 popup_menu_object = gtk_menu_new();
3408 /* packet list heading pop-up menu */
3409 packet_list_heading_action_group = gtk_action_group_new ("PacketListHeadingPopUpMenuActionGroup");
3411 gtk_action_group_add_actions (packet_list_heading_action_group, /* the action group */
3412 packet_list_heading_menu_popup_action_entries, /* an array of action descriptions */
3413 G_N_ELEMENTS(packet_list_heading_menu_popup_action_entries), /* the number of entries */
3414 popup_menu_object); /* data to pass to the action callbacks */
3416 gtk_action_group_add_toggle_actions(packet_list_heading_action_group, /* the action group */
3417 packet_list_heading_menu_toggle_action_entries, /* an array of action descriptions */
3418 G_N_ELEMENTS(packet_list_heading_menu_toggle_action_entries), /* the number of entries */
3419 NULL); /* data to pass to the action callbacks */
3421 ui_manager_packet_list_heading = gtk_ui_manager_new ();
3422 gtk_ui_manager_insert_action_group (ui_manager_packet_list_heading,
3423 packet_list_heading_action_group,
3424 0); /* the position at which the group will be inserted. */
3426 gtk_ui_manager_add_ui_from_string (ui_manager_packet_list_heading,ui_desc_packet_list_heading_menu_popup, -1, &error);
3429 fprintf (stderr, "Warning: building Packet List Heading Pop-Up failed: %s\n",
3431 g_error_free (error);
3435 g_object_set_data(G_OBJECT(popup_menu_object), PM_PACKET_LIST_COL_KEY,
3436 gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup"));
3438 popup_menu_list = g_slist_append((GSList *)popup_menu_list, ui_manager_packet_list_heading);
3440 /* packet list pop-up menu */
3441 packet_list_action_group = gtk_action_group_new ("PacketListPopUpMenuActionGroup");
3443 gtk_action_group_add_actions (packet_list_action_group, /* the action group */
3444 packet_list_menu_popup_action_entries, /* an array of action descriptions */
3445 G_N_ELEMENTS(packet_list_menu_popup_action_entries), /* the number of entries */
3446 popup_menu_object); /* data to pass to the action callbacks */
3448 ui_manager_packet_list_menu = gtk_ui_manager_new ();
3450 gtk_ui_manager_insert_action_group (ui_manager_packet_list_menu,
3451 packet_list_action_group,
3452 0); /* the position at which the group will be inserted. */
3454 gtk_ui_manager_add_ui_from_string (ui_manager_packet_list_menu, ui_desc_packet_list_menu_popup, -1, &error);
3457 fprintf (stderr, "Warning: building Packet List Pop-Up menu failed: %s\n",
3459 g_error_free (error);
3463 g_object_set_data(G_OBJECT(popup_menu_object), PM_PACKET_LIST_KEY,
3464 gtk_ui_manager_get_widget(ui_manager_packet_list_menu, "/PacketListMenuPopup"));
3466 popup_menu_list = g_slist_append((GSList *)popup_menu_list, ui_manager_packet_list_menu);
3469 /* packet detail pop-up menu */
3470 packet_list_details_action_group = gtk_action_group_new ("PacketListDetailsMenuPopUpActionGroup");
3472 gtk_action_group_add_actions (packet_list_details_action_group, /* the action group */
3473 tree_view_menu_popup_action_entries, /* an array of action descriptions */
3474 G_N_ELEMENTS(tree_view_menu_popup_action_entries), /* the number of entries */
3475 popup_menu_object); /* data to pass to the action callbacks */
3477 ui_manager_tree_view_menu = gtk_ui_manager_new ();
3479 gtk_ui_manager_insert_action_group (ui_manager_tree_view_menu,
3480 packet_list_details_action_group,
3481 0); /* the position at which the group will be inserted. */
3483 gtk_ui_manager_add_ui_from_string (ui_manager_tree_view_menu, ui_desc_tree_view_menu_popup, -1, &error);
3486 fprintf (stderr, "Warning: building TreeWiew Pop-Up menu failed: %s\n",
3488 g_error_free (error);
3492 g_object_set_data(G_OBJECT(popup_menu_object), PM_TREE_VIEW_KEY,
3493 gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup"));
3495 popup_menu_list = g_slist_append((GSList *)popup_menu_list, ui_manager_tree_view_menu);
3498 * Hex dump pop-up menu.
3499 * We provide our own empty menu to suppress the default pop-up menu
3502 packet_list_byte_menu_action_group = gtk_action_group_new ("PacketListByteMenuPopUpActionGroup");
3505 gtk_action_group_add_radio_actions (packet_list_byte_menu_action_group, /* the action group */
3506 bytes_menu_radio_action_entries, /* an array of radio action descriptions */
3507 G_N_ELEMENTS(bytes_menu_radio_action_entries), /* the number of entries */
3508 recent.gui_bytes_view, /* the value of the action to activate initially, or -1 if no action should be activated */
3509 G_CALLBACK(select_bytes_view_cb), /* the callback to connect to the changed signal */
3510 popup_menu_object); /* data to pass to the action callbacks */
3512 ui_manager_bytes_menu = gtk_ui_manager_new ();
3514 gtk_ui_manager_insert_action_group (ui_manager_bytes_menu,
3515 packet_list_byte_menu_action_group,
3516 0); /* the position at which the group will be inserted. */
3518 gtk_ui_manager_add_ui_from_string (ui_manager_bytes_menu, ui_desc_bytes_menu_popup, -1, &error);
3521 fprintf (stderr, "Warning: building Bytes Pop-Up menu failed: %s\n",
3523 g_error_free (error);
3527 g_object_set_data(G_OBJECT(popup_menu_object), PM_BYTES_VIEW_KEY,
3528 gtk_ui_manager_get_widget(ui_manager_bytes_menu, "/BytesMenuPopup"));
3530 popup_menu_list = g_slist_append((GSList *)popup_menu_list, ui_manager_bytes_menu);
3533 #ifdef MAIN_MENU_USE_UIMANAGER
3534 main_menu_bar_action_group = gtk_action_group_new ("MenuActionGroup");
3535 gtk_action_group_add_actions (main_menu_bar_action_group, /* the action group */
3536 main_menu_bar_entries, /* an array of action descriptions */
3537 G_N_ELEMENTS(main_menu_bar_entries), /* the number of entries */
3538 NULL); /* data to pass to the action callbacks */
3540 gtk_action_group_add_toggle_actions(main_menu_bar_action_group, /* the action group */
3541 main_menu_bar_toggle_action_entries, /* an array of action descriptions */
3542 G_N_ELEMENTS(main_menu_bar_toggle_action_entries), /* the number of entries */
3543 NULL); /* data to pass to the action callbacks */
3545 gtk_action_group_add_radio_actions (main_menu_bar_action_group, /* the action group */
3546 main_menu_bar_radio_view_time_entries, /* an array of radio action descriptions */
3547 G_N_ELEMENTS(main_menu_bar_radio_view_time_entries), /* the number of entries */
3548 recent.gui_time_format, /* the value of the action to activate initially, or -1 if no action should be activated */
3549 G_CALLBACK(timestamp_format_new_cb), /* the callback to connect to the changed signal */
3550 NULL); /* data to pass to the action callbacks */
3552 gtk_action_group_add_radio_actions (main_menu_bar_action_group, /* the action group */
3553 main_menu_bar_radio_view_time_fileformat_prec_entries, /* an array of radio action descriptions */
3554 G_N_ELEMENTS(main_menu_bar_radio_view_time_fileformat_prec_entries), /* the number of entries */
3555 recent.gui_time_precision, /* the value of the action to activate initially, or -1 if no action should be activated */
3556 G_CALLBACK(timestamp_precision_new_cb), /* the callback to connect to the changed signal */
3557 NULL); /* data to pass to the action callbacks */
3561 ui_manager_main_menubar = gtk_ui_manager_new ();
3562 gtk_ui_manager_insert_action_group (ui_manager_main_menubar, main_menu_bar_action_group, 0);
3563 gtk_ui_manager_add_ui_from_string (ui_manager_main_menubar,ui_desc_menubar, -1, &error);
3566 fprintf (stderr, "Warning: building main menubar failed: %s\n",
3568 g_error_free (error);
3571 #else /* MAIN_MENU_USE_UIMANAGER */
3572 main_menu_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", grp);
3573 gtk_item_factory_create_items_ac(main_menu_factory, nmenu_items, menu_items, NULL, 2);
3574 #endif /* MAIN_MENU_USE_UIMANAGER */
3576 statusbar_profiles_action_group = gtk_action_group_new ("StatusBarProfilesPopUpMenuActionGroup");
3578 gtk_action_group_add_actions (statusbar_profiles_action_group, /* the action group */
3579 statusbar_profiles_menu_action_entries, /* an array of action descriptions */
3580 G_N_ELEMENTS(statusbar_profiles_menu_action_entries), /* the number of entries */
3581 popup_menu_object); /* data to pass to the action callbacks */
3583 ui_manager_statusbar_profiles_menu = gtk_ui_manager_new ();
3584 gtk_ui_manager_insert_action_group (ui_manager_statusbar_profiles_menu,
3585 statusbar_profiles_action_group,
3586 0); /* the position at which the group will be inserted. */
3588 gtk_ui_manager_add_ui_from_string (ui_manager_statusbar_profiles_menu,ui_statusbar_profiles_menu_popup, -1, &error);
3591 fprintf (stderr, "Warning: building Statusbar Profiles Pop-Up failed: %s\n",
3593 g_error_free (error);
3597 g_object_set_data(G_OBJECT(popup_menu_object), PM_STATUSBAR_PROFILES_KEY,
3598 gtk_ui_manager_get_widget(ui_manager_statusbar_profiles_menu, "/ProfilesMenuPopup"));
3600 popup_menu_list = g_slist_append((GSList *)popup_menu_list, ui_manager_statusbar_profiles_menu);
3602 menu_dissector_filter();
3603 merge_all_tap_menus(tap_menu_tree_root);
3605 /* Initialize enabled/disabled state of menu items */
3606 set_menus_for_capture_file(NULL);
3608 /* Un-#if this when we actually implement Cut/Copy/Paste.
3609 Then make sure you enable them when they can be done. */
3610 set_menu_sensitivity_old("/Edit/Cut", FALSE);
3611 set_menu_sensitivity_old("/Edit/Copy", FALSE);
3612 set_menu_sensitivity_old("/Edit/Paste", FALSE);
3615 set_menus_for_captured_packets(FALSE);
3616 set_menus_for_selected_packet(&cfile);
3617 set_menus_for_selected_tree_row(&cfile);
3618 set_menus_for_capture_in_progress(FALSE);
3619 set_menus_for_file_set(/* dialog */TRUE, /* previous file */ FALSE, /* next_file */ FALSE);
3621 /* Init with an empty recent files list */
3622 clear_menu_recent_capture_file_cmd_cb(NULL, NULL);
3624 /* Protocol help links */
3625 proto_help_menu_init(gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup"));
3630 static gint tap_menu_item_add_compare(gconstpointer a, gconstpointer b)
3633 ((const menu_item_t *) a)->name,
3634 ((const menu_item_t *) b)->name);
3638 /* add a menuitem below the current node */
3639 static GList * tap_menu_item_add(
3642 const char *stock_id,
3643 GtkItemFactoryCallback callback,
3644 gboolean (*selected_packet_enabled)(frame_data *, epan_dissect_t *, gpointer callback_data),
3645 gboolean (*selected_tree_row_enabled)(field_info *, gpointer callback_data),
3646 gpointer callback_data,
3653 child = g_malloc(sizeof (menu_item_t));
3655 child->group = group;
3656 child->stock_id = stock_id;
3657 child->callback = callback;
3658 child->selected_packet_enabled = selected_packet_enabled;
3659 child->selected_tree_row_enabled = selected_tree_row_enabled;
3660 child->callback_data = callback_data;
3661 child->enabled = FALSE;
3662 child->children = NULL;
3664 /* insert the new child node into the parent */
3665 curr = curnode->data;
3666 curr->children = g_list_insert_sorted(curr->children, child, tap_menu_item_add_compare);
3668 /* return the new node */
3669 /* XXX: improve this */
3670 return g_list_find(curr->children, child);
3674 * Add a new menu item for a tap.
3675 * This must be called after we've created the main menu, so it can't
3676 * be called from the routine that registers taps - we have to introduce
3677 * another per-tap registration routine.
3679 * "callback" gets called when the menu item is selected; it should do
3680 * the work of creating the tap window.
3682 * "selected_packet_enabled" gets called by "set_menus_for_selected_packet()";
3683 * it's passed a Boolean that's TRUE if a packet is selected and FALSE
3684 * otherwise, and should return TRUE if the tap will work now (which
3685 * might depend on whether a packet is selected and, if one is, on the
3686 * packet) and FALSE if not.
3688 * "selected_tree_row_enabled" gets called by
3689 * "set_menus_for_selected_tree_row()"; it's passed a Boolean that's TRUE if
3690 * a protocol tree row is selected and FALSE otherwise, and should return
3691 * TRUE if the tap will work now (which might depend on whether a tree row
3692 * is selected and, if one is, on the tree row) and FALSE if not.
3695 register_stat_menu_item_stock(
3697 register_stat_group_t group,
3698 const char *stock_id,
3699 GtkItemFactoryCallback callback,
3700 gboolean (*selected_packet_enabled)(frame_data *, epan_dissect_t *, gpointer callback_data),
3701 gboolean (*selected_tree_row_enabled)(field_info *, gpointer callback_data),
3702 gpointer callback_data)
3704 /*static const char toolspath[] = "/Statistics/";*/
3705 const char *toolspath;
3714 * The menu path must be relative.
3716 g_assert(*name != '/');
3719 case(REGISTER_STAT_GROUP_GENERIC): toolspath = "/Statistics/"; break;
3720 case(REGISTER_STAT_GROUP_CONVERSATION_LIST): toolspath = "/Statistics/_Conversation List/"; break;
3721 case(REGISTER_STAT_GROUP_ENDPOINT_LIST): toolspath = "/Statistics/_Endpoint List/"; break;
3722 case(REGISTER_STAT_GROUP_RESPONSE_TIME): toolspath = "/Statistics/Service _Response Time/"; break;
3723 case(REGISTER_STAT_GROUP_UNSORTED): toolspath = "/Statistics/"; break;
3724 case(REGISTER_ANALYZE_GROUP_UNSORTED): toolspath = "/Analyze/"; break;
3725 case(REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER): toolspath = "/Analyze/Conversation Filter/"; break;
3726 case(REGISTER_STAT_GROUP_TELEPHONY): toolspath = "/Telephony/"; break;
3727 case(REGISTER_TOOLS_GROUP_UNSORTED): toolspath = "/Tools/"; break;
3729 g_assert(!"no such menu group");
3733 /* add the (empty) root node, if not already done */
3734 if(tap_menu_tree_root == NULL) {
3735 child = g_malloc0(sizeof (menu_item_t));
3736 tap_menu_tree_root = g_list_append(NULL, child);
3740 * Create any submenus required.
3742 curnode = tap_menu_tree_root;
3744 while ((p = strchr(p, '/')) != NULL) {
3746 * OK, everything between "name" and "p" is
3747 * a menu relative subtree into which the menu item
3750 * Construct the absolute path name of that subtree.
3752 menupathlen = strlen(toolspath) + 1 + (p - name);
3753 menupath = g_malloc(menupathlen);
3754 g_strlcpy(menupath, toolspath, menupathlen);
3755 g_strlcat(menupath, name, menupathlen);
3758 * Does there exist an entry with that path at this
3759 * level of the Analyze menu tree?
3761 child = curnode->data;
3762 for (childnode = child->children; childnode != NULL; childnode = childnode->next) {
3763 child = childnode->data;
3764 if (strcmp(child->name, menupath) == 0)
3767 if (childnode == NULL) {
3769 * No. Create such an item as a subtree, and
3770 * add it to the Tools menu tree.
3772 childnode = tap_menu_item_add(
3773 menupath, group, "", NULL, NULL ,NULL, NULL, curnode);
3776 * Yes. We don't need this "menupath" any longer.
3780 curnode = childnode;
3783 * Skip over the '/' we found.
3789 * Construct the main menu path for the menu item.
3791 menupathlen = strlen(toolspath) + 1 + strlen(name);
3792 menupath = g_malloc(menupathlen);
3793 g_strlcpy(menupath, toolspath, menupathlen);
3794 g_strlcat(menupath, name, menupathlen);
3797 * Construct an item factory entry for the item, and add it to
3801 menupath, group, stock_id, callback,
3802 selected_packet_enabled, selected_tree_row_enabled,
3803 callback_data, curnode);
3807 * Add a new menu item for a stat.
3808 * This must be called after we've created the main menu, so it can't
3809 * be called from the routine that registers stats - we have to introduce
3810 * another per-stat registration routine.
3812 * @param name the menu label
3814 * @param group the menu group this stat should be registered to
3816 * @param callback gets called when the menu item is selected; it should do
3817 * the work of creating the stat window.
3819 * @param selected_packet_enabled gets called by set_menus_for_selected_packet();
3820 * it's passed a pointer to the "frame_data" structure for the current frame,
3821 * if any, and to the "epan_dissect_t" structure for that frame, if any, and
3822 * should return TRUE if the stat will work now (which might depend on whether
3823 * a frame is selected and, if one is, on the frame) and FALSE if not.
3825 * @param selected_tree_row_enabled gets called by
3826 * set_menus_for_selected_tree_row(); it's passed a pointer to the
3827 * "field_info" structure for the currently selected field, if any,
3828 * and should return TRUE if the stat will work now (which might depend on
3829 * whether a tree row is selected and, if one is, on the tree row) and
3832 * @param callback_data data for callback function
3835 register_stat_menu_item(
3837 register_stat_group_t group,
3838 GtkItemFactoryCallback callback,
3839 gboolean (*selected_packet_enabled)(frame_data *, epan_dissect_t *, gpointer callback_data),
3840 gboolean (*selected_tree_row_enabled)(field_info *, gpointer callback_data),
3841 gpointer callback_data)
3843 register_stat_menu_item_stock(
3848 selected_packet_enabled,
3849 selected_tree_row_enabled,
3853 static guint merge_tap_menus_layered(GList *node, gint group) {
3854 #ifdef MAIN_MENU_USE_UIMANAGER
3858 #endif /* MAIN_MENU_USE_UIMANAGER */
3859 GtkItemFactoryEntry *entry;
3863 menu_item_t *node_data = node->data;
3866 * Is this a leaf node or an interior node?
3868 if (node_data->children == NULL) {
3874 * The root node doesn't correspond to a menu tree item; it
3875 * has a null name pointer.
3877 if (node_data->name != NULL && group == node_data->group) {
3878 entry = g_malloc0(sizeof (GtkItemFactoryEntry));
3879 entry->path = node_data->name;
3880 entry->callback = node_data->callback;
3882 case(REGISTER_STAT_GROUP_UNSORTED):
3884 case(REGISTER_STAT_GROUP_GENERIC):
3886 case(REGISTER_STAT_GROUP_CONVERSATION_LIST):
3887 entry->item_type = "<StockItem>";
3888 entry->extra_data = WIRESHARK_STOCK_CONVERSATIONS;
3890 case(REGISTER_STAT_GROUP_ENDPOINT_LIST):
3891 entry->item_type = "<StockItem>";
3892 entry->extra_data = WIRESHARK_STOCK_ENDPOINTS;
3894 case(REGISTER_STAT_GROUP_RESPONSE_TIME):
3895 entry->item_type = "<StockItem>";
3896 entry->extra_data = WIRESHARK_STOCK_TIME;
3898 case(REGISTER_STAT_GROUP_TELEPHONY):
3900 case(REGISTER_ANALYZE_GROUP_UNSORTED):
3902 case(REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER):
3904 case(REGISTER_TOOLS_GROUP_UNSORTED):
3907 g_assert_not_reached();
3909 if(node_data->stock_id!= NULL) {
3910 entry->item_type = "<StockItem>";
3911 entry->extra_data = node_data->stock_id;
3913 #ifdef MAIN_MENU_USE_UIMANAGER
3915 g_warning("entry->path = %s",entry->path);
3916 action = gtk_action_new(entry->path, /* name */
3917 const gchar *label, /* label */
3919 node_data->stock_id); /* stock_id */
3920 gtk_action_group_add_action_with_accel(main_menu_bar_action_group,
3922 NULL); /*the accelerator for the action,
3923 * in the format understood by gtk_accelerator_parse(),
3924 * or "" for no accelerator, or NULL to use the stock accelerator.
3927 g_signal_connect (action, "activate",
3928 G_CALLBACK (node_data->callback),
3929 node_data->callback_data);
3932 gtk_item_factory_create_item(main_menu_factory, entry, node_data->callback_data, /* callback_type */ 2);
3933 set_menu_sensitivity_old(node_data->name, FALSE); /* no capture file yet */
3934 #endif /* MAIN_MENU_USE_UIMANAGER */
3940 * It's an interior node; call
3941 * "merge_tap_menus_layered()" on all its children
3945 * The root node doesn't correspond to a menu tree item; it
3946 * has a null name pointer.
3948 if (node_data->name != NULL && group == node_data->group) {
3949 entry = g_malloc0(sizeof (GtkItemFactoryEntry));
3950 entry->path = node_data->name;
3951 entry->item_type = "<Branch>";
3952 #ifdef MAIN_MENU_USE_UIMANAGER
3953 p = strrchr(node_data->name,'/');
3956 action = gtk_action_new(entry->path, /* name */
3959 node_data->stock_id); /* stock_id */
3960 gtk_action_group_add_action_with_accel(main_menu_bar_action_group,
3962 NULL); /*the accelerator for the action,
3963 * in the format understood by gtk_accelerator_parse(),
3964 * or "" for no accelerator, or NULL to use the stock accelerator.
3967 if(group==REGISTER_STAT_GROUP_RESPONSE_TIME){
3968 gtk_ui_manager_add_ui (ui_manager_main_menubar, merge_id,
3969 "/Menubar/StatisticsMenu", /* path */
3971 entry->path, /* action */
3972 GTK_UI_MANAGER_MENU, /* type */
3973 FALSE); /* "top" if TRUE, the UI element is added before its siblings */
3977 gtk_item_factory_create_item(main_menu_factory, entry,
3979 set_menu_sensitivity_old(node_data->name,
3980 FALSE); /* no children yet */
3981 #endif /* MAIN_MENU_USE_UIMANAGER */
3986 for (child = node_data->children; child != NULL; child =
3988 added += merge_tap_menus_layered(child, group);
3996 void merge_all_tap_menus(GList *node) {
3997 GtkItemFactoryEntry *sep_entry;
3999 sep_entry = g_malloc0(sizeof (GtkItemFactoryEntry));
4000 sep_entry->item_type = "<Separator>";
4001 sep_entry->path = "/Statistics/";
4002 #ifdef MAIN_MENU_USE_UIMANAGER
4003 /* build the new menus */
4004 merge_id = gtk_ui_manager_new_merge_id (ui_manager_main_menubar);
4008 * merge only the menu items of the specific group,
4009 * and then append a seperator
4011 if (merge_tap_menus_layered(node, REGISTER_STAT_GROUP_GENERIC)) {
4012 #ifdef MAIN_MENU_USE_UIMANAGER
4015 gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);
4016 #endif /* MAIN_MENU_USE_UIMANAGER */
4018 if (merge_tap_menus_layered(node, REGISTER_STAT_GROUP_CONVERSATION_LIST)) {
4019 /*gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);*/
4021 if (merge_tap_menus_layered(node, REGISTER_STAT_GROUP_ENDPOINT_LIST)) {
4022 /*gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);*/
4024 if (merge_tap_menus_layered(node, REGISTER_STAT_GROUP_RESPONSE_TIME)) {
4025 #ifdef MAIN_MENU_USE_UIMANAGER
4028 gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);
4029 #endif /* MAIN_MENU_USE_UIMANAGER */
4031 if (merge_tap_menus_layered(node, REGISTER_STAT_GROUP_TELEPHONY)) {
4032 /*gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);*/
4034 if (merge_tap_menus_layered(node, REGISTER_STAT_GROUP_UNSORTED)) {
4035 /*gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);*/
4037 if (merge_tap_menus_layered(node, REGISTER_ANALYZE_GROUP_UNSORTED)) {
4038 sep_entry->path = "/Analyze/";
4039 /*gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);*/
4041 if (merge_tap_menus_layered(node, REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER)) {
4042 sep_entry->path = "/Analyze/Conversation Filter/";
4043 /*gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);*/
4045 if (merge_tap_menus_layered(node, REGISTER_TOOLS_GROUP_UNSORTED)) {
4046 /*gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);*/
4053 * Enable/disable menu sensitivity.
4056 set_menu_sensitivity(GtkUIManager *ui_manager, const gchar *path, gint val)
4060 action = gtk_ui_manager_get_action(ui_manager, path);
4062 fprintf (stderr, "Warning: couldn't find action path= %s\n",
4066 #if GLIB_CHECK_VERSION(2,6,0)
4067 gtk_action_set_sensitive (action,
4068 val); /* TRUE to make the action sensitive */
4070 g_object_set (G_OBJECT (action), "sensitive", val, NULL);
4074 #ifndef MAIN_MENU_USE_UIMANAGER
4076 * Enable/disable menu sensitivity for the old menubar code.
4079 set_menu_sensitivity_old(const gchar *path, gint val)
4081 GtkWidget *menu_item;
4084 /* the underscore character regularly confuses things, as it will prevent finding
4085 * the menu_item, so it has to be removed first */
4086 dup = g_strdup(path);
4097 if ((menu_item = gtk_item_factory_get_widget(main_menu_factory, dup)) != NULL) {
4098 if (GTK_IS_MENU(menu_item)) {
4100 * "dup" refers to a submenu; "gtk_item_factory_get_widget()"
4101 * gets the menu, not the item that, when selected, pops up
4104 * We have to change the latter item's sensitivity, so that
4105 * it shows up normally if sensitive and grayed-out if
4108 menu_item = gtk_menu_get_attach_widget(GTK_MENU(menu_item));
4110 gtk_widget_set_sensitive(menu_item, val);
4112 #ifndef NEW_PACKET_LIST
4113 /* be sure this menu item *is* existing */
4114 g_assert_not_reached();
4121 #endif /* MAIN_MENU_USE_UIMANAGER */
4124 set_menu_object_data_meat(GtkUIManager *ui_manager, const gchar *path, const gchar *key, gpointer data)
4126 GtkWidget *menu = NULL;
4128 if ((menu = gtk_ui_manager_get_widget(ui_manager, path)) != NULL)
4129 g_object_set_data(G_OBJECT(menu), key, data);
4132 #ifndef MAIN_MENU_USE_UIMANAGER
4134 set_menu_object_data_meat_old(GtkItemFactory *ifactory, const gchar *path, const gchar *key, gpointer data)
4136 GtkWidget *menu = NULL;
4138 if ((menu = gtk_item_factory_get_widget(ifactory, path)) != NULL)
4139 g_object_set_data(G_OBJECT(menu), key, data);
4144 set_menu_object_data (const gchar *path, const gchar *key, gpointer data) {
4145 GSList *menu_list = popup_menu_list;
4146 gchar *shortpath = strrchr(path, '/');
4148 #ifdef MAIN_MENU_USE_UIMANAGER
4149 set_menu_object_data_meat(ui_manager_main_menubar, path, key, data);
4151 set_menu_object_data_meat_old(main_menu_factory, path, key, data);
4152 #endif /* MAIN_MENU_USE_UIMANAGER */
4153 while (menu_list != NULL) {
4154 set_menu_object_data_meat(menu_list->data, shortpath, key, data);
4155 set_menu_object_data_meat(menu_list->data, path, key, data);
4156 menu_list = g_slist_next(menu_list);
4161 /* Recently used capture files submenu:
4162 * Submenu containing the recently used capture files.
4163 * The capture filenames are always kept with the absolute path, to be independant
4164 * of the current path.
4165 * They are only stored inside the labels of the submenu (no separate list). */
4167 #define MENU_RECENT_FILES_PATH_OLD "/File/Open Recent"
4168 #define MENU_RECENT_FILES_PATH "/Menubar/FileMenu/OpenRecent"
4169 #define MENU_RECENT_FILES_KEY "Recent File Name"
4174 update_menu_recent_capture_file1(GtkWidget *widget, gpointer cnt) {
4175 gchar *widget_cf_name;
4177 widget_cf_name = g_object_get_data(G_OBJECT(widget), MENU_RECENT_FILES_KEY);
4179 /* if this menu item is a file, count it */
4180 if (widget_cf_name) {
4182 main_welcome_add_recent_capture_files(widget_cf_name);
4188 /* update the menu */
4190 update_menu_recent_capture_file(GtkWidget *submenu_recent_files) {
4194 main_welcome_reset_recent_capture_files();
4196 gtk_container_foreach(GTK_CONTAINER(submenu_recent_files),
4197 update_menu_recent_capture_file1, &cnt);
4199 /* make parent menu item sensitive only, if we have any valid files in the list */
4200 #ifdef MAIN_MENU_USE_UIMANAGER
4201 set_menu_sensitivity(ui_manager_main_menubar, MENU_RECENT_FILES_PATH, cnt);
4203 set_menu_sensitivity_old(MENU_RECENT_FILES_PATH_OLD, cnt);
4209 /* remove the capture filename from the "Recent Files" menu */
4211 remove_menu_recent_capture_filename(gchar *cf_name) {
4212 GtkWidget *submenu_recent_files;
4214 GList* child_list_item;
4215 GtkWidget *menu_item_child;
4216 const gchar *menu_item_cf_name;
4218 /* get the submenu container item */
4219 #ifdef MAIN_MENU_USE_UIMANAGER
4220 submenu_recent_files = gtk_ui_manager_get_widget(ui_manager_main_menubar, MENU_RECENT_FILES_PATH);
4221 if(!submenu_recent_files){
4222 g_warning("remove_menu_recent_capture_filename: No submenu_recent_files found, path= MENU_RECENT_FILES_PATH");
4225 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH_OLD);
4227 /* find the corresponding menu item to be removed */
4228 child_list = gtk_container_get_children(GTK_CONTAINER(submenu_recent_files));
4229 child_list_item = child_list;
4230 while(child_list_item) {
4231 menu_item_child = (GTK_BIN(child_list_item->data))->child;
4232 if (menu_item_child != NULL) { /* Note: there are two "extra" items on the end of the child_list: */
4233 /* - a separator (with no menu_item_child and thus no text label) */
4234 /* - a 2nd item with a menu_child with text label "Clear" */
4235 /* [See add_menu_recent_capture_file_absolute() ] */
4236 /* 'if (menu_item_child != NULL)' skips the separator item; */
4237 /* An absolute filename in cf_name will never match "Clear". */
4238 menu_item_cf_name = gtk_label_get_text(GTK_LABEL(menu_item_child));
4239 if(strcmp(menu_item_cf_name, cf_name) == 0) {
4240 /* XXX: is this all we need to do, to free the menu item and its label?
4241 The reference count of widget will go to 0, so it'll be freed;
4242 will that free the label? */
4243 gtk_container_remove(GTK_CONTAINER(submenu_recent_files), child_list_item->data);
4246 child_list_item = g_list_next(child_list_item);
4248 g_list_free(child_list);
4250 update_menu_recent_capture_file(submenu_recent_files);
4254 /* remove the capture filename from the "Recent Files" menu */
4256 remove_menu_recent_capture_file(GtkWidget *widget, gpointer unused _U_) {
4257 GtkWidget *submenu_recent_files;
4258 gchar *widget_cf_name;
4261 widget_cf_name = g_object_get_data(G_OBJECT(widget), MENU_RECENT_FILES_KEY);
4262 g_free(widget_cf_name);
4264 /* get the submenu container item */
4265 #ifdef MAIN_MENU_USE_UIMANAGER
4266 submenu_recent_files = gtk_ui_manager_get_widget(ui_manager_main_menubar, MENU_RECENT_FILES_PATH);
4267 if(!submenu_recent_files){
4268 g_warning("remove_menu_recent_capture_file: No submenu_recent_files found, path= MENU_RECENT_FILES_PATH");
4271 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH_OLD);
4273 /* XXX: is this all we need to do, to free the menu item and its label?
4274 The reference count of widget will go to 0, so it'll be freed;
4275 will that free the label? */
4276 gtk_container_remove(GTK_CONTAINER(submenu_recent_files), widget);
4280 /* callback, if the user pushed the <Clear> menu item */
4282 clear_menu_recent_capture_file_cmd_cb(GtkWidget *w _U_, gpointer unused _U_) {
4283 GtkWidget *submenu_recent_files;
4285 #ifdef MAIN_MENU_USE_UIMANAGER
4286 submenu_recent_files = gtk_ui_manager_get_widget(ui_manager_main_menubar, MENU_RECENT_FILES_PATH);
4287 if(!submenu_recent_files){
4288 g_warning("clear_menu_recent_capture_file_cmd_cb: No submenu_recent_files found, path= MENU_RECENT_FILES_PATH");
4291 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH_OLD);
4294 gtk_container_foreach(GTK_CONTAINER(submenu_recent_files),
4295 remove_menu_recent_capture_file, NULL);
4297 update_menu_recent_capture_file(submenu_recent_files);
4301 /* Open a file by it's name
4302 (Beware: will not ask to close existing capture file!) */
4304 menu_open_filename(gchar *cf_name)
4306 GtkWidget *submenu_recent_files;
4309 #ifdef MAIN_MENU_USE_UIMANAGER
4310 submenu_recent_files = gtk_ui_manager_get_widget(ui_manager_main_menubar, MENU_RECENT_FILES_PATH);
4311 if(!submenu_recent_files){
4312 g_warning("menu_open_filename: No submenu_recent_files found, path= MENU_RECENT_FILES_PATH");
4315 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH_OLD);
4317 /* open and read the capture file (this will close an existing file) */
4318 if (cf_open(&cfile, cf_name, FALSE, &err) == CF_OK) {
4319 cf_read(&cfile, FALSE);
4321 /* the capture file apparently no longer exists; remove menu item */
4322 /* XXX: ask user to remove item, it's maybe only a temporary problem */
4323 remove_menu_recent_capture_filename(cf_name);
4326 update_menu_recent_capture_file(submenu_recent_files);
4330 /* callback, if the user pushed a recent file submenu item */
4332 menu_open_recent_file_cmd(GtkWidget *w)
4334 GtkWidget *submenu_recent_files;
4335 GtkWidget *menu_item_child;
4336 const gchar *cf_name;
4339 #ifdef MAIN_MENU_USE_UIMANAGER
4340 submenu_recent_files = gtk_ui_manager_get_widget(ui_manager_main_menubar, MENU_RECENT_FILES_PATH);
4341 if(!submenu_recent_files){
4342 g_warning("menu_open_recent_file_cmd: No submenu_recent_files found, path= MENU_RECENT_FILES_PATH");
4345 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH_OLD);
4347 /* get capture filename from the menu item label */
4348 menu_item_child = (GTK_BIN(w))->child;
4349 cf_name = gtk_label_get_text(GTK_LABEL(menu_item_child));
4351 /* open and read the capture file (this will close an existing file) */
4352 if (cf_open(&cfile, cf_name, FALSE, &err) == CF_OK) {
4353 cf_read(&cfile, FALSE);
4355 /* the capture file apparently no longer exists; remove menu item */
4356 /* XXX: ask user to remove item, it's maybe only a temporary problem */
4357 remove_menu_recent_capture_file(w, NULL);
4360 update_menu_recent_capture_file(submenu_recent_files);
4363 static void menu_open_recent_file_answered_cb(gpointer dialog _U_, gint btn, gpointer data)
4367 /* save file first */
4368 file_save_as_cmd(after_save_open_recent_file, data);
4372 menu_open_recent_file_cmd(data);
4374 case(ESD_BTN_CANCEL):
4377 g_assert_not_reached();
4382 menu_open_recent_file_cmd_cb(GtkWidget *widget, gpointer data _U_) {
4386 if((cfile.state != FILE_CLOSED) && !cfile.user_saved && prefs.gui_ask_unsaved) {
4387 /* user didn't saved his current file, ask him */
4388 dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_YES_NO_CANCEL,
4389 "%sSave capture file before opening a new one?%s\n\n"
4390 "If you open a new capture file without saving, your current capture data will be discarded.",
4391 simple_dialog_primary_start(), simple_dialog_primary_end());
4392 simple_dialog_set_cb(dialog, menu_open_recent_file_answered_cb, widget);
4394 /* unchanged file */
4395 menu_open_recent_file_cmd(widget);
4399 /* add the capture filename (with an absolute path) to the "Recent Files" menu */
4401 add_menu_recent_capture_file_absolute(gchar *cf_name) {
4402 GtkWidget *submenu_recent_files;
4403 GList *menu_item_list;
4405 gchar *widget_cf_name;
4406 gchar *normalized_cf_name;
4407 GtkWidget *menu_item;
4412 normalized_cf_name = g_strdup(cf_name);
4414 /* replace all slashes by backslashes */
4415 g_strdelimit(normalized_cf_name, "/", '\\');
4418 /* get the submenu container item */
4419 #ifdef MAIN_MENU_USE_UIMANAGER
4420 submenu_recent_files = gtk_ui_manager_get_widget(ui_manager_main_menubar, MENU_RECENT_FILES_PATH);
4421 if(!submenu_recent_files){
4422 g_warning("add_menu_recent_capture_file_absolute: No submenu_recent_files found, path= MENU_RECENT_FILES_PATH");
4425 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH_OLD);
4427 /* convert container to a GList */
4428 menu_item_list = gtk_container_get_children(GTK_CONTAINER(submenu_recent_files));
4430 /* iterate through list items of menu_item_list,
4431 * removing special items, a maybe duplicate entry and every item above count_max */
4433 for (li = g_list_first(menu_item_list); li; li = li->next, cnt++) {
4434 /* get capture filename */
4435 menu_item = GTK_WIDGET(li->data);
4436 widget_cf_name = g_object_get_data(G_OBJECT(menu_item), MENU_RECENT_FILES_KEY);
4438 /* if this element string is one of our special items (seperator, ...) or
4439 * already in the list or
4440 * this element is above maximum count (too old), remove it */
4441 if (!widget_cf_name ||
4443 /* do a case insensitive compare on win32 */
4444 g_ascii_strncasecmp(widget_cf_name, normalized_cf_name, 1000) == 0 ||
4446 /* do a case sensitive compare on unix */
4447 strncmp(widget_cf_name, normalized_cf_name, 1000) == 0 ||
4449 cnt >= prefs.gui_recent_files_count_max) {
4450 remove_menu_recent_capture_file(li->data, NULL);
4455 g_list_free(menu_item_list);
4457 /* add new item at latest position */
4458 menu_item = gtk_menu_item_new_with_label(normalized_cf_name);
4459 g_object_set_data(G_OBJECT(menu_item), MENU_RECENT_FILES_KEY, normalized_cf_name);
4460 gtk_menu_shell_prepend (GTK_MENU_SHELL(submenu_recent_files), menu_item);
4461 g_signal_connect_swapped(GTK_OBJECT(menu_item), "activate",
4462 G_CALLBACK(menu_open_recent_file_cmd_cb), (GtkObject *) menu_item);
4463 gtk_widget_show (menu_item);
4465 /* add seperator at last position */
4466 menu_item = gtk_menu_item_new();
4467 gtk_menu_shell_append (GTK_MENU_SHELL(submenu_recent_files), menu_item);
4468 gtk_widget_show (menu_item);
4470 /* add new "clear list" item at last position */
4471 menu_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_CLEAR, NULL);
4472 gtk_menu_shell_append (GTK_MENU_SHELL(submenu_recent_files), menu_item);
4473 g_signal_connect_swapped(GTK_OBJECT(menu_item), "activate",
4474 G_CALLBACK(clear_menu_recent_capture_file_cmd_cb), (GtkObject *) menu_item);
4475 gtk_widget_show (menu_item);
4477 update_menu_recent_capture_file(submenu_recent_files);
4481 /* add the capture filename to the "Recent Files" menu */
4482 /* (will change nothing, if this filename is already in the menu) */
4484 * XXX - We might want to call SHAddToRecentDocs under Windows 7:
4485 * http://stackoverflow.com/questions/437212/how-do-you-register-a-most-recently-used-list-with-windows-in-preparation-for-win
4488 add_menu_recent_capture_file(gchar *cf_name) {
4493 /* if this filename is an absolute path, we can use it directly */
4494 if (g_path_is_absolute(cf_name)) {
4495 add_menu_recent_capture_file_absolute(cf_name);
4499 /* this filename is not an absolute path, prepend the current dir */
4500 curr = g_get_current_dir();
4501 absolute = g_strdup_printf("%s%s%s", curr, G_DIR_SEPARATOR_S, cf_name);
4502 add_menu_recent_capture_file_absolute(absolute);
4508 /* write all capture filenames of the menu to the user's recent file */
4510 menu_recent_file_write_all(FILE *rf) {
4511 GtkWidget *submenu_recent_files;
4516 #ifdef MAIN_MENU_USE_UIMANAGER
4517 submenu_recent_files = gtk_ui_manager_get_widget(ui_manager_main_menubar, MENU_RECENT_FILES_PATH);
4518 if(!submenu_recent_files){
4519 g_warning("add_menu_recent_capture_file_absolute: No submenu_recent_files found, path= MENU_RECENT_FILES_PATH");
4522 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH_OLD);
4524 /* we have to iterate backwards through the children's list,
4525 * so we get the latest item last in the file.
4526 * (don't use gtk_container_foreach() here, it will return the wrong iteration order) */
4527 children = gtk_container_get_children(GTK_CONTAINER(submenu_recent_files));
4528 child = g_list_last(children);
4529 while(child != NULL) {
4530 /* get capture filename from the menu item label */
4531 cf_name = g_object_get_data(G_OBJECT(child->data), MENU_RECENT_FILES_KEY);
4534 fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", u3_contract_device_path(cf_name));
4536 fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", cf_name);
4539 child = g_list_previous(child);
4542 g_list_free(children);
4547 show_hide_cb(GtkWidget *w, gpointer data _U_, gint action)
4550 /* save current setting in recent */
4552 case(SHOW_HIDE_MAIN_TOOLBAR):
4553 recent.main_toolbar_show = GTK_CHECK_MENU_ITEM(w)->active;
4555 case(SHOW_HIDE_FILTER_TOOLBAR):
4556 recent.filter_toolbar_show = GTK_CHECK_MENU_ITEM(w)->active;
4559 case(SHOW_HIDE_AIRPCAP_TOOLBAR):
4560 recent.airpcap_toolbar_show = GTK_CHECK_MENU_ITEM(w)->active;
4563 case(SHOW_HIDE_STATUSBAR):
4564 recent.statusbar_show = GTK_CHECK_MENU_ITEM(w)->active;
4566 case(SHOW_HIDE_PACKET_LIST):
4567 recent.packet_list_show = GTK_CHECK_MENU_ITEM(w)->active;
4569 case(SHOW_HIDE_TREE_VIEW):
4570 recent.tree_view_show = GTK_CHECK_MENU_ITEM(w)->active;
4572 case(SHOW_HIDE_BYTE_VIEW):
4573 recent.byte_view_show = GTK_CHECK_MENU_ITEM(w)->active;
4576 g_assert_not_reached();
4579 main_widgets_show_or_hide();
4582 #ifndef MAIN_MENU_USE_UIMANAGER
4584 timestamp_format_cb(GtkWidget *w _U_, gpointer d _U_, gint action)
4586 if (recent.gui_time_format != action) {
4587 timestamp_set_type(action);
4588 recent.gui_time_format = action;
4589 #ifdef NEW_PACKET_LIST
4590 /* This call adjusts column width */
4591 cf_timestamp_auto_precision(&cfile);
4592 new_packet_list_queue_draw();
4594 cf_change_time_formats(&cfile);
4601 timestamp_precision_cb(GtkWidget *w _U_, gpointer d _U_, gint action)
4603 if (recent.gui_time_precision != action) {
4604 /* the actual precision will be set in cf_change_time_formats() below */
4605 if (action == TS_PREC_AUTO) {
4606 timestamp_set_precision(TS_PREC_AUTO_SEC);
4608 timestamp_set_precision(action);
4610 recent.gui_time_precision = action;
4611 #ifdef NEW_PACKET_LIST
4612 /* This call adjusts column width */
4613 cf_timestamp_auto_precision(&cfile);
4614 new_packet_list_queue_draw();
4616 cf_change_time_formats(&cfile);
4623 timestamp_seconds_time_cb(GtkWidget *w, gpointer d _U_, gint action _U_)
4625 if (GTK_CHECK_MENU_ITEM(w)->active) {
4626 recent.gui_seconds_format = TS_SECONDS_HOUR_MIN_SEC;
4628 recent.gui_seconds_format = TS_SECONDS_DEFAULT;
4630 timestamp_set_seconds_type (recent.gui_seconds_format);
4632 #ifdef NEW_PACKET_LIST
4633 /* This call adjusts column width */
4634 cf_timestamp_auto_precision(&cfile);
4635 new_packet_list_queue_draw();
4637 cf_change_time_formats(&cfile);
4642 menu_name_resolution_changed(void)
4644 GtkWidget *menu = NULL;
4645 #ifdef MAIN_MENU_USE_UIMANAGER
4646 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/EnableforMACLayer");
4648 g_warning("menu_name_resolution_changed: No menu found, path= /Menubar/ViewMenu/NameResolution/EnableforMACLayer");
4650 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), g_resolv_flags & RESOLV_MAC);
4652 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/EnableforNetworkLayer");
4654 g_warning("menu_name_resolution_changed: No menu found, path= /Menubar/ViewMenu/NameResolution/EnableforNetworkLayer");
4656 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), g_resolv_flags & RESOLV_NETWORK);
4658 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/EnableforTransportLayer");
4660 g_warning("menu_name_resolution_changed: No menu found, path= /Menubar/ViewMenu/NameResolution/EnableforTransportLayer");
4662 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), g_resolv_flags & RESOLV_TRANSPORT);
4665 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Name Resolution/Enable for MAC Layer");
4666 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), g_resolv_flags & RESOLV_MAC);
4668 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Name Resolution/Enable for Network Layer");
4669 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), g_resolv_flags & RESOLV_NETWORK);
4671 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Name Resolution/Enable for Transport Layer");
4672 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), g_resolv_flags & RESOLV_TRANSPORT);
4673 #endif /* MAIN_MENU_USE_UIMANAGER */
4677 name_resolution_cb(GtkWidget *w, gpointer d _U_, gint action)
4679 if (GTK_CHECK_MENU_ITEM(w)->active) {
4680 g_resolv_flags |= action;
4682 g_resolv_flags &= ~action;
4688 menu_auto_scroll_live_changed(gboolean auto_scroll_live_in) {
4692 /* tell menu about it */
4693 #ifdef MAIN_MENU_USE_UIMANAGER
4694 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/AutoScrollinLiveCapture");
4696 g_warning("menu_auto_scroll_live_changed: No menu found, path= /Menubar/ViewMenu/AutoScrollinLiveCapture");
4699 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Auto Scroll in Live Capture");
4700 #endif /* MAIN_MENU_USE_UIMANAGER */
4701 if( ((gboolean) GTK_CHECK_MENU_ITEM(menu)->active) != auto_scroll_live_in) {
4702 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), auto_scroll_live_in);
4705 /* tell toolbar about it */
4706 toolbar_auto_scroll_live_changed(auto_scroll_live_in);
4708 /* change auto scroll */
4709 if(auto_scroll_live_in != auto_scroll_live) {
4710 auto_scroll_live = auto_scroll_live_in;
4714 #ifndef MAIN_MENU_USE_UIMANAGER
4716 auto_scroll_live_cb(GtkWidget *w _U_, gpointer d _U_)
4718 menu_auto_scroll_live_changed(GTK_CHECK_MENU_ITEM(w)->active);
4726 menu_colorize_changed(gboolean packet_list_colorize) {
4730 /* tell menu about it */
4731 #ifdef MAIN_MENU_USE_UIMANAGER
4732 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/ColorizePacketList");
4734 g_warning("menu_colorize_changed: No menu found, path= /Menubar/ViewMenu/ColorizePacketList");
4737 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Colorize Packet List");
4738 #endif /* MAIN_MENU_USE_UIMANAGER */
4739 if( ((gboolean) GTK_CHECK_MENU_ITEM(menu)->active) != packet_list_colorize) {
4740 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), packet_list_colorize);
4743 /* tell toolbar about it */
4744 toolbar_colorize_changed(packet_list_colorize);
4746 /* change colorization */
4747 if(packet_list_colorize != recent.packet_list_colorize) {
4748 recent.packet_list_colorize = packet_list_colorize;
4749 color_filters_enable(packet_list_colorize);
4750 #ifdef NEW_PACKET_LIST
4751 new_packet_list_colorize_packets();
4753 cf_colorize_packets(&cfile);
4759 colorize_cb(GtkWidget *w, gpointer d _U_)
4761 menu_colorize_changed(GTK_CHECK_MENU_ITEM(w)->active);
4765 /* the recent file read has finished, update the menu corresponding */
4767 menu_recent_read_finished(void) {
4768 GtkWidget *menu = NULL;
4770 #ifdef MAIN_MENU_USE_UIMANAGER
4771 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/MainToolbar");
4773 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/MainToolbar");
4775 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.main_toolbar_show);
4777 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/FilterToolbar");
4779 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/FilterToolbar");
4781 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.filter_toolbar_show);
4785 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Main Toolbar");
4786 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.main_toolbar_show);
4788 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Filter Toolbar");
4789 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.filter_toolbar_show);
4790 #endif /* MAIN_MENU_USE_UIMANAGER*/
4792 #ifdef MAIN_MENU_USE_UIMANAGER
4793 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/WirelessToolbar");
4795 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/WirelessToolbar");
4797 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.airpcap_toolbar_show);
4800 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Wireless Toolbar");
4801 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.airpcap_toolbar_show);
4802 #endif /* MAIN_MENU_USE_UIMANAGER */
4803 #endif /* HAVE_AIRPCAP */
4805 #ifdef MAIN_MENU_USE_UIMANAGER
4807 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/Statusbar");
4809 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/Statusbar");
4811 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.statusbar_show);
4814 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/PacketList");
4816 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/PacketList");
4818 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.packet_list_show);
4821 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/PacketDetails");
4823 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/PacketDetails");
4825 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.tree_view_show);
4828 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/PacketBytes");
4830 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/PacketBytes");
4832 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.byte_view_show);
4835 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/ColorizePacketList");
4837 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/ColorizePacketList");
4839 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.packet_list_colorize);
4843 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Statusbar");
4844 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.statusbar_show);
4846 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Packet List");
4847 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.packet_list_show);
4849 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Packet Details");
4850 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.tree_view_show);
4852 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Packet Bytes");
4853 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.byte_view_show);
4855 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Colorize Packet List");
4856 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.packet_list_colorize);
4857 #endif /* MAIN_MENU_USE_UIMANAGER*/
4859 menu_name_resolution_changed();
4862 #ifdef MAIN_MENU_USE_UIMANAGER
4863 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/AutoScrollinLiveCapture");
4865 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/AutoScrollinLiveCapture");
4867 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), auto_scroll_live);
4870 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Auto Scroll in Live Capture");
4871 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), auto_scroll_live);
4872 #endif /* MAIN_MENU_USE_UIMANAGER*/
4875 main_widgets_rearrange();
4877 /* don't change the time format, if we had a command line value */
4878 if (timestamp_get_type() != TS_NOT_SET) {
4879 recent.gui_time_format = timestamp_get_type();
4882 #ifdef MAIN_MENU_USE_UIMANAGER
4884 timestamp_set_type(recent.gui_time_format);
4885 #ifdef NEW_PACKET_LIST
4886 /* This call adjusts column width */
4887 cf_timestamp_auto_precision(&cfile);
4888 new_packet_list_queue_draw();
4890 cf_change_time_formats(&cfile);
4893 /* This should not be needed as we set the active radioItem when we crate the actiongroup */
4894 switch(recent.gui_time_format) {
4895 case(TS_ABSOLUTE_WITH_DATE):
4896 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/TimeDisplayFormat/DateandTimeofDay");
4898 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/TimeDisplayFormat/DateandTimeofDay");
4902 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/TimeDisplayFormat/TimeofDay");
4904 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/TimeDisplayFormat/TimeofDay");
4908 g_warning("TS_RELATIVE");
4909 action = gtk_ui_manager_get_action(ui_manager_main_menubar, "/Menubar/ViewMenu/TimeDisplayFormat/SecondsSinceBeginningofCapture");
4910 gtk_action_activate(action);
4911 if(gtk_action_is_sensitive(action))
4912 g_warning("ACTION IS SENSIBLE");
4914 g_warning("NO ACTION");
4917 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/TimeDisplayFormat/SecondsSinceBeginningofCapture");
4919 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/TimeDisplayFormat/SecondsSinceBeginningofCapture");
4923 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/TimeDisplayFormat/SecondsSincePreviousCapturedPacket");
4925 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/TimeDisplayFormat/SecondsSincePreviousCapturedPacket");
4929 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/TimeDisplayFormat/SecondsSincePreviousDisplayedPacket");
4931 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/TimeDisplayFormat/SecondsSincePreviousDisplayedPacket");
4935 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/TimeDisplayFormat/SecondsSinceEpoch");
4937 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/TimeDisplayFormat/SecondsSinceEpoch");
4941 g_assert_not_reached();
4943 /* set_active will not trigger the callback when activating an active item! */
4944 recent.gui_time_format = -1;
4945 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), FALSE);
4946 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
4949 switch(recent.gui_time_format) {
4950 case(TS_ABSOLUTE_WITH_DATE):
4951 menu = gtk_item_factory_get_widget(main_menu_factory,
4952 "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456");
4955 menu = gtk_item_factory_get_widget(main_menu_factory,
4956 "/View/Time Display Format/Time of Day: 01:02:03.123456");
4959 menu = gtk_item_factory_get_widget(main_menu_factory,
4960 "/View/Time Display Format/Seconds Since Beginning of Capture: 123.123456");
4963 menu = gtk_item_factory_get_widget(main_menu_factory,
4964 "/View/Time Display Format/Seconds Since Previous Captured Packet: 1.123456");
4967 menu = gtk_item_factory_get_widget(main_menu_factory,
4968 "/View/Time Display Format/Seconds Since Previous Displayed Packet: 1.123456");
4971 menu = gtk_item_factory_get_widget(main_menu_factory,
4972 "/View/Time Display Format/Seconds Since Epoch (1970-01-01): 1234567890.123456");
4975 g_assert_not_reached();
4977 /* set_active will not trigger the callback when activating an active item! */
4978 recent.gui_time_format = -1;
4979 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), FALSE);
4980 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
4981 #endif /* MAIN_MENU_USE_UIMANAGER */
4982 #ifdef MAIN_MENU_USE_UIMANAGER
4983 /* the actual precision will be set in cf_change_time_formats() below */
4984 if (recent.gui_time_precision == TS_PREC_AUTO) {
4985 timestamp_set_precision(TS_PREC_AUTO_SEC);
4987 timestamp_set_precision(recent.gui_time_precision);
4989 #ifdef NEW_PACKET_LIST
4990 /* This call adjusts column width */
4991 cf_timestamp_auto_precision(&cfile);
4992 new_packet_list_queue_draw();
4994 cf_change_time_formats(&cfile);
4998 switch(recent.gui_time_precision) {
5000 menu = gtk_item_factory_get_widget(main_menu_factory,
5001 "/View/Time Display Format/Automatic (File Format Precision)");
5003 case(TS_PREC_FIXED_SEC):
5004 menu = gtk_item_factory_get_widget(main_menu_factory,
5005 "/View/Time Display Format/Seconds: 0");
5007 case(TS_PREC_FIXED_DSEC):
5008 menu = gtk_item_factory_get_widget(main_menu_factory,
5009 "/View/Time Display Format/Deciseconds: 0.1");
5011 case(TS_PREC_FIXED_CSEC):
5012 menu = gtk_item_factory_get_widget(main_menu_factory,
5013 "/View/Time Display Format/Centiseconds: 0.12");
5015 case(TS_PREC_FIXED_MSEC):
5016 menu = gtk_item_factory_get_widget(main_menu_factory,
5017 "/View/Time Display Format/Milliseconds: 0.123");
5019 case(TS_PREC_FIXED_USEC):
5020 menu = gtk_item_factory_get_widget(main_menu_factory,
5021 "/View/Time Display Format/Microseconds: 0.123456");
5023 case(TS_PREC_FIXED_NSEC):
5024 menu = gtk_item_factory_get_widget(main_menu_factory,
5025 "/View/Time Display Format/Nanoseconds: 0.123456789");
5028 g_assert_not_reached();
5031 /* set_active will not trigger the callback when activating an active item! */
5032 recent.gui_time_precision = -1;
5033 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), FALSE);
5034 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
5035 #endif /* MAIN_MENU_USE_UIMANAGER */
5037 /* don't change the seconds format, if we had a command line value */
5038 if (timestamp_get_seconds_type() != TS_SECONDS_NOT_SET) {
5039 recent.gui_seconds_format = timestamp_get_seconds_type();
5041 #ifdef MAIN_MENU_USE_UIMANAGER
5042 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/TimeDisplayFormat/DisplaySecondsWithHoursAndMinutes");
5044 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/TimeDisplayFormat/DisplaySecondsWithHoursAndMinutes");
5048 menu = gtk_item_factory_get_widget(main_menu_factory,
5049 "/View/Time Display Format/Display Seconds with hours and minutes");
5050 #endif /* MAIN_MENU_USE_UIMANAGER */
5052 switch (recent.gui_seconds_format) {
5053 case TS_SECONDS_DEFAULT:
5054 recent.gui_seconds_format = -1;
5055 /* set_active will not trigger the callback when deactivating an inactive item! */
5056 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
5057 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), FALSE);
5059 case TS_SECONDS_HOUR_MIN_SEC:
5060 recent.gui_seconds_format = -1;
5061 /* set_active will not trigger the callback when activating an active item! */
5062 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), FALSE);
5063 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
5066 g_assert_not_reached();
5069 menu_colorize_changed(recent.packet_list_colorize);
5074 popup_menu_handler(GtkWidget *widget, GdkEvent *event, gpointer data)
5076 GtkWidget *menu = (GtkWidget *)data;
5077 GdkEventButton *event_button = NULL;
5080 if(widget == NULL || event == NULL || data == NULL) {
5085 * If we ever want to make the menu differ based on what row
5086 * and/or column we're above, we'd use "eth_clist_get_selection_info()"
5087 * to find the row and column number for the coordinates; a CTree is,
5088 * I guess, like a CList with one column(?) and the expander widget
5091 /* Check if we are on packet_list object */
5092 if (widget == g_object_get_data(G_OBJECT(popup_menu_object), E_MPACKET_LIST_KEY) &&
5093 ((GdkEventButton *)event)->button != 1) {
5094 #ifdef NEW_PACKET_LIST
5096 if (new_packet_list_get_event_row_column((GdkEventButton *)event, &physical_row, &row, &column)) {
5098 if (packet_list_get_event_row_column(widget, (GdkEventButton *)event, &row, &column)) {
5100 g_object_set_data(G_OBJECT(popup_menu_object), E_MPACKET_LIST_ROW_KEY,
5101 #ifdef NEW_PACKET_LIST
5102 GINT_TO_POINTER(row));
5104 GINT_TO_POINTER(row));
5106 g_object_set_data(G_OBJECT(popup_menu_object), E_MPACKET_LIST_COL_KEY,
5107 GINT_TO_POINTER(column));
5108 #ifdef NEW_PACKET_LIST
5109 new_packet_list_set_selected_row(row);
5111 packet_list_set_selected_row(row);
5116 /* Check if we are on tree_view object */
5117 if (widget == tree_view_gbl) {
5118 tree_view_select(widget, (GdkEventButton *) event);
5121 /* context menu handler */
5122 if(event->type == GDK_BUTTON_PRESS) {
5123 event_button = (GdkEventButton *) event;
5125 /* To quote the "Gdk Event Structures" doc:
5126 * "Normally button 1 is the left mouse button, 2 is the middle button, and 3 is the right button" */
5127 if(event_button->button == 3) {
5128 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
5129 event_button->button,
5130 event_button->time);
5131 g_signal_stop_emission_by_name(widget, "button_press_event");
5136 /* Check if we are on byte_view object */
5137 if(widget == get_notebook_bv_ptr(byte_nb_ptr_gbl)) {
5138 byte_view_select(widget, (GdkEventButton *) event);
5141 /* GDK_2BUTTON_PRESS is a doubleclick -> expand/collapse tree row */
5142 /* GTK version 1 seems to be doing this automatically */
5143 if (widget == tree_view_gbl && event->type == GDK_2BUTTON_PRESS) {
5146 if (gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(widget),
5147 (gint) (((GdkEventButton *)event)->x),
5148 (gint) (((GdkEventButton *)event)->y),
5149 &path, NULL, NULL, NULL))
5151 if (gtk_tree_view_row_expanded(GTK_TREE_VIEW(widget), path))
5152 gtk_tree_view_collapse_row(GTK_TREE_VIEW(widget), path);
5154 gtk_tree_view_expand_row(GTK_TREE_VIEW(widget), path,
5156 gtk_tree_path_free(path);
5162 /* Enable or disable menu items based on whether you have a capture file
5163 you've finished reading and, if you have one, whether it's been saved
5164 and whether it could be saved except by copying the raw packet data. */
5166 set_menus_for_capture_file(capture_file *cf)
5169 /* We have no capture file */
5170 #ifdef MAIN_MENU_USE_UIMANAGER
5171 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Merge", FALSE);
5172 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Close", FALSE);
5173 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Save", FALSE);
5174 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/SaveAs", FALSE);
5175 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Export", FALSE);
5176 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/Reload", FALSE);
5178 set_menu_sensitivity_old("/File/Merge...", FALSE);
5179 set_menu_sensitivity_old("/File/Close", FALSE);
5180 set_menu_sensitivity_old("/File/Save", FALSE);
5181 set_menu_sensitivity_old("/File/Save As...", FALSE);
5182 set_menu_sensitivity_old("/File/Export", FALSE);
5183 set_menu_sensitivity_old("/View/Reload", FALSE);
5184 #endif /* MAIN_MENU_USE_UIMANAGER */
5186 set_toolbar_for_capture_file(FALSE);
5187 set_toolbar_for_unsaved_capture_file(FALSE);
5189 #ifdef MAIN_MENU_USE_UIMANAGER
5190 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Merge", TRUE);
5191 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Close", TRUE);
5192 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Save", !cf->user_saved);
5194 * "Save As..." works only if we can write the file out in at least
5195 * one format (so we can save the whole file or just a subset) or
5196 * if we have an unsaved capture (so writing the whole file out
5197 * with a raw data copy makes sense).
5199 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/SaveAs",
5200 cf_can_save_as(cf) || !cf->user_saved);
5201 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Export", TRUE);
5202 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/Reload", TRUE);
5204 set_menu_sensitivity_old("/File/Merge...", TRUE);
5205 set_menu_sensitivity_old("/File/Close", TRUE);
5206 set_menu_sensitivity_old("/File/Save", !cf->user_saved);
5208 * "Save As..." works only if we can write the file out in at least
5209 * one format (so we can save the whole file or just a subset) or
5210 * if we have an unsaved capture (so writing the whole file out
5211 * with a raw data copy makes sense).
5213 set_menu_sensitivity_old("/File/Save As...",
5214 cf_can_save_as(cf) || !cf->user_saved);
5215 set_menu_sensitivity_old("/File/Export", TRUE);
5216 set_menu_sensitivity_old("/View/Reload", TRUE);
5217 #endif /* MAIN_MENU_USE_UIMANAGER */
5218 set_toolbar_for_unsaved_capture_file(!cf->user_saved);
5219 set_toolbar_for_capture_file(TRUE);
5223 /* Enable or disable menu items based on whether there's a capture in
5226 set_menus_for_capture_in_progress(gboolean capture_in_progress)
5228 #ifdef MAIN_MENU_USE_UIMANAGER
5229 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Open",
5230 !capture_in_progress);
5231 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/OpenRecent",
5232 !capture_in_progress);
5233 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Export",
5234 capture_in_progress);
5235 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Set",
5236 !capture_in_progress);
5239 set_menu_sensitivity_old("/File/Open...",
5240 !capture_in_progress);
5241 set_menu_sensitivity_old("/File/Open Recent",
5242 !capture_in_progress);
5243 set_menu_sensitivity_old("/File/Export",
5244 capture_in_progress);
5245 set_menu_sensitivity_old("/File/File Set",
5246 !capture_in_progress);
5247 #endif /* MAIN_MENU_USE_UIMANAGER */
5248 set_menu_sensitivity(ui_manager_packet_list_heading, "/PacketListHeadingPopup/SortAscending",
5249 !capture_in_progress);
5250 set_menu_sensitivity(ui_manager_packet_list_heading, "/PacketListHeadingPopup/SortDescending",
5251 !capture_in_progress);
5252 set_menu_sensitivity(ui_manager_packet_list_heading, "/PacketListHeadingPopup/NoSorting",
5253 !capture_in_progress);
5256 #ifdef MAIN_MENU_USE_UIMANAGER
5257 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/CaptureMenu/Options",
5258 !capture_in_progress);
5259 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/CaptureMenu/Start",
5260 !capture_in_progress);
5261 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/CaptureMenu/Stop",
5262 capture_in_progress);
5263 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/CaptureMenu/Restart",
5264 capture_in_progress);
5266 set_menu_sensitivity_old("/Capture/Options...",
5267 !capture_in_progress);
5268 set_menu_sensitivity_old("/Capture/Start",
5269 !capture_in_progress);
5270 set_menu_sensitivity_old("/Capture/Stop",
5271 capture_in_progress);
5272 set_menu_sensitivity_old("/Capture/Restart",
5273 capture_in_progress);
5274 #endif /* MAIN_MENU_USE_UIMANAGER */
5275 set_toolbar_for_capture_in_progress(capture_in_progress);
5277 set_capture_if_dialog_for_capture_in_progress(capture_in_progress);
5278 #endif /* HAVE_LIBPCAP */
5281 /* Enable or disable menu items based on whether you have some captured
5284 walk_menu_tree_for_captured_packets(GList *node,
5285 gboolean have_captured_packets)
5287 gboolean is_enabled;
5289 menu_item_t *node_data = node->data;
5292 * Is this a leaf node or an interior node?
5294 if (node_data->children == NULL) {
5298 * If it has no "selected_packet_enabled()" or
5299 * "selected_tree_row_enabled()" routines, we enable
5300 * it. This allows tap windows to be popped up even
5301 * if you have no capture file; this is done to let
5302 * the user pop up multiple tap windows before reading
5303 * in a capture file, so that they can be processed in
5304 * parallel while the capture file is being read rather
5305 * than one at at time as you pop up the windows, and to
5306 * let the user pop up tap windows before starting an
5307 * "Update list of packets in real time" capture, so that
5308 * the statistics can be displayed while the capture is
5311 * If it has either of those routines, we disable it for
5312 * now - as long as, when a capture is first available,
5313 * we don't get called after a packet or tree row is
5314 * selected, that's OK.
5315 * XXX - that should be done better.
5317 if (node_data->selected_packet_enabled == NULL &&
5318 node_data->selected_tree_row_enabled == NULL)
5319 node_data->enabled = TRUE;
5321 node_data->enabled = FALSE;
5324 * It's an interior node; call
5325 * "walk_menu_tree_for_captured_packets()" on all its
5326 * children and, if any of them are enabled, enable
5327 * this node, otherwise disable it.
5329 * XXX - should we just leave all interior nodes enabled?
5330 * Which is a better UI choice?
5333 for (child = node_data->children; child != NULL; child =
5335 if (walk_menu_tree_for_captured_packets(child,
5336 have_captured_packets))
5339 node_data->enabled = is_enabled;
5343 * The root node doesn't correspond to a menu tree item; it
5344 * has a null name pointer.
5346 if (node_data->name != NULL) {
5347 #ifdef MAIN_MENU_USE_UIMANAGER
5348 set_menu_sensitivity(ui_manager_main_menubar, node_data->name,
5349 node_data->enabled);
5351 set_menu_sensitivity_old(node_data->name,
5352 node_data->enabled);
5355 return node_data->enabled;
5359 set_menus_for_captured_packets(gboolean have_captured_packets)
5361 #ifdef MAIN_MENU_USE_UIMANAGER
5362 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Print",
5363 have_captured_packets);
5365 set_menu_sensitivity_old("/File/Print...",
5366 have_captured_packets);
5367 #endif /* MAIN_MENU_USE_UIMANAGER */
5368 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/Print",
5369 have_captured_packets);
5371 #ifdef MAIN_MENU_USE_UIMANAGER
5372 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/FindPacket",
5373 have_captured_packets);
5374 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/FindNext",
5375 have_captured_packets);
5376 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/FindPrevious",
5377 have_captured_packets);
5378 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ZoomIn",
5379 have_captured_packets);
5380 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ZoomOut",
5381 have_captured_packets);
5382 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/NormalSize",
5383 have_captured_packets);
5384 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/GotoCorrespondingPacket",
5385 have_captured_packets);
5386 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/PreviousPacket",
5387 have_captured_packets);
5388 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/NextPacket",
5389 have_captured_packets);
5390 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/FirstPacket",
5391 have_captured_packets);
5392 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/LastPacket",
5393 have_captured_packets);
5394 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/PreviousPacketInConversation",
5395 have_captured_packets);
5396 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/NextPacketInConversation",
5397 have_captured_packets);
5398 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/StatisticsMenu/Summary",
5399 have_captured_packets);
5400 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/StatisticsMenu/ProtocolHierarchy",
5401 have_captured_packets);
5403 set_menu_sensitivity_old("/Edit/Find Packet...",
5404 have_captured_packets);
5405 set_menu_sensitivity_old("/Edit/Find Next",
5406 have_captured_packets);
5407 set_menu_sensitivity_old("/Edit/Find Previous",
5408 have_captured_packets);
5409 set_menu_sensitivity_old("/View/Zoom In",
5410 have_captured_packets);
5411 set_menu_sensitivity_old("/View/Zoom Out",
5412 have_captured_packets);
5413 set_menu_sensitivity_old("/View/Normal Size",
5414 have_captured_packets);
5415 set_menu_sensitivity_old("/Go/Go to Packet...",
5416 have_captured_packets);
5417 set_menu_sensitivity_old("/Go/Previous Packet",
5418 have_captured_packets);
5419 set_menu_sensitivity_old("/Go/Next Packet",
5420 have_captured_packets);
5421 set_menu_sensitivity_old("/Go/First Packet",
5422 have_captured_packets);
5423 set_menu_sensitivity_old("/Go/Last Packet",
5424 have_captured_packets);
5425 set_menu_sensitivity_old("/Go/Previous Packet In Conversation",
5426 have_captured_packets);
5427 set_menu_sensitivity_old("/Go/Next Packet In Conversation",
5428 have_captured_packets);
5429 set_menu_sensitivity_old("/Statistics/Summary",
5430 have_captured_packets);
5431 set_menu_sensitivity_old("/Statistics/Protocol Hierarchy",
5432 have_captured_packets);
5433 #endif /* MAIN_MENU_USE_UIMANAGER */
5434 walk_menu_tree_for_captured_packets(tap_menu_tree_root,
5435 have_captured_packets);
5436 set_toolbar_for_captured_packets(have_captured_packets);
5439 /* Enable or disable menu items based on whether a packet is selected and,
5440 if so, on the properties of the packet. */
5442 walk_menu_tree_for_selected_packet(GList *node, frame_data *fd,
5443 epan_dissect_t *edt)
5445 gboolean is_enabled;
5447 menu_item_t *node_data = node->data;
5450 * Is this a leaf node or an interior node?
5452 if (node_data->children == NULL) {
5456 * If it has no "selected_packet_enabled()" routine,
5457 * leave its enabled/disabled status alone - it
5458 * doesn't depend on whether we have a packet selected
5459 * or not or on the selected packet.
5461 * If it has a "selected_packet_enabled()" routine,
5462 * call it and set the item's enabled/disabled status
5463 * based on its return value.
5465 if (node_data->selected_packet_enabled != NULL)
5466 node_data->enabled = node_data->selected_packet_enabled(fd, edt, node_data->callback_data);
5469 * It's an interior node; call
5470 * "walk_menu_tree_for_selected_packet()" on all its
5471 * children and, if any of them are enabled, enable
5472 * this node, otherwise disable it.
5474 * XXX - should we just leave all interior nodes enabled?
5475 * Which is a better UI choice?
5478 for (child = node_data->children; child != NULL; child =
5480 if (walk_menu_tree_for_selected_packet(child, fd, edt))
5483 node_data->enabled = is_enabled;
5487 * The root node doesn't correspond to a menu tree item; it
5488 * has a null name pointer.
5490 if (node_data->name != NULL) {
5491 #ifdef MAIN_MENU_USE_UIMANAGER
5492 set_menu_sensitivity(ui_manager_main_menubar, node_data->name,
5493 node_data->enabled);
5495 set_menu_sensitivity_old(node_data->name,
5496 node_data->enabled);
5497 #endif /* MAIN_MENU_USE_UIMANAGER */
5499 return node_data->enabled;
5503 packet_is_ssl(epan_dissect_t* edt)
5509 if (!edt || !edt->tree)
5511 ssl_id = proto_get_id_by_filter_name("ssl");
5514 array = proto_find_finfo(edt->tree, ssl_id);
5515 is_ssl = (array->len > 0) ? TRUE : FALSE;
5516 g_ptr_array_free(array, TRUE);
5521 set_menus_for_selected_packet(capture_file *cf)
5523 /* Making the menu context-sensitive allows for easier selection of the
5524 desired item and has the added benefit, with large captures, of
5525 avoiding needless looping through huge lists for marked, ignored,
5526 or time-referenced packets. */
5527 gboolean is_ssl = packet_is_ssl(cf->edt);
5528 gboolean frame_selected = cf->current_frame != NULL;
5529 /* A frame is selected */
5530 gboolean have_marked = frame_selected && cf->marked_count > 0;
5531 /* We have marked frames. (XXX - why check frame_selected?) */
5532 gboolean another_is_marked = have_marked &&
5533 !(cf->marked_count == 1 && cf->current_frame->flags.marked);
5534 /* We have a marked frame other than the current frame (i.e.,
5535 we have at least one marked frame, and either there's more
5536 than one marked frame or the current frame isn't marked). */
5537 gboolean have_time_ref = cf->ref_time_count > 0;
5538 gboolean another_is_time_ref = frame_selected && have_time_ref &&
5539 !(cf->ref_time_count == 1 && cf->current_frame->flags.ref_time);
5540 /* We have a time reference frame other than the current frame (i.e.,
5541 we have at least one time reference frame, and either there's more
5542 than one time reference frame or the current frame isn't a
5543 time reference frame). (XXX - why check frame_selected?) */
5545 #ifdef MAIN_MENU_USE_UIMANAGER
5546 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/MarkPacket",
5549 set_menu_sensitivity_old("/Edit/Mark Packet (toggle)",
5551 #endif /* MAIN_MENU_USE_UIMANAGER */
5552 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/MarkPacket",
5554 #ifdef MAIN_MENU_USE_UIMANAGER
5555 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/MarkAllDisplayedPackets",
5556 cf->displayed_count > 0);
5557 /* Unlike un-ignore, do not allow unmark of all frames when no frames are displayed */
5558 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/UnmarkAllPackets",
5560 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/FindNextMark",
5562 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/FindPreviousMark",
5565 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/IgnorePacket",
5568 set_menu_sensitivity_old("/Edit/Mark All Displayed Packets (toggle)",
5569 cf->displayed_count > 0);
5570 /* Unlike un-ignore, do not allow unmark of all frames when no frames are displayed */
5571 set_menu_sensitivity_old("/Edit/Unmark All Packets",
5573 set_menu_sensitivity_old("/Edit/Find Next Mark",
5575 set_menu_sensitivity_old("/Edit/Find Previous Mark",
5578 set_menu_sensitivity_old("/Edit/Ignore Packet (toggle)",
5580 #endif /* MAIN_MENU_USE_UIMANAGER */
5581 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/IgnorePacket",
5583 #ifdef MAIN_MENU_USE_UIMANAGER
5584 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/IgnoreAllDisplayedPackets",
5585 cf->displayed_count > 0 && cf->displayed_count != cf->count);
5586 /* Allow un-ignore of all frames even with no frames currently displayed */
5587 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Un-IgnoreAllPackets",
5588 cf->ignored_count > 0);
5590 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/SetTimeReference",
5593 set_menu_sensitivity_old("/Edit/Ignore All Displayed Packets (toggle)",
5594 cf->displayed_count > 0 && cf->displayed_count != cf->count);
5595 /* Allow un-ignore of all frames even with no frames currently displayed */
5596 set_menu_sensitivity_old("/Edit/Un-Ignore All Packets",
5597 cf->ignored_count > 0);
5599 set_menu_sensitivity_old("/Edit/Set Time Reference (toggle)",
5601 #endif /* MAIN_MENU_USE_UIMANAGER */
5602 #ifdef NEW_PACKET_LIST
5603 #ifdef MAIN_MENU_USE_UIMANAGER
5604 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Un-TimeReferenceAllPackets",
5607 set_menu_sensitivity_old("/Edit/Un-Time Reference All Packets",
5609 #endif /* MAIN_MENU_USE_UIMANAGER */
5610 #endif /* NEW_PACKET_LIST */
5611 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/SetTimeReference",
5613 #ifdef MAIN_MENU_USE_UIMANAGER
5614 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/FindNextTimeReference",
5615 another_is_time_ref);
5616 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/FindPreviousTimeReference",
5617 another_is_time_ref);
5619 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ResizeAllColumns",
5621 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/CollapseAll",
5624 set_menu_sensitivity_old("/Edit/Find Next Time Reference",
5625 another_is_time_ref);
5626 set_menu_sensitivity_old("/Edit/Find Previous Time Reference",
5627 another_is_time_ref);
5629 set_menu_sensitivity_old("/View/Resize All Columns",
5631 set_menu_sensitivity_old("/View/Collapse All",
5633 #endif /* MAIN_MENU_USE_UIMANAGER */
5634 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/CollapseAll",
5636 #ifdef MAIN_MENU_USE_UIMANAGER
5637 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ExpandAll",
5640 set_menu_sensitivity_old("/View/Expand All",
5642 #endif /* MAIN_MENU_USE_UIMANAGER */
5643 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ExpandAll",
5645 #ifdef MAIN_MENU_USE_UIMANAGER
5646 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ColorizeConversation",
5648 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ResetColoring1-10",
5649 tmp_color_filters_used());
5650 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ShowPacketinNewWindow",
5653 set_menu_sensitivity_old("/View/Colorize Conversation",
5655 set_menu_sensitivity_old("/View/Reset Coloring 1-10",
5656 tmp_color_filters_used());
5657 set_menu_sensitivity_old("/View/Show Packet in New Window",
5659 #endif /* MAIN_MENU_USE_UIMANAGER */
5660 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ShowPacketinNewWindow",
5662 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ManuallyResolveAddress",
5663 frame_selected ? ((cf->edt->pi.ethertype == ETHERTYPE_IP)||(cf->edt->pi.ethertype == ETHERTYPE_IPv6)) : FALSE);
5664 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/SCTP",
5665 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_SCTP) : FALSE);
5666 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/FollowTCPStream",
5667 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
5668 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FollowTCPStream",
5669 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
5670 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/FollowUDPStream",
5671 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
5672 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/FollowSSLStream",
5673 frame_selected ? is_ssl : FALSE);
5674 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FollowSSLStream",
5675 frame_selected ? is_ssl : FALSE);
5676 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter",
5678 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/Ethernet",
5679 frame_selected ? (cf->edt->pi.dl_src.type == AT_ETHER) : FALSE);
5680 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/IP",
5681 frame_selected ? ((cf->edt->pi.ethertype == ETHERTYPE_IP)||(cf->edt->pi.ethertype == ETHERTYPE_IPv6)) : FALSE);
5682 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/TCP",
5683 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
5684 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/UDP",
5685 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
5686 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FollowUDPStream",
5687 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
5688 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/PN-CBA",
5689 frame_selected ? (cf->edt->pi.profinet_type != 0 && cf->edt->pi.profinet_type < 10) : FALSE);
5690 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation",
5692 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/Ethernet",
5693 frame_selected ? (cf->edt->pi.dl_src.type == AT_ETHER) : FALSE);
5694 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/IP",
5695 frame_selected ? ((cf->edt->pi.ethertype == ETHERTYPE_IP)||(cf->edt->pi.ethertype == ETHERTYPE_IPv6)) : FALSE);
5696 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/TCP",
5697 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
5698 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/UDP",
5699 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
5700 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/PN-CBA",
5701 frame_selected ? (cf->edt->pi.profinet_type != 0 && cf->edt->pi.profinet_type < 10) : FALSE);
5702 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/DecodeAs",
5703 frame_selected && decode_as_ok());
5704 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/DecodeAs",
5705 frame_selected && decode_as_ok());
5706 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/Copy",
5708 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ApplyAsFilter",
5710 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/PrepareaFilter",
5712 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ResolveName",
5713 frame_selected && (g_resolv_flags & RESOLV_ALL_ADDRS) != RESOLV_ALL_ADDRS);
5714 #ifdef MAIN_MENU_USE_UIMANAGER
5715 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/FollowTCPStream",
5716 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
5717 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/FollowUDPStream",
5718 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
5719 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/FollowSSLStream",
5720 frame_selected ? is_ssl : FALSE);
5721 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/DecodeAs",
5722 frame_selected && decode_as_ok());
5723 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/ResolveName",
5724 frame_selected && (g_resolv_flags & RESOLV_ALL_ADDRS) != RESOLV_ALL_ADDRS);
5725 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ToolsMenu/FirewallACLRules",
5729 set_menu_sensitivity_old("/Analyze/Follow TCP Stream",
5730 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
5731 set_menu_sensitivity_old("/Analyze/Follow UDP Stream",
5732 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
5733 set_menu_sensitivity_old("/Analyze/Follow SSL Stream",
5734 frame_selected ? is_ssl : FALSE);
5735 set_menu_sensitivity_old("/Analyze/Decode As...",
5736 frame_selected && decode_as_ok());
5737 set_menu_sensitivity_old("/View/Name Resolution/Resolve Name",
5738 frame_selected && (g_resolv_flags & RESOLV_ALL_ADDRS) != RESOLV_ALL_ADDRS);
5739 set_menu_sensitivity_old("/Tools/Firewall ACL Rules",
5741 #endif /* MAIN_MENU_USE_UIMANAGER */
5742 walk_menu_tree_for_selected_packet(tap_menu_tree_root, cf->current_frame,
5746 /* Enable or disable menu items based on whether a tree row is selected
5747 and, if so, on the properties of the tree row. */
5749 walk_menu_tree_for_selected_tree_row(GList *node, field_info *fi)
5751 gboolean is_enabled;
5753 menu_item_t *node_data = node->data;
5756 * Is this a leaf node or an interior node?
5758 if (node_data->children == NULL) {
5762 * If it has no "selected_tree_row_enabled()" routine,
5763 * leave its enabled/disabled status alone - it
5764 * doesn't depend on whether we have a tree row selected
5765 * or not or on the selected tree row.
5767 * If it has a "selected_tree_row_enabled()" routine,
5768 * call it and set the item's enabled/disabled status
5769 * based on its return value.
5771 if (node_data->selected_tree_row_enabled != NULL)
5772 node_data->enabled = node_data->selected_tree_row_enabled(fi, node_data->callback_data);
5775 * It's an interior node; call
5776 * "walk_menu_tree_for_selected_tree_row()" on all its
5777 * children and, if any of them are enabled, enable
5778 * this node, otherwise disable it.
5780 * XXX - should we just leave all interior nodes enabled?
5781 * Which is a better UI choice?
5784 for (child = node_data->children; child != NULL; child =
5786 if (walk_menu_tree_for_selected_tree_row(child, fi))
5789 node_data->enabled = is_enabled;
5793 * The root node doesn't correspond to a menu tree item; it
5794 * has a null name pointer.
5796 if (node_data->name != NULL) {
5797 #ifdef MAIN_MENU_USE_UIMANAGER
5798 set_menu_sensitivity(ui_manager_main_menubar, node_data->name,
5799 node_data->enabled);
5801 set_menu_sensitivity_old(node_data->name,
5802 node_data->enabled);
5803 #endif /* MAIN_MENU_USE_UIMANAGER */
5805 return node_data->enabled;
5809 menu_prefs_toggle_bool (GtkWidget *w, gpointer data)
5811 gboolean *value = data;
5812 module_t *module = g_object_get_data (G_OBJECT(w), "module");
5814 module->prefs_changed = TRUE;
5817 prefs_apply (module);
5818 if (!prefs.gui_use_pref_save) {
5821 redissect_packets();
5825 menu_prefs_change_enum (GtkWidget *w, gpointer data)
5828 module_t *module = g_object_get_data (G_OBJECT(w), "module");
5829 gint new_value = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(w), "enumval"));
5831 if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM(w)))
5834 if (*value != new_value) {
5835 module->prefs_changed = TRUE;
5838 prefs_apply (module);
5839 if (!prefs.gui_use_pref_save) {
5842 redissect_packets();
5847 menu_prefs_reset(void)
5849 g_free (g_object_get_data(G_OBJECT(ui_manager_tree_view_menu), "menu_abbrev"));
5850 g_object_set_data(G_OBJECT(ui_manager_tree_view_menu), "menu_abbrev", NULL);
5854 menu_prefs_change_ok (GtkWidget *w, gpointer parent_w)
5856 GtkWidget *entry = g_object_get_data (G_OBJECT(w), "entry");
5857 module_t *module = g_object_get_data (G_OBJECT(w), "module");
5858 pref_t *pref = g_object_get_data (G_OBJECT(w), "pref");
5859 const gchar *new_value = gtk_entry_get_text(GTK_ENTRY(entry));
5864 switch (pref->type) {
5866 uval = strtoul(new_value, &p, pref->info.base);
5867 if (p == new_value || *p != '\0') {
5868 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
5869 "The value \"%s\" isn't a valid number.",
5873 if (*pref->varp.uint != uval) {
5874 module->prefs_changed = TRUE;
5875 *pref->varp.uint = uval;
5879 if (strcmp (*pref->varp.string, new_value) != 0) {
5880 module->prefs_changed = TRUE;
5881 g_free((void*)*pref->varp.string);
5882 *pref->varp.string = g_strdup(new_value);
5886 if (range_convert_str(&newrange, new_value, pref->info.max_value) != CVT_NO_ERROR) {
5887 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
5888 "The value \"%s\" isn't a valid range.",
5892 if (!ranges_are_equal(*pref->varp.range, newrange)) {
5893 module->prefs_changed = TRUE;
5894 g_free(*pref->varp.range);
5895 *pref->varp.range = newrange;
5901 g_assert_not_reached();
5905 if (module->prefs_changed) {
5906 /* Ensure we reload the sub menu */
5908 prefs_apply (module);
5909 if (!prefs.gui_use_pref_save) {
5912 redissect_packets();
5915 window_destroy(GTK_WIDGET(parent_w));
5919 menu_prefs_change_cancel (GtkWidget *w _U_, gpointer parent_w)
5921 window_destroy(GTK_WIDGET(parent_w));
5925 menu_prefs_edit_dlg (GtkWidget *w, gpointer data)
5927 pref_t *pref = data;
5928 module_t *module = g_object_get_data (G_OBJECT(w), "module");
5929 gchar *value = NULL;
5931 GtkWidget *win, *main_tb, *main_vb, *bbox, *cancel_bt, *ok_bt;
5932 GtkWidget *entry, *label;
5933 GtkTooltips *tooltips;
5935 switch (pref->type) {
5937 switch (pref->info.base) {
5939 value = g_strdup_printf("%o", *pref->varp.uint);
5942 value = g_strdup_printf("%u", *pref->varp.uint);
5945 value = g_strdup_printf("%x", *pref->varp.uint);
5948 g_assert_not_reached();
5953 value = g_strdup(*pref->varp.string);
5956 value = g_strdup(range_convert_range (*pref->varp.range));
5959 g_assert_not_reached();
5963 tooltips = gtk_tooltips_new();
5965 win = dlg_window_new(module->description);
5967 gtk_window_set_resizable(GTK_WINDOW(win),FALSE);
5968 gtk_window_resize(GTK_WINDOW(win), 400, 100);
5970 main_vb = gtk_vbox_new(FALSE, 5);
5971 gtk_container_add(GTK_CONTAINER(win), main_vb);
5972 gtk_container_set_border_width(GTK_CONTAINER(main_vb), 6);
5974 main_tb = gtk_table_new(2, 2, FALSE);
5975 gtk_box_pack_start(GTK_BOX(main_vb), main_tb, FALSE, FALSE, 0);
5976 gtk_table_set_col_spacings(GTK_TABLE(main_tb), 10);
5978 label = gtk_label_new(ep_strdup_printf("%s:", pref->title));
5979 gtk_table_attach_defaults(GTK_TABLE(main_tb), label, 0, 1, 1, 2);
5980 gtk_misc_set_alignment(GTK_MISC(label), 1.0f, 0.5f);
5981 if (pref->description)
5982 gtk_tooltips_set_tip(tooltips, label, pref->description, NULL);
5984 entry = gtk_entry_new();
5985 gtk_table_attach_defaults(GTK_TABLE(main_tb), entry, 1, 2, 1, 2);
5986 gtk_entry_set_text(GTK_ENTRY(entry), value);
5987 if (pref->description)
5988 gtk_tooltips_set_tip(tooltips, entry, pref->description, NULL);
5990 bbox = dlg_button_row_new(GTK_STOCK_CANCEL,GTK_STOCK_OK, NULL);
5991 gtk_box_pack_end(GTK_BOX(main_vb), bbox, FALSE, FALSE, 0);
5993 ok_bt = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_OK);
5994 g_object_set_data (G_OBJECT(ok_bt), "module", module);
5995 g_object_set_data (G_OBJECT(ok_bt), "entry", entry);
5996 g_object_set_data (G_OBJECT(ok_bt), "pref", pref);
5997 g_signal_connect(ok_bt, "clicked", G_CALLBACK(menu_prefs_change_ok), win);
5999 dlg_set_activate(entry, ok_bt);
6001 cancel_bt = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_CANCEL);
6002 g_signal_connect(cancel_bt, "clicked", G_CALLBACK(menu_prefs_change_cancel), win);
6003 window_set_cancel_button(win, cancel_bt, NULL);
6005 gtk_widget_grab_default(ok_bt);
6006 gtk_widget_show_all(win);
6011 add_protocol_prefs_menu (pref_t *pref, gpointer data)
6013 GtkWidget *menu_preferences;
6014 GtkWidget *menu_item, *menu_sub_item, *sub_menu;
6015 GSList *group = NULL;
6016 module_t *module = data;
6017 const enum_val_t *enum_valp;
6018 gchar *label = NULL;
6020 switch (pref->type) {
6022 switch (pref->info.base) {
6024 label = g_strdup_printf ("%s: %o", pref->title, *pref->varp.uint);
6027 label = g_strdup_printf ("%s: %u", pref->title, *pref->varp.uint);
6030 label = g_strdup_printf ("%s: %x", pref->title, *pref->varp.uint);
6033 g_assert_not_reached();
6036 menu_item = gtk_menu_item_new_with_label(label);
6037 g_object_set_data (G_OBJECT(menu_item), "module", module);
6038 g_signal_connect(menu_item, "activate", G_CALLBACK(menu_prefs_edit_dlg), pref);
6042 menu_item = gtk_check_menu_item_new_with_label(pref->title);
6043 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menu_item), *pref->varp.boolp);
6044 g_object_set_data (G_OBJECT(menu_item), "module", module);
6045 g_signal_connect(menu_item, "activate", G_CALLBACK(menu_prefs_toggle_bool), pref->varp.boolp);
6048 menu_item = gtk_menu_item_new_with_label(pref->title);
6049 sub_menu = gtk_menu_new();
6050 gtk_menu_item_set_submenu (GTK_MENU_ITEM(menu_item), sub_menu);
6051 enum_valp = pref->info.enum_info.enumvals;
6052 while (enum_valp->name != NULL) {
6053 menu_sub_item = gtk_radio_menu_item_new_with_label(group, enum_valp->description);
6054 group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_sub_item));
6055 if (enum_valp->value == *pref->varp.enump) {
6056 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menu_sub_item), TRUE);
6058 g_object_set_data (G_OBJECT(menu_sub_item), "module", module);
6059 g_object_set_data (G_OBJECT(menu_sub_item), "enumval", GINT_TO_POINTER(enum_valp->value));
6060 g_signal_connect(menu_sub_item, "activate", G_CALLBACK(menu_prefs_change_enum), pref->varp.enump);
6061 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_sub_item);
6062 gtk_widget_show (menu_sub_item);
6067 label = g_strdup_printf ("%s: %s", pref->title, *pref->varp.string);
6068 menu_item = gtk_menu_item_new_with_label(label);
6069 g_object_set_data (G_OBJECT(menu_item), "module", module);
6070 g_signal_connect(menu_item, "activate", G_CALLBACK(menu_prefs_edit_dlg), pref);
6074 label = g_strdup_printf ("%s: %s", pref->title, range_convert_range (*pref->varp.range));
6075 menu_item = gtk_menu_item_new_with_label(label);
6076 g_object_set_data (G_OBJECT(menu_item), "module", module);
6077 g_signal_connect(menu_item, "activate", G_CALLBACK(menu_prefs_edit_dlg), pref);
6081 label = g_strdup_printf ("%s...", pref->title);
6082 menu_item = gtk_menu_item_new_with_label(label);
6083 g_signal_connect (menu_item, "activate", G_CALLBACK(uat_window_cb), pref->varp.uat);
6086 case PREF_STATIC_TEXT:
6089 /* Nothing to add */
6093 menu_preferences = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/ProtocolPreferences");
6094 if(!menu_preferences)
6095 g_warning("menu_preferences Not found path:TreeViewPopup/ProtocolPreferences");
6096 sub_menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM(menu_preferences));
6097 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
6098 gtk_widget_show (menu_item);
6104 rebuild_protocol_prefs_menu (module_t *prefs_module_p, gboolean preferences)
6106 GtkWidget *menu_preferences, *menu_item;
6107 GtkWidget *sub_menu;
6110 menu_preferences = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/ProtocolPreferences");
6112 sub_menu = gtk_menu_new();
6113 gtk_menu_item_set_submenu (GTK_MENU_ITEM(menu_preferences), sub_menu);
6115 label = g_strdup_printf ("%s Preferences...", prefs_module_p->description);
6116 menu_item = gtk_image_menu_item_new_with_label (label);
6117 gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM(menu_item),
6118 gtk_image_new_from_stock(GTK_STOCK_PREFERENCES, GTK_ICON_SIZE_MENU));
6119 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
6120 g_signal_connect_swapped(GTK_OBJECT(menu_item), "activate",
6121 G_CALLBACK(properties_cb), (GtkObject *) menu_item);
6122 gtk_widget_show (menu_item);
6125 menu_item = gtk_menu_item_new();
6126 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
6127 gtk_widget_show (menu_item);
6129 prefs_pref_foreach(prefs_module_p, add_protocol_prefs_menu, prefs_module_p);
6131 /* No preferences, remove sub menu */
6132 gtk_menu_item_set_submenu (GTK_MENU_ITEM(menu_preferences), NULL);
6137 #ifdef NEW_PACKET_LIST
6139 menu_visible_column_toggle (GtkWidget *w _U_, gpointer data)
6141 new_packet_list_toggle_visible_column (GPOINTER_TO_INT(data));
6145 rebuild_visible_columns_menu (void)
6147 GtkWidget *menu_columns[2], *menu_item;
6148 GtkWidget *sub_menu;
6152 gint i, col_id, cur_fmt;
6153 #ifdef MAIN_MENU_USE_UIMANAGER
6154 menu_columns[0] = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/DisplayedColumns");
6155 if(! menu_columns[0]){
6156 fprintf (stderr, "Warning: couldn't find menu_columns[0] path=/Menubar/ViewMenu/DisplayedColumns");
6159 menu_columns[0] = gtk_item_factory_get_widget(main_menu_factory, "/View/Displayed Columns");
6160 #endif /* MAIN_MENU_USE_UIMANAGER */
6161 menu_columns[1] = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/DisplayedColumns");
6163 if(! menu_columns[1]){
6164 fprintf (stderr, "Warning: couldn't find menu_columns[1] path=/PacketListHeadingPopup/DisplayedColumns");
6167 for (i = 0; i < 2; i++) {
6168 sub_menu = gtk_menu_new();
6169 gtk_menu_item_set_submenu (GTK_MENU_ITEM(menu_columns[i]), sub_menu);
6171 clp = g_list_first (prefs.col_list);
6174 cfmt = (fmt_data *) clp->data;
6175 cur_fmt = get_column_format_from_str(cfmt->fmt);
6176 if (cur_fmt == COL_CUSTOM) {
6177 title = g_strdup_printf ("%s (%s)", cfmt->title, cfmt->custom_field);
6179 title = g_strdup_printf ("%s (%s)", cfmt->title, col_format_desc (cur_fmt));
6181 menu_item = gtk_check_menu_item_new_with_label(title);
6183 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menu_item), cfmt->visible);
6184 g_signal_connect(menu_item, "activate", G_CALLBACK(menu_visible_column_toggle), GINT_TO_POINTER(col_id));
6185 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
6186 gtk_widget_show (menu_item);
6187 clp = g_list_next (clp);
6191 menu_item = gtk_menu_item_new();
6192 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
6193 gtk_widget_show (menu_item);
6195 menu_item = gtk_menu_item_new_with_label ("Display All");
6196 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
6197 g_signal_connect(menu_item, "activate", G_CALLBACK(packet_list_heading_activate_all_columns), NULL);
6198 gtk_widget_show (menu_item);
6204 menus_set_column_resolved (gboolean resolved, gboolean can_resolve)
6208 menu = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/ShowResolved");
6210 fprintf (stderr, "Warning: couldn't find menu path=/PacketListHeadingPopup/ShowResolved");
6212 g_object_set_data(G_OBJECT(menu), "skip-update", (void *)1);
6213 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), resolved && can_resolve);
6214 set_menu_sensitivity(ui_manager_packet_list_heading, "/PacketListHeadingPopup/ShowResolved", can_resolve);
6215 g_object_set_data(G_OBJECT(menu), "skip-update", NULL);
6219 menus_set_column_align_default (gboolean right_justify)
6221 GtkWidget *submenu, *menu_item_child;
6222 GList *child_list, *child_list_item;
6223 const gchar *menu_item_name;
6224 size_t menu_item_len;
6226 /* get the submenu container item */
6227 submenu = gtk_ui_manager_get_widget (ui_manager_packet_list_heading, "/PacketListHeadingPopup");
6229 fprintf (stderr, "Warning: couldn't find submenu path=/PacketListHeadingPopup");
6232 /* find the corresponding menu items to update */
6233 child_list = gtk_container_get_children(GTK_CONTAINER(submenu));
6234 child_list_item = child_list;
6235 while(child_list_item) {
6236 menu_item_child = (GTK_BIN(child_list_item->data))->child;
6237 if (menu_item_child != NULL) {
6238 menu_item_name = gtk_label_get_text(GTK_LABEL(menu_item_child));
6239 menu_item_len = strlen (menu_item_name);
6240 if(strncmp(menu_item_name, "Align Left", 10) == 0) {
6241 if (!right_justify && menu_item_len == 10) {
6242 gtk_label_set_text(GTK_LABEL(menu_item_child), "Align Left\t(default)");
6243 } else if (right_justify && menu_item_len > 10) {
6244 gtk_label_set_text(GTK_LABEL(menu_item_child), "Align Left");
6246 } else if (strncmp (menu_item_name, "Align Right", 11) == 0) {
6247 if (right_justify && menu_item_len == 11) {
6248 gtk_label_set_text(GTK_LABEL(menu_item_child), "Align Right\t(default)");
6249 } else if (!right_justify && menu_item_len > 11) {
6250 gtk_label_set_text(GTK_LABEL(menu_item_child), "Align Right");
6254 child_list_item = g_list_next(child_list_item);
6256 g_list_free(child_list);
6260 set_menus_for_selected_tree_row(capture_file *cf)
6262 gboolean properties;
6265 if (cf->finfo_selected != NULL) {
6266 header_field_info *hfinfo = cf->finfo_selected->hfinfo;
6270 if (hfinfo->parent == -1) {
6271 abbrev = hfinfo->abbrev;
6272 id = (hfinfo->type == FT_PROTOCOL) ? proto_get_id((protocol_t *)hfinfo->strings) : -1;
6274 abbrev = proto_registrar_get_abbrev(hfinfo->parent);
6275 id = hfinfo->parent;
6277 properties = prefs_is_registered_protocol(abbrev);
6278 set_menu_sensitivity(ui_manager_tree_view_menu,
6279 "/TreeViewPopup/GotoCorrespondingPacket", hfinfo->type == FT_FRAMENUM);
6280 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/Copy",
6282 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/Copy/AsFilter",
6283 proto_can_match_selected(cf->finfo_selected, cf->edt));
6284 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyasColumn",
6285 hfinfo->type != FT_NONE);
6286 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter",
6287 proto_can_match_selected(cf->finfo_selected, cf->edt));
6288 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter",
6289 proto_can_match_selected(cf->finfo_selected, cf->edt));
6290 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ColorizewithFilter",
6291 proto_can_match_selected(cf->finfo_selected, cf->edt));
6292 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ProtocolPreferences",
6294 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/DisableProtocol",
6295 (id == -1) ? FALSE : proto_can_toggle_protocol(id));
6296 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ExpandSubtrees",
6297 cf->finfo_selected->tree_type != -1);
6298 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/WikiProtocolPage",
6299 (id == -1) ? FALSE : TRUE);
6300 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FilterFieldReference",
6301 (id == -1) ? FALSE : TRUE);
6302 #ifdef MAIN_MENU_USE_UIMANAGER
6303 set_menu_sensitivity(ui_manager_tree_view_menu,
6304 "/Menubar/MenuFile/Export/SelectedPacketBytes", TRUE);
6305 set_menu_sensitivity(ui_manager_tree_view_menu,
6306 "/Menubar/MenuGo/GotoCorrespondingPacket", hfinfo->type == FT_FRAMENUM);
6307 set_menu_sensitivity(ui_manager_tree_view_menu, "/Menubar/MenuEdit/Copy/Description",
6308 proto_can_match_selected(cf->finfo_selected, cf->edt));
6309 set_menu_sensitivity(ui_manager_tree_view_menu, "/Menubar/MenuEdit/Copy/Fieldname",
6310 proto_can_match_selected(cf->finfo_selected, cf->edt));
6311 set_menu_sensitivity(ui_manager_tree_view_menu, "/Menubar/MenuEdit/Copy/Value",
6312 proto_can_match_selected(cf->finfo_selected, cf->edt));
6313 set_menu_sensitivity(ui_manager_tree_view_menu, "/Menubar/MenuEdit/Copy/AsFilter",
6314 proto_can_match_selected(cf->finfo_selected, cf->edt));
6315 set_menu_sensitivity(ui_manager_tree_view_menu, "/Menubar/MenuAnalyze/ApplyasColumn",
6316 hfinfo->type != FT_NONE);
6317 set_menu_sensitivity(ui_manager_tree_view_menu, "/Menubar/MenuAnalyze/ApplyAsFilter",
6318 proto_can_match_selected(cf->finfo_selected, cf->edt));
6319 set_menu_sensitivity(ui_manager_tree_view_menu, "/Menubar/MenuAnalyze/PrepareaFilter",
6320 proto_can_match_selected(cf->finfo_selected, cf->edt));
6321 set_menu_sensitivity(ui_manager_tree_view_menu, "/Menubar/MenuView/ExpandSubtrees",
6322 cf->finfo_selected->tree_type != -1);
6324 set_menu_sensitivity_old(
6325 "/File/Export/Selected Packet Bytes...", TRUE);
6326 set_menu_sensitivity_old(
6327 "/Go/Go to Corresponding Packet", hfinfo->type == FT_FRAMENUM);
6328 set_menu_sensitivity_old("/Edit/Copy/Description",
6329 proto_can_match_selected(cf->finfo_selected, cf->edt));
6330 set_menu_sensitivity_old("/Edit/Copy/Fieldname",
6331 proto_can_match_selected(cf->finfo_selected, cf->edt));
6332 set_menu_sensitivity_old("/Edit/Copy/Value",
6333 proto_can_match_selected(cf->finfo_selected, cf->edt));
6334 set_menu_sensitivity_old("/Edit/Copy/As Filter",
6335 proto_can_match_selected(cf->finfo_selected, cf->edt));
6336 set_menu_sensitivity_old("/Analyze/Apply as Column",
6337 hfinfo->type != FT_NONE);
6338 set_menu_sensitivity_old("/Analyze/Apply as Filter",
6339 proto_can_match_selected(cf->finfo_selected, cf->edt));
6340 set_menu_sensitivity_old("/Analyze/Prepare a Filter",
6341 proto_can_match_selected(cf->finfo_selected, cf->edt));
6342 set_menu_sensitivity_old("/View/Expand Subtrees",
6343 cf->finfo_selected->tree_type != -1);
6345 prev_abbrev = g_object_get_data(G_OBJECT(ui_manager_tree_view_menu), "menu_abbrev");
6346 if (!prev_abbrev || (strcmp (prev_abbrev, abbrev) != 0)) {
6347 /* No previous protocol or protocol changed - update Protocol Preferences menu */
6348 module_t *prefs_module_p = prefs_find_module(abbrev);
6349 rebuild_protocol_prefs_menu (prefs_module_p, properties);
6351 g_object_set_data(G_OBJECT(ui_manager_tree_view_menu), "menu_abbrev", g_strdup(abbrev));
6352 g_free (prev_abbrev);
6355 set_menu_sensitivity(ui_manager_tree_view_menu,
6356 "/TreeViewPopup/GotoCorrespondingPacket", FALSE);
6357 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/Copy", FALSE);
6358 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyasColumn", FALSE);
6359 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter", FALSE);
6360 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter", FALSE);
6361 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ColorizewithFilter", FALSE);
6362 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ProtocolPreferences",
6364 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/DisableProtocol", FALSE);
6365 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ExpandSubtrees", FALSE);
6366 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/WikiProtocolPage",
6368 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FilterFieldReference",
6370 #ifdef MAIN_MENU_USE_UIMANAGER
6371 set_menu_sensitivity(ui_manager_main_menubar,
6372 "/Menubar/FileMenu/Export/SelectedPacketBytes", FALSE);
6373 set_menu_sensitivity(ui_manager_main_menubar,
6374 "/Menubar/GoMenu/GotoCorrespondingPacket", FALSE);
6375 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Copy/Description", FALSE);
6376 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Copy/Fieldname", FALSE);
6377 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Copy/Value", FALSE);
6378 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Copy/AsFilter", FALSE);
6379 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/ApplyasColumn", FALSE);
6380 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/ApplyAsFilter", FALSE);
6381 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/PrepareaFilter", FALSE);
6382 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ExpandSubtrees", FALSE);
6384 set_menu_sensitivity_old("/File/Export/Selected Packet Bytes...", FALSE);
6385 set_menu_sensitivity_old("/Go/Go to Corresponding Packet", FALSE);
6386 set_menu_sensitivity_old("/Edit/Copy/Description", FALSE);
6387 set_menu_sensitivity_old("/Edit/Copy/Fieldname", FALSE);
6388 set_menu_sensitivity_old("/Edit/Copy/Value", FALSE);
6389 set_menu_sensitivity_old("/Edit/Copy/As Filter", FALSE);
6390 set_menu_sensitivity_old("/Analyze/Apply as Column", FALSE);
6391 set_menu_sensitivity_old("/Analyze/Apply as Filter", FALSE);
6392 set_menu_sensitivity_old("/Analyze/Prepare a Filter", FALSE);
6393 set_menu_sensitivity_old("/View/Expand Subtrees", FALSE);
6394 #endif /* MAIN_MENU_USE_UIMANAGER */
6397 walk_menu_tree_for_selected_tree_row(tap_menu_tree_root, cf->finfo_selected);
6400 void set_menus_for_packet_history(gboolean back_history, gboolean forward_history) {
6401 #ifdef MAIN_MENU_USE_UIMANAGER
6402 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/Back", back_history);
6403 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/Forward", forward_history);
6405 set_menu_sensitivity_old("/Go/Back", back_history);
6406 set_menu_sensitivity_old("/Go/Forward", forward_history);
6407 #endif /* MAIN_MENU_USE_UIMANAGER */
6408 set_toolbar_for_packet_history(back_history, forward_history);
6412 void set_menus_for_file_set(gboolean file_set, gboolean previous_file, gboolean next_file) {
6413 #ifdef MAIN_MENU_USE_UIMANAGER
6414 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Set/ListFiles", file_set);
6415 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Set/PreviousFile", previous_file);
6416 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Set/NextFile", next_file);
6418 set_menu_sensitivity_old("/File/File Set/List Files", file_set);
6419 set_menu_sensitivity_old("/File/File Set/Previous File", previous_file);
6420 set_menu_sensitivity_old("/File/File Set/Next File", next_file);
6421 #endif /* MAIN_MENU_USE_UIMANAGER */
6424 GtkWidget *menus_get_profiles_menu (void)
6426 return gtk_ui_manager_get_widget(ui_manager_statusbar_profiles_menu, "/ProfilesMenuPopup/Change");
6429 void set_menus_for_profiles(gboolean default_profile)
6431 set_menu_sensitivity(ui_manager_statusbar_profiles_menu, "/ProfilesMenuPopup/Delete", !default_profile);
6432 set_menu_sensitivity(ui_manager_statusbar_profiles_menu, "/ProfilesMenuPopup/Rename", !default_profile);
6441 * indent-tabs-mode: nil
6444 * ex: set shiftwidth=4 tabstop=8 expandtab
6445 * :indentSize=4:tabSize=8:noTabs=true: