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/file_import_dlg.h"
64 #include "gtk/find_dlg.h"
65 #include "gtk/goto_dlg.h"
66 #include "gtk/summary_dlg.h"
67 #include "gtk/prefs_dlg.h"
68 #include "gtk/packet_win.h"
69 #include "gtk/follow_tcp.h"
70 #include "gtk/follow_udp.h"
71 #include "gtk/follow_ssl.h"
72 #include "gtk/decode_as_dlg.h"
73 #include "gtk/help_dlg.h"
74 #include "gtk/supported_protos_dlg.h"
75 #include "gtk/proto_dlg.h"
76 #include "gtk/proto_hier_stats_dlg.h"
78 #include "gtk/stock_icons.h"
79 #include "gtk/gtkglobals.h"
80 #include "gtk/recent.h"
81 #include "gtk/main_proto_draw.h"
82 #include "gtk/conversations_table.h"
83 #include "gtk/hostlist_table.h"
84 #include "gtk/packet_history.h"
85 #include "gtk/sctp_stat.h"
86 #include "gtk/firewall_dlg.h"
88 #include "gtk/macros_dlg.h"
89 #include "gtk/export_object.h"
90 #include "gtk/gui_stat_menu.h"
92 #include "gtk/menus.h"
93 #include "gtk/main_toolbar.h"
94 #include "gtk/main_welcome.h"
95 #include "gtk/uat_gui.h"
96 #include "gtk/gui_utils.h"
97 #include "gtk/manual_addr_resolv.h"
98 #include "gtk/proto_help.h"
99 #include "gtk/dissector_tables_dlg.h"
100 #include "gtk/utf8_entities.h"
102 #ifdef NEW_PACKET_LIST
103 #include "gtk/new_packet_list.h"
105 #include "gtk/main_packet_list.h"
108 #ifdef HAVE_IGE_MAC_INTEGRATION
109 #include <ige-mac-menu.h>
112 #ifdef HAVE_GTKOSXAPPLICATION
113 #include <igemacintegration/gtkosxapplication.h>
116 static int initialize = TRUE;
117 #ifdef MAIN_MENU_USE_UIMANAGER
118 GtkActionGroup *main_menu_bar_action_group;
120 static GtkItemFactory *main_menu_factory = NULL;
121 #endif /* MAIN_MENU_USE_UIMANAGER */
122 static GtkUIManager *ui_manager_main_menubar = NULL;
123 static GtkUIManager *ui_manager_packet_list_heading = NULL;
124 static GtkUIManager *ui_manager_packet_list_menu = NULL;
125 static GtkUIManager *ui_manager_tree_view_menu = NULL;
126 static GtkUIManager *ui_manager_bytes_menu = NULL;
127 static GtkUIManager *ui_manager_statusbar_profiles_menu = NULL;
128 static GSList *popup_menu_list = NULL;
130 static GtkAccelGroup *grp;
132 typedef struct _menu_item {
136 const char *stock_id;
138 GtkItemFactoryCallback callback;
139 gpointer callback_data;
140 gboolean (*selected_packet_enabled)(frame_data *, epan_dissect_t *, gpointer callback_data);
141 gboolean (*selected_tree_row_enabled)(field_info *, gpointer callback_data);
145 static GList *tap_menu_tree_root = NULL;
147 GtkWidget *popup_menu_object;
150 #define GTK_MENU_FUNC(a) ((GtkItemFactoryCallback)(a))
152 static void merge_all_tap_menus(GList *node);
153 #ifdef MAIN_MENU_USE_UIMANAGER
154 static void menu_open_recent_file_cmd_cb(GtkAction *action, gpointer data _U_ );
155 static void add_recent_items (guint merge_id, GtkUIManager *ui_manager);
156 #endif /* MAIN_MENU_USE_UIMANAGER */
158 static void menus_init(void);
159 static void set_menu_sensitivity (GtkUIManager *ui_manager, const gchar *, gint);
160 #ifndef MAIN_MENU_USE_UIMANAGER
161 static void clear_menu_recent_capture_file_cmd_cb(GtkWidget *w, gpointer unused _U_);
162 static void set_menu_sensitivity_old (const gchar *, gint);
163 #endif /* MAIN_MENU_USE_UIMANAGER */
164 static void show_hide_cb(GtkWidget *w, gpointer data, gint action);
165 #ifndef MAIN_MENU_USE_UIMANAGER
166 static void timestamp_format_cb(GtkWidget *w, gpointer d, gint action);
167 static void timestamp_precision_cb(GtkWidget *w, gpointer d, gint action);
169 static void timestamp_seconds_time_cb(GtkWidget *w, gpointer d, gint action);
170 static void name_resolution_cb(GtkWidget *w, gpointer d, gint action);
172 #ifndef MAIN_MENU_USE_UIMANAGER
173 static void auto_scroll_live_cb(GtkWidget *w, gpointer d);
176 static void colorize_cb(GtkWidget *w, gpointer d);
179 /* As a general GUI guideline, we try to follow the Gnome Human Interface Guidelines, which can be found at:
180 http://developer.gnome.org/projects/gup/hig/1.0/index.html
182 Please note: there are some differences between the Gnome HIG menu suggestions and our implementation:
184 File/Open Recent: the Gnome HIG suggests putting the list of recently used files as elements into the File menuitem.
185 As this is ok for only a few items, this will become unhandy for 10 or even more list entries.
186 For this reason, we use a submenu for this.
188 File/Close: the Gnome HIG suggests putting this item just above the Quit item.
189 This results in unintuitive behaviour as both Close and Quit items are very near together.
190 By putting the Close item near the open item(s), it better suggests that it will close the
191 currently opened/captured file only.
195 SHOW_HIDE_MAIN_TOOLBAR = 1,
196 SHOW_HIDE_FILTER_TOOLBAR,
197 SHOW_HIDE_AIRPCAP_TOOLBAR,
199 SHOW_HIDE_PACKET_LIST,
202 } show_hide_values_e;
213 build_conversation_filter(int action, gboolean show_dialog)
215 packet_info *pi = &cfile.edt->pi;
221 if (pi->profinet_type == 0) {
223 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
224 "Error filtering conversation. Please make\n"
225 "sure you have a PROFINET CBA packet selected.");
230 if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4
231 && pi->ipproto == IP_PROTO_TCP ) {
233 switch(pi->profinet_type) {
235 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)",
236 ip_to_str( pi->net_dst.data),
237 ip_to_str( pi->net_src.data),
238 ip_to_str( pi->net_src.data),
239 ip_to_str( pi->net_dst.data));
242 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)",
243 ip_to_str( pi->net_src.data),
244 ip_to_str( pi->net_dst.data),
245 ip_to_str( pi->net_dst.data),
246 ip_to_str( pi->net_src.data));
249 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)",
250 ip_to_str( pi->net_dst.data),
251 ip_to_str( pi->net_src.data),
252 ip_to_str( pi->net_src.data),
253 ip_to_str( pi->net_dst.data));
256 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)",
257 ip_to_str( pi->net_src.data),
258 ip_to_str( pi->net_dst.data),
259 ip_to_str( pi->net_dst.data),
260 ip_to_str( pi->net_src.data));
270 if (pi->ipproto != IP_PROTO_TCP) {
272 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
273 "Error filtering conversation. Please make\n"
274 "sure you have a TCP packet selected.");
279 if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4 ) {
281 buf = g_strdup_printf("(ip.addr eq %s and ip.addr eq %s) and (tcp.port eq %d and tcp.port eq %d)",
282 ip_to_str( pi->net_src.data),
283 ip_to_str( pi->net_dst.data),
284 pi->srcport, pi->destport );
285 } else if( pi->net_src.type == AT_IPv6 && pi->net_dst.type == AT_IPv6 ) {
287 buf = g_strdup_printf("(ipv6.addr eq %s and ipv6.addr eq %s) and (tcp.port eq %d and tcp.port eq %d)",
288 ip6_to_str((const struct e_in6_addr *)pi->net_src.data),
289 ip6_to_str((const struct e_in6_addr *)pi->net_dst.data),
290 pi->srcport, pi->destport );
296 if (pi->ipproto != IP_PROTO_UDP) {
298 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
299 "Error filtering conversation. Please make\n"
300 "sure you have a UDP packet selected.");
305 if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4 ) {
307 buf = g_strdup_printf("(ip.addr eq %s and ip.addr eq %s) and (udp.port eq %d and udp.port eq %d)",
308 ip_to_str( pi->net_src.data),
309 ip_to_str( pi->net_dst.data),
310 pi->srcport, pi->destport );
311 } else if( pi->net_src.type == AT_IPv6 && pi->net_dst.type == AT_IPv6 ) {
313 buf = g_strdup_printf("(ipv6.addr eq %s and ipv6.addr eq %s) and (udp.port eq %d and udp.port eq %d)",
314 ip6_to_str((const struct e_in6_addr *)pi->net_src.data),
315 ip6_to_str((const struct e_in6_addr *)pi->net_dst.data),
316 pi->srcport, pi->destport );
322 if ((pi->ethertype != ETHERTYPE_IP) && (pi->ethertype != ETHERTYPE_IPv6)) {
324 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
325 "Error filtering conversation. Please make\n"
326 "sure you have a IP packet selected.");
331 if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4 ) {
333 buf = g_strdup_printf("ip.addr eq %s and ip.addr eq %s",
334 ip_to_str( pi->net_src.data),
335 ip_to_str( pi->net_dst.data));
336 } else if( pi->net_src.type == AT_IPv6 && pi->net_dst.type == AT_IPv6 ) {
338 buf = g_strdup_printf("ipv6.addr eq %s and ipv6.addr eq %s",
339 ip6_to_str((const struct e_in6_addr *)pi->net_src.data),
340 ip6_to_str((const struct e_in6_addr *)pi->net_dst.data));
346 /* XXX - is this the right way to check for Ethernet? */
347 /* check for the data link address type */
348 /* (ethertype will be 0 when used as length field) */
349 if (pi->dl_src.type != AT_ETHER) {
351 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
352 "Error filtering conversation. Please make\n"
353 "sure you have a Ethernet packet selected.");
358 if( pi->dl_src.type == AT_ETHER && pi->dl_dst.type == AT_ETHER ) {
360 buf = g_strdup_printf("eth.addr eq %s and eth.addr eq %s",
361 ether_to_str( pi->dl_src.data),
362 ether_to_str( pi->dl_dst.data));
375 conversation_cb(GtkAction *a _U_, gpointer data _U_, int action)
378 GtkWidget *filter_te;
380 if (cfile.current_frame) {
381 /* create a filter-string based on the selected packet and action */
382 filter = build_conversation_filter(action, TRUE);
384 /* Run the display filter so it goes in effect - even if it's the
385 same as the previous display filter. */
386 filter_te = gtk_bin_get_child(GTK_BIN(g_object_get_data(G_OBJECT(top_level), E_DFILTER_CM_KEY)));
388 gtk_entry_set_text(GTK_ENTRY(filter_te), filter);
389 main_filter_packets(&cfile, filter, TRUE);
396 colorize_conversation_cb(GtkWidget * w _U_, gpointer data _U_, int action)
398 gchar *filter = NULL;
400 if( (action>>8) == 255 ) {
401 color_filters_reset_tmp();
402 #ifdef NEW_PACKET_LIST
403 new_packet_list_colorize_packets();
405 cf_colorize_packets(&cfile);
407 } else if (cfile.current_frame) {
408 if( (action&0xff) == 0 ) {
409 /* colorize_conversation_cb was called from the window-menu
410 * or through an accelerator key. Try to build a conversation
411 * filter in the order TCP, UDP, IP, Ethernet and apply the
413 filter = build_conversation_filter(CONV_TCP,FALSE);
415 filter = build_conversation_filter(CONV_UDP,FALSE);
417 filter = build_conversation_filter(CONV_IP,FALSE);
419 filter = build_conversation_filter(CONV_ETHER,FALSE);
420 if( filter == NULL ) {
421 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Unable to build conversation filter.");
425 /* create a filter-string based on the selected packet and action */
426 filter = build_conversation_filter(action&0xff, TRUE);
429 if( (action>>8) == 0) {
430 /* Open the "new coloring filter" dialog with the filter */
431 color_display_with_filter(filter);
433 /* Set one of the temporary coloring filters */
434 color_filters_set_tmp((guint8)(action>>8),filter,FALSE);
435 #ifdef NEW_PACKET_LIST
436 new_packet_list_colorize_packets();
438 cf_colorize_packets(&cfile);
447 goto_conversation_frame(gboolean dir)
450 dfilter_t *dfcode = NULL;
451 gboolean found_packet=FALSE;
453 filter = build_conversation_filter(CONV_TCP,FALSE);
455 filter = build_conversation_filter(CONV_UDP,FALSE);
457 filter = build_conversation_filter(CONV_IP,FALSE);
458 if( filter == NULL ) {
459 simple_status("Unable to build conversation filter.");
464 if (!dfilter_compile(filter, &dfcode)) {
465 /* The attempt failed; report an error. */
466 simple_status("Error compiling filter for this conversation.");
471 found_packet = cf_find_packet_dfilter(&cfile, dfcode, dir);
474 /* We didn't find a packet */
475 simple_status("No previous/next packet in conversation.");
478 dfilter_free(dfcode);
482 #ifdef MAIN_MENU_USE_UIMANAGER
484 goto_next_frame_conversation_cb(GtkAction *action _U_, gpointer user_data _U_)
486 goto_conversation_frame(FALSE);
490 goto_previous_frame_conversation_cb(GtkAction *action _U_, gpointer user_data _U_)
492 goto_conversation_frame(TRUE);
496 goto_next_frame_conversation_cb(GtkWidget *w _U_, gpointer d _U_)
498 goto_conversation_frame(FALSE);
502 goto_previous_frame_conversation_cb(GtkWidget *w _U_, gpointer d _U_)
504 goto_conversation_frame(TRUE);
506 #endif /* MAIN_MENU_USE_UIMANAGER */
513 tree_view_menu_apply_selected_cb(GtkAction *action _U_, gpointer user_data)
515 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter/Selected");
516 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_REPLACE|MATCH_SELECTED_APPLY_NOW);
520 tree_view_menu_apply_not_selected_cb(GtkAction *action _U_, gpointer user_data)
522 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter/NotSelected");
523 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_NOT|MATCH_SELECTED_APPLY_NOW);
527 tree_view_menu_apply_and_selected_cb(GtkAction *action _U_, gpointer user_data)
529 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter/AndSelected");
530 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_AND|MATCH_SELECTED_APPLY_NOW);
534 tree_view_menu_apply_or_selected_cb(GtkAction *action _U_, gpointer user_data)
536 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter/OrSelected");
537 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_OR|MATCH_SELECTED_APPLY_NOW);
541 tree_view_menu_apply_and_not_selected_cb(GtkAction *action _U_, gpointer user_data)
543 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter/AndNotSelected");
544 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_AND_NOT|MATCH_SELECTED_APPLY_NOW);
548 tree_view_menu_apply_or_not_selected_cb(GtkAction *action _U_, gpointer user_data)
550 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter/OrNotSelected");
551 match_selected_ptree_cb( widget , user_data,MATCH_SELECTED_OR_NOT|MATCH_SELECTED_APPLY_NOW);
553 /* Prepare a filter */
555 tree_view_menu_prepare_selected_cb(GtkAction *action _U_, gpointer user_data)
557 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter/Selected");
558 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_REPLACE);
562 tree_view_menu_prepare_not_selected_cb(GtkAction *action _U_, gpointer user_data)
564 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter/NotSelected");
565 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_NOT);
569 tree_view_menu_prepare_and_selected_cb(GtkAction *action _U_, gpointer user_data)
571 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter/AndSelected");
572 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_AND);
576 tree_view_menu_prepare_or_selected_cb(GtkAction *action _U_, gpointer user_data)
578 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter/OrSelected");
579 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_OR);
583 tree_view_menu_prepare_and_not_selected_cb(GtkAction *action _U_, gpointer user_data)
585 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter/AndNotSelected");
586 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_AND_NOT);
590 tree_view_menu_prepare_or_not_selected_cb(GtkAction *action _U_, gpointer user_data)
592 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter/OrNotSelected");
593 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_OR_NOT);
596 /* Prepare for use of GTKUImanager */
597 #ifdef MAIN_MENU_USE_UIMANAGER
600 copy_description_cb(GtkAction *action _U_, gpointer user_data)
602 copy_selected_plist_cb( NULL /* widget _U_ */ , user_data, COPY_SELECTED_DESCRIPTION);
606 copy_fieldname_cb(GtkAction *action _U_, gpointer user_data)
608 copy_selected_plist_cb( NULL /* widget _U_ */ , user_data, COPY_SELECTED_FIELDNAME);
612 copy_value_cb(GtkAction *action _U_, gpointer user_data)
614 copy_selected_plist_cb( NULL /* widget _U_ */ , user_data, COPY_SELECTED_VALUE);
618 copy_as_filter_cb(GtkAction *action _U_, gpointer user_data)
620 match_selected_ptree_cb( NULL /* widget _U_ */ , user_data, MATCH_SELECTED_REPLACE|MATCH_SELECTED_COPY_ONLY);
624 set_reftime_cb(GtkAction *action _U_, gpointer user_data)
626 reftime_frame_cb( NULL /* widget _U_ */ , user_data, REFTIME_TOGGLE);
630 find_next_ref_time_cb(GtkAction *action _U_, gpointer user_data)
632 reftime_frame_cb( NULL /* widget _U_ */ , user_data, REFTIME_FIND_NEXT);
636 find_previous_ref_time_cb(GtkAction *action _U_, gpointer user_data)
638 reftime_frame_cb( NULL /* widget _U_ */ , user_data, REFTIME_FIND_PREV);
642 menus_prefs_cb(GtkAction *action _U_, gpointer user_data)
644 prefs_page_cb( NULL /* widget _U_ */ , user_data, PREFS_PAGE_USER_INTERFACE);
648 main_toolbar_show_hide_cb(GtkAction *action _U_, gpointer user_data)
650 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/MainToolbar");
653 g_warning("main_toolbar_show_hide_cb: No widget found");
655 show_hide_cb( widget, user_data, SHOW_HIDE_MAIN_TOOLBAR);
660 filter_toolbar_show_hide_cb(GtkAction * action _U_, gpointer user_data)
662 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/FilterToolbar");
664 g_warning("filter_toolbar_show_hide_cb: No widget found");
666 show_hide_cb( widget, user_data, SHOW_HIDE_FILTER_TOOLBAR);
672 wireless_toolbar_show_hide_cb(GtkAction *action _U_, gpointer user_data)
674 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/WirelessToolbar");
676 g_warning("wireless_toolbar_show_hide_cb: No widget found");
678 show_hide_cb( widget, user_data, SHOW_HIDE_AIRPCAP_TOOLBAR);
681 #endif /* HAVE_AIRPCAP */
684 status_bar_show_hide_cb(GtkAction *action _U_, gpointer user_data)
686 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/Statusbar");
688 g_warning("status_bar_show_hide_cb: No widget found");
690 show_hide_cb( widget, user_data, SHOW_HIDE_STATUSBAR);
694 packet_list_show_hide_cb(GtkAction *action _U_, gpointer user_data)
696 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/PacketList");
698 g_warning("packet_list_show_hide_cb: No widget found");
700 show_hide_cb( widget, user_data, SHOW_HIDE_PACKET_LIST);
704 packet_details_show_hide_cb(GtkAction *action _U_, gpointer user_data)
706 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/PacketDetails");
708 g_warning("packet_details_show_hide_cb: No widget found");
710 show_hide_cb( widget, user_data, SHOW_HIDE_TREE_VIEW);
714 packet_bytes_show_hide_cb(GtkAction *action _U_, gpointer user_data)
716 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/PacketBytes");
718 g_warning("packet_bytes_show_hide_cb: No widget found");
720 show_hide_cb( widget, user_data, SHOW_HIDE_BYTE_VIEW);
725 timestamp_format_new_cb (GtkRadioAction *action, GtkRadioAction *current _U_, gpointer user_data _U_)
729 value = gtk_radio_action_get_current_value (action);
730 g_warning("timestamp_format_new_cb, value %u, recent.gui_time_format %u",value, recent.gui_time_format);
731 if (recent.gui_time_format != value) {
732 timestamp_set_type(value);
733 recent.gui_time_format = value;
734 #ifdef NEW_PACKET_LIST
735 /* This call adjusts column width */
736 cf_timestamp_auto_precision(&cfile);
737 new_packet_list_queue_draw();
739 cf_change_time_formats(&cfile);
746 timestamp_precision_new_cb (GtkRadioAction *action, GtkRadioAction *current _U_, gpointer user_data _U_)
750 value = gtk_radio_action_get_current_value (action);
751 g_warning("timestamp_precision_new_cb, value %u, recent.gui_time_precision %u",value, recent.gui_time_precision);
752 if (recent.gui_time_precision != value) {
753 /* the actual precision will be set in cf_change_time_formats() below */
754 if (value == TS_PREC_AUTO) {
755 timestamp_set_precision(TS_PREC_AUTO_SEC);
757 timestamp_set_precision(value);
759 recent.gui_time_precision = value;
760 #ifdef NEW_PACKET_LIST
761 /* This call adjusts column width */
762 cf_timestamp_auto_precision(&cfile);
763 new_packet_list_queue_draw();
765 cf_change_time_formats(&cfile);
772 view_menu_seconds_time_cb(GtkAction *action _U_, gpointer user_data)
774 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/TimeDisplayFormat/DisplaySecondsWithHoursAndMinutes");
776 g_warning("view_menu_seconds_time_cb: No widget found");
778 timestamp_seconds_time_cb(widget, user_data, 0);
783 view_menu_en_for_MAC_cb(GtkAction *action _U_, gpointer user_data)
785 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/EnableforMACLayer");
787 g_warning("view_menu_en_for_MAC_cb: No widget found");
789 name_resolution_cb( widget , user_data, RESOLV_MAC);
794 view_menu_en_for_network_cb(GtkAction *action _U_, gpointer user_data)
796 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/EnableforNetworkLayer");
798 g_warning("view_menu_en_for_network_cb: No widget found");
800 name_resolution_cb( widget , user_data, RESOLV_NETWORK);
805 view_menu_en_for_transport_cb(GtkAction *action _U_, gpointer user_data)
807 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/EnableforTransportLayer");
809 g_warning("view_menu_en_for_transport_cb: No widget found");
811 name_resolution_cb( widget , user_data, RESOLV_TRANSPORT);
816 view_menu_colorize_pkt_lst_cb(GtkAction *action _U_, gpointer user_data)
818 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/ColorizePacketList");
820 g_warning("view_menu_colorize_pkt_lst_cb: No widget found");
822 colorize_cb( widget , user_data);
828 view_menu_auto_scroll_live_cb(GtkAction *action _U_, gpointer user_data _U_)
830 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/AutoScrollinLiveCapture");
833 g_warning("view_menu_auto_scroll_live_cb: No widget found");
835 menu_auto_scroll_live_changed(GTK_CHECK_MENU_ITEM(widget)->active);
840 view_menu_color_conv_color1_cb(GtkAction *action _U_, gpointer user_data)
842 colorize_conversation_cb( NULL /* widget _U_*/ , user_data, 1*256);
847 view_menu_color_conv_color2_cb(GtkAction *action _U_, gpointer user_data)
849 colorize_conversation_cb( NULL /* widget _U_*/ , user_data, 2*256);
853 view_menu_color_conv_color3_cb(GtkAction *action _U_, gpointer user_data)
855 colorize_conversation_cb( NULL /* widget _U_*/ , user_data, 3*256);
859 view_menu_color_conv_color4_cb(GtkAction *action _U_, gpointer user_data)
861 colorize_conversation_cb( NULL /* widget _U_*/ , user_data, 4*256);
865 view_menu_color_conv_color5_cb(GtkAction *action _U_, gpointer user_data)
867 colorize_conversation_cb( NULL /* widget _U_*/ , user_data, 5*256);
871 view_menu_color_conv_color6_cb(GtkAction *action _U_, gpointer user_data)
873 colorize_conversation_cb( NULL /* widget _U_*/ , user_data, 6*256);
877 view_menu_color_conv_color7_cb(GtkAction *action _U_, gpointer user_data)
879 colorize_conversation_cb( NULL /* widget _U_*/ , user_data, 7*256);
883 view_menu_color_conv_color8_cb(GtkAction *action _U_, gpointer user_data)
885 colorize_conversation_cb( NULL /* widget _U_*/ , user_data, 8*256);
889 view_menu_color_conv_color9_cb(GtkAction *action _U_, gpointer user_data)
891 colorize_conversation_cb( NULL /* widget _U_*/ , user_data, 9*256);
895 view_menu_color_conv_color10_cb(GtkAction *action _U_, gpointer user_data)
897 colorize_conversation_cb( NULL /* widget _U_*/ , user_data, 10*256);
902 view_menu_color_conv_new_rule_cb(GtkAction *action _U_, gpointer user_data)
904 colorize_conversation_cb( NULL /* widget _U_*/ , user_data, 0);
909 view_menu_reset_coloring_cb(GtkAction *action _U_, gpointer user_data)
911 colorize_conversation_cb( NULL /* widget _U_*/ , user_data, 255*256);
916 help_menu_cont_cb(GtkAction *action _U_, gpointer user_data _U_)
918 topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(HELP_CONTENT));
922 help_menu_faq_cb(GtkAction *action _U_, gpointer user_data _U_)
924 topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(ONLINEPAGE_FAQ));
928 help_menu_wireshark_cb(GtkAction *action _U_, gpointer user_data _U_)
930 topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_WIRESHARK));
934 help_menu_wireshark_flt_cb(GtkAction *action _U_, gpointer user_data _U_)
936 topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_WIRESHARK_FILTER));
940 help_menu_Tshark_cb(GtkAction *action _U_, gpointer user_data _U_)
942 topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_TSHARK));
946 help_menu_RawShark_cb(GtkAction *action _U_, gpointer user_data _U_)
948 topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_RAWSHARK));
952 help_menu_Dumpcap_cb(GtkAction *action _U_, gpointer user_data _U_)
954 topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_DUMPCAP));
958 help_menu_Mergecap_cb(GtkAction *action _U_, gpointer user_data _U_)
960 topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_MERGECAP));
964 help_menu_Editcap_cb(GtkAction *action _U_, gpointer user_data _U_)
966 topic_menu_cb(NULL/* widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_EDITCAP));
970 help_menu_Text2pcap_cb(GtkAction *action _U_, gpointer user_data _U_)
972 topic_menu_cb(NULL/* widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_TEXT2PCAP));
976 help_menu_Website_cb(GtkAction *action _U_, gpointer user_data _U_)
978 topic_menu_cb(NULL/* widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(ONLINEPAGE_HOME));
982 help_menu_Wiki_cb(GtkAction *action _U_, gpointer user_data _U_)
984 topic_menu_cb(NULL/* widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(ONLINEPAGE_WIKI));
988 help_menu_Downloads_cb(GtkAction *action _U_, gpointer user_data _U_)
990 topic_menu_cb(NULL/* widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(ONLINEPAGE_DOWNLOAD));
994 help_menu_SampleCaptures_cb(GtkAction *action _U_, gpointer user_data _U_)
996 topic_menu_cb( NULL/* widget_U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(ONLINEPAGE_SAMPLE_FILES));
999 static const char *ui_desc_menubar =
1001 " <menubar name ='Menubar'>\n"
1002 " <menu name= 'FileMenu' action='/File'>\n"
1003 " <menuitem name='Open' action='/File/Open'/>\n"
1004 " <menu name='OpenRecent' action='/File/OpenRecent'>\n"
1005 " <placeholder name='RecentFiles'/>\n"
1007 " <menuitem name='Merge' action='/File/Merge'/>\n"
1008 " <menuitem name='Import' action='/File/Import'/>\n"
1009 " <menuitem name='Close' action='/File/Close'/>\n"
1011 " <menuitem name='Save' action='/File/Save'/>\n"
1012 " <menuitem name='SaveAs' action='/File/SaveAs'/>\n"
1014 " <menu name= 'Set' action='/File/Set'>\n"
1015 " <menuitem name='ListFiles' action='/File/Set/ListFiles'/>\n"
1016 " <menuitem name='NextFile' action='/File/Set/NextFile'/>\n"
1017 " <menuitem name='PreviousFile' action='/File/Set/PreviousFile'/>\n"
1020 " <menu name= 'Export' action='/File/Export'>\n"
1022 " <menuitem name='File' action='/File/Export/File'/>\n"
1024 " <menu name= 'File' action='/File/Export/File'>\n"
1025 " <menuitem name='AsTxt' action='/File/Export/File/Text'/>\n"
1026 " <menuitem name='AsPostScript' action='/File/Export/File/PostScript'/>\n"
1027 " <menuitem name='AsCSV' action='/File/Export/File/CSV'/>\n"
1028 " <menuitem name='AsCArrays' action='/File/Export/File/CArrays'/>\n"
1030 " <menuitem name='AsPSML' action='/File/Export/File/PSML'/>\n"
1031 " <menuitem name='AsPDML' action='/File/Export/File/PDML'/>\n"
1035 " <menuitem name='SelectedPacketBytes' action='/File/Export/SelectedPacketBytes'/>\n"
1036 " <menu name= 'Objects' action='/File/Export/Objects'>\n"
1037 " <menuitem name='HTTP' action='/File/Export/Objects/HTTP'/>\n"
1038 " <menuitem name='DICOM' action='/File/Export/Objects/DICOM'/>\n"
1039 " <menuitem name='SMB' action='/File/Export/Objects/SMB'/>\n"
1043 " <menuitem name='Print' action='/File/Print'/>\n"
1045 " <menuitem name='Quit' action='/File/Quit'/>\n"
1047 " <menu name= 'EditMenu' action='/Edit'>\n"
1048 " <menu name= 'Copy' action='/Edit/Copy'>\n"
1049 " <menuitem name='Description' action='/Edit/Copy/Description'/>\n"
1050 " <menuitem name='Fieldname' action='/Edit/Copy/Fieldname'/>\n"
1051 " <menuitem name='Value' action='/Edit/Copy/Value'/>\n"
1053 " <menuitem name='AsFilter' action='/Edit/Copy/AsFilter'/>\n"
1055 " <menuitem name='FindPacket' action='/Edit/FindPacket'/>\n"
1056 " <menuitem name='FindNext' action='/Edit/FindNext'/>\n"
1057 " <menuitem name='FindPrevious' action='/Edit/FindPrevious'/>\n"
1059 #ifdef NEW_PACKET_LIST
1060 " <menuitem name='MarkPacket' action='/Edit/MarkPacket'/>\n"
1061 " <menuitem name='MarkAllDisplayedPackets' action='/Edit/MarkAllDisplayedPackets'/>\n"
1062 " <menuitem name='UnmarkAllPackets' action='/Edit/UnmarkAllPackets'/>\n"
1063 " <menuitem name='FindNextMark' action='/Edit/FindNextMark'/>\n"
1064 " <menuitem name='FindPreviousMark' action='/Edit/FindPreviousMark'/>\n"
1066 " <menuitem name='IgnorePacket' action='/Edit/IgnorePacket'/>\n"
1067 " <menuitem name='IgnoreAllDisplayedPackets' action='/Edit/IgnoreAllDisplayedPackets'/>\n"
1068 " <menuitem name='Un-IgnoreAllPackets' action='/Edit/Un-IgnoreAllPackets'/>\n"
1070 " <menuitem name='SetTimeReference' action='/Edit/SetTimeReference'/>\n"
1071 " <menuitem name='Un-TimeReferenceAllPackets' action='/Edit/Un-TimeReferenceAllPackets'/>\n"
1072 " <menuitem name='FindNextTimeReference' action='/Edit/FindNextTimeReference'/>\n"
1073 " <menuitem name='FindPreviousTimeReference' action='/Edit/FindPreviousTimeReference'/>\n"
1075 #else /* NEW_PACKET_LIST */
1076 #error "You must use the new packet list if you are using GTKUIManager for menus"
1078 " <menuitem name='ConfigurationProfiles' action='/Edit/ConfigurationProfiles'/>\n"
1079 " <menuitem name='Preferences' action='/Edit/Preferences'/>\n"
1081 " <menu name= 'ViewMenu' action='/View'>\n"
1082 " <menuitem name='MainToolbar' action='/View/MainToolbar'/>\n"
1083 " <menuitem name='FilterToolbar' action='/View/FilterToolbar'/>\n"
1085 " <menuitem name='WirelessToolbar' action='/View/WirelessToolbar'/>\n"
1087 " <menuitem name='Statusbar' action='/View/Statusbar'/>\n"
1089 " <menuitem name='PacketList' action='/View/PacketList'/>\n"
1090 " <menuitem name='PacketDetails' action='/View/PacketDetails'/>\n"
1091 " <menuitem name='PacketBytes' action='/View/PacketBytes'/>\n"
1093 " <menu name= 'TimeDisplayFormat' action='/View/TimeDisplayFormat'>\n"
1094 " <menuitem name='DateandTimeofDay' action='/View/TimeDisplayFormat/DateandTimeofDay'/>\n"
1095 " <menuitem name='TimeofDay' action='/View/TimeDisplayFormat/TimeofDay'/>\n"
1096 " <menuitem name='SecondsSinceEpoch' action='/View/TimeDisplayFormat/SecondsSinceEpoch'/>\n"
1097 " <menuitem name='SecondsSinceBeginningofCapture' action='/View/TimeDisplayFormat/SecondsSinceBeginningofCapture'/>\n"
1098 " <menuitem name='SecondsSincePreviousCapturedPacket' action='/View/TimeDisplayFormat/SecondsSincePreviousCapturedPacket'/>\n"
1099 " <menuitem name='SecondsSincePreviousDisplayedPacket' action='/View/TimeDisplayFormat/SecondsSincePreviousDisplayedPacket'/>\n"
1101 " <menuitem name='FileFormatPrecision-Automatic' action='/View/TimeDisplayFormat/FileFormatPrecision-Automatic'/>\n"
1102 " <menuitem name='FileFormatPrecision-Seconds' action='/View/TimeDisplayFormat/FileFormatPrecision-Seconds'/>\n"
1103 " <menuitem name='FileFormatPrecision-Deciseconds' action='/View/TimeDisplayFormat/FileFormatPrecision-Deciseconds'/>\n"
1104 " <menuitem name='FileFormatPrecision-Centiseconds' action='/View/TimeDisplayFormat/FileFormatPrecision-Centiseconds'/>\n"
1105 " <menuitem name='FileFormatPrecision-Milliseconds' action='/View/TimeDisplayFormat/FileFormatPrecision-Milliseconds'/>\n"
1106 " <menuitem name='FileFormatPrecision-Microseconds' action='/View/TimeDisplayFormat/FileFormatPrecision-Microseconds'/>\n"
1107 " <menuitem name='FileFormatPrecision-Nanoseconds' action='/View/TimeDisplayFormat/FileFormatPrecision-Nanoseconds'/>\n"
1109 " <menuitem name='DisplaySecondsWithHoursAndMinutes' action='/View/TimeDisplayFormat/DisplaySecondsWithHoursAndMinutes'/>\n"
1111 " <menu name= 'NameResolution' action='/View/NameResolution'>\n"
1112 " <menuitem name='ResolveName' action='/View/NameResolution/ResolveName'/>\n"
1114 " <menuitem name='EnableforMACLayer' action='/View/NameResolution/EnableforMACLayer'/>\n"
1115 " <menuitem name='EnableforNetworkLayer' action='/View/NameResolution/EnableforNetworkLayer'/>\n"
1116 " <menuitem name='EnableforTransportLayer' action='/View/NameResolution/EnableforTransportLayer'/>\n"
1118 " <menuitem name='ColorizePacketList' action='/View/ColorizePacketList'/>\n"
1119 " <menuitem name='AutoScrollinLiveCapture' action='/View/AutoScrollinLiveCapture'/>\n"
1121 " <menuitem name='ZoomIn' action='/View/ZoomIn'/>\n"
1122 " <menuitem name='ZoomOut' action='/View/ZoomOut'/>\n"
1123 " <menuitem name='NormalSize' action='/View/NormalSize'/>\n"
1125 " <menuitem name='ResizeAllColumns' action='/View/ResizeAllColumns'/>\n"
1126 " <menuitem name='DisplayedColumns' action='/View/DisplayedColumns'/>\n"
1128 " <menuitem name='ExpandSubtrees' action='/View/ExpandSubtrees'/>\n"
1129 " <menuitem name='ExpandAll' action='/View/ExpandAll'/>\n"
1130 " <menuitem name='CollapseAll' action='/View/CollapseAll'/>\n"
1132 " <menu name= 'ColorizeConversation' action='/View/ColorizeConversation'>\n"
1133 " <menuitem name='Color1' action='/View/ColorizeConversation/Color 1'/>\n"
1134 " <menuitem name='Color2' action='/View/ColorizeConversation/Color 2'/>\n"
1135 " <menuitem name='Color3' action='/View/ColorizeConversation/Color 3'/>\n"
1136 " <menuitem name='Color4' action='/View/ColorizeConversation/Color 4'/>\n"
1137 " <menuitem name='Color5' action='/View/ColorizeConversation/Color 5'/>\n"
1138 " <menuitem name='Color6' action='/View/ColorizeConversation/Color 6'/>\n"
1139 " <menuitem name='Color7' action='/View/ColorizeConversation/Color 7'/>\n"
1140 " <menuitem name='Color8' action='/View/ColorizeConversation/Color 8'/>\n"
1141 " <menuitem name='Color9' action='/View/ColorizeConversation/Color 9'/>\n"
1142 " <menuitem name='Color10' action='/View/ColorizeConversation/Color 10'/>\n"
1143 " <menuitem name='NewColoringRule' action='/View/ColorizeConversation/NewColoringRule'/>\n"
1146 " <menuitem name='ResetColoring1-10' action='/View/ResetColoring1-10'/>\n"
1147 " <menuitem name='ColoringRules' action='/View/ColoringRules'/>\n"
1149 " <menuitem name='ShowPacketinNewWindow' action='/View/ShowPacketinNewWindow'/>\n"
1150 " <menuitem name='Reload' action='/View/Reload'/>\n"
1152 " <menu name= 'GoMenu' action='/Go'>\n"
1153 " <menuitem name='Back' action='/Go/Back'/>\n"
1154 " <menuitem name='Forward' action='/Go/Forward'/>\n"
1155 " <menuitem name='Goto' action='/Go/Goto'/>\n"
1156 " <menuitem name='GotoCorrespondingPacket' action='/Go/GotoCorrespondingPacket'/>\n"
1158 " <menuitem name='PreviousPacket' action='/Go/PreviousPacket'/>\n"
1159 " <menuitem name='NextPacket' action='/Go/NextPacket'/>\n"
1160 " <menuitem name='FirstPacket' action='/Go/FirstPacket'/>\n"
1161 " <menuitem name='LastPacket' action='/Go/LastPacket'/>\n"
1162 " <menuitem name='PreviousPacketInConversation' action='/Go/PreviousPacketInConversation'/>\n"
1163 " <menuitem name='NextPacketInConversation' action='/Go/NextPacketInConversation'/>\n"
1166 " <menu name= 'CaptureMenu' action='/Capture'>\n"
1167 " <menuitem name='Interfaces' action='/Capture/Interfaces'/>\n"
1168 " <menuitem name='Options' action='/Capture/Options'/>\n"
1169 " <menuitem name='Start' action='/Capture/Start'/>\n"
1170 " <menuitem name='Stop' action='/Capture/Stop'/>\n"
1171 " <menuitem name='Restart' action='/Capture/Restart'/>\n"
1172 " <menuitem name='CaptureFilters' action='/Capture/CaptureFilters'/>\n"
1174 #endif /* HAVE_LIBPCAP */
1175 " <menu name= 'AnalyzeMenu' action='/Analyze'>\n"
1176 " <menuitem name='DisplayFilters' action='/Analyze/DisplayFilters'/>\n"
1178 " <menuitem name='ApplyasColumn' action='/Analyze/ApplyasColumn'/>\n"
1179 " <menu name= 'ApplyAsFilter' action='/Analyze/ApplyasFilter'>\n"
1180 " <menuitem name='Selected' action='/Analyze/ApplyasFilter/Selected'/>\n"
1181 " <menuitem name='NotSelected' action='/Analyze/ApplyasFilter/NotSelected'/>\n"
1182 " <menuitem name='AndSelected' action='/Analyze/ApplyasFilter/AndSelected'/>\n"
1183 " <menuitem name='OrSelected' action='/Analyze/ApplyasFilter/OrSelected'/>\n"
1184 " <menuitem name='AndNotSelected' action='/Analyze/ApplyasFilter/AndNotSelected'/>\n"
1185 " <menuitem name='OrNotSelected' action='/Analyze/ApplyasFilter/OrNotSelected'/>\n"
1187 " <menu name= 'PrepareaFilter' action='/Analyze/PrepareaFilter'>\n"
1188 " <menuitem name='Selected' action='/Analyze/PrepareaFilter/Selected'/>\n"
1189 " <menuitem name='NotSelected' action='/Analyze/PrepareaFilter/NotSelected'/>\n"
1190 " <menuitem name='AndSelected' action='/Analyze/PrepareaFilter/AndSelected'/>\n"
1191 " <menuitem name='OrSelected' action='/Analyze/PrepareaFilter/OrSelected'/>\n"
1192 " <menuitem name='AndNotSelected' action='/Analyze/PrepareaFilter/AndNotSelected'/>\n"
1193 " <menuitem name='OrNotSelected' action='/Analyze/PrepareaFilter/OrNotSelected'/>\n"
1195 " <menuitem name='EnabledProtocols' action='/Analyze/EnabledProtocols'/>\n"
1196 " <menuitem name='DecodeAs' action='/Analyze/DecodeAs'/>\n"
1197 " <menuitem name='UserSpecifiedDecodes' action='/Analyze/UserSpecifiedDecodes'/>\n"
1199 " <menuitem name='FollowTCPStream' action='/Analyze/FollowTCPStream'/>\n"
1200 " <menuitem name='FollowUDPStream' action='/Analyze/FollowUDPStream'/>\n"
1201 " <menuitem name='FollowSSLStream' action='/Analyze/FollowSSLStream'/>\n"
1203 " <menu name= 'StatisticsMenu' action='/Statistics'>\n"
1204 " <menuitem name='Summary' action='/Statistics/Summary'/>\n"
1205 " <menuitem name='ProtocolHierarchy' action='/Statistics/ProtocolHierarchy'/>\n"
1206 " <menuitem name='Conversations' action='/Statistics/Conversations'/>\n"
1207 " <menuitem name='Endpoints' action='/Statistics/Endpoints'/>\n"
1209 " <menu name= 'TelephonyMenu' action='/Telephony'>\n"
1211 " <menu name= 'ToolsMenu' action='/Tools'>\n"
1212 " <menuitem name='FirewallACLRules' action='/Tools/FirewallACLRules'/>\n"
1214 " <menu name= 'WSinternalMenu' action='/WSinternal'>\n"
1215 " <menuitem name='Dissectortables' action='/WSinternal/Dissectortables'/>\n"
1217 " <menu name= 'HelpMenu' action='/Help'>\n"
1218 " <menuitem name='Contents' action='/Help/Contents'/>\n"
1219 " <menuitem name='FAQs' action='/Help/FAQs'/>\n"
1220 " <menu name= 'ManualPages' action='/Help/ManualPages'>\n"
1221 " <menuitem name='Wireshark' action='/Help/ManualPages/Wireshark'/>\n"
1222 " <menuitem name='WiresharkFilter' action='/Help/ManualPages/WiresharkFilter'/>\n"
1224 " <menuitem name='TShark' action='/Help/ManualPages/TShark'/>\n"
1225 " <menuitem name='RawShark' action='/Help/ManualPages/RawShark'/>\n"
1226 " <menuitem name='Dumpcap' action='/Help/ManualPages/Dumpcap'/>\n"
1227 " <menuitem name='Mergecap' action='/Help/ManualPages/Mergecap'/>\n"
1228 " <menuitem name='Editcap' action='/Help/ManualPages/Editcap'/>\n"
1229 " <menuitem name='Text2pcap' action='/Help/ManualPages/Text2pcap'/>\n"
1232 " <menuitem name='Website' action='/Help/Website'/>\n"
1233 " <menuitem name='Wiki' action='/Help/Wiki'/>\n"
1234 " <menuitem name='Downloads' action='/Help/Downloads'/>\n"
1235 " <menuitem name='SampleCaptures' action='/Help/SampleCaptures'/>\n"
1237 " <menuitem name='SupportedProtocols' action='/Help/SupportedProtocols'/>\n"
1239 " <menuitem name='AboutWireshark' action='/Help/AboutWireshark'/>\n"
1248 * Please do not use keystrokes that are used as "universal" shortcuts in
1249 * various desktop environments:
1252 * http://support.microsoft.com/kb/126449
1255 * http://library.gnome.org/users/user-guide/nightly/keyboard-skills.html.en
1258 * http://developer.kde.org/documentation/standards/kde/style/keys/shortcuts.html
1260 * In particular, do not use the following <control> sequences for anything
1261 * other than their standard purposes:
1263 * <control>O File->Open
1264 * <control>S File->Save
1265 * <control>P File->Print
1266 * <control>W File->Close
1267 * <control>Q File->Quit
1268 * <control>Z Edit->Undo (which we don't currently have)
1269 * <control>X Edit->Cut (which we don't currently have)
1270 * <control>C Edit->Copy (which we don't currently have)
1271 * <control>V Edit->Paste (which we don't currently have)
1272 * <control>A Edit->Select All (which we don't currently have)
1274 * Note that some if not all of the Edit keys above already perform those
1275 * functions in text boxes, such as the Filter box. Do no, under any
1276 * circumstances, make a change that keeps them from doing so.
1282 * const gchar *name;
1283 * const gchar *stock_id;
1284 * const gchar *label;
1285 * const gchar *accelerator;
1286 * const gchar *tooltip;
1287 * GCallback callback;
1289 * const gchar *name; The name of the action.
1290 * const gchar *stock_id; The stock id for the action, or the name of an icon from the icon theme.
1291 * const gchar *label; The label for the action. This field should typically be marked for translation,
1292 * see gtk_action_group_set_translation_domain().
1293 * If label is NULL, the label of the stock item with id stock_id is used.
1294 * const gchar *accelerator; The accelerator for the action, in the format understood by gtk_accelerator_parse().
1295 * const gchar *tooltip; The tooltip for the action. This field should typically be marked for translation,
1296 * see gtk_action_group_set_translation_domain().
1297 * GCallback callback; The function to call when the action is activated.
1300 static const GtkActionEntry main_menu_bar_entries[] = {
1302 { "/File", NULL, "_File", NULL, NULL, NULL },
1303 { "/Edit", NULL, "_Edit", NULL, NULL, NULL },
1304 { "/View", NULL, "_View", NULL, NULL, NULL },
1305 { "/Go", NULL, "_Go", NULL, NULL, NULL },
1307 { "/Capture", NULL, "_Capture", NULL, NULL, NULL },
1309 { "/Analyze", NULL, "_Analyze", NULL, NULL, NULL },
1310 { "/Statistics", NULL, "_Statistics", NULL, NULL, NULL },
1311 { "/Telephony", NULL, "Telephon_y", NULL, NULL, NULL },
1312 { "/Tools", NULL, "_Tools", NULL, NULL, NULL },
1313 { "/WSinternal", NULL, "WS internal", NULL, NULL, NULL },
1314 { "/Help", NULL, "_Help", NULL, NULL, NULL },
1316 { "/File/Open", GTK_STOCK_OPEN, "_Open...", "<control>O", "Open a file", G_CALLBACK(file_open_cmd_cb) },
1317 { "/File/OpenRecent", NULL, "Open _Recent", NULL, NULL, NULL },
1318 { "/File/Merge", NULL, "_Merge...", NULL, NULL, G_CALLBACK(file_merge_cmd_cb) },
1319 { "/File/Import", NULL, "_Import...", NULL, NULL, G_CALLBACK(file_import_cmd_cb) },
1320 { "/File/Close", GTK_STOCK_CLOSE, "_Close", "<control>W", NULL, G_CALLBACK(file_close_cmd_cb) },
1322 { "/File/Save", GTK_STOCK_SAVE, "_Save", "<control>S", NULL, G_CALLBACK(file_save_cmd_cb) },
1323 { "/File/SaveAs", GTK_STOCK_SAVE_AS, "Save _As...", "<shift><control>S", NULL, G_CALLBACK(file_save_as_cmd_cb) },
1325 { "/File/Set", NULL, "File Set", NULL, NULL, NULL },
1326 { "/File/Export", NULL, "Export", NULL, NULL, NULL },
1327 { "/File/Print", GTK_STOCK_PRINT, "_Print...", "<control>P", NULL, G_CALLBACK(file_print_cmd_cb) },
1328 { "/File/Quit", GTK_STOCK_QUIT, "_Quit", "<control>Q", NULL, G_CALLBACK(file_quit_cmd_cb) },
1330 { "/File/Set/ListFiles", WIRESHARK_STOCK_FILE_SET_LIST, "List Files", NULL, NULL, G_CALLBACK(fileset_cb) },
1331 { "/File/Set/NextFile", WIRESHARK_STOCK_FILE_SET_NEXT, "Next File", NULL, NULL, G_CALLBACK(fileset_next_cb) },
1332 { "/File/Set/PreviousFile",WIRESHARK_STOCK_FILE_SET_PREVIOUS, "Previous File", NULL, NULL, G_CALLBACK(fileset_previous_cb) },
1335 { "/File/Export/File", NULL, "File...", NULL, NULL, G_CALLBACK(export_text_cmd_cb) },
1337 { "/File/Export/File", NULL, "File...", NULL, NULL, NULL },
1338 { "/File/Export/File/Text", NULL, "as \"Plain _Text\" file...", NULL, NULL, G_CALLBACK(export_text_cmd_cb) },
1339 { "/File/Export/File/PostScript", NULL, "as \"_PostScript\" file...", NULL, NULL, G_CALLBACK(export_ps_cmd_cb) },
1340 { "/File/Export/File/CSV", NULL, "as \"_CSV\" (Comma Separated Values packet summary) file...",
1341 NULL, NULL, G_CALLBACK(export_csv_cmd_cb) },
1342 { "/File/Export/File/CArrays", NULL, "as \"C _Arrays\" (packet bytes) file...",
1343 NULL, NULL, G_CALLBACK(export_carrays_cmd_cb) },
1344 { "/File/Export/File/PSML", NULL, "as XML - \"P_SML\" (packet summary) file...",
1345 NULL, NULL, G_CALLBACK(export_psml_cmd_cb) },
1346 { "/File/Export/File/PDML", NULL, "as XML - \"P_DML\" (packet details) file...",
1347 NULL, NULL, G_CALLBACK(export_pdml_cmd_cb) },
1349 { "/File/Export/SelectedPacketBytes", NULL, "Selected Packet _Bytes...", "<control>H", NULL, G_CALLBACK(savehex_cb) },
1350 { "/File/Export/Objects", NULL, "Objects", NULL, NULL, NULL },
1351 { "/File/Export/Objects/HTTP", NULL, "_HTTP", NULL, NULL, G_CALLBACK(eo_http_cb) },
1352 { "/File/Export/Objects/DICOM", NULL, "_DICOM", NULL, NULL, G_CALLBACK(eo_dicom_cb) },
1353 { "/File/Export/Objects/SMB", NULL, "_SMB", NULL, NULL, G_CALLBACK(eo_smb_cb) },
1356 { "/Edit/Copy", NULL, "Copy", NULL, NULL, NULL },
1358 { "/Edit/Copy/Description", NULL, "Description", "<shift><control>D", NULL, G_CALLBACK(copy_description_cb) },
1359 { "/Edit/Copy/Fieldname", NULL, "Fieldname", "<shift><control>F", NULL, G_CALLBACK(copy_fieldname_cb) },
1360 { "/Edit/Copy/Value", NULL, "Value", "<shift><control>V", NULL, G_CALLBACK(copy_value_cb) },
1361 { "/Edit/Copy/AsFilter", NULL, "As Filter", "<shift><control>C", NULL, G_CALLBACK(copy_as_filter_cb) },
1365 * Un-#if this when we actually implement Cut/Copy/Paste for the
1366 * packet list and packet detail windows.
1368 * Note: when we implement Cut/Copy/Paste in those windows, we
1369 * will almost certainly want to allow multiple packets to be
1370 * selected in the packet list pane and multiple packet detail
1371 * items to be selected in the packet detail pane, so that
1372 * the user can, for example, copy the summaries of multiple
1373 * packets to the clipboard from the packet list pane and multiple
1374 * packet detail items - perhaps *all* packet detail items - from
1375 * the packet detail pane. Given that, we'll also want to
1376 * implement Select All.
1378 * If multiple packets are selected, we would probably display nothing
1379 * in the packet detail pane, just as we do if no packet is selected,
1380 * and any menu items etc. that would pertain only to a single packet
1381 * would be disabled.
1383 * If multiple packet detail items are selected, we would probably
1384 * disable all items that pertain only to a single packet detail
1385 * item, such as some items in the status bar.
1387 * XXX - the actions for these will be different depending on what
1388 * widget we're in; ^C should copy from the filter text widget if
1389 * we're in that widget, the packet list if we're in that widget
1390 * (presumably copying the summaries of selected packets to the
1391 * clipboard, e.g. the text copy would be the text of the columns),
1392 * the packet detail if we're in that widget (presumably copying
1393 * the contents of selected protocol tree items to the clipboard,
1394 * e.g. the text copy would be the text displayed for those items),
1397 * Given that those menu items should also affect text widgets
1398 * such as the filter box, we would again want Select All, and,
1399 * at least for the filter box, we would also want Undo and Redo.
1400 * We would only want Cut, Paste, Undo, and Redo for the packet
1401 * list and packet detail panes if we support modifying them.
1403 {"/Edit/_Undo", "<control>Z", NULL,
1404 0, "<StockItem>", GTK_STOCK_UNDO,},
1405 {"/Edit/_Redo", "<shift><control>Z", NULL,
1406 0, "<StockItem>", GTK_STOCK_REDO,},
1407 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1408 {"/Edit/Cu_t", "<control>X", NULL,
1409 0, "<StockItem>", GTK_STOCK_CUT,},
1410 {"/Edit/_Copy", "<control>C", NULL,
1411 0, "<StockItem>", GTK_STOCK_COPY,},
1412 {"/Edit/_Paste", "<control>V", NULL,
1413 0, "<StockItem>", GTK_STOCK_PASTE,},
1414 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1415 {"/Edit/Select _All", "<control>A", NULL, 0,
1416 #ifdef GTK_STOCK_SELECT_ALL /* first appeared in 2.10 */
1417 "<StockItem>", GTK_STOCK_SELECT_ALL,
1420 #endif /* GTK_STOCK_SELECT_ALL */
1422 { "/Edit/FindPacket", GTK_STOCK_FIND, "_Find Packet...", "<control>F", NULL, G_CALLBACK(find_frame_cb) },
1423 { "/Edit/FindNext", NULL, "Find Ne_xt", "<control>N", NULL, G_CALLBACK(find_next_cb) },
1424 { "/Edit/FindPrevious", NULL, "Find Pre_vious", "<control>B", NULL, G_CALLBACK(find_previous_cb) },
1426 #ifdef NEW_PACKET_LIST
1427 { "/Edit/MarkPacket", NULL, "_Mark Packet (toggle)", "<control>M", NULL, G_CALLBACK(new_packet_list_mark_frame_cb) },
1428 { "/Edit/FindNextMark", NULL, "Find Next Mark", "<shift><control>N", NULL, G_CALLBACK(find_next_mark_cb) },
1429 { "/Edit/FindPreviousMark", NULL, "Find Next Mark", "<shift><control>B", NULL, G_CALLBACK(find_prev_mark_cb) },
1430 { "/Edit/MarkAllDisplayedPackets", NULL, "Mark All Displayed Packets (toggle)", "<control>A", NULL, G_CALLBACK(new_packet_list_mark_all_displayed_frames_cb) },
1431 { "/Edit/UnmarkAllPackets", NULL, "_Unmark All Packets", "<control>D", NULL, G_CALLBACK(new_packet_list_unmark_all_frames_cb) },
1433 { "/Edit/IgnorePacket", NULL, "_Ignore Packet (toggle)", "<control>X", NULL, G_CALLBACK(new_packet_list_ignore_frame_cb) },
1435 * XXX - this next one overrides /Edit/Copy/Description
1437 { "/Edit/IgnoreAllDisplayedPackets", NULL, "_Ignore All Displayed Packets (toggle)","<alt><shift><control>X", NULL, G_CALLBACK(new_packet_list_ignore_all_displayed_frames_cb) },
1438 { "/Edit/Un-IgnoreAllPackets", NULL, "U_n-Ignore All Packets", "<shift><control>X", NULL, G_CALLBACK(new_packet_list_unignore_all_frames_cb) },
1439 { "/Edit/SetTimeReference", WIRESHARK_STOCK_TIME, "Set Time Reference (toggle)", "<control>T", NULL, G_CALLBACK(set_reftime_cb) },
1440 { "/Edit/Un-TimeReferenceAllPackets",NULL, "Un-Time Reference All Packets", "<alt><control>T", NULL, G_CALLBACK(new_packet_list_untime_reference_all_frames_cb) },
1441 { "/Edit/FindNextTimeReference", NULL, "Find Next Time Reference", "<alt><control>N", NULL, G_CALLBACK(find_next_ref_time_cb) },
1442 { "/Edit/FindPreviousTimeReference", NULL, "Find Previous Time Reference", "<alt><control>B", NULL, G_CALLBACK(find_previous_ref_time_cb) },
1444 #else /* NEW_PACKET_LIST */
1445 #error "You must use the new packet list if you are using GTKUIManager for menus"
1446 #endif /* NEW_PACKET_LIST */
1447 { "/Edit/ConfigurationProfiles", NULL, "_Configuration Profiles...", "<shift><control>A", NULL, G_CALLBACK(profile_dialog_cb) },
1448 { "/Edit/Preferences", GTK_STOCK_PREFERENCES, "_Preferences...", "<shift><control>P", NULL, G_CALLBACK(menus_prefs_cb) },
1451 { "/View/TimeDisplayFormat", NULL, "_Time Display Format", NULL, NULL, NULL },
1453 { "/View/NameResolution", NULL, "Name Resol_ution", NULL, NULL, NULL },
1454 { "/View/ZoomIn", GTK_STOCK_ZOOM_IN, "_Zoom In", "<control>plus", NULL, G_CALLBACK(view_zoom_in_cb) },
1455 { "/View/ZoomOut", GTK_STOCK_ZOOM_OUT, "Zoom _Out", "<control>minus", NULL, G_CALLBACK(view_zoom_out_cb) },
1456 { "/View/NormalSize", GTK_STOCK_ZOOM_100, "_Normal Size", "<control>equal", NULL, G_CALLBACK(view_zoom_100_cb) },
1457 #ifdef NEW_PACKET_LIST
1458 { "/View/ResizeAllColumns", WIRESHARK_STOCK_RESIZE_COLUMNS, "Resize All Columns", "<shift><control>R", NULL, G_CALLBACK(new_packet_list_resize_columns_cb) },
1459 { "/View/DisplayedColumns", NULL, "Displayed Columns", NULL, NULL, NULL },
1461 #error "You must use the new packet list if you are using GTKUIManager for menus"
1462 #endif /* NEW_PACKET_LIST */
1463 { "/View/ExpandSubtrees", NULL, "Expand Subtrees", NULL, NULL, G_CALLBACK(expand_tree_cb) },
1464 { "/View/ExpandAll", NULL, "Expand All", NULL, NULL, G_CALLBACK(expand_all_cb) },
1465 { "/View/CollapseAll", NULL, "Collapse All", NULL, NULL, G_CALLBACK(collapse_all_cb) },
1466 { "/View/ColorizeConversation", NULL, "Colorize Conversation",NULL, NULL, NULL },
1468 { "/View/ColorizeConversation/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(view_menu_color_conv_color1_cb) },
1469 { "/View/ColorizeConversation/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(view_menu_color_conv_color2_cb) },
1470 { "/View/ColorizeConversation/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(view_menu_color_conv_color3_cb) },
1471 { "/View/ColorizeConversation/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(view_menu_color_conv_color4_cb) },
1472 { "/View/ColorizeConversation/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(view_menu_color_conv_color5_cb) },
1473 { "/View/ColorizeConversation/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(view_menu_color_conv_color6_cb) },
1474 { "/View/ColorizeConversation/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(view_menu_color_conv_color7_cb) },
1475 { "/View/ColorizeConversation/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(view_menu_color_conv_color8_cb) },
1476 { "/View/ColorizeConversation/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(view_menu_color_conv_color9_cb) },
1477 { "/View/ColorizeConversation/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(view_menu_color_conv_color10_cb) },
1478 { "/View/ColorizeConversation/NewColoringRule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(view_menu_color_conv_new_rule_cb) },
1480 { "/View/ResetColoring1-10", NULL, "Reset Coloring 1-10", "<control>space", NULL, G_CALLBACK(view_menu_reset_coloring_cb) },
1481 { "/View/ColoringRules", GTK_STOCK_SELECT_COLOR, "_Coloring Rules...", NULL, NULL, G_CALLBACK(color_display_cb) },
1482 { "/View/ShowPacketinNewWindow", NULL, "Show Packet in New _Window", NULL, NULL, G_CALLBACK(new_window_cb) },
1483 { "/View/Reload", GTK_STOCK_REFRESH, "_Reload", "<control>R", NULL, G_CALLBACK(file_reload_cmd_cb) },
1486 { "/Go/Back", GTK_STOCK_GO_BACK, "_Back", "<alt>Left", NULL, G_CALLBACK(history_back_cb) },
1487 { "/Go/Forward", GTK_STOCK_GO_FORWARD, "_Forward", "<alt>Right", NULL, G_CALLBACK(history_forward_cb) },
1488 { "/Go/Goto", GTK_STOCK_JUMP_TO, "_Go to Packet...", "<control>G", NULL, G_CALLBACK(goto_frame_cb) },
1489 { "/Go/GotoCorrespondingPacket", NULL, "Go to _Corresponding Packet", NULL, NULL, G_CALLBACK(goto_framenum_cb) },
1490 { "/Go/PreviousPacket", GTK_STOCK_GO_UP, "Previous Packet", "<control>Up", NULL, G_CALLBACK(goto_previous_frame_cb) },
1491 { "/Go/NextPacket", GTK_STOCK_GO_DOWN, "Next Packet", "<control>Down", NULL, G_CALLBACK(goto_next_frame_cb) },
1492 { "/Go/FirstPacket", GTK_STOCK_GOTO_TOP, "F_irst Packet", "<control>Home", NULL, G_CALLBACK(goto_top_frame_cb) },
1493 { "/Go/LastPacket", GTK_STOCK_GOTO_BOTTOM, "_Last Packet", "<control>End", NULL, G_CALLBACK(goto_bottom_frame_cb) },
1494 { "/Go/PreviousPacketInConversation", GTK_STOCK_GO_UP, "Previous Packet In Conversation", "<control>bracketleft", NULL, G_CALLBACK(goto_previous_frame_conversation_cb) },
1495 { "/Go/NextPacketInConversation", GTK_STOCK_GO_DOWN, "Next Packet In Conversation", "<control>bracketright", NULL, G_CALLBACK(goto_next_frame_conversation_cb) },
1498 { "/Capture/Interfaces", WIRESHARK_STOCK_CAPTURE_INTERFACES, "_Interfaces...", "<control>I", NULL, G_CALLBACK(capture_if_cb) },
1499 { "/Capture/Options", WIRESHARK_STOCK_CAPTURE_OPTIONS, "_Options...", "<control>K", NULL, G_CALLBACK(capture_prep_cb) },
1500 { "/Capture/Start", WIRESHARK_STOCK_CAPTURE_START, "_Start", "<control>E", NULL, G_CALLBACK(capture_start_cb) },
1501 { "/Capture/Stop", WIRESHARK_STOCK_CAPTURE_STOP, "S_top", "<control>E", NULL, G_CALLBACK(capture_stop_cb) },
1502 { "/Capture/Restart", WIRESHARK_STOCK_CAPTURE_RESTART, "_Restart", "<control>R", NULL, G_CALLBACK(capture_restart_cb) },
1503 { "/Capture/CaptureFilters", WIRESHARK_STOCK_CAPTURE_FILTER, "Capture _Filters...", NULL, NULL, G_CALLBACK(cfilter_dialog_cb) },
1505 #endif /* HAVE_LIBPCAP */
1506 { "/Analyze/DisplayFilters", WIRESHARK_STOCK_DISPLAY_FILTER, "_Display Filters...", NULL, NULL, G_CALLBACK(dfilter_dialog_cb) },
1508 { "/Analyze/DisplayFilterMacros", NULL, "Display Filter _Macros...", NULL, NULL, G_CALLBACK(macros_dialog_cb) },
1509 { "/Analyze/ApplyasColumn", NULL, "Apply as Column", NULL, NULL, G_CALLBACK(apply_as_custom_column_cb) },
1510 { "/Analyze/ApplyasFilter", NULL, "Apply as Filter", NULL, NULL, NULL },
1512 { "/Analyze/ApplyasFilter/Selected", NULL, "_Selected" , NULL, NULL, G_CALLBACK(tree_view_menu_apply_selected_cb) },
1513 { "/Analyze/ApplyasFilter/NotSelected", NULL, "_Not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_not_selected_cb) },
1514 { "/Analyze/ApplyasFilter/AndSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _and Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_and_selected_cb) },
1515 { "/Analyze/ApplyasFilter/OrSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _or Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_or_selected_cb) },
1516 { "/Analyze/ApplyasFilter/AndNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " a_nd not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_and_not_selected_cb) },
1517 { "/Analyze/ApplyasFilter/OrNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " o_r not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_or_not_selected_cb) },
1519 { "/Analyze/PrepareaFilter", NULL, "Prepare a Filter", NULL, NULL, NULL },
1520 { "/Analyze/PrepareaFilter/Selected", NULL, "_Selected" , NULL, NULL, G_CALLBACK(tree_view_menu_prepare_selected_cb) },
1521 { "/Analyze/PrepareaFilter/NotSelected", NULL, "_Not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_not_selected_cb) },
1522 { "/Analyze/PrepareaFilter/AndSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _and Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_and_selected_cb) },
1523 { "/Analyze/PrepareaFilter/OrSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _or Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_or_selected_cb) },
1524 { "/Analyze/PrepareaFilter/AndNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " a_nd not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_and_not_selected_cb) },
1525 { "/Analyze/PrepareaFilter/OrNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " o_r not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_or_not_selected_cb) },
1527 { "/Analyze/EnabledProtocols", WIRESHARK_STOCK_CHECKBOX, "_Enabled Protocols...", "<shift><control>E", NULL, G_CALLBACK(proto_cb) },
1528 { "/Analyze/DecodeAs", WIRESHARK_STOCK_DECODE_AS, "Decode _As...", NULL, NULL, G_CALLBACK(decode_as_cb) },
1529 { "/Analyze/UserSpecifiedDecodes", WIRESHARK_STOCK_DECODE_AS, "_User Specified Decodes...", NULL, NULL, G_CALLBACK(decode_show_cb) },
1531 { "/Analyze/FollowTCPStream", NULL, "Follow TCP Stream", NULL, NULL, G_CALLBACK(follow_tcp_stream_cb) },
1532 { "/Analyze/FollowUDPStream", NULL, "Follow UDP Stream", NULL, NULL, G_CALLBACK(follow_udp_stream_cb) },
1533 { "/Analyze/FollowSSLStream", NULL, "Follow SSL Stream", NULL, NULL, G_CALLBACK(follow_ssl_stream_cb) },
1536 { "/Statistics/Summary", GTK_STOCK_PROPERTIES, "_Summary", NULL, NULL, G_CALLBACK(summary_open_cb) },
1537 { "/Statistics/ProtocolHierarchy", NULL, "_Protocol Hierarchy", NULL, NULL, G_CALLBACK(proto_hier_stats_cb) },
1538 { "/Statistics/Conversations", WIRESHARK_STOCK_CONVERSATIONS, "Conversations", NULL, NULL, G_CALLBACK(init_conversation_notebook_cb) },
1539 { "/Statistics/Endpoints", WIRESHARK_STOCK_ENDPOINTS, "Endpoints", NULL, NULL, G_CALLBACK(init_hostlist_notebook_cb) },
1541 { "/Tools/FirewallACLRules", NULL, "Firewall ACL Rules", NULL, NULL, G_CALLBACK(firewall_rule_cb) },
1543 { "/WSinternal/Dissectortables", NULL, "Dissector tables", NULL, NULL, G_CALLBACK(dissector_tables_dlg_cb) },
1545 { "/Help/Contents", GTK_STOCK_HELP, "_Contents", "F1", NULL, G_CALLBACK(help_menu_cont_cb) },
1546 { "/Help/FAQs", NULL, "FAQ's", NULL, NULL, G_CALLBACK(help_menu_faq_cb) },
1547 { "/Help/ManualPages", NULL, "ManualPages", NULL, NULL, NULL },
1548 { "/Help/ManualPages/Wireshark", NULL, "Wireshark", NULL, NULL, G_CALLBACK(help_menu_wireshark_cb) },
1549 { "/Help/ManualPages/WiresharkFilter", NULL, "Wireshark Filter", NULL, NULL, G_CALLBACK(help_menu_wireshark_flt_cb) },
1550 { "/Help/ManualPages/TShark", NULL, "Wireshark", NULL, NULL, G_CALLBACK(help_menu_Tshark_cb) },
1551 { "/Help/ManualPages/RawShark", NULL, "RawShark", NULL, NULL, G_CALLBACK(help_menu_RawShark_cb) },
1552 { "/Help/ManualPages/Dumpcap", NULL, "Dumpcap", NULL, NULL, G_CALLBACK(help_menu_Dumpcap_cb) },
1553 { "/Help/ManualPages/Mergecap", NULL, "Mergecap", NULL, NULL, G_CALLBACK(help_menu_Mergecap_cb) },
1554 { "/Help/ManualPages/Editcap", NULL, "Editcap", NULL, NULL, G_CALLBACK(help_menu_Editcap_cb) },
1555 { "/Help/ManualPages/Text2pcap", NULL, "Text2pcap", NULL, NULL, G_CALLBACK(help_menu_Text2pcap_cb) },
1557 { "/Help/Website", GTK_STOCK_HOME, "Website", NULL, NULL, G_CALLBACK(help_menu_Website_cb) },
1558 { "/Help/Wiki", WIRESHARK_STOCK_WIKI, "Wiki", NULL, NULL, G_CALLBACK(help_menu_Wiki_cb) },
1559 { "/Help/Downloads", NULL, "Downloads", NULL, NULL, G_CALLBACK(help_menu_Downloads_cb) },
1560 { "/Help/SampleCaptures", NULL, "Sample Captures", NULL, NULL, G_CALLBACK(help_menu_SampleCaptures_cb) },
1561 { "/Help/SupportedProtocols", NULL, "_Supported Protocols (slow!)", NULL, NULL, G_CALLBACK(supported_cb) },
1562 { "/Help/AboutWireshark", WIRESHARK_STOCK_ABOUT, "_About Wireshark", NULL, NULL, G_CALLBACK(about_wireshark_cb) },
1565 static const GtkToggleActionEntry main_menu_bar_toggle_action_entries[] =
1567 /* name, stock id, label, accel, tooltip, callback, is_active */
1568 {"/View/MainToolbar", NULL, "_Main Toolbar", NULL, NULL, G_CALLBACK(main_toolbar_show_hide_cb), TRUE},
1569 {"/View/FilterToolbar", NULL, "_FilterToolbar", NULL, NULL, G_CALLBACK(filter_toolbar_show_hide_cb), TRUE},
1571 {"/View/WirelessToolbar", NULL, "_WirelessToolbar", NULL, NULL, G_CALLBACK(wireless_toolbar_show_hide_cb), TRUE},
1572 #endif /* HAVE_AIRPCAP */
1573 {"/View/Statusbar", NULL, "_Statusbar", NULL, NULL, G_CALLBACK(status_bar_show_hide_cb), TRUE},
1574 {"/View/PacketList", NULL, "Packet _List", NULL, NULL, G_CALLBACK(packet_list_show_hide_cb), TRUE},
1575 {"/View/PacketDetails", NULL, "Packet _Details", NULL, NULL, G_CALLBACK(packet_details_show_hide_cb), TRUE},
1576 {"/View/PacketBytes", NULL, "Packet _Bytes", NULL, NULL, G_CALLBACK(packet_bytes_show_hide_cb), TRUE},
1577 {"/View/TimeDisplayFormat/DisplaySecondsWithHoursAndMinutes", NULL, "Display Seconds with hours and minutes", NULL, NULL, G_CALLBACK(view_menu_seconds_time_cb), FALSE},
1578 {"/View/NameResolution/ResolveName", NULL, "_Resolve Name", NULL, NULL, G_CALLBACK(resolve_name_cb), FALSE},
1579 {"/View/NameResolution/EnableforMACLayer", NULL, "Enable for _MAC Layer", NULL, NULL, G_CALLBACK(view_menu_en_for_MAC_cb), TRUE},
1580 {"/View/NameResolution/EnableforNetworkLayer", NULL, "Enable for _Network Layer", NULL, NULL, G_CALLBACK(view_menu_en_for_network_cb), TRUE },
1581 {"/View/NameResolution/EnableforTransportLayer", NULL, "Enable for _Transport Layer", NULL, NULL, G_CALLBACK(view_menu_en_for_transport_cb), TRUE },
1582 {"/View/ColorizePacketList", NULL, "Colorize Packet List", NULL, NULL, G_CALLBACK(view_menu_colorize_pkt_lst_cb), TRUE },
1584 {"/View/AutoScrollinLiveCapture", NULL, "Auto Scroll in Li_ve Capture", NULL, NULL, G_CALLBACK(view_menu_auto_scroll_live_cb), TRUE },
1590 static const GtkRadioActionEntry main_menu_bar_radio_view_time_entries [] =
1592 /* name, stock id, label, accel, tooltip, value */
1593 { "/View/TimeDisplayFormat/DateandTimeofDay", NULL, "Date and Time of Day: 1970-01-01 01:02:03.123456", "<alt><control>1", NULL, TS_ABSOLUTE_WITH_DATE },
1594 { "/View/TimeDisplayFormat/TimeofDay", NULL, "Time of Day: 01:02:03.123456", "<alt><control>2", NULL, TS_ABSOLUTE },
1595 { "/View/TimeDisplayFormat/SecondsSinceEpoch", NULL, "Seconds Since Epoch (1970-01-01): 1234567890.123456", "<alt><control>3", NULL, TS_EPOCH },
1596 { "/View/TimeDisplayFormat/SecondsSinceBeginningofCapture", NULL, "Seconds Since Beginning of Capture: 123.123456", "<alt><control>4", NULL, TS_RELATIVE },
1597 { "/View/TimeDisplayFormat/SecondsSincePreviousCapturedPacket", NULL, "Seconds Since Previous Captured Packet: 1.123456", "<alt><control>5", NULL, TS_DELTA },
1598 { "/View/TimeDisplayFormat/SecondsSincePreviousDisplayedPacket",NULL, "Seconds Since Previous Displayed Packet: 1.123456", "<alt><control>6", NULL, TS_DELTA_DIS },
1601 static const GtkRadioActionEntry main_menu_bar_radio_view_time_fileformat_prec_entries [] =
1603 /* name, stock id, label, accel, tooltip, value */
1604 { "/View/TimeDisplayFormat/FileFormatPrecision-Automatic", NULL, "Automatic (File Format Precision)", NULL, NULL, TS_PREC_AUTO },
1605 { "/View/TimeDisplayFormat/FileFormatPrecision-Seconds", NULL, "Seconds: 0", NULL, NULL, TS_PREC_FIXED_SEC },
1606 { "/View/TimeDisplayFormat/FileFormatPrecision-Deciseconds", NULL, "Deciseconds: 0.1", NULL, NULL, TS_PREC_FIXED_DSEC },
1607 { "/View/TimeDisplayFormat/FileFormatPrecision-Centiseconds", NULL, "Centiseconds: 0.12", NULL, NULL, TS_PREC_FIXED_CSEC },
1608 { "/View/TimeDisplayFormat/FileFormatPrecision-Milliseconds", NULL, "Milliseconds: 0.123", NULL, NULL, TS_PREC_FIXED_MSEC },
1609 { "/View/TimeDisplayFormat/FileFormatPrecision-Microseconds", NULL, "Microseconds: 0.123456", NULL, NULL, TS_PREC_FIXED_USEC },
1610 { "/View/TimeDisplayFormat/FileFormatPrecision-Nanoseconds", NULL, "Nanoseconds: 0.123456789", NULL, NULL, TS_PREC_FIXED_NSEC },
1612 #else /* MAIN_MENU_USE_UIMANAGER */
1616 * Please do not use keystrokes that are used as "universal" shortcuts in
1617 * various desktop environments:
1620 * http://support.microsoft.com/kb/126449
1623 * http://library.gnome.org/users/user-guide/nightly/keyboard-skills.html.en
1626 * http://developer.kde.org/documentation/standards/kde/style/keys/shortcuts.html
1628 * In particular, do not use the following <control> sequences for anything
1629 * other than their standard purposes:
1631 * <control>O File->Open
1632 * <control>S File->Save
1633 * <control>P File->Print
1634 * <control>W File->Close
1635 * <control>Q File->Quit
1636 * <control>Z Edit->Undo (which we don't currently have)
1637 * <control>X Edit->Cut (which we don't currently have)
1638 * <control>C Edit->Copy (which we don't currently have)
1639 * <control>V Edit->Paste (which we don't currently have)
1640 * <control>A Edit->Select All (which we don't currently have)
1642 * Note that some if not all of the Edit keys above already perform those
1643 * functions in text boxes, such as the Filter box. Do no, under any
1644 * circumstances, make a change that keeps them from doing so.
1647 /* This is the GtkItemFactoryEntry structure used to generate new menus.
1648 Item 1: The menu path. The letter after the underscore indicates an
1649 accelerator key once the menu is open.
1650 Item 2: The accelerator key for the entry
1651 Item 3: The callback function.
1652 Item 4: The callback action. This changes the parameters with
1653 which the function is called. The default is 0.
1654 Item 5: The item type, used to define what kind of an item it is.
1655 Here are the possible values:
1659 "<Title>" -> create a title item
1660 "<Item>" -> create a simple item
1661 "<ImageItem>" -> create an item holding an image
1662 "<StockItem>" -> create an item holding a stock image
1663 "<CheckItem>" -> create a check item
1664 "<ToggleItem>" -> create a toggle item
1665 "<RadioItem>" -> create a radio item
1666 <path> -> path of a radio item to link against
1667 "<Separator>" -> create a separator
1668 "<Tearoff>" -> create a tearoff separator
1669 "<Branch>" -> create an item to hold sub items (optional)
1670 "<LastBranch>" -> create a right justified branch
1671 Item 6: extra data needed for ImageItem and StockItem
1673 static GtkItemFactoryEntry menu_items[] =
1675 {"/_File", NULL, NULL, 0, "<Branch>", NULL,},
1676 {"/File/_Open...", "<control>O", GTK_MENU_FUNC(file_open_cmd_cb),
1677 0, "<StockItem>", GTK_STOCK_OPEN,},
1678 {"/File/Open _Recent", NULL, NULL, 0, "<Branch>", NULL,},
1679 {"/File/_Merge...", NULL, GTK_MENU_FUNC(file_merge_cmd_cb), 0, NULL, NULL,},
1680 {"/File/_Import...", NULL, GTK_MENU_FUNC(file_import_cmd_cb), 0, NULL, NULL,},
1681 {"/File/_Close", "<control>W", GTK_MENU_FUNC(file_close_cmd_cb),
1682 0, "<StockItem>", GTK_STOCK_CLOSE,},
1683 {"/File/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1684 {"/File/_Save", "<control>S", GTK_MENU_FUNC(file_save_cmd_cb),
1685 0, "<StockItem>", GTK_STOCK_SAVE,},
1686 {"/File/Save _As...", "<shift><control>S", GTK_MENU_FUNC(file_save_as_cmd_cb),
1687 0, "<StockItem>", GTK_STOCK_SAVE_AS,},
1688 {"/File/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1689 {"/File/File Set", NULL, NULL, 0, "<Branch>", NULL,},
1690 {"/File/File Set/List Files", NULL, GTK_MENU_FUNC(fileset_cb), 0, "<StockItem>", WIRESHARK_STOCK_FILE_SET_LIST,},
1691 {"/File/File Set/Next File", NULL, GTK_MENU_FUNC(fileset_next_cb), 0, "<StockItem>", WIRESHARK_STOCK_FILE_SET_NEXT,},
1692 {"/File/File Set/Previous File", NULL, GTK_MENU_FUNC(fileset_previous_cb), 0, "<StockItem>", WIRESHARK_STOCK_FILE_SET_PREVIOUS,},
1693 {"/File/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1694 {"/File/_Export", NULL, NULL, 0, "<Branch>", NULL,},
1696 {"/File/Export/File...", NULL, GTK_MENU_FUNC(export_text_cmd_cb),
1699 {"/File/Export/as \"Plain _Text\" file...", NULL, GTK_MENU_FUNC(export_text_cmd_cb),
1701 {"/File/Export/as \"_PostScript\" file...", NULL, GTK_MENU_FUNC(export_ps_cmd_cb),
1703 {"/File/Export/as \"_CSV\" (Comma Separated Values packet summary) file...",
1704 NULL, GTK_MENU_FUNC(export_csv_cmd_cb), 0, NULL, NULL,},
1705 {"/File/Export/as \"C _Arrays\" (packet bytes) file...", NULL, GTK_MENU_FUNC(export_carrays_cmd_cb),
1707 {"/File/Export/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1708 {"/File/Export/as XML - \"P_SML\" (packet summary) file...", NULL, GTK_MENU_FUNC(export_psml_cmd_cb),
1710 {"/File/Export/as XML - \"P_DML\" (packet details) file...", NULL, GTK_MENU_FUNC(export_pdml_cmd_cb),
1712 {"/File/Export/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1714 {"/File/Export/Selected Packet _Bytes...", "<control>H", GTK_MENU_FUNC(savehex_cb),
1716 {"/File/Export/_Objects/_HTTP", NULL, GTK_MENU_FUNC(eo_http_cb), 0, NULL, NULL,},
1717 {"/File/Export/_Objects/_DICOM", NULL, GTK_MENU_FUNC(eo_dicom_cb), 0, NULL, NULL,},
1718 {"/File/Export/_Objects/_SMB", NULL, GTK_MENU_FUNC(eo_smb_cb), 0, NULL, NULL,},
1719 {"/File/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1720 {"/File/_Print...", "<control>P", GTK_MENU_FUNC(file_print_cmd_cb),
1721 0, "<StockItem>", GTK_STOCK_PRINT,},
1722 {"/File/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1723 {"/File/_Quit", "<control>Q", GTK_MENU_FUNC(file_quit_cmd_cb),
1724 0, "<StockItem>", GTK_STOCK_QUIT,},
1725 {"/_Edit", NULL, NULL, 0, "<Branch>", NULL,},
1726 {"/Edit/Copy", NULL, NULL, 0, "<Branch>", NULL,},
1727 {"/Edit/Copy/Description", "<shift><control>D", GTK_MENU_FUNC(copy_selected_plist_cb), COPY_SELECTED_DESCRIPTION, NULL, NULL,},
1728 {"/Edit/Copy/Fieldname", "<shift><control>F", GTK_MENU_FUNC(copy_selected_plist_cb), COPY_SELECTED_FIELDNAME, NULL, NULL,},
1729 {"/Edit/Copy/Value", "<shift><control>V", GTK_MENU_FUNC(copy_selected_plist_cb), COPY_SELECTED_VALUE, NULL, NULL,},
1730 {"/Edit/Copy/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1731 {"/Edit/Copy/As Filter", "<shift><control>C", GTK_MENU_FUNC(match_selected_ptree_cb),
1732 MATCH_SELECTED_REPLACE|MATCH_SELECTED_COPY_ONLY, NULL, NULL,},
1735 * Un-#if this when we actually implement Cut/Copy/Paste for the
1736 * packet list and packet detail windows.
1738 * Note: when we implement Cut/Copy/Paste in those windows, we
1739 * will almost certainly want to allow multiple packets to be
1740 * selected in the packet list pane and multiple packet detail
1741 * items to be selected in the packet detail pane, so that
1742 * the user can, for example, copy the summaries of multiple
1743 * packets to the clipboard from the packet list pane and multiple
1744 * packet detail items - perhaps *all* packet detail items - from
1745 * the packet detail pane. Given that, we'll also want to
1746 * implement Select All.
1748 * If multiple packets are selected, we would probably display nothing
1749 * in the packet detail pane, just as we do if no packet is selected,
1750 * and any menu items etc. that would pertain only to a single packet
1751 * would be disabled.
1753 * If multiple packet detail items are selected, we would probably
1754 * disable all items that pertain only to a single packet detail
1755 * item, such as some items in the status bar.
1757 * XXX - the actions for these will be different depending on what
1758 * widget we're in; ^C should copy from the filter text widget if
1759 * we're in that widget, the packet list if we're in that widget
1760 * (presumably copying the summaries of selected packets to the
1761 * clipboard, e.g. the text copy would be the text of the columns),
1762 * the packet detail if we're in that widget (presumably copying
1763 * the contents of selected protocol tree items to the clipboard,
1764 * e.g. the text copy would be the text displayed for those items),
1767 * Given that those menu items should also affect text widgets
1768 * such as the filter box, we would again want Select All, and,
1769 * at least for the filter box, we would also want Undo and Redo.
1770 * We would only want Cut, Paste, Undo, and Redo for the packet
1771 * list and packet detail panes if we support modifying them.
1773 {"/Edit/_Undo", "<control>Z", NULL,
1774 0, "<StockItem>", GTK_STOCK_UNDO,},
1775 {"/Edit/_Redo", "<shift><control>Z", NULL,
1776 0, "<StockItem>", GTK_STOCK_REDO,},
1777 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1778 {"/Edit/Cu_t", "<control>X", NULL,
1779 0, "<StockItem>", GTK_STOCK_CUT,},
1780 {"/Edit/_Copy", "<control>C", NULL,
1781 0, "<StockItem>", GTK_STOCK_COPY,},
1782 {"/Edit/_Paste", "<control>V", NULL,
1783 0, "<StockItem>", GTK_STOCK_PASTE,},
1784 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1785 {"/Edit/Select _All", "<control>A", NULL, 0,
1786 #ifdef GTK_STOCK_SELECT_ALL /* first appeared in 2.10 */
1787 "<StockItem>", GTK_STOCK_SELECT_ALL,
1790 #endif /* GTK_STOCK_SELECT_ALL */
1793 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1794 {"/Edit/_Find Packet...", "<control>F", GTK_MENU_FUNC(find_frame_cb), 0, "<StockItem>", GTK_STOCK_FIND,},
1795 {"/Edit/Find Ne_xt", "<control>N", GTK_MENU_FUNC(find_next_cb), 0, NULL, NULL,},
1796 {"/Edit/Find Pre_vious", "<control>B", GTK_MENU_FUNC(find_previous_cb), 0, NULL, NULL,},
1797 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1798 #ifdef NEW_PACKET_LIST
1799 {"/Edit/_Mark Packet (toggle)", "<control>M", GTK_MENU_FUNC(new_packet_list_mark_frame_cb),0, NULL, NULL,},
1800 {"/Edit/Mark All Displayed Packets (toggle)", "<shift><control>M", GTK_MENU_FUNC(new_packet_list_mark_all_displayed_frames_cb), 0, NULL, NULL,},
1801 {"/Edit/Unmark All Packets", "<alt><control>M", GTK_MENU_FUNC(new_packet_list_unmark_all_frames_cb), 0, NULL, NULL,},
1802 {"/Edit/Find Next Mark", "<shift><control>N", GTK_MENU_FUNC(find_next_mark_cb), 0, NULL, NULL,},
1803 {"/Edit/Find Previous Mark", "<shift><control>B", GTK_MENU_FUNC(find_prev_mark_cb), 0, NULL, NULL,},
1804 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1805 {"/Edit/_Ignore Packet (toggle)", "<control>D", GTK_MENU_FUNC(new_packet_list_ignore_frame_cb), 0, NULL, NULL,},
1807 * XXX - this next one overrides /Edit/Copy/Description
1809 {"/Edit/Ignore All Displayed Packets (toggle)","<shift><control>D", GTK_MENU_FUNC(new_packet_list_ignore_all_displayed_frames_cb), 0, NULL, NULL,},
1810 {"/Edit/U_n-Ignore All Packets", "<alt><control>D", GTK_MENU_FUNC(new_packet_list_unignore_all_frames_cb), 0, NULL, NULL,},
1811 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1812 {"/Edit/Set Time Reference (toggle)", "<control>T", GTK_MENU_FUNC(reftime_frame_cb), REFTIME_TOGGLE, "<StockItem>", WIRESHARK_STOCK_TIME,},
1813 {"/Edit/Un-Time Reference All Packets", "<alt><control>T", GTK_MENU_FUNC(new_packet_list_untime_reference_all_frames_cb), 0, NULL, NULL,},
1814 {"/Edit/Find Next Time Reference", "<alt><control>N", GTK_MENU_FUNC(reftime_frame_cb), REFTIME_FIND_NEXT, NULL, NULL,},
1815 {"/Edit/Find Previous Time Reference", "<alt><control>B", GTK_MENU_FUNC(reftime_frame_cb), REFTIME_FIND_PREV, NULL, NULL,},
1816 #else /* NEW_PACKET_LIST */
1818 * XXX - this should be changed to match the list used with the new
1819 * packet list, assuming we don't just drop the old packet list
1822 {"/Edit/_Mark Packet (toggle)", "<control>M", GTK_MENU_FUNC(packet_list_mark_frame_cb),
1824 {"/Edit/Find Next Mark", "<shift><control>N", GTK_MENU_FUNC(find_next_mark_cb),
1826 {"/Edit/Find Previous Mark", "<shift><control>B", GTK_MENU_FUNC(find_prev_mark_cb),
1828 {"/Edit/Mark _All Displayed Packets (toggle)", "<shift><control>M", GTK_MENU_FUNC(packet_list_mark_all_frames_cb), 0, NULL, NULL,},
1829 {"/Edit/_Unmark All Packets", "<alt><control>M", GTK_MENU_FUNC(packet_list_unmark_all_frames_cb), 0, NULL, NULL,},
1830 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1831 {"/Edit/_Ignore Packet (toggle)", "<control>D", GTK_MENU_FUNC(packet_list_ignore_frame_cb),
1833 {"/Edit/Ignore All Displayed Packets (toggle)", "<shift><control>D", GTK_MENU_FUNC(packet_list_ignore_all_frames_cb),
1835 {"/Edit/U_n-Ignore All Packets", "<alt><control>D", GTK_MENU_FUNC(packet_list_unignore_all_frames_cb),
1837 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1838 {"/Edit/Set Time Reference (toggle)", "<control>T", GTK_MENU_FUNC(reftime_frame_cb),
1839 REFTIME_TOGGLE, "<StockItem>", WIRESHARK_STOCK_TIME,},
1840 {"/Edit/Find Next Time Reference", "<alt><shift><control>N", GTK_MENU_FUNC(reftime_frame_cb), REFTIME_FIND_NEXT, NULL, NULL,},
1841 {"/Edit/Find Previous Time Reference", "<alt><shift><control>B", GTK_MENU_FUNC(reftime_frame_cb), REFTIME_FIND_PREV, NULL, NULL,},
1842 #endif /* NEW_PACKET_LIST */
1843 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1844 {"/Edit/_Configuration Profiles...", "<shift><control>A", GTK_MENU_FUNC(profile_dialog_cb), 0, NULL, NULL,},
1845 {"/Edit/_Preferences...", "<shift><control>P", GTK_MENU_FUNC(prefs_page_cb),
1846 PREFS_PAGE_USER_INTERFACE, "<StockItem>", GTK_STOCK_PREFERENCES,},
1847 {"/_View", NULL, NULL, 0, "<Branch>", NULL,},
1848 {"/View/_Main Toolbar", NULL, GTK_MENU_FUNC(show_hide_cb), SHOW_HIDE_MAIN_TOOLBAR, "<CheckItem>", NULL,},
1849 {"/View/_Filter Toolbar", NULL, GTK_MENU_FUNC(show_hide_cb), SHOW_HIDE_FILTER_TOOLBAR, "<CheckItem>", NULL,},
1851 {"/View/_Wireless Toolbar", NULL, GTK_MENU_FUNC(show_hide_cb), SHOW_HIDE_AIRPCAP_TOOLBAR, "<CheckItem>", NULL,},
1853 {"/View/_Statusbar", NULL, GTK_MENU_FUNC(show_hide_cb), SHOW_HIDE_STATUSBAR, "<CheckItem>", NULL,},
1854 {"/View/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1855 {"/View/Packet _List", NULL, GTK_MENU_FUNC(show_hide_cb), SHOW_HIDE_PACKET_LIST, "<CheckItem>", NULL,},
1856 {"/View/Packet _Details", NULL, GTK_MENU_FUNC(show_hide_cb), SHOW_HIDE_TREE_VIEW, "<CheckItem>", NULL,},
1857 {"/View/Packet _Bytes", NULL, GTK_MENU_FUNC(show_hide_cb), SHOW_HIDE_BYTE_VIEW, "<CheckItem>", NULL,},
1858 {"/View/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1859 {"/View/_Time Display Format", NULL, NULL, 0, "<Branch>", NULL,},
1860 {"/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),
1861 TS_ABSOLUTE_WITH_DATE, "<RadioItem>", NULL,},
1862 {"/View/Time Display Format/Time of Day: 01:02:03.123456", "<alt><control>2", GTK_MENU_FUNC(timestamp_format_cb),
1863 TS_ABSOLUTE, "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456", NULL,},
1864 {"/View/Time Display Format/Seconds Since Epoch (1970-01-01): 1234567890.123456", "<alt><control>3", GTK_MENU_FUNC(timestamp_format_cb),
1865 TS_EPOCH, "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456", NULL,},
1866 {"/View/Time Display Format/Seconds Since Beginning of Capture: 123.123456", "<alt><control>4", GTK_MENU_FUNC(timestamp_format_cb),
1867 TS_RELATIVE, "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456", NULL,},
1868 {"/View/Time Display Format/Seconds Since Previous Captured Packet: 1.123456", "<alt><control>5", GTK_MENU_FUNC(timestamp_format_cb),
1869 TS_DELTA, "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456", NULL,},
1870 {"/View/Time Display Format/Seconds Since Previous Displayed Packet: 1.123456", "<alt><control>6", GTK_MENU_FUNC(timestamp_format_cb),
1871 TS_DELTA_DIS, "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456", NULL,},
1872 {"/View/Time Display Format/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1873 {"/View/Time Display Format/Automatic (File Format Precision)", NULL, GTK_MENU_FUNC(timestamp_precision_cb),
1874 TS_PREC_AUTO, "<RadioItem>", NULL,},
1875 {"/View/Time Display Format/Seconds: 0", NULL, GTK_MENU_FUNC(timestamp_precision_cb),
1876 TS_PREC_FIXED_SEC, "/View/Time Display Format/Automatic (File Format Precision)", NULL,},
1877 {"/View/Time Display Format/Deciseconds: 0.1", NULL, GTK_MENU_FUNC(timestamp_precision_cb),
1878 TS_PREC_FIXED_DSEC, "/View/Time Display Format/Automatic (File Format Precision)", NULL,},
1879 {"/View/Time Display Format/Centiseconds: 0.12", NULL, GTK_MENU_FUNC(timestamp_precision_cb),
1880 TS_PREC_FIXED_CSEC, "/View/Time Display Format/Automatic (File Format Precision)", NULL,},
1881 {"/View/Time Display Format/Milliseconds: 0.123", NULL, GTK_MENU_FUNC(timestamp_precision_cb),
1882 TS_PREC_FIXED_MSEC, "/View/Time Display Format/Automatic (File Format Precision)", NULL,},
1883 {"/View/Time Display Format/Microseconds: 0.123456", NULL, GTK_MENU_FUNC(timestamp_precision_cb),
1884 TS_PREC_FIXED_USEC, "/View/Time Display Format/Automatic (File Format Precision)", NULL,},
1885 {"/View/Time Display Format/Nanoseconds: 0.123456789", NULL, GTK_MENU_FUNC(timestamp_precision_cb),
1886 TS_PREC_FIXED_NSEC, "/View/Time Display Format/Automatic (File Format Precision)", NULL,},
1887 {"/View/Time Display Format/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1888 {"/View/Time Display Format/Display Seconds with hours and minutes", "<alt><control>0", GTK_MENU_FUNC(timestamp_seconds_time_cb), 0, "<CheckItem>", NULL,},
1889 {"/View/Name Resol_ution", NULL, NULL, 0, "<Branch>", NULL,},
1890 {"/View/Name Resolution/_Resolve Name", NULL, GTK_MENU_FUNC(resolve_name_cb), 0, NULL, NULL,},
1891 {"/View/Name Resolution/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1892 {"/View/Name Resolution/Enable for _MAC Layer", NULL, GTK_MENU_FUNC(name_resolution_cb), RESOLV_MAC, "<CheckItem>", NULL,},
1893 {"/View/Name Resolution/Enable for _Network Layer", NULL, GTK_MENU_FUNC(name_resolution_cb), RESOLV_NETWORK, "<CheckItem>", NULL,},
1894 {"/View/Name Resolution/Enable for _Transport Layer", NULL, GTK_MENU_FUNC(name_resolution_cb), RESOLV_TRANSPORT, "<CheckItem>", NULL,},
1895 {"/View/Colorize Packet List", NULL, colorize_cb, 0, "<CheckItem>", NULL,},
1897 {"/View/Auto Scroll in Li_ve Capture", NULL, GTK_MENU_FUNC(auto_scroll_live_cb), 0, "<CheckItem>", NULL,},
1899 {"/View/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1900 {"/View/_Zoom In", "<control>plus", GTK_MENU_FUNC(view_zoom_in_cb),
1901 0, "<StockItem>", GTK_STOCK_ZOOM_IN,},
1902 {"/View/Zoom _Out", "<control>minus", GTK_MENU_FUNC(view_zoom_out_cb),
1903 0, "<StockItem>", GTK_STOCK_ZOOM_OUT,},
1904 {"/View/_Normal Size", "<control>equal", GTK_MENU_FUNC(view_zoom_100_cb),
1905 0, "<StockItem>", GTK_STOCK_ZOOM_100,},
1906 #ifdef NEW_PACKET_LIST
1907 {"/View/Resize All Columns", "<shift><control>R", GTK_MENU_FUNC(new_packet_list_resize_columns_cb),
1908 0, "<StockItem>", WIRESHARK_STOCK_RESIZE_COLUMNS,},
1909 {"/View/Displayed Columns", NULL, NULL, 0, NULL, NULL,},
1911 {"/View/Resize All Columns", "<shift><control>R", GTK_MENU_FUNC(packet_list_resize_columns_cb),
1912 0, "<StockItem>", WIRESHARK_STOCK_RESIZE_COLUMNS,},
1913 #endif /* NEW_PACKET_LIST */
1914 {"/View/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1915 {"/View/E_xpand Subtrees", "<shift>Right", GTK_MENU_FUNC(expand_tree_cb), 0, NULL, NULL,},
1916 {"/View/_Expand All", "<control>Right", GTK_MENU_FUNC(expand_all_cb),
1918 {"/View/Collapse _All", "<control>Left", GTK_MENU_FUNC(collapse_all_cb),
1920 {"/View/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1921 {"/View/Colorize Conversation", NULL, NULL, 0, "<Branch>",NULL,},
1922 {"/View/Colorize Conversation/Color 1", "<control>1",
1923 GTK_MENU_FUNC(colorize_conversation_cb), 1*256, "<StockItem>", WIRESHARK_STOCK_COLOR1,},
1924 {"/View/Colorize Conversation/Color 2", "<control>2",
1925 GTK_MENU_FUNC(colorize_conversation_cb), 2*256, "<StockItem>", WIRESHARK_STOCK_COLOR2,},
1926 {"/View/Colorize Conversation/Color 3", "<control>3",
1927 GTK_MENU_FUNC(colorize_conversation_cb), 3*256, "<StockItem>", WIRESHARK_STOCK_COLOR3,},
1928 {"/View/Colorize Conversation/Color 4", "<control>4",
1929 GTK_MENU_FUNC(colorize_conversation_cb), 4*256, "<StockItem>", WIRESHARK_STOCK_COLOR4,},
1930 {"/View/Colorize Conversation/Color 5", "<control>5",
1931 GTK_MENU_FUNC(colorize_conversation_cb), 5*256, "<StockItem>", WIRESHARK_STOCK_COLOR5,},
1932 {"/View/Colorize Conversation/Color 6", "<control>6",
1933 GTK_MENU_FUNC(colorize_conversation_cb), 6*256, "<StockItem>", WIRESHARK_STOCK_COLOR6,},
1934 {"/View/Colorize Conversation/Color 7", "<control>7",
1935 GTK_MENU_FUNC(colorize_conversation_cb), 7*256, "<StockItem>", WIRESHARK_STOCK_COLOR7,},
1936 {"/View/Colorize Conversation/Color 8", "<control>8",
1937 GTK_MENU_FUNC(colorize_conversation_cb), 8*256, "<StockItem>", WIRESHARK_STOCK_COLOR8,},
1938 {"/View/Colorize Conversation/Color 9", "<control>9",
1939 GTK_MENU_FUNC(colorize_conversation_cb), 9*256, "<StockItem>", WIRESHARK_STOCK_COLOR9,},
1940 {"/View/Colorize Conversation/Color 10", "<control>0",
1941 GTK_MENU_FUNC(colorize_conversation_cb), 10*256, "<StockItem>", WIRESHARK_STOCK_COLOR0,},
1942 {"/View/Colorize Conversation/<separator>", NULL,
1943 NULL, 0, "<Separator>",NULL,},
1944 {"/View/Colorize Conversation/New Coloring Rule...", NULL,
1945 GTK_MENU_FUNC(colorize_conversation_cb), 0, "<StockItem>", GTK_STOCK_SELECT_COLOR,},
1946 {"/View/Reset Coloring 1-10", "<control>space",
1947 GTK_MENU_FUNC(colorize_conversation_cb), 255*256, NULL, NULL,},
1948 {"/View/_Coloring Rules...", NULL, color_display_cb,
1949 0, "<StockItem>", GTK_STOCK_SELECT_COLOR,},
1950 {"/View/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1953 {"/View/Show Packet in New _Window", NULL,
1954 GTK_MENU_FUNC(new_window_cb), 0, NULL, NULL,},
1955 {"/View/_Reload", "<control>R", GTK_MENU_FUNC(file_reload_cmd_cb),
1956 0, "<StockItem>", GTK_STOCK_REFRESH,},
1957 {"/_Go", NULL, NULL, 0, "<Branch>", NULL,},
1958 {"/Go/_Back", "<alt>Left",
1959 GTK_MENU_FUNC(history_back_cb), 0, "<StockItem>", GTK_STOCK_GO_BACK,},
1960 {"/Go/_Forward", "<alt>Right",
1961 GTK_MENU_FUNC(history_forward_cb), 0, "<StockItem>", GTK_STOCK_GO_FORWARD,},
1962 {"/Go/_Go to Packet...", "<control>G",
1963 GTK_MENU_FUNC(goto_frame_cb), 0, "<StockItem>", GTK_STOCK_JUMP_TO,},
1964 {"/Go/Go to _Corresponding Packet", NULL, GTK_MENU_FUNC(goto_framenum_cb),
1966 {"/Go/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1967 {"/Go/Previous Packet", "<control>Up",
1968 GTK_MENU_FUNC(goto_previous_frame_cb), 0, "<StockItem>", GTK_STOCK_GO_UP,},
1969 {"/Go/Next Packet", "<control>Down",
1970 GTK_MENU_FUNC(goto_next_frame_cb), 0, "<StockItem>", GTK_STOCK_GO_DOWN,},
1971 {"/Go/F_irst Packet", "<control>Home",
1972 GTK_MENU_FUNC(goto_top_frame_cb), 0, "<StockItem>", GTK_STOCK_GOTO_TOP,},
1973 {"/Go/_Last Packet", "<control>End",
1974 GTK_MENU_FUNC(goto_bottom_frame_cb), 0, "<StockItem>", GTK_STOCK_GOTO_BOTTOM,},
1975 {"/Go/Previous Packet In Conversation", "<control>bracketleft",
1976 GTK_MENU_FUNC(goto_previous_frame_conversation_cb), 0, NULL, NULL,},
1977 {"/Go/Next Packet In Conversation", "<control>bracketright",
1978 GTK_MENU_FUNC(goto_next_frame_conversation_cb), 0, NULL, NULL,},
1980 {"/_Capture", NULL, NULL, 0, "<Branch>", NULL,},
1981 {"/Capture/_Interfaces...", "<control>I",
1982 GTK_MENU_FUNC(capture_if_cb), 0, "<StockItem>", WIRESHARK_STOCK_CAPTURE_INTERFACES,},
1983 {"/Capture/_Options...", "<control>K",
1984 GTK_MENU_FUNC(capture_prep_cb), 0, "<StockItem>", WIRESHARK_STOCK_CAPTURE_OPTIONS,},
1985 {"/Capture/_Start", "<control>E",
1986 GTK_MENU_FUNC(capture_start_cb), 0, "<StockItem>", WIRESHARK_STOCK_CAPTURE_START,},
1987 {"/Capture/S_top", "<control>E", GTK_MENU_FUNC(capture_stop_cb),
1988 0, "<StockItem>", WIRESHARK_STOCK_CAPTURE_STOP,},
1989 {"/Capture/_Restart", "<control>R", GTK_MENU_FUNC(capture_restart_cb),
1990 0, "<StockItem>", WIRESHARK_STOCK_CAPTURE_RESTART,},
1991 {"/Capture/Capture _Filters...", NULL, GTK_MENU_FUNC(cfilter_dialog_cb),
1992 0, "<StockItem>", WIRESHARK_STOCK_CAPTURE_FILTER,},
1993 #endif /* HAVE_LIBPCAP */
1994 {"/_Analyze", NULL, NULL, 0, "<Branch>", NULL,},
1995 {"/Analyze/_Display Filters...", NULL, GTK_MENU_FUNC(dfilter_dialog_cb),
1996 0, "<StockItem>", WIRESHARK_STOCK_DISPLAY_FILTER,},
1997 {"/Analyze/Display Filter _Macros...", NULL, GTK_MENU_FUNC(macros_dialog_cb), 0, NULL, NULL,},
1998 {"/Analyze/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1999 {"/Analyze/Apply as Column", NULL, GTK_MENU_FUNC(apply_as_custom_column_cb), 0, NULL, NULL},
2000 {"/Analyze/Appl_y as Filter", NULL, NULL, 0, "<Branch>", NULL,},
2001 {"/Analyze/Apply as Filter/_Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
2002 MATCH_SELECTED_REPLACE|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
2003 {"/Analyze/Apply as Filter/_Not Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
2004 MATCH_SELECTED_NOT|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
2005 {"/Analyze/Apply as Filter/" UTF8_HORIZONTAL_ELLIPSIS " _and Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
2006 MATCH_SELECTED_AND|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
2007 {"/Analyze/Apply as Filter/" UTF8_HORIZONTAL_ELLIPSIS " _or Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
2008 MATCH_SELECTED_OR|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
2009 {"/Analyze/Apply as Filter/" UTF8_HORIZONTAL_ELLIPSIS " a_nd not Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
2010 MATCH_SELECTED_AND_NOT|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
2011 {"/Analyze/Apply as Filter/" UTF8_HORIZONTAL_ELLIPSIS " o_r not Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
2012 MATCH_SELECTED_OR_NOT|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
2013 {"/Analyze/_Prepare a Filter", NULL, NULL, 0, "<Branch>", NULL,},
2014 {"/Analyze/Prepare a Filter/_Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
2015 MATCH_SELECTED_REPLACE, NULL, NULL,},
2016 {"/Analyze/Prepare a Filter/_Not Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
2017 MATCH_SELECTED_NOT, NULL, NULL,},
2018 {"/Analyze/Prepare a Filter/" UTF8_HORIZONTAL_ELLIPSIS " _and Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
2019 MATCH_SELECTED_AND, NULL, NULL,},
2020 {"/Analyze/Prepare a Filter/" UTF8_HORIZONTAL_ELLIPSIS " _or Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
2021 MATCH_SELECTED_OR, NULL, NULL,},
2022 {"/Analyze/Prepare a Filter/" UTF8_HORIZONTAL_ELLIPSIS " a_nd not Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
2023 MATCH_SELECTED_AND_NOT, NULL, NULL,},
2024 {"/Analyze/Prepare a Filter/" UTF8_HORIZONTAL_ELLIPSIS " o_r not Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
2025 MATCH_SELECTED_OR_NOT, NULL, NULL,},
2026 {"/Analyze/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
2027 {"/Analyze/_Enabled Protocols...", "<shift><control>E", GTK_MENU_FUNC(proto_cb),
2028 0, "<StockItem>", WIRESHARK_STOCK_CHECKBOX,},
2029 {"/Analyze/Decode _As...", NULL, GTK_MENU_FUNC(decode_as_cb),
2030 0, "<StockItem>", WIRESHARK_STOCK_DECODE_AS,},
2031 {"/Analyze/_User Specified Decodes...", NULL,
2032 GTK_MENU_FUNC(decode_show_cb), 0, "<StockItem>", WIRESHARK_STOCK_DECODE_AS,},
2033 {"/Analyze/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
2034 {"/Analyze/_Follow TCP Stream", NULL,
2035 GTK_MENU_FUNC(follow_tcp_stream_cb), 0, NULL, NULL,},
2036 {"/Analyze/_Follow UDP Stream", NULL,
2037 GTK_MENU_FUNC(follow_udp_stream_cb), 0, NULL, NULL,},
2038 {"/Analyze/_Follow SSL Stream", NULL,
2039 GTK_MENU_FUNC(follow_ssl_stream_cb), 0, NULL, NULL,},
2040 {"/_Statistics", NULL, NULL, 0, "<Branch>", NULL,},
2041 {"/Statistics/_Summary", NULL, GTK_MENU_FUNC(summary_open_cb), 0, "<StockItem>", GTK_STOCK_PROPERTIES,},
2042 {"/Statistics/_Protocol Hierarchy", NULL,
2043 GTK_MENU_FUNC(proto_hier_stats_cb), 0, NULL, NULL,},
2044 {"/Statistics/Conversations", NULL,
2045 GTK_MENU_FUNC(init_conversation_notebook_cb), 0, "<StockItem>", WIRESHARK_STOCK_CONVERSATIONS,},
2046 {"/Statistics/Endpoints", NULL,
2047 GTK_MENU_FUNC(init_hostlist_notebook_cb), 0, "<StockItem>", WIRESHARK_STOCK_ENDPOINTS,},
2048 {"/Telephon_y", NULL, NULL, 0, "<Branch>", NULL,},
2049 {"/_Tools", NULL, NULL, 0, "<Branch>", NULL,},
2050 {"/Tools/Firewall ACL Rules", NULL,
2051 firewall_rule_cb, 0, NULL, NULL,},
2052 {"/WS internal", NULL, NULL, 0, "<Branch>", NULL,},
2053 {"/WS internal/Dissector tables", NULL, GTK_MENU_FUNC(dissector_tables_dlg_cb),
2055 {"/_Help", NULL, NULL, 0, "<Branch>", NULL,},
2056 {"/Help/_Contents", "F1", GTK_MENU_FUNC(topic_menu_cb), HELP_CONTENT, "<StockItem>", GTK_STOCK_HELP,},
2057 {"/Help/FAQ's", NULL, GTK_MENU_FUNC(topic_menu_cb), ONLINEPAGE_FAQ, NULL, NULL,},
2058 {"/Help/Manual Pages", NULL, NULL, 0, "<Branch>", NULL,},
2059 {"/Help/Manual Pages/Wireshark", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_WIRESHARK, NULL, NULL,},
2060 {"/Help/Manual Pages/Wireshark Filter", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_WIRESHARK_FILTER, NULL, NULL,},
2061 {"/Help/Manual Pages/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
2062 {"/Help/Manual Pages/TShark", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_TSHARK, NULL, NULL,},
2063 {"/Help/Manual Pages/RawShark", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_RAWSHARK, NULL, NULL,},
2064 {"/Help/Manual Pages/Dumpcap", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_DUMPCAP, NULL, NULL,},
2065 {"/Help/Manual Pages/Mergecap", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_MERGECAP, NULL, NULL,},
2066 {"/Help/Manual Pages/Editcap", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_EDITCAP, NULL, NULL,},
2067 {"/Help/Manual Pages/Text2pcap", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_TEXT2PCAP, NULL, NULL,},
2068 {"/Help/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
2069 {"/Help/Website", NULL, GTK_MENU_FUNC(topic_menu_cb), ONLINEPAGE_HOME, "<StockItem>", GTK_STOCK_HOME,},
2070 {"/Help/Wiki", NULL, GTK_MENU_FUNC(topic_menu_cb), ONLINEPAGE_WIKI, "<StockItem>", WIRESHARK_STOCK_WIKI,},
2071 {"/Help/Downloads", NULL, GTK_MENU_FUNC(topic_menu_cb), ONLINEPAGE_DOWNLOAD, NULL, NULL,},
2072 {"/Help/Sample Captures", NULL, GTK_MENU_FUNC(topic_menu_cb), ONLINEPAGE_SAMPLE_FILES, NULL, NULL,},
2073 {"/Help/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
2074 {"/Help/_Supported Protocols (slow!)", NULL, GTK_MENU_FUNC(supported_cb), 0, NULL, NULL,},
2075 {"/Help/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
2076 {"/Help/_About Wireshark", NULL, GTK_MENU_FUNC(about_wireshark_cb),
2077 0, "<StockItem>", WIRESHARK_STOCK_ABOUT}
2080 /* calculate the number of menu_items */
2081 static int nmenu_items = sizeof(menu_items) / sizeof(menu_items[0]);
2082 #endif /* MAIN_MENU_USE_UIMANAGER */
2086 select_bytes_view_cb (GtkRadioAction *action, GtkRadioAction *current _U_, gpointer user_data _U_)
2090 value = gtk_radio_action_get_current_value (action);
2092 select_bytes_view( NULL, NULL, value);
2096 sort_ascending_cb(GtkAction *action _U_, gpointer user_data)
2098 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/SortAscending");
2099 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_SORT_ASCENDING);
2103 sort_descending_cb(GtkAction *action _U_, gpointer user_data)
2105 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/SortDescending");
2106 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_SORT_DESCENDING);
2110 no_sorting_cb(GtkAction *action _U_, gpointer user_data)
2112 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/NoSorting");
2113 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_SORT_NONE);
2117 packet_list_heading_show_resolved_cb(GtkAction *action _U_, gpointer user_data _U_)
2119 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/ShowResolved");
2121 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_TOGGLE_RESOLVED);
2125 packet_list_heading_align_left_cb(GtkAction *action _U_, gpointer user_data)
2127 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/AlignLeft");
2128 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_ALIGN_LEFT);
2132 packet_list_heading_align_center_cb(GtkAction *action _U_, gpointer user_data)
2134 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/AlignCenter");
2135 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_ALIGN_CENTER);
2139 packet_list_heading_align_right_cb(GtkAction *action _U_, gpointer user_data)
2141 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/AlignRight");
2142 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_ALIGN_RIGHT);
2146 packet_list_heading_col_pref_cb(GtkAction *action _U_, gpointer user_data)
2148 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/ColumnPreferences");
2149 prefs_page_cb( widget , user_data, PREFS_PAGE_COLUMNS);
2153 packet_list_heading_resize_col_cb(GtkAction *action _U_, gpointer user_data)
2155 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/ResizeColumn");
2156 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_RESIZE);
2160 packet_list_heading_change_col_cb(GtkAction *action _U_, gpointer user_data)
2162 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/RenameColumnTitle");
2163 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_CHANGE);
2167 packet_list_heading_activate_all_columns_cb(GtkAction *action _U_, gpointer user_data _U_)
2169 new_packet_list_set_all_columns_visible ();
2173 packet_list_heading_hide_col_cb(GtkAction *action _U_, gpointer user_data)
2175 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/RenameColumnTitle");
2176 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_HIDE);
2180 packet_list_heading_remove_col_cb(GtkAction *action _U_, gpointer user_data)
2182 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/RemoveColumn");
2183 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_REMOVE);
2187 packet_list_menu_set_ref_time_cb(GtkAction *action _U_, gpointer user_data)
2189 reftime_frame_cb( NULL /* widget _U_ */ , user_data, REFTIME_TOGGLE);
2194 packet_list_menu_apply_selected_cb(GtkAction *action _U_, gpointer user_data)
2196 match_selected_plist_cb( NULL /* widget _U_ */, user_data, MATCH_SELECTED_REPLACE|MATCH_SELECTED_APPLY_NOW);
2200 packet_list_menu_apply_not_selected_cb(GtkAction *action _U_, gpointer user_data)
2202 match_selected_plist_cb( NULL /* widget _U_ */ , user_data, MATCH_SELECTED_NOT|MATCH_SELECTED_APPLY_NOW);
2206 packet_list_menu_apply_and_selected_cb(GtkAction *action _U_, gpointer user_data)
2208 match_selected_plist_cb( NULL /* widget _U_ */ , user_data, MATCH_SELECTED_AND|MATCH_SELECTED_APPLY_NOW);
2212 packet_list_menu_apply_or_selected_cb(GtkAction *action _U_, gpointer user_data)
2214 match_selected_plist_cb( NULL /* widget _U_ */ , user_data, MATCH_SELECTED_OR|MATCH_SELECTED_APPLY_NOW);
2218 packet_list_menu_apply_and_not_selected_cb(GtkAction *action _U_, gpointer user_data)
2220 match_selected_plist_cb( NULL /* widget _U_ */ , user_data, MATCH_SELECTED_AND_NOT|MATCH_SELECTED_APPLY_NOW);
2224 packet_list_menu_apply_or_not_selected_cb(GtkAction *action _U_, gpointer user_data)
2226 match_selected_plist_cb( NULL /* widget _U_ */ , user_data,MATCH_SELECTED_OR_NOT|MATCH_SELECTED_APPLY_NOW);
2228 /* Prepare a filter */
2230 packet_list_menu_prepare_selected_cb(GtkAction *action _U_, gpointer user_data)
2232 match_selected_plist_cb( NULL /* widget _U_ */ , user_data, MATCH_SELECTED_REPLACE);
2236 packet_list_menu_prepare_not_selected_cb(GtkAction *action _U_, gpointer user_data)
2238 match_selected_plist_cb( NULL /* widget _U_ */ , user_data, MATCH_SELECTED_NOT);
2242 packet_list_menu_prepare_and_selected_cb(GtkAction *action _U_, gpointer user_data)
2244 match_selected_plist_cb( NULL /* widget _U_ */ , user_data, MATCH_SELECTED_AND);
2248 packet_list_menu_prepare_or_selected_cb(GtkAction *action _U_, gpointer user_data)
2250 match_selected_plist_cb( NULL /* widget _U_ */ , user_data, MATCH_SELECTED_OR);
2254 packet_list_menu_prepare_and_not_selected_cb(GtkAction *action _U_, gpointer user_data)
2256 match_selected_plist_cb( NULL /* widget _U_ */ , user_data, MATCH_SELECTED_AND_NOT);
2260 packet_list_menu_prepare_or_not_selected_cb(GtkAction *action _U_, gpointer user_data)
2262 match_selected_plist_cb( NULL /* widget _U_ */ , user_data, MATCH_SELECTED_OR_NOT);
2266 packet_list_menu_conversation_ethernet_cb(GtkAction *action, gpointer user_data)
2268 conversation_cb( action, user_data, CONV_ETHER);
2272 packet_list_menu_conversation_ip_cb(GtkAction *action _U_, gpointer user_data)
2274 conversation_cb( action, user_data, CONV_IP);
2278 packet_list_menu_conversation_tcp_cb(GtkAction *action _U_, gpointer user_data)
2280 conversation_cb( action, user_data, CONV_TCP);
2284 packet_list_menu_conversation_udp_cb(GtkAction *action _U_, gpointer user_data)
2286 conversation_cb( action, user_data, CONV_UDP);
2290 packet_list_menu_conversation_pn_cba_cb(GtkAction *action _U_, gpointer user_data)
2292 conversation_cb( action, user_data, CONV_CBA);
2298 packet_list_menu_color_conv_ethernet_color1_cb(GtkAction *action _U_, gpointer user_data)
2300 colorize_conversation_cb( NULL /* widget _U_ */, user_data, CONV_ETHER+1*256);
2305 packet_list_menu_color_conv_ethernet_color2_cb(GtkAction *action _U_, gpointer user_data)
2307 colorize_conversation_cb( NULL/* widget _U_ */ , user_data, CONV_ETHER+1*256);
2311 packet_list_menu_color_conv_ethernet_color3_cb(GtkAction *action _U_, gpointer user_data)
2313 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_ETHER+3*256);
2317 packet_list_menu_color_conv_ethernet_color4_cb(GtkAction *action _U_, gpointer user_data)
2319 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_ETHER+4*256);
2323 packet_list_menu_color_conv_ethernet_color5_cb(GtkAction *action _U_, gpointer user_data)
2325 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_ETHER+5*256);
2329 packet_list_menu_color_conv_ethernet_color6_cb(GtkAction *action _U_, gpointer user_data)
2331 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_ETHER+6*256);
2335 packet_list_menu_color_conv_ethernet_color7_cb(GtkAction *action _U_, gpointer user_data)
2337 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_ETHER+7*256);
2341 packet_list_menu_color_conv_ethernet_color8_cb(GtkAction *action _U_, gpointer user_data)
2343 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_ETHER+8*256);
2347 packet_list_menu_color_conv_ethernet_color9_cb(GtkAction *action _U_, gpointer user_data)
2349 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_ETHER+9*256);
2353 packet_list_menu_color_conv_ethernet_color10_cb(GtkAction *action _U_, gpointer user_data)
2355 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_ETHER+10*256);
2360 packet_list_menu_color_conv_ethernet_new_rule_cb(GtkAction *action _U_, gpointer user_data)
2362 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_ETHER);
2369 packet_list_menu_color_conv_ip_color1_cb(GtkAction *action _U_, gpointer user_data)
2371 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_IP+1*256);
2376 packet_list_menu_color_conv_ip_color2_cb(GtkAction *action _U_, gpointer user_data)
2378 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_IP+1*256);
2382 packet_list_menu_color_conv_ip_color3_cb(GtkAction *action _U_, gpointer user_data)
2384 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_IP+3*256);
2388 packet_list_menu_color_conv_ip_color4_cb(GtkAction *action _U_, gpointer user_data)
2390 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_IP+4*256);
2394 packet_list_menu_color_conv_ip_color5_cb(GtkAction *action _U_, gpointer user_data)
2396 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_IP+5*256);
2400 packet_list_menu_color_conv_ip_color6_cb(GtkAction *action _U_, gpointer user_data)
2402 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_IP+6*256);
2406 packet_list_menu_color_conv_ip_color7_cb(GtkAction *action _U_, gpointer user_data)
2408 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_IP+7*256);
2412 packet_list_menu_color_conv_ip_color8_cb(GtkAction *action _U_, gpointer user_data)
2414 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_IP+8*256);
2418 packet_list_menu_color_conv_ip_color9_cb(GtkAction *action _U_, gpointer user_data)
2420 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_IP+9*256);
2424 packet_list_menu_color_conv_ip_color10_cb(GtkAction *action _U_, gpointer user_data)
2426 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_IP+10*256);
2431 packet_list_menu_color_conv_ip_new_rule_cb(GtkAction *action _U_, gpointer user_data)
2433 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_TCP);
2439 packet_list_menu_color_conv_tcp_color1_cb(GtkAction *action _U_, gpointer user_data)
2441 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_TCP+1*256);
2446 packet_list_menu_color_conv_tcp_color2_cb(GtkAction *action _U_, gpointer user_data)
2448 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_TCP+1*256);
2452 packet_list_menu_color_conv_tcp_color3_cb(GtkAction *action _U_, gpointer user_data)
2454 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_TCP+3*256);
2458 packet_list_menu_color_conv_tcp_color4_cb(GtkAction *action _U_, gpointer user_data)
2460 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_TCP+4*256);
2464 packet_list_menu_color_conv_tcp_color5_cb(GtkAction *action _U_, gpointer user_data)
2466 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_TCP+5*256);
2470 packet_list_menu_color_conv_tcp_color6_cb(GtkAction *action _U_, gpointer user_data)
2472 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_TCP+6*256);
2476 packet_list_menu_color_conv_tcp_color7_cb(GtkAction *action _U_, gpointer user_data)
2478 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_TCP+7*256);
2482 packet_list_menu_color_conv_tcp_color8_cb(GtkAction *action _U_, gpointer user_data)
2484 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_TCP+8*256);
2488 packet_list_menu_color_conv_tcp_color9_cb(GtkAction *action _U_, gpointer user_data)
2490 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_TCP+9*256);
2494 packet_list_menu_color_conv_tcp_color10_cb(GtkAction *action _U_, gpointer user_data)
2496 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_TCP+10*256);
2501 packet_list_menu_color_conv_tcp_new_rule_cb(GtkAction *action _U_, gpointer user_data)
2503 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_TCP);
2509 packet_list_menu_color_conv_udp_color1_cb(GtkAction *action _U_, gpointer user_data)
2511 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_UDP+1*256);
2516 packet_list_menu_color_conv_udp_color2_cb(GtkAction *action _U_, gpointer user_data)
2518 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_UDP+1*256);
2522 packet_list_menu_color_conv_udp_color3_cb(GtkAction *action _U_, gpointer user_data)
2524 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_UDP+3*256);
2528 packet_list_menu_color_conv_udp_color4_cb(GtkAction *action _U_, gpointer user_data)
2530 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_UDP+4*256);
2534 packet_list_menu_color_conv_udp_color5_cb(GtkAction *action _U_, gpointer user_data)
2536 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_UDP+5*256);
2540 packet_list_menu_color_conv_udp_color6_cb(GtkAction *action _U_, gpointer user_data)
2542 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_UDP+6*256);
2546 packet_list_menu_color_conv_udp_color7_cb(GtkAction *action _U_, gpointer user_data)
2548 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_UDP+7*256);
2552 packet_list_menu_color_conv_udp_color8_cb(GtkAction *action _U_, gpointer user_data)
2554 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_UDP+8*256);
2558 packet_list_menu_color_conv_udp_color9_cb(GtkAction *action _U_, gpointer user_data)
2560 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_UDP+9*256);
2564 packet_list_menu_color_conv_udp_color10_cb(GtkAction *action _U_, gpointer user_data)
2566 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_UDP+10*256);
2571 packet_list_menu_color_conv_udp_new_rule_cb(GtkAction *action _U_, gpointer user_data)
2573 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_UDP);
2580 packet_list_menu_color_conv_cba_color1_cb(GtkAction *action _U_, gpointer user_data)
2582 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_CBA+1*256);
2587 packet_list_menu_color_conv_cba_color2_cb(GtkAction *action _U_, gpointer user_data)
2589 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_CBA+1*256);
2593 packet_list_menu_color_conv_cba_color3_cb(GtkAction *action _U_, gpointer user_data)
2595 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_CBA+3*256);
2599 packet_list_menu_color_conv_cba_color4_cb(GtkAction *action _U_, gpointer user_data)
2601 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_CBA+4*256);
2605 packet_list_menu_color_conv_cba_color5_cb(GtkAction *action _U_, gpointer user_data)
2607 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_CBA+5*256);
2611 packet_list_menu_color_conv_cba_color6_cb(GtkAction *action _U_, gpointer user_data)
2613 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_CBA+6*256);
2617 packet_list_menu_color_conv_cba_color7_cb(GtkAction *action _U_, gpointer user_data)
2619 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_CBA+7*256);
2623 packet_list_menu_color_conv_cba_color8_cb(GtkAction *action _U_, gpointer user_data)
2625 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_CBA+8*256);
2629 packet_list_menu_color_conv_cba_color9_cb(GtkAction *action _U_, gpointer user_data)
2631 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_CBA+9*256);
2635 packet_list_menu_color_conv_cba_color10_cb(GtkAction *action _U_, gpointer user_data)
2637 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_CBA+10*256);
2642 packet_list_menu_color_conv_cba_new_rule_cb(GtkAction *action _U_, gpointer user_data)
2644 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_CBA);
2649 packet_list_menu_copy_sum_txt(GtkAction *action _U_, gpointer user_data)
2651 copy_hex_cb( NULL /* widget _U_ */ , user_data, CS_TEXT);
2656 packet_list_menu_copy_sum_csv(GtkAction *action _U_, gpointer user_data)
2658 copy_hex_cb( NULL /* widget _U_ */ , user_data, CS_CSV);
2663 packet_list_menu_copy_as_flt(GtkAction *action _U_, gpointer user_data)
2665 copy_hex_cb( NULL /* widget _U_ */ , user_data, MATCH_SELECTED_REPLACE|MATCH_SELECTED_COPY_ONLY);
2670 packet_list_menu_copy_bytes_oht_cb(GtkAction *action _U_, gpointer user_data)
2672 copy_hex_cb( NULL /* widget _U_ */ , user_data, CD_ALLINFO | CD_FLAGS_SELECTEDONLY);
2677 packet_list_menu_copy_bytes_oh_cb(GtkAction *action _U_, gpointer user_data)
2679 copy_hex_cb( NULL /* widget _U_ */ , user_data, CD_HEXCOLUMNS | CD_FLAGS_SELECTEDONLY);
2684 packet_list_menu_copy_bytes_text_cb(GtkAction *action _U_, gpointer user_data)
2686 copy_hex_cb( NULL /* widget _U_ */ , user_data, CD_TEXTONLY | CD_FLAGS_SELECTEDONLY);
2691 packet_list_menu_copy_bytes_hex_strm_cb(GtkAction *action _U_, gpointer user_data)
2693 copy_hex_cb( NULL /* widget _U_ */ , user_data, CD_HEX | CD_FLAGS_SELECTEDONLY);
2698 packet_list_menu_copy_bytes_bin_strm_cb(GtkAction *action _U_, gpointer user_data)
2700 copy_hex_cb( NULL /* widget _U_ */ , user_data, CD_BINARY | CD_FLAGS_SELECTEDONLY);
2708 tree_view_menu_color_with_flt_color1_cb(GtkAction *action _U_, gpointer user_data)
2710 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 1);
2715 tree_view_menu_color_with_flt_color2_cb(GtkAction *action _U_, gpointer user_data)
2717 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 2);
2721 tree_view_menu_color_with_flt_color3_cb(GtkAction *action _U_, gpointer user_data)
2723 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 3);
2727 tree_view_menu_color_with_flt_color4_cb(GtkAction *action _U_, gpointer user_data)
2729 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 4);
2733 tree_view_menu_color_with_flt_color5_cb(GtkAction *action _U_, gpointer user_data)
2735 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 5);
2739 tree_view_menu_color_with_flt_color6_cb(GtkAction *action _U_, gpointer user_data)
2741 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 6);
2745 tree_view_menu_color_with_flt_color7_cb(GtkAction *action _U_, gpointer user_data)
2747 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 7);
2751 tree_view_menu_color_with_flt_color8_cb(GtkAction *action _U_, gpointer user_data)
2753 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 8);
2757 tree_view_menu_color_with_flt_color9_cb(GtkAction *action _U_, gpointer user_data)
2759 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 9);
2763 tree_view_menu_color_with_flt_color10_cb(GtkAction *action _U_, gpointer user_data)
2765 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 10);
2770 tree_view_menu_color_with_flt_new_rule_cb(GtkAction *action _U_, gpointer user_data)
2772 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 0);
2777 tree_view_menu_copy_desc(GtkAction *action _U_, gpointer user_data)
2779 copy_selected_plist_cb( NULL /* widget _U_ */ , user_data, COPY_SELECTED_DESCRIPTION);
2784 tree_view_menu_copy_field(GtkAction *action _U_, gpointer user_data)
2786 copy_selected_plist_cb( NULL /* widget _U_ */ , user_data, COPY_SELECTED_FIELDNAME);
2791 tree_view_menu_copy_value(GtkAction *action _U_, gpointer user_data)
2793 copy_selected_plist_cb( NULL /* widget _U_ */ , user_data, COPY_SELECTED_VALUE);
2798 tree_view_menu_copy_as_flt(GtkAction *action _U_, gpointer user_data)
2800 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/Copy/AsFilter");
2801 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_REPLACE|MATCH_SELECTED_COPY_ONLY);
2805 static const char *ui_desc_packet_list_heading_menu_popup =
2807 " <popup name='PacketListHeadingPopup' action='PopupAction'>\n"
2808 " <menuitem name='SortAscending' action='/Sort Ascending'/>\n"
2809 " <menuitem name='SortDescending' action='/Sort Descending'/>\n"
2810 " <menuitem name='NoSorting' action='/No Sorting'/>\n"
2812 " <menuitem name='ShowResolved' action='/Show Resolved'/>\n"
2814 " <menuitem name='AlignLeft' action='/Align Left'/>\n"
2815 " <menuitem name='AlignCenter' action='/Align Center'/>\n"
2816 " <menuitem name='AlignRight' action='/Align Right'/>\n"
2818 " <menuitem name='ColumnPreferences' action='/Column Preferences'/>\n"
2819 " <menuitem name='EditColumnDetails' action='/Edit Column Details'/>\n"
2820 " <menuitem name='ResizeColumn' action='/Resize Column'/>\n"
2822 " <menu name='DisplayedColumns' action='/Displayed Columns'>\n"
2823 " <menuitem name='Display All' action='/Displayed Columns/Display All'/>\n"
2825 " <menuitem name='HideColumn' action='/Hide Column'/>\n"
2826 " <menuitem name='RemoveColumn' action='/Remove Column'/>\n"
2830 static const GtkActionEntry packet_list_heading_menu_popup_action_entries[] = {
2831 { "/Sort Ascending", GTK_STOCK_SORT_ASCENDING, "Sort Ascending", NULL, NULL, G_CALLBACK(sort_ascending_cb) },
2832 { "/Sort Descending", GTK_STOCK_SORT_DESCENDING, "Sort Descending", NULL, NULL, G_CALLBACK(sort_descending_cb) },
2833 { "/No Sorting", NULL, "No Sorting", NULL, NULL, G_CALLBACK(no_sorting_cb) },
2834 { "/Align Left", GTK_STOCK_JUSTIFY_LEFT, "Align Left", NULL, NULL, G_CALLBACK(packet_list_heading_align_left_cb) },
2835 { "/Align Center", GTK_STOCK_JUSTIFY_CENTER, "Align Center", NULL, NULL, G_CALLBACK(packet_list_heading_align_center_cb) },
2836 { "/Align Right", GTK_STOCK_JUSTIFY_RIGHT, "Align Right", NULL, NULL, G_CALLBACK(packet_list_heading_align_right_cb) },
2837 { "/Column Preferences", GTK_STOCK_PREFERENCES, "Column Preferences...", NULL, NULL, G_CALLBACK(packet_list_heading_col_pref_cb) },
2838 { "/Edit Column Details", WIRESHARK_STOCK_EDIT, "Edit Column Details...", NULL, NULL, G_CALLBACK(packet_list_heading_change_col_cb) },
2839 { "/Resize Column", WIRESHARK_STOCK_RESIZE_COLUMNS, "Resize Column", NULL, NULL, G_CALLBACK(packet_list_heading_resize_col_cb) },
2840 { "/Displayed Columns", NULL, "Displayed Columns", NULL, NULL, NULL },
2841 { "/Displayed Columns/Display All", NULL, "Display All", NULL, NULL, G_CALLBACK(packet_list_heading_activate_all_columns_cb) },
2842 { "/Hide Column", NULL, "Hide Column", NULL, NULL, G_CALLBACK(packet_list_heading_hide_col_cb) },
2843 { "/Remove Column", GTK_STOCK_DELETE, "Remove Column", NULL, NULL, G_CALLBACK(packet_list_heading_remove_col_cb) },
2846 static const GtkToggleActionEntry packet_list_heading_menu_toggle_action_entries[] =
2848 /* name, stock id, label, accel, tooltip, callback, is_active */
2849 {"/Show Resolved", NULL, "Show Resolved", NULL, NULL, G_CALLBACK(packet_list_heading_show_resolved_cb), FALSE},
2852 static const char *ui_desc_packet_list_menu_popup =
2854 " <popup name='PacketListMenuPopup' action='PopupAction'>\n"
2855 " <menuitem name='MarkPacket' action='/MarkPacket'/>\n"
2856 " <menuitem name='IgnorePacket' action='/IgnorePacket'/>\n"
2857 " <menuitem name='SetTimeReference' action='/Set Time Reference'/>\n"
2859 " <menuitem name='ManuallyResolveAddress' action='/ManuallyResolveAddress'/>\n"
2861 " <menu name= 'ApplyAsFilter' action='/Apply as Filter'>\n"
2862 " <menuitem name='Selected' action='/Apply as Filter/Selected'/>\n"
2863 " <menuitem name='NotSelected' action='/Apply as Filter/Not Selected'/>\n"
2864 " <menuitem name='AndSelected' action='/Apply as Filter/AndSelected'/>\n"
2865 " <menuitem name='OrSelected' action='/Apply as Filter/OrSelected'/>\n"
2866 " <menuitem name='AndNotSelected' action='/Apply as Filter/AndNotSelected'/>\n"
2867 " <menuitem name='OrNotSelected' action='/Apply as Filter/OrNotSelected'/>\n"
2869 " <menu name= 'PrepareaFilter' action='/Prepare a Filter'>\n"
2870 " <menuitem name='Selected' action='/Prepare a Filter/Selected'/>\n"
2871 " <menuitem name='NotSelected' action='/Prepare a Filter/Not Selected'/>\n"
2872 " <menuitem name='AndSelected' action='/Prepare a Filter/AndSelected'/>\n"
2873 " <menuitem name='OrSelected' action='/Prepare a Filter/OrSelected'/>\n"
2874 " <menuitem name='AndNotSelected' action='/Prepare a Filter/AndNotSelected'/>\n"
2875 " <menuitem name='OrNotSelected' action='/Prepare a Filter/OrNotSelected'/>\n"
2877 " <menu name= 'ConversationFilter' action='/Conversation Filter'>\n"
2878 " <menuitem name='Ethernet' action='/Conversation Filter/Ethernet'/>\n"
2879 " <menuitem name='IP' action='/Conversation Filter/IP'/>\n"
2880 " <menuitem name='TCP' action='/Conversation Filter/TCP'/>\n"
2881 " <menuitem name='UDP' action='/Conversation Filter/UDP'/>\n"
2882 " <menuitem name='PN-CBA' action='/Conversation Filter/PN-CBA'/>\n"
2884 " <menu name= 'ColorizeConversation' action='/Colorize Conversation'>\n"
2885 " <menu name= 'Ethernet' action='/Colorize Conversation/Ethernet'>\n"
2886 " <menuitem name='Color1' action='/Colorize Conversation/Ethernet/Color 1'/>\n"
2887 " <menuitem name='Color2' action='/Colorize Conversation/Ethernet/Color 2'/>\n"
2888 " <menuitem name='Color3' action='/Colorize Conversation/Ethernet/Color 3'/>\n"
2889 " <menuitem name='Color4' action='/Colorize Conversation/Ethernet/Color 4'/>\n"
2890 " <menuitem name='Color5' action='/Colorize Conversation/Ethernet/Color 5'/>\n"
2891 " <menuitem name='Color6' action='/Colorize Conversation/Ethernet/Color 6'/>\n"
2892 " <menuitem name='Color7' action='/Colorize Conversation/Ethernet/Color 7'/>\n"
2893 " <menuitem name='Color8' action='/Colorize Conversation/Ethernet/Color 8'/>\n"
2894 " <menuitem name='Color9' action='/Colorize Conversation/Ethernet/Color 9'/>\n"
2895 " <menuitem name='Color10' action='/Colorize Conversation/Ethernet/Color 10'/>\n"
2896 " <menuitem name='NewColoringRule' action='/Colorize Conversation/Ethernet/New Coloring Rule'/>\n"
2898 " <menu name= 'IP' action='/Colorize Conversation/IP'>\n"
2899 " <menuitem name='Color1' action='/Colorize Conversation/IP/Color 1'/>\n"
2900 " <menuitem name='Color2' action='/Colorize Conversation/IP/Color 2'/>\n"
2901 " <menuitem name='Color3' action='/Colorize Conversation/IP/Color 3'/>\n"
2902 " <menuitem name='Color4' action='/Colorize Conversation/IP/Color 4'/>\n"
2903 " <menuitem name='Color5' action='/Colorize Conversation/IP/Color 5'/>\n"
2904 " <menuitem name='Color6' action='/Colorize Conversation/IP/Color 6'/>\n"
2905 " <menuitem name='Color7' action='/Colorize Conversation/IP/Color 7'/>\n"
2906 " <menuitem name='Color8' action='/Colorize Conversation/IP/Color 8'/>\n"
2907 " <menuitem name='Color9' action='/Colorize Conversation/IP/Color 9'/>\n"
2908 " <menuitem name='Color10' action='/Colorize Conversation/IP/Color 10'/>\n"
2909 " <menuitem name='NewColoringRule' action='/Colorize Conversation/IP/New Coloring Rule'/>\n"
2911 " <menu name= 'TCP' action='/Colorize Conversation/TCP'>\n"
2912 " <menuitem name='Color1' action='/Colorize Conversation/TCP/Color 1'/>\n"
2913 " <menuitem name='Color2' action='/Colorize Conversation/TCP/Color 2'/>\n"
2914 " <menuitem name='Color3' action='/Colorize Conversation/TCP/Color 3'/>\n"
2915 " <menuitem name='Color4' action='/Colorize Conversation/TCP/Color 4'/>\n"
2916 " <menuitem name='Color5' action='/Colorize Conversation/TCP/Color 5'/>\n"
2917 " <menuitem name='Color6' action='/Colorize Conversation/TCP/Color 6'/>\n"
2918 " <menuitem name='Color7' action='/Colorize Conversation/TCP/Color 7'/>\n"
2919 " <menuitem name='Color8' action='/Colorize Conversation/TCP/Color 8'/>\n"
2920 " <menuitem name='Color9' action='/Colorize Conversation/TCP/Color 9'/>\n"
2921 " <menuitem name='Color10' action='/Colorize Conversation/TCP/Color 10'/>\n"
2922 " <menuitem name='NewColoringRule' action='/Colorize Conversation/TCP/New Coloring Rule'/>\n"
2924 " <menu name= 'UDP' action='/Colorize Conversation/UDP'>\n"
2925 " <menuitem name='Color1' action='/Colorize Conversation/UDP/Color 1'/>\n"
2926 " <menuitem name='Color2' action='/Colorize Conversation/UDP/Color 2'/>\n"
2927 " <menuitem name='Color3' action='/Colorize Conversation/UDP/Color 3'/>\n"
2928 " <menuitem name='Color4' action='/Colorize Conversation/UDP/Color 4'/>\n"
2929 " <menuitem name='Color5' action='/Colorize Conversation/UDP/Color 5'/>\n"
2930 " <menuitem name='Color6' action='/Colorize Conversation/UDP/Color 6'/>\n"
2931 " <menuitem name='Color7' action='/Colorize Conversation/UDP/Color 7'/>\n"
2932 " <menuitem name='Color8' action='/Colorize Conversation/UDP/Color 8'/>\n"
2933 " <menuitem name='Color9' action='/Colorize Conversation/UDP/Color 9'/>\n"
2934 " <menuitem name='Color10' action='/Colorize Conversation/UDP/Color 10'/>\n"
2935 " <menuitem name='NewColoringRule' action='/Colorize Conversation/UDP/New Coloring Rule'/>\n"
2937 " <menu name= 'PN-CBA' action='/Colorize Conversation/PN-CBA'>\n"
2938 " <menuitem name='Color1' action='/Colorize Conversation/PN-CBA/Color 1'/>\n"
2939 " <menuitem name='Color2' action='/Colorize Conversation/PN-CBA/Color 2'/>\n"
2940 " <menuitem name='Color3' action='/Colorize Conversation/PN-CBA/Color 3'/>\n"
2941 " <menuitem name='Color4' action='/Colorize Conversation/PN-CBA/Color 4'/>\n"
2942 " <menuitem name='Color5' action='/Colorize Conversation/PN-CBA/Color 5'/>\n"
2943 " <menuitem name='Color6' action='/Colorize Conversation/PN-CBA/Color 6'/>\n"
2944 " <menuitem name='Color7' action='/Colorize Conversation/PN-CBA/Color 7'/>\n"
2945 " <menuitem name='Color8' action='/Colorize Conversation/PN-CBA/Color 8'/>\n"
2946 " <menuitem name='Color9' action='/Colorize Conversation/PN-CBA/Color 9'/>\n"
2947 " <menuitem name='Color10' action='/Colorize Conversation/PN-CBA/Color 10'/>\n"
2948 " <menuitem name='NewColoringRule' action='/Colorize Conversation/PN-CBA/New Coloring Rule'/>\n"
2951 " <menu name= 'SCTP' action='/SCTP'>\n"
2952 " <menuitem name='AnalysethisAssociation' action='/SCTP/Analyse this Association'/>\n"
2953 " <menuitem name='PrepareFilterforthisAssociation' action='/SCTP/Prepare Filter for this Association'/>\n"
2955 " <menuitem name='FollowTCPStream' action='/Follow TCP Stream'/>\n"
2956 " <menuitem name='FollowUDPStream' action='/Follow UDP Stream'/>\n"
2957 " <menuitem name='FollowSSLStream' action='/Follow SSL Stream'/>\n"
2959 " <menu name= 'Copy' action='/Copy'>\n"
2960 " <menuitem name='SummaryTxt' action='/Copy/SummaryTxt'/>\n"
2961 " <menuitem name='SummaryCSV' action='/Copy/SummaryCSV'/>\n"
2962 " <menuitem name='AsFilter' action='/Copy/AsFilter'/>\n"
2964 " <menu name= 'Bytes' action='/Copy/Bytes'>\n"
2965 " <menuitem name='OffsetHexText' action='/Copy/Bytes/OffsetHexText'/>\n"
2966 " <menuitem name='OffsetHex' action='/Copy/Bytes/OffsetHex'/>\n"
2967 " <menuitem name='PrintableTextOnly' action='/Copy/Bytes/PrintableTextOnly'/>\n"
2969 " <menuitem name='HexStream' action='/Copy/Bytes/HexStream'/>\n"
2970 " <menuitem name='BinaryStream' action='/Copy/Bytes/BinaryStream'/>\n"
2974 " <menuitem name='DecodeAs' action='/DecodeAs'/>\n"
2975 " <menuitem name='Print' action='/Print'/>\n"
2976 " <menuitem name='ShowPacketinNewWindow' action='/ShowPacketinNewWindow'/>\n"
2980 static const GtkActionEntry packet_list_menu_popup_action_entries[] = {
2981 { "/MarkPacket", NULL, "Mark Packet (toggle)", NULL, NULL, G_CALLBACK(new_packet_list_mark_frame_cb) },
2982 { "/IgnorePacket", NULL, "Ignore Packet (toggle)", NULL, NULL, G_CALLBACK(new_packet_list_ignore_frame_cb) },
2983 { "/Set Time Reference", WIRESHARK_STOCK_TIME, "Set Time Reference (toggle)", NULL, NULL, G_CALLBACK(packet_list_menu_set_ref_time_cb) },
2984 { "/ManuallyResolveAddress", NULL, "Manually Resolve Address", NULL, NULL, G_CALLBACK(manual_addr_resolv_dlg) },
2985 { "/Apply as Filter", NULL, "Apply as Filter", NULL, NULL, NULL },
2987 { "/Apply as Filter/Selected", NULL, "_Selected" , NULL, NULL, G_CALLBACK(packet_list_menu_apply_selected_cb) },
2988 { "/Apply as Filter/Not Selected", NULL, "_Not Selected", NULL, NULL, G_CALLBACK(packet_list_menu_apply_not_selected_cb) },
2989 { "/Apply as Filter/AndSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _and Selected", NULL, NULL, G_CALLBACK(packet_list_menu_apply_and_selected_cb) },
2990 { "/Apply as Filter/OrSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _or Selected", NULL, NULL, G_CALLBACK(packet_list_menu_apply_or_selected_cb) },
2991 { "/Apply as Filter/AndNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " a_nd not Selected", NULL, NULL, G_CALLBACK(packet_list_menu_apply_and_not_selected_cb) },
2992 { "/Apply as Filter/OrNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " o_r not Selected", NULL, NULL, G_CALLBACK(packet_list_menu_apply_or_not_selected_cb) },
2994 { "/Prepare a Filter", NULL, "Prepare a Filter", NULL, NULL, NULL },
2995 { "/Prepare a Filter/Selected", NULL, "_Selected" , NULL, NULL, G_CALLBACK(packet_list_menu_prepare_selected_cb) },
2996 { "/Prepare a Filter/Not Selected", NULL, "_Not Selected", NULL, NULL, G_CALLBACK(packet_list_menu_prepare_not_selected_cb) },
2997 { "/Prepare a Filter/AndSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _and Selected", NULL, NULL, G_CALLBACK(packet_list_menu_prepare_and_selected_cb) },
2998 { "/Prepare a Filter/OrSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _or Selected", NULL, NULL, G_CALLBACK(packet_list_menu_prepare_or_selected_cb) },
2999 { "/Prepare a Filter/AndNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " a_nd not Selected", NULL, NULL, G_CALLBACK(packet_list_menu_prepare_and_not_selected_cb) },
3000 { "/Prepare a Filter/OrNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " o_r not Selected", NULL, NULL, G_CALLBACK(packet_list_menu_prepare_or_not_selected_cb) },
3002 { "/Conversation Filter", NULL, "Conversation Filter", NULL, NULL, NULL },
3003 { "/Conversation Filter/Ethernet", NULL, "Ethernet", NULL, NULL, G_CALLBACK(packet_list_menu_conversation_ethernet_cb) },
3004 { "/Conversation Filter/IP", NULL, "IP", NULL, NULL, G_CALLBACK(packet_list_menu_conversation_ip_cb) },
3005 { "/Conversation Filter/TCP", NULL, "TCP", NULL, NULL, G_CALLBACK(packet_list_menu_conversation_tcp_cb) },
3006 { "/Conversation Filter/UDP", NULL, "UDP", NULL, NULL, G_CALLBACK(packet_list_menu_conversation_udp_cb) },
3007 { "/Conversation Filter/PN-CBA", NULL, "PN-CBA", NULL, NULL, G_CALLBACK(packet_list_menu_conversation_pn_cba_cb) },
3009 { "/Colorize Conversation", NULL, "Colorize Conversation", NULL, NULL, NULL },
3011 { "/Colorize Conversation/Ethernet", NULL, "Ethernet", NULL, NULL, NULL },
3013 { "/Colorize Conversation/Ethernet/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color1_cb) },
3014 { "/Colorize Conversation/Ethernet/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color2_cb) },
3015 { "/Colorize Conversation/Ethernet/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color3_cb) },
3016 { "/Colorize Conversation/Ethernet/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color4_cb) },
3017 { "/Colorize Conversation/Ethernet/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color5_cb) },
3018 { "/Colorize Conversation/Ethernet/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color6_cb) },
3019 { "/Colorize Conversation/Ethernet/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color7_cb) },
3020 { "/Colorize Conversation/Ethernet/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color8_cb) },
3021 { "/Colorize Conversation/Ethernet/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color9_cb) },
3022 { "/Colorize Conversation/Ethernet/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color10_cb) },
3023 { "/Colorize Conversation/Ethernet/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_new_rule_cb) },
3025 { "/Colorize Conversation/IP", NULL, "IP", NULL, NULL, NULL },
3027 { "/Colorize Conversation/IP/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color1_cb) },
3028 { "/Colorize Conversation/IP/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color2_cb) },
3029 { "/Colorize Conversation/IP/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color3_cb) },
3030 { "/Colorize Conversation/IP/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color4_cb) },
3031 { "/Colorize Conversation/IP/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color5_cb) },
3032 { "/Colorize Conversation/IP/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color6_cb) },
3033 { "/Colorize Conversation/IP/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color7_cb) },
3034 { "/Colorize Conversation/IP/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color8_cb) },
3035 { "/Colorize Conversation/IP/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color9_cb) },
3036 { "/Colorize Conversation/IP/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color10_cb) },
3037 { "/Colorize Conversation/IP/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_new_rule_cb) },
3039 { "/Colorize Conversation/TCP", NULL, "TCP", NULL, NULL, NULL },
3041 { "/Colorize Conversation/TCP/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color1_cb) },
3042 { "/Colorize Conversation/TCP/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color2_cb) },
3043 { "/Colorize Conversation/TCP/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color3_cb) },
3044 { "/Colorize Conversation/TCP/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color4_cb) },
3045 { "/Colorize Conversation/TCP/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color5_cb) },
3046 { "/Colorize Conversation/TCP/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color6_cb) },
3047 { "/Colorize Conversation/TCP/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color7_cb) },
3048 { "/Colorize Conversation/TCP/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color8_cb) },
3049 { "/Colorize Conversation/TCP/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color9_cb) },
3050 { "/Colorize Conversation/TCP/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color10_cb) },
3051 { "/Colorize Conversation/TCP/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_new_rule_cb) },
3053 { "/Colorize Conversation/UDP", NULL, "UDP", NULL, NULL, NULL },
3055 { "/Colorize Conversation/UDP/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color1_cb) },
3056 { "/Colorize Conversation/UDP/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color2_cb) },
3057 { "/Colorize Conversation/UDP/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color3_cb) },
3058 { "/Colorize Conversation/UDP/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color4_cb) },
3059 { "/Colorize Conversation/UDP/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color5_cb) },
3060 { "/Colorize Conversation/UDP/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color6_cb) },
3061 { "/Colorize Conversation/UDP/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color7_cb) },
3062 { "/Colorize Conversation/UDP/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color8_cb) },
3063 { "/Colorize Conversation/UDP/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color9_cb) },
3064 { "/Colorize Conversation/UDP/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color10_cb) },
3065 { "/Colorize Conversation/UDP/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_new_rule_cb) },
3067 { "/Colorize Conversation/PN-CBA", NULL, "PN-CBA Server", NULL, NULL, NULL },
3069 { "/Colorize Conversation/PN-CBA/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color1_cb) },
3070 { "/Colorize Conversation/PN-CBA/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color2_cb) },
3071 { "/Colorize Conversation/PN-CBA/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color3_cb) },
3072 { "/Colorize Conversation/PN-CBA/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color4_cb) },
3073 { "/Colorize Conversation/PN-CBA/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color5_cb) },
3074 { "/Colorize Conversation/PN-CBA/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color6_cb) },
3075 { "/Colorize Conversation/PN-CBA/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color7_cb) },
3076 { "/Colorize Conversation/PN-CBA/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color8_cb) },
3077 { "/Colorize Conversation/PN-CBA/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color9_cb) },
3078 { "/Colorize Conversation/PN-CBA/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color10_cb) },
3079 { "/Colorize Conversation/PN-CBA/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_new_rule_cb) },
3081 { "/SCTP", NULL, "SCTP", NULL, NULL, NULL },
3082 { "/SCTP/Analyse this Association", NULL, "Analyse this Association", NULL, NULL, G_CALLBACK(sctp_analyse_start) },
3083 { "/SCTP/Prepare Filter for this Association", NULL, "Prepare Filter for this Association", NULL, NULL, G_CALLBACK(sctp_set_assoc_filter) },
3086 { "/Follow TCP Stream", NULL, "Follow TCP Stream", NULL, NULL, G_CALLBACK(follow_tcp_stream_cb) },
3087 { "/Follow UDP Stream", NULL, "Follow UDP Stream", NULL, NULL, G_CALLBACK(follow_udp_stream_cb) },
3088 { "/Follow SSL Stream", NULL, "Follow SSL Stream", NULL, NULL, G_CALLBACK(follow_ssl_stream_cb) },
3090 { "/Copy", NULL, "Copy", NULL, NULL, NULL },
3091 { "/Copy/SummaryTxt", NULL, "Summary (Text)", NULL, NULL, G_CALLBACK(packet_list_menu_copy_sum_txt) },
3092 { "/Copy/SummaryCSV", NULL, "Summary (CSV)", NULL, NULL, G_CALLBACK(packet_list_menu_copy_sum_csv) },
3093 { "/Copy/AsFilter", NULL, "As Filter", NULL, NULL, G_CALLBACK(packet_list_menu_copy_as_flt) },
3096 { "/Copy/Bytes", NULL, "Bytes", NULL, NULL, NULL },
3097 { "/Copy/Bytes/OffsetHexText", NULL, "Offset Hex Text", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_oht_cb) },
3098 { "/Copy/Bytes/OffsetHex", NULL, "Offset Hex", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_oh_cb) },
3099 { "/Copy/Bytes/PrintableTextOnly", NULL, "Printable Text Only", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_text_cb) },
3101 { "/Copy/Bytes/HexStream", NULL, "Hex Stream", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_hex_strm_cb) },
3102 { "/Copy/Bytes/BinaryStream", NULL, "Binary Stream", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_bin_strm_cb) },
3104 { "/DecodeAs", WIRESHARK_STOCK_DECODE_AS, "Decode As...", NULL, NULL, G_CALLBACK(decode_as_cb) },
3105 { "/Print", GTK_STOCK_PRINT, "Print...", NULL, NULL, G_CALLBACK(file_print_selected_cmd_cb) },
3106 { "/ShowPacketinNewWindow", NULL, "Show Packet in New Window", NULL, NULL, G_CALLBACK(new_window_cb) },
3110 static const char *ui_desc_tree_view_menu_popup =
3112 " <popup name='TreeViewPopup' action='PopupAction'>\n"
3113 " <menuitem name='ExpandSubtrees' action='/ExpandSubtrees'/>\n"
3114 " <menuitem name='ExpandAll' action='/ExpandAll'/>\n"
3115 " <menuitem name='CollapseAll' action='/CollapseAll'/>\n"
3117 " <menuitem name='ApplyasColumn' action='/Apply as Column'/>\n"
3119 " <menu name= 'ApplyAsFilter' action='/Apply as Filter'>\n"
3120 " <menuitem name='Selected' action='/Apply as Filter/Selected'/>\n"
3121 " <menuitem name='NotSelected' action='/Apply as Filter/Not Selected'/>\n"
3122 " <menuitem name='AndSelected' action='/Apply as Filter/AndSelected'/>\n"
3123 " <menuitem name='OrSelected' action='/Apply as Filter/OrSelected'/>\n"
3124 " <menuitem name='AndNotSelected' action='/Apply as Filter/AndNotSelected'/>\n"
3125 " <menuitem name='OrNotSelected' action='/Apply as Filter/OrNotSelected'/>\n"
3127 " <menu name= 'PrepareaFilter' action='/Prepare a Filter'>\n"
3128 " <menuitem name='Selected' action='/Prepare a Filter/Selected'/>\n"
3129 " <menuitem name='NotSelected' action='/Prepare a Filter/Not Selected'/>\n"
3130 " <menuitem name='AndSelected' action='/Prepare a Filter/AndSelected'/>\n"
3131 " <menuitem name='OrSelected' action='/Prepare a Filter/OrSelected'/>\n"
3132 " <menuitem name='AndNotSelected' action='/Prepare a Filter/AndNotSelected'/>\n"
3133 " <menuitem name='OrNotSelected' action='/Prepare a Filter/OrNotSelected'/>\n"
3135 " <menu name= 'ColorizewithFilter' action='/Colorize with Filter'>\n"
3136 " <menuitem name='Color1' action='/Colorize with Filter/Color 1'/>\n"
3137 " <menuitem name='Color2' action='/Colorize with Filter/Color 2'/>\n"
3138 " <menuitem name='Color3' action='/Colorize with Filter/Color 3'/>\n"
3139 " <menuitem name='Color4' action='/Colorize with Filter/Color 4'/>\n"
3140 " <menuitem name='Color5' action='/Colorize with Filter/Color 5'/>\n"
3141 " <menuitem name='Color6' action='/Colorize with Filter/Color 6'/>\n"
3142 " <menuitem name='Color7' action='/Colorize with Filter/Color 7'/>\n"
3143 " <menuitem name='Color8' action='/Colorize with Filter/Color 8'/>\n"
3144 " <menuitem name='Color9' action='/Colorize with Filter/Color 9'/>\n"
3145 " <menuitem name='Color10' action='/Colorize with Filter/Color 10'/>\n"
3146 " <menuitem name='NewColoringRule' action='/Colorize with Filter/New Coloring Rule'/>\n"
3148 " <menuitem name='FollowTCPStream' action='/Follow TCP Stream'/>\n"
3149 " <menuitem name='FollowUDPStream' action='/Follow UDP Stream'/>\n"
3150 " <menuitem name='FollowSSLStream' action='/Follow SSL Stream'/>\n"
3152 " <menu name= 'Copy' action='/Copy'>\n"
3153 " <menuitem name='Description' action='/Copy/Description'/>\n"
3154 " <menuitem name='Fieldname' action='/Copy/Fieldname'/>\n"
3155 " <menuitem name='Value' action='/Copy/Value'/>\n"
3157 " <menuitem name='AsFilter' action='/Copy/AsFilter'/>\n"
3159 " <menu name= 'Bytes' action='/Copy/Bytes'>\n"
3160 " <menuitem name='OffsetHexText' action='/Copy/Bytes/OffsetHexText'/>\n"
3161 " <menuitem name='OffsetHex' action='/Copy/Bytes/OffsetHex'/>\n"
3162 " <menuitem name='PrintableTextOnly' action='/Copy/Bytes/PrintableTextOnly'/>\n"
3164 " <menuitem name='HexStream' action='/Copy/Bytes/HexStream'/>\n"
3165 " <menuitem name='BinaryStream' action='/Copy/Bytes/BinaryStream'/>\n"
3168 " <menuitem name='ExportSelectedPacketBytes' action='/ExportSelectedPacketBytes'/>\n"
3170 " <menuitem name='WikiProtocolPage' action='/WikiProtocolPage'/>\n"
3171 " <menuitem name='FilterFieldReference' action='/FilterFieldReference'/>\n"
3172 #if GLIB_CHECK_VERSION(2,14,0) /* GRegex */
3173 " <menuitem name='ProtocolHelp' action='/ProtocolHelp'/>\n"
3174 #endif /* GLIB_CHECK_VERSION(2,14,0) */
3175 " <menuitem name='ProtocolPreferences' action='/ProtocolPreferences'/>\n"
3177 " <menuitem name='DecodeAs' action='/DecodeAs'/>\n"
3178 " <menuitem name='DisableProtocol' action='/DisableProtocol'/>\n"
3179 " <menuitem name='ResolveName' action='/ResolveName'/>\n"
3180 " <menuitem name='GotoCorrespondingPacket' action='/GotoCorrespondingPacket'/>\n"
3184 static const GtkActionEntry tree_view_menu_popup_action_entries[] = {
3185 { "/ExpandSubtrees", NULL, "Expand Subtrees", NULL, NULL, G_CALLBACK(expand_tree_cb) },
3186 { "/ExpandAll", NULL, "Expand All", NULL, NULL, G_CALLBACK(expand_all_cb) },
3187 { "/CollapseAll", NULL, "Collapse All", NULL, NULL, G_CALLBACK(collapse_all_cb) },
3188 { "/Apply as Column", NULL, "Apply as Column", NULL, NULL, G_CALLBACK(apply_as_custom_column_cb) },
3189 { "/Apply as Filter", NULL, "Apply as Filter", NULL, NULL, NULL },
3191 { "/Apply as Filter/Selected", NULL, "_Selected" , NULL, NULL, G_CALLBACK(tree_view_menu_apply_selected_cb) },
3192 { "/Apply as Filter/Not Selected", NULL, "_Not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_not_selected_cb) },
3193 { "/Apply as Filter/AndSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _and Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_and_selected_cb) },
3194 { "/Apply as Filter/OrSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _or Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_or_selected_cb) },
3195 { "/Apply as Filter/AndNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " a_nd not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_and_not_selected_cb) },
3196 { "/Apply as Filter/OrNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " o_r not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_or_not_selected_cb) },
3198 { "/Prepare a Filter", NULL, "Prepare a Filter", NULL, NULL, NULL },
3199 { "/Prepare a Filter/Selected", NULL, "_Selected" , NULL, NULL, G_CALLBACK(tree_view_menu_prepare_selected_cb) },
3200 { "/Prepare a Filter/Not Selected", NULL, "_Not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_not_selected_cb) },
3201 { "/Prepare a Filter/AndSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _and Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_and_selected_cb) },
3202 { "/Prepare a Filter/OrSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _or Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_or_selected_cb) },
3203 { "/Prepare a Filter/AndNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " a_nd not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_and_not_selected_cb) },
3204 { "/Prepare a Filter/OrNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " o_r not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_or_not_selected_cb) },
3206 { "/Colorize with Filter", NULL, "Colorize with Filter", NULL, NULL, NULL },
3207 { "/Colorize with Filter/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color1_cb) },
3208 { "/Colorize with Filter/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color2_cb) },
3209 { "/Colorize with Filter/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color3_cb) },
3210 { "/Colorize with Filter/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color4_cb) },
3211 { "/Colorize with Filter/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color5_cb) },
3212 { "/Colorize with Filter/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color6_cb) },
3213 { "/Colorize with Filter/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color7_cb) },
3214 { "/Colorize with Filter/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color8_cb) },
3215 { "/Colorize with Filter/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color9_cb) },
3216 { "/Colorize with Filter/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color10_cb) },
3217 { "/Colorize with Filter/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_new_rule_cb) },
3219 { "/Follow TCP Stream", NULL, "Follow TCP Stream", NULL, NULL, G_CALLBACK(follow_tcp_stream_cb) },
3220 { "/Follow UDP Stream", NULL, "Follow UDP Stream", NULL, NULL, G_CALLBACK(follow_udp_stream_cb) },
3221 { "/Follow SSL Stream", NULL, "Follow SSL Stream", NULL, NULL, G_CALLBACK(follow_ssl_stream_cb) },
3223 { "/Copy", NULL, "Copy", NULL, NULL, NULL },
3224 { "/Copy/Description", NULL, "Description", NULL, NULL, G_CALLBACK(tree_view_menu_copy_desc) },
3225 { "/Copy/Fieldname", NULL, "Fieldname", NULL, NULL, G_CALLBACK(tree_view_menu_copy_field) },
3226 { "/Copy/Value", NULL, "Value", NULL, NULL, G_CALLBACK(tree_view_menu_copy_value) },
3228 { "/Copy/AsFilter", NULL, "As Filter", NULL, NULL, G_CALLBACK(tree_view_menu_copy_as_flt) },
3230 { "/Copy/Bytes", NULL, "Bytes", NULL, NULL, NULL },
3231 { "/Copy/Bytes/OffsetHexText", NULL, "Offset Hex Text", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_oht_cb) },
3232 { "/Copy/Bytes/OffsetHex", NULL, "Offset Hex", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_oh_cb) },
3233 { "/Copy/Bytes/PrintableTextOnly", NULL, "Printable Text Only", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_text_cb) },
3235 { "/Copy/Bytes/HexStream", NULL, "Hex Stream", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_hex_strm_cb) },
3236 { "/Copy/Bytes/BinaryStream", NULL, "Binary Stream", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_bin_strm_cb) },
3238 { "/ExportSelectedPacketBytes", NULL, "Export Selected Packet Bytes...", NULL, NULL, G_CALLBACK(savehex_cb) },
3240 { "/WikiProtocolPage", WIRESHARK_STOCK_WIKI, "Wiki Protocol Page", NULL, NULL, G_CALLBACK(selected_ptree_info_cb) },
3241 { "/FilterFieldReference", WIRESHARK_STOCK_INTERNET, "Filter Field Reference", NULL, NULL, G_CALLBACK(selected_ptree_ref_cb) },
3242 #if GLIB_CHECK_VERSION(2,14,0) /* GRegex */
3243 { "/ProtocolHelp", NULL, "Protocol Help", NULL, NULL, NULL },
3244 #endif /* GLIB_CHECK_VERSION(2,14,0) */
3245 { "/ProtocolPreferences", NULL, "Protocol Preferences", NULL, NULL, NULL },
3246 { "/DecodeAs", WIRESHARK_STOCK_DECODE_AS, "Decode As...", NULL, NULL, G_CALLBACK(decode_as_cb) },
3247 { "/DisableProtocol", WIRESHARK_STOCK_CHECKBOX, "Disable Protocol...", NULL, NULL, G_CALLBACK(proto_disable_cb) },
3248 { "/ResolveName", NULL, "_Resolve Name", NULL, NULL, G_CALLBACK(resolve_name_cb) },
3249 { "/GotoCorrespondingPacket", NULL, "_Go to Corresponding Packet", NULL, NULL, G_CALLBACK(goto_framenum_cb) },
3252 static const char *ui_desc_bytes_menu_popup =
3254 " <popup name='BytesMenuPopup' action='PopupAction'>\n"
3255 " <menuitem name='HexView' action='/HexView'/>\n"
3256 " <menuitem name='BitsView' action='/BitsView'/>\n"
3259 static const GtkRadioActionEntry bytes_menu_radio_action_entries [] =
3261 /* name, stock id, label, accel, tooltip, value */
3262 { "/HexView", NULL, "Hex View", NULL, NULL, BYTES_HEX },
3263 { "/BitsView", NULL, "Bits View", NULL, NULL, BYTES_BITS },
3266 static const char *ui_statusbar_profiles_menu_popup =
3268 " <popup name='ProfilesMenuPopup' action='PopupAction'>\n"
3269 " <menuitem name='Profiles' action='/Profiles'/>\n"
3271 " <menuitem name='New' action='/New'/>\n"
3272 " <menuitem name='Copy' action='/Copy'/>\n"
3273 " <menuitem name='Delete' action='/Delete'/>\n"
3274 " <menuitem name='Rename' action='/Rename'/>\n"
3276 " <menu name='Change' action='/Change'>\n"
3277 " <menuitem name='Default' action='/Change/Default'/>\n"
3281 static const GtkActionEntry statusbar_profiles_menu_action_entries [] =
3283 { "/Profiles", NULL, "Configuration Profiles...", NULL, NULL, G_CALLBACK(profile_dialog_cb) },
3284 { "/New", GTK_STOCK_NEW, "New...", NULL, NULL, G_CALLBACK(profile_new_cb) },
3285 { "/Copy", GTK_STOCK_COPY, "Copy...", NULL, NULL, G_CALLBACK(profile_copy_cb) },
3286 { "/Delete", GTK_STOCK_DELETE, "Delete", NULL, NULL, G_CALLBACK(profile_delete_cb) },
3287 #if GLIB_CHECK_VERSION(2,6,0)
3288 { "/Rename", GTK_STOCK_EDIT, "Rename...", NULL, NULL, G_CALLBACK(profile_rename_cb) },
3290 { "/Rename", NULL, "Rename...", NULL, NULL, G_CALLBACK(profile_rename_cb) },
3292 { "/Change", NULL, "Change", NULL, NULL, NULL },
3293 { "/Change/Default", NULL, "Default", NULL, NULL, NULL },
3297 main_menu_new(GtkAccelGroup ** table) {
3299 #ifdef HAVE_IGE_MAC_INTEGRATION
3300 GtkWidget *quit_item, *about_item, *preferences_item;
3301 IgeMacMenuGroup *group;
3303 #ifdef HAVE_GTKOSXAPPLICATION
3304 GtkOSXApplication *theApp;
3306 GtkOSXApplicationMenuGroup *group;
3307 GtkWidget * dock_menu;
3310 grp = gtk_accel_group_new();
3315 #ifdef MAIN_MENU_USE_UIMANAGER
3316 menubar = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar");
3318 menubar = main_menu_factory->widget;
3320 #ifdef HAVE_IGE_MAC_INTEGRATION
3321 if(prefs.gui_macosx_style) {
3322 ige_mac_menu_set_menu_bar(GTK_MENU_SHELL(menubar));
3323 ige_mac_menu_set_global_key_handler_enabled(TRUE);
3325 /* Create menu items to populate the application menu with. We have to
3326 * do this because we are still using the old GtkItemFactory API for
3328 group = ige_mac_menu_add_app_menu_group();
3329 about_item = gtk_menu_item_new_with_label("About");
3330 g_signal_connect(about_item, "activate", G_CALLBACK(about_wireshark_cb),
3332 ige_mac_menu_add_app_menu_item(group, GTK_MENU_ITEM(about_item), NULL);
3334 group = ige_mac_menu_add_app_menu_group();
3335 preferences_item = gtk_menu_item_new_with_label("Preferences");
3336 g_signal_connect(preferences_item, "activate", G_CALLBACK(prefs_cb),
3338 ige_mac_menu_add_app_menu_item(group, GTK_MENU_ITEM(preferences_item),
3342 /* The quit item in the application menu shows up whenever ige mac
3343 * integration is enabled, even if the OS X UI style in Wireshark isn't
3345 quit_item = gtk_menu_item_new_with_label("Quit");
3346 g_signal_connect(quit_item, "activate", G_CALLBACK(file_quit_cmd_cb), NULL);
3347 ige_mac_menu_set_quit_menu_item(GTK_MENU_ITEM(quit_item));
3350 #ifdef HAVE_GTKOSXAPPLICATION
3351 theApp = g_object_new(GTK_TYPE_OSX_APPLICATION, NULL);
3353 if(prefs.gui_macosx_style) {
3354 gtk_osxapplication_set_menu_bar(theApp, GTK_MENU_SHELL(menubar));
3355 gtk_osxapplication_set_use_quartz_accelerators(theApp, TRUE);
3357 group = gtk_osxapplication_add_app_menu_group (theApp);
3358 item = gtk_item_factory_get_item(main_menu_factory,"/Help/About Wireshark");
3359 gtk_osxapplication_add_app_menu_item(theApp, group,GTK_MENU_ITEM (item));
3361 group = gtk_osxapplication_add_app_menu_group (theApp);
3362 item = gtk_item_factory_get_item(main_menu_factory,"/Edit/Preferences...");
3363 gtk_osxapplication_add_app_menu_item(theApp, group,GTK_MENU_ITEM (item));
3365 group = gtk_osxapplication_add_app_menu_group (theApp);
3366 item = gtk_item_factory_get_item(main_menu_factory,"/Help");
3367 gtk_osxapplication_set_help_menu(theApp,GTK_MENU_ITEM(item));
3369 /* Quit item is not needed */
3370 gtk_item_factory_delete_item(main_menu_factory,"/File/Quit");
3373 /* generate dock menu */
3374 dock_menu = gtk_menu_new();
3376 item = gtk_menu_item_new_with_label("Start");
3377 g_signal_connect(item, "activate", G_CALLBACK (capture_start_cb), NULL);
3378 gtk_menu_shell_append(GTK_MENU_SHELL(dock_menu), item);
3380 item = gtk_menu_item_new_with_label("Stop");
3381 g_signal_connect(item, "activate", G_CALLBACK (capture_stop_cb), NULL);
3382 gtk_menu_shell_append(GTK_MENU_SHELL(dock_menu), item);
3384 item = gtk_menu_item_new_with_label("Restart");
3385 g_signal_connect(item, "activate", G_CALLBACK (capture_restart_cb), NULL);
3386 gtk_menu_shell_append(GTK_MENU_SHELL(dock_menu), item);
3388 gtk_osxapplication_set_dock_menu(theApp, GTK_MENU_SHELL(dock_menu));
3398 void menu_dissector_filter_cb( GtkWidget *widget _U_,
3399 gpointer callback_data,
3400 guint callback_action _U_)
3402 dissector_filter_t *filter_entry = callback_data;
3403 GtkWidget *filter_te;
3406 filter_te = gtk_bin_get_child(GTK_BIN(g_object_get_data(G_OBJECT(top_level), E_DFILTER_CM_KEY)));
3408 /* XXX - this gets the packet_info of the last dissected packet, */
3409 /* which is not necessarily the last selected packet */
3410 /* e.g. "Update list of packets in real time" won't work correct */
3411 buf = filter_entry->build_filter_string(&cfile.edt->pi);
3413 gtk_entry_set_text(GTK_ENTRY(filter_te), buf);
3415 /* Run the display filter so it goes in effect - even if it's the
3416 same as the previous display filter. */
3417 main_filter_packets(&cfile, buf, TRUE);
3419 g_free( (void *) buf);
3422 gboolean menu_dissector_filter_spe_cb(frame_data *fd _U_, epan_dissect_t *edt, gpointer callback_data) {
3423 dissector_filter_t *filter_entry = callback_data;
3425 /* XXX - this gets the packet_info of the last dissected packet, */
3426 /* which is not necessarily the last selected packet */
3427 /* e.g. "Update list of packets in real time" won't work correct */
3428 return (edt != NULL) ? filter_entry->is_filter_valid(&edt->pi) : FALSE;
3431 void menu_dissector_filter(void) {
3432 GList *list_entry = dissector_filter_list;
3433 dissector_filter_t *filter_entry;
3435 while(list_entry != NULL) {
3436 filter_entry = list_entry->data;
3438 register_stat_menu_item(filter_entry->name, REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER,
3439 menu_dissector_filter_cb,
3440 menu_dissector_filter_spe_cb,
3441 NULL /* selected_tree_row_enabled */,
3444 list_entry = g_list_next(list_entry);
3451 GtkActionGroup *packet_list_heading_action_group, *packet_list_action_group,
3452 *packet_list_details_action_group, *packet_list_byte_menu_action_group,
3453 *statusbar_profiles_action_group;
3454 GError *error = NULL;
3455 #ifdef MAIN_MENU_USE_UIMANAGER
3457 #endif /* MAIN_MENU_USE_UIMANAGER */
3463 popup_menu_object = gtk_menu_new();
3465 /* packet list heading pop-up menu */
3466 packet_list_heading_action_group = gtk_action_group_new ("PacketListHeadingPopUpMenuActionGroup");
3468 gtk_action_group_add_actions (packet_list_heading_action_group, /* the action group */
3469 packet_list_heading_menu_popup_action_entries, /* an array of action descriptions */
3470 G_N_ELEMENTS(packet_list_heading_menu_popup_action_entries), /* the number of entries */
3471 popup_menu_object); /* data to pass to the action callbacks */
3473 gtk_action_group_add_toggle_actions(packet_list_heading_action_group, /* the action group */
3474 packet_list_heading_menu_toggle_action_entries, /* an array of action descriptions */
3475 G_N_ELEMENTS(packet_list_heading_menu_toggle_action_entries), /* the number of entries */
3476 NULL); /* data to pass to the action callbacks */
3478 ui_manager_packet_list_heading = gtk_ui_manager_new ();
3479 gtk_ui_manager_insert_action_group (ui_manager_packet_list_heading,
3480 packet_list_heading_action_group,
3481 0); /* the position at which the group will be inserted. */
3483 gtk_ui_manager_add_ui_from_string (ui_manager_packet_list_heading,ui_desc_packet_list_heading_menu_popup, -1, &error);
3486 fprintf (stderr, "Warning: building Packet List Heading Pop-Up failed: %s\n",
3488 g_error_free (error);
3492 g_object_set_data(G_OBJECT(popup_menu_object), PM_PACKET_LIST_COL_KEY,
3493 gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup"));
3495 popup_menu_list = g_slist_append((GSList *)popup_menu_list, ui_manager_packet_list_heading);
3497 /* packet list pop-up menu */
3498 packet_list_action_group = gtk_action_group_new ("PacketListPopUpMenuActionGroup");
3500 gtk_action_group_add_actions (packet_list_action_group, /* the action group */
3501 packet_list_menu_popup_action_entries, /* an array of action descriptions */
3502 G_N_ELEMENTS(packet_list_menu_popup_action_entries), /* the number of entries */
3503 popup_menu_object); /* data to pass to the action callbacks */
3505 ui_manager_packet_list_menu = gtk_ui_manager_new ();
3507 gtk_ui_manager_insert_action_group (ui_manager_packet_list_menu,
3508 packet_list_action_group,
3509 0); /* the position at which the group will be inserted. */
3511 gtk_ui_manager_add_ui_from_string (ui_manager_packet_list_menu, ui_desc_packet_list_menu_popup, -1, &error);
3514 fprintf (stderr, "Warning: building Packet List Pop-Up menu failed: %s\n",
3516 g_error_free (error);
3520 g_object_set_data(G_OBJECT(popup_menu_object), PM_PACKET_LIST_KEY,
3521 gtk_ui_manager_get_widget(ui_manager_packet_list_menu, "/PacketListMenuPopup"));
3523 popup_menu_list = g_slist_append((GSList *)popup_menu_list, ui_manager_packet_list_menu);
3526 /* packet detail pop-up menu */
3527 packet_list_details_action_group = gtk_action_group_new ("PacketListDetailsMenuPopUpActionGroup");
3529 gtk_action_group_add_actions (packet_list_details_action_group, /* the action group */
3530 tree_view_menu_popup_action_entries, /* an array of action descriptions */
3531 G_N_ELEMENTS(tree_view_menu_popup_action_entries), /* the number of entries */
3532 popup_menu_object); /* data to pass to the action callbacks */
3534 ui_manager_tree_view_menu = gtk_ui_manager_new ();
3536 gtk_ui_manager_insert_action_group (ui_manager_tree_view_menu,
3537 packet_list_details_action_group,
3538 0); /* the position at which the group will be inserted. */
3540 gtk_ui_manager_add_ui_from_string (ui_manager_tree_view_menu, ui_desc_tree_view_menu_popup, -1, &error);
3543 fprintf (stderr, "Warning: building TreeWiew Pop-Up menu failed: %s\n",
3545 g_error_free (error);
3549 g_object_set_data(G_OBJECT(popup_menu_object), PM_TREE_VIEW_KEY,
3550 gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup"));
3552 popup_menu_list = g_slist_append((GSList *)popup_menu_list, ui_manager_tree_view_menu);
3555 * Hex dump pop-up menu.
3556 * We provide our own empty menu to suppress the default pop-up menu
3559 packet_list_byte_menu_action_group = gtk_action_group_new ("PacketListByteMenuPopUpActionGroup");
3562 gtk_action_group_add_radio_actions (packet_list_byte_menu_action_group, /* the action group */
3563 bytes_menu_radio_action_entries, /* an array of radio action descriptions */
3564 G_N_ELEMENTS(bytes_menu_radio_action_entries), /* the number of entries */
3565 recent.gui_bytes_view, /* the value of the action to activate initially, or -1 if no action should be activated */
3566 G_CALLBACK(select_bytes_view_cb), /* the callback to connect to the changed signal */
3567 popup_menu_object); /* data to pass to the action callbacks */
3569 ui_manager_bytes_menu = gtk_ui_manager_new ();
3571 gtk_ui_manager_insert_action_group (ui_manager_bytes_menu,
3572 packet_list_byte_menu_action_group,
3573 0); /* the position at which the group will be inserted. */
3575 gtk_ui_manager_add_ui_from_string (ui_manager_bytes_menu, ui_desc_bytes_menu_popup, -1, &error);
3578 fprintf (stderr, "Warning: building Bytes Pop-Up menu failed: %s\n",
3580 g_error_free (error);
3584 g_object_unref(packet_list_byte_menu_action_group);
3586 g_object_set_data(G_OBJECT(popup_menu_object), PM_BYTES_VIEW_KEY,
3587 gtk_ui_manager_get_widget(ui_manager_bytes_menu, "/BytesMenuPopup"));
3589 popup_menu_list = g_slist_append((GSList *)popup_menu_list, ui_manager_bytes_menu);
3592 #ifdef MAIN_MENU_USE_UIMANAGER
3593 main_menu_bar_action_group = gtk_action_group_new ("MenuActionGroup");
3594 gtk_action_group_add_actions (main_menu_bar_action_group, /* the action group */
3595 main_menu_bar_entries, /* an array of action descriptions */
3596 G_N_ELEMENTS(main_menu_bar_entries), /* the number of entries */
3597 NULL); /* data to pass to the action callbacks */
3599 gtk_action_group_add_toggle_actions(main_menu_bar_action_group, /* the action group */
3600 main_menu_bar_toggle_action_entries, /* an array of action descriptions */
3601 G_N_ELEMENTS(main_menu_bar_toggle_action_entries), /* the number of entries */
3602 NULL); /* data to pass to the action callbacks */
3604 gtk_action_group_add_radio_actions (main_menu_bar_action_group, /* the action group */
3605 main_menu_bar_radio_view_time_entries, /* an array of radio action descriptions */
3606 G_N_ELEMENTS(main_menu_bar_radio_view_time_entries), /* the number of entries */
3607 recent.gui_time_format, /* the value of the action to activate initially, or -1 if no action should be activated */
3608 G_CALLBACK(timestamp_format_new_cb), /* the callback to connect to the changed signal */
3609 NULL); /* data to pass to the action callbacks */
3611 gtk_action_group_add_radio_actions (main_menu_bar_action_group, /* the action group */
3612 main_menu_bar_radio_view_time_fileformat_prec_entries, /* an array of radio action descriptions */
3613 G_N_ELEMENTS(main_menu_bar_radio_view_time_fileformat_prec_entries), /* the number of entries */
3614 recent.gui_time_precision, /* the value of the action to activate initially, or -1 if no action should be activated */
3615 G_CALLBACK(timestamp_precision_new_cb), /* the callback to connect to the changed signal */
3616 NULL); /* data to pass to the action callbacks */
3620 ui_manager_main_menubar = gtk_ui_manager_new ();
3621 gtk_ui_manager_insert_action_group (ui_manager_main_menubar, main_menu_bar_action_group, 0);
3622 gtk_ui_manager_add_ui_from_string (ui_manager_main_menubar,ui_desc_menubar, -1, &error);
3625 fprintf (stderr, "Warning: building main menubar failed: %s\n",
3627 g_error_free (error);
3630 g_object_unref(main_menu_bar_action_group);
3631 gtk_window_add_accel_group (GTK_WINDOW(top_level),
3632 gtk_ui_manager_get_accel_group(ui_manager_main_menubar));
3636 /* Add the recent files items to the menu
3637 * use place holders and
3638 * gtk_ui_manager_add_ui().
3640 merge_id = gtk_ui_manager_new_merge_id (ui_manager_main_menubar);
3641 add_recent_items (merge_id, ui_manager_main_menubar);
3642 #else /* MAIN_MENU_USE_UIMANAGER */
3643 main_menu_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", grp);
3644 gtk_item_factory_create_items_ac(main_menu_factory, nmenu_items, menu_items, NULL, 2);
3645 #endif /* MAIN_MENU_USE_UIMANAGER */
3647 statusbar_profiles_action_group = gtk_action_group_new ("StatusBarProfilesPopUpMenuActionGroup");
3649 gtk_action_group_add_actions (statusbar_profiles_action_group, /* the action group */
3650 statusbar_profiles_menu_action_entries, /* an array of action descriptions */
3651 G_N_ELEMENTS(statusbar_profiles_menu_action_entries), /* the number of entries */
3652 popup_menu_object); /* data to pass to the action callbacks */
3654 ui_manager_statusbar_profiles_menu = gtk_ui_manager_new ();
3655 gtk_ui_manager_insert_action_group (ui_manager_statusbar_profiles_menu,
3656 statusbar_profiles_action_group,
3657 0); /* the position at which the group will be inserted. */
3659 gtk_ui_manager_add_ui_from_string (ui_manager_statusbar_profiles_menu,ui_statusbar_profiles_menu_popup, -1, &error);
3662 fprintf (stderr, "Warning: building Statusbar Profiles Pop-Up failed: %s\n",
3664 g_error_free (error);
3668 g_object_unref(statusbar_profiles_action_group);
3670 g_object_set_data(G_OBJECT(popup_menu_object), PM_STATUSBAR_PROFILES_KEY,
3671 gtk_ui_manager_get_widget(ui_manager_statusbar_profiles_menu, "/ProfilesMenuPopup"));
3673 popup_menu_list = g_slist_append((GSList *)popup_menu_list, ui_manager_statusbar_profiles_menu);
3675 menu_dissector_filter();
3676 merge_all_tap_menus(tap_menu_tree_root);
3678 /* Initialize enabled/disabled state of menu items */
3679 set_menus_for_capture_file(NULL);
3681 /* Un-#if this when we actually implement Cut/Copy/Paste.
3682 Then make sure you enable them when they can be done. */
3683 set_menu_sensitivity_old("/Edit/Cut", FALSE);
3684 set_menu_sensitivity_old("/Edit/Copy", FALSE);
3685 set_menu_sensitivity_old("/Edit/Paste", FALSE);
3688 set_menus_for_captured_packets(FALSE);
3689 set_menus_for_selected_packet(&cfile);
3690 set_menus_for_selected_tree_row(&cfile);
3691 set_menus_for_capture_in_progress(FALSE);
3692 set_menus_for_file_set(/* dialog */TRUE, /* previous file */ FALSE, /* next_file */ FALSE);
3694 #ifndef MAIN_MENU_USE_UIMANAGER
3695 /* Init with an empty recent files list */
3696 clear_menu_recent_capture_file_cmd_cb(NULL, NULL);
3697 #endif /* MAIN_MENU_USE_UIMANAGER */
3698 /* Protocol help links */
3699 proto_help_menu_init(gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup"));
3704 static gint tap_menu_item_add_compare(gconstpointer a, gconstpointer b)
3707 ((const menu_item_t *) a)->name,
3708 ((const menu_item_t *) b)->name);
3712 /* add a menuitem below the current node */
3713 static GList * tap_menu_item_add(
3717 const char *stock_id,
3718 GtkItemFactoryCallback callback,
3719 gboolean (*selected_packet_enabled)(frame_data *, epan_dissect_t *, gpointer callback_data),
3720 gboolean (*selected_tree_row_enabled)(field_info *, gpointer callback_data),
3721 gpointer callback_data,
3728 child = g_malloc(sizeof (menu_item_t));
3730 child->group = group;
3731 child->label = label;
3732 child->stock_id = stock_id;
3733 child->callback = callback;
3734 child->selected_packet_enabled = selected_packet_enabled;
3735 child->selected_tree_row_enabled = selected_tree_row_enabled;
3736 child->callback_data = callback_data;
3737 child->enabled = FALSE;
3738 child->children = NULL;
3740 /* insert the new child node into the parent */
3741 curr = curnode->data;
3742 curr->children = g_list_insert_sorted(curr->children, child, tap_menu_item_add_compare);
3744 /* return the new node */
3745 /* XXX: improve this */
3746 return g_list_find(curr->children, child);
3750 * Add a new menu item for a tap.
3751 * This must be called after we've created the main menu, so it can't
3752 * be called from the routine that registers taps - we have to introduce
3753 * another per-tap registration routine.
3755 * "callback" gets called when the menu item is selected; it should do
3756 * the work of creating the tap window.
3758 * "selected_packet_enabled" gets called by "set_menus_for_selected_packet()";
3759 * it's passed a Boolean that's TRUE if a packet is selected and FALSE
3760 * otherwise, and should return TRUE if the tap will work now (which
3761 * might depend on whether a packet is selected and, if one is, on the
3762 * packet) and FALSE if not.
3764 * "selected_tree_row_enabled" gets called by
3765 * "set_menus_for_selected_tree_row()"; it's passed a Boolean that's TRUE if
3766 * a protocol tree row is selected and FALSE otherwise, and should return
3767 * TRUE if the tap will work now (which might depend on whether a tree row
3768 * is selected and, if one is, on the tree row) and FALSE if not.
3772 register_stat_menu_item_stock(
3774 register_stat_group_t group,
3775 const char *stock_id,
3776 GtkItemFactoryCallback callback,
3777 gboolean (*selected_packet_enabled)(frame_data *, epan_dissect_t *, gpointer callback_data),
3778 gboolean (*selected_tree_row_enabled)(field_info *, gpointer callback_data),
3779 gpointer callback_data)
3781 /*static const char toolspath[] = "/Statistics/";*/
3782 const char *toolspath;
3791 * The menu path must be relative.
3793 g_assert(*name != '/');
3794 #ifdef MAIN_MENU_USE_UIMANAGER
3796 case(REGISTER_STAT_GROUP_GENERIC): toolspath = "/Statistics/"; break;
3797 case(REGISTER_STAT_GROUP_CONVERSATION_LIST): toolspath = "/Statistics/ConversationList/"; break;
3798 case(REGISTER_STAT_GROUP_ENDPOINT_LIST): toolspath = "/Statistics/EndpointList/"; break;
3799 case(REGISTER_STAT_GROUP_RESPONSE_TIME): toolspath = "/Statistics/ServiceResponseTime/"; break;
3800 case(REGISTER_STAT_GROUP_UNSORTED): toolspath = "/Statistics/"; break;
3801 case(REGISTER_ANALYZE_GROUP_UNSORTED): toolspath = "/Analyze/"; break;
3802 case(REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER): toolspath = "Analyze/ConversationFilter/"; break;
3803 case(REGISTER_STAT_GROUP_TELEPHONY): toolspath = "/Telephony/"; break;
3804 case(REGISTER_TOOLS_GROUP_UNSORTED): toolspath = "/Tools/"; break;
3806 g_assert(!"no such menu group");
3811 case(REGISTER_STAT_GROUP_GENERIC): toolspath = "/Statistics/"; break;
3812 case(REGISTER_STAT_GROUP_CONVERSATION_LIST): toolspath = "/Statistics/_Conversation List/"; break;
3813 case(REGISTER_STAT_GROUP_ENDPOINT_LIST): toolspath = "/Statistics/_Endpoint List/"; break;
3814 case(REGISTER_STAT_GROUP_RESPONSE_TIME): toolspath = "/Statistics/Service _Response Time/"; break;
3815 case(REGISTER_STAT_GROUP_UNSORTED): toolspath = "/Statistics/"; break;
3816 case(REGISTER_ANALYZE_GROUP_UNSORTED): toolspath = "/Analyze/"; break;
3817 case(REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER): toolspath = "/Analyze/Conversation Filter/"; break;
3818 case(REGISTER_STAT_GROUP_TELEPHONY): toolspath = "/Telephony/"; break;
3819 case(REGISTER_TOOLS_GROUP_UNSORTED): toolspath = "/Tools/"; break;
3821 g_assert(!"no such menu group");
3825 /* add the (empty) root node, if not already done */
3826 if(tap_menu_tree_root == NULL) {
3827 child = g_malloc0(sizeof (menu_item_t));
3828 tap_menu_tree_root = g_list_append(NULL, child);
3832 * Create any submenus required.
3834 curnode = tap_menu_tree_root;
3836 while ((p = strchr(p, '/')) != NULL) {
3838 * OK, everything between "name" and "p" is
3839 * a menu relative subtree into which the menu item
3842 * Construct the absolute path name of that subtree.
3844 menupathlen = strlen(toolspath) + 1 + (p - name);
3845 menupath = g_malloc(menupathlen);
3846 g_strlcpy(menupath, toolspath, menupathlen);
3847 g_strlcat(menupath, name, menupathlen);
3850 * Does there exist an entry with that path at this
3851 * level of the Analyze menu tree?
3853 child = curnode->data;
3854 for (childnode = child->children; childnode != NULL; childnode = childnode->next) {
3855 child = childnode->data;
3856 if (strcmp(child->name, menupath) == 0)
3859 if (childnode == NULL) {
3861 * No. Create such an item as a subtree, and
3862 * add it to the Tools menu tree.
3864 childnode = tap_menu_item_add(
3865 menupath, group, name, "", NULL, NULL ,NULL, NULL, curnode);
3868 * Yes. We don't need this "menupath" any longer.
3872 curnode = childnode;
3875 * Skip over the '/' we found.
3881 * Construct the main menu path for the menu item.
3883 menupathlen = strlen(toolspath) + 1 + strlen(name);
3884 menupath = g_malloc(menupathlen);
3885 g_strlcpy(menupath, toolspath, menupathlen);
3886 g_strlcat(menupath, name, menupathlen);
3889 * Construct an item factory entry for the item, and add it to
3893 menupath, group, name, stock_id, callback,
3894 selected_packet_enabled, selected_tree_row_enabled,
3895 callback_data, curnode);
3899 * Add a new menu item for a stat.
3900 * This must be called after we've created the main menu, so it can't
3901 * be called from the routine that registers stats - we have to introduce
3902 * another per-stat registration routine.
3904 * @param name the menu label
3906 * @param group the menu group this stat should be registered to
3908 * @param callback gets called when the menu item is selected; it should do
3909 * the work of creating the stat window.
3911 * @param selected_packet_enabled gets called by set_menus_for_selected_packet();
3912 * it's passed a pointer to the "frame_data" structure for the current frame,
3913 * if any, and to the "epan_dissect_t" structure for that frame, if any, and
3914 * should return TRUE if the stat will work now (which might depend on whether
3915 * a frame is selected and, if one is, on the frame) and FALSE if not.
3917 * @param selected_tree_row_enabled gets called by
3918 * set_menus_for_selected_tree_row(); it's passed a pointer to the
3919 * "field_info" structure for the currently selected field, if any,
3920 * and should return TRUE if the stat will work now (which might depend on
3921 * whether a tree row is selected and, if one is, on the tree row) and
3924 * @param callback_data data for callback function
3927 register_stat_menu_item(
3929 register_stat_group_t group,
3930 GtkItemFactoryCallback callback,
3931 gboolean (*selected_packet_enabled)(frame_data *, epan_dissect_t *, gpointer callback_data),
3932 gboolean (*selected_tree_row_enabled)(field_info *, gpointer callback_data),
3933 gpointer callback_data)
3935 register_stat_menu_item_stock(
3940 selected_packet_enabled,
3941 selected_tree_row_enabled,
3945 #ifdef MAIN_MENU_USE_UIMANAGER
3946 static guint merge_tap_menus_layered(GList *node, gint group) {
3947 GtkItemFactoryEntry *entry;
3953 GtkActionGroup *action_group;
3956 menu_item_t *node_data = node->data;
3957 gchar *action_grp_name;
3960 * Is this a leaf node or an interior node?
3962 if (node_data->children == NULL) {
3968 * The root node doesn't correspond to a menu tree item; it
3969 * has a null name pointer.
3971 if (node_data->name != NULL && group == node_data->group) {
3972 entry = g_malloc0(sizeof (GtkItemFactoryEntry));
3973 entry->path = node_data->name;
3974 entry->callback = node_data->callback;
3976 case(REGISTER_STAT_GROUP_UNSORTED):
3978 case(REGISTER_STAT_GROUP_GENERIC):
3980 case(REGISTER_STAT_GROUP_CONVERSATION_LIST):
3981 entry->item_type = "<StockItem>";
3982 entry->extra_data = WIRESHARK_STOCK_CONVERSATIONS;
3984 case(REGISTER_STAT_GROUP_ENDPOINT_LIST):
3985 entry->item_type = "<StockItem>";
3986 entry->extra_data = WIRESHARK_STOCK_ENDPOINTS;
3988 case(REGISTER_STAT_GROUP_RESPONSE_TIME):
3989 entry->item_type = "<StockItem>";
3990 entry->extra_data = WIRESHARK_STOCK_TIME;
3992 case(REGISTER_STAT_GROUP_TELEPHONY):
3994 case(REGISTER_ANALYZE_GROUP_UNSORTED):
3996 case(REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER):
3998 case(REGISTER_TOOLS_GROUP_UNSORTED):
4001 g_assert_not_reached();
4003 if(node_data->stock_id!= NULL) {
4004 entry->item_type = "<StockItem>";
4005 entry->extra_data = node_data->stock_id;
4008 gtk_item_factory_create_item(main_menu_factory, entry, node_data->callback_data, /* callback_type */ 2);
4009 set_menu_sensitivity_old(main_menu_factory, node_data->name, FALSE); /* no capture file yet */
4016 * It's an interior node; call
4017 * "merge_tap_menus_layered()" on all its children
4021 * The root node doesn't correspond to a menu tree item; it
4022 * has a null name pointer.
4024 if (node_data->name != NULL && group == node_data->group) {
4028 /* the underscore character regularly confuses things, as it will prevent finding
4029 * the menu_item, so it has to be removed first
4031 dup = g_strdup(node_data->name);
4033 while(*node_data->name) {
4034 if (*node_data->name != '_') {
4035 *dest = *node_data->name;
4042 entry = g_malloc0(sizeof (GtkItemFactoryEntry));
4043 entry->path = node_data->name;
4044 entry->item_type = "<Branch>";
4045 /* use the node_data->name(path) with the slashes replaced by "-" as the action group name */
4046 action_grp_name = g_strdup(dup+1);
4047 g_strdelimit(action_grp_name, "/", '-');
4049 g_warning("<Branch> %s",action_grp_name);
4052 action_group = gtk_action_group_new (action_grp_name);
4054 case(REGISTER_STAT_GROUP_UNSORTED):
4055 merge_id = gtk_ui_manager_new_merge_id (ui_manager_main_menubar);
4056 gtk_ui_manager_insert_action_group (ui_manager_main_menubar, action_group, 0);
4057 g_object_set_data (G_OBJECT (ui_manager_main_menubar),
4058 "Menubar-StatisticsMenu-merge-id", GUINT_TO_POINTER (merge_id));
4060 action = gtk_action_new(node_data->name, /* name */
4061 strrchr(node_data->name,'/'), /* label */
4063 node_data->stock_id); /* stock_id */
4065 gtk_action_group_add_action (action_group, action);
4066 g_object_unref (action);
4068 gtk_ui_manager_add_ui (ui_manager_main_menubar, merge_id,
4069 "/Menubar/StatisticsMenu", /* path */
4070 strrchr(node_data->name,'/'), /* name */
4071 node_data->name, /* action */
4072 GTK_UI_MANAGER_MENU, /* type */
4073 FALSE); /* "top" if TRUE, the UI element is added before its siblings */
4076 g_warning("<Stat unsorted> %s",action_grp_name);
4077 g_warning("label %s",node_data->label);
4079 case(REGISTER_STAT_GROUP_GENERIC):
4082 case(REGISTER_STAT_GROUP_ENDPOINT_LIST):
4084 case(REGISTER_STAT_GROUP_RESPONSE_TIME):
4086 case(REGISTER_STAT_GROUP_TELEPHONY):
4088 case(REGISTER_ANALYZE_GROUP_UNSORTED):
4090 case(REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER):
4092 case(REGISTER_TOOLS_GROUP_UNSORTED):
4093 g_warning("<Tools> %s",action_grp_name);
4094 g_warning("label %s",node_data->label);
4097 g_assert_not_reached();
4101 gtk_item_factory_create_item(main_menu_factory, entry,
4103 set_menu_sensitivity_old(main_menu_factory, node_data->name,
4104 FALSE); /* no children yet */
4110 for (child = node_data->children; child != NULL; child =
4112 added += merge_tap_menus_layered(child, group);
4120 static guint merge_tap_menus_layered(GList *node, gint group) {
4121 GtkItemFactoryEntry *entry;
4125 menu_item_t *node_data = node->data;
4128 * Is this a leaf node or an interior node?
4130 if (node_data->children == NULL) {
4136 * The root node doesn't correspond to a menu tree item; it
4137 * has a null name pointer.
4139 if (node_data->name != NULL && group == node_data->group) {
4140 entry = g_malloc0(sizeof (GtkItemFactoryEntry));
4141 entry->path = node_data->name;
4142 entry->callback = node_data->callback;
4144 case(REGISTER_STAT_GROUP_UNSORTED):
4146 case(REGISTER_STAT_GROUP_GENERIC):
4148 case(REGISTER_STAT_GROUP_CONVERSATION_LIST):
4149 entry->item_type = "<StockItem>";
4150 entry->extra_data = WIRESHARK_STOCK_CONVERSATIONS;
4152 case(REGISTER_STAT_GROUP_ENDPOINT_LIST):
4153 entry->item_type = "<StockItem>";
4154 entry->extra_data = WIRESHARK_STOCK_ENDPOINTS;
4156 case(REGISTER_STAT_GROUP_RESPONSE_TIME):
4157 entry->item_type = "<StockItem>";
4158 entry->extra_data = WIRESHARK_STOCK_TIME;
4160 case(REGISTER_STAT_GROUP_TELEPHONY):
4162 case(REGISTER_ANALYZE_GROUP_UNSORTED):
4164 case(REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER):
4166 case(REGISTER_TOOLS_GROUP_UNSORTED):
4169 g_assert_not_reached();
4171 if(node_data->stock_id!= NULL) {
4172 entry->item_type = "<StockItem>";
4173 entry->extra_data = node_data->stock_id;
4175 gtk_item_factory_create_item(main_menu_factory, entry, node_data->callback_data, /* callback_type */ 2);
4176 set_menu_sensitivity_old(node_data->name, FALSE); /* no capture file yet */
4182 * It's an interior node; call
4183 * "merge_tap_menus_layered()" on all its children
4187 * The root node doesn't correspond to a menu tree item; it
4188 * has a null name pointer.
4190 if (node_data->name != NULL && group == node_data->group) {
4191 entry = g_malloc0(sizeof (GtkItemFactoryEntry));
4192 entry->path = node_data->name;
4193 entry->item_type = "<Branch>";
4195 gtk_item_factory_create_item(main_menu_factory, entry,
4197 set_menu_sensitivity_old(node_data->name, FALSE); /* no children yet */
4202 for (child = node_data->children; child != NULL; child =
4204 added += merge_tap_menus_layered(child, group);
4210 #endif /* MAIN_MENU_USE_UIMANAGER */
4214 g_warning("entry->path = %s",entry->path);
4215 action = gtk_action_new(entry->path, /* name */
4216 const gchar *label, /* label */
4218 node_data->stock_id); /* stock_id */
4219 gtk_action_group_add_action_with_accel(main_menu_bar_action_group,
4221 NULL); /*the accelerator for the action,
4222 * in the format understood by gtk_accelerator_parse(),
4223 * or "" for no accelerator, or NULL to use the stock accelerator.
4226 g_signal_connect (action, "activate",
4227 G_CALLBACK (node_data->callback),
4228 node_data->callback_data);
4231 g_warning("Group: %s", node_data->name);
4232 p = strrchr(node_data->name,'/');
4235 action = gtk_action_new(entry->path, /* name */
4238 node_data->stock_id); /* stock_id */
4239 gtk_action_group_add_action_with_accel(main_menu_bar_action_group,
4241 NULL); /*the accelerator for the action,
4242 * in the format understood by gtk_accelerator_parse(),
4243 * or "" for no accelerator, or NULL to use the stock accelerator.
4246 if(group==REGISTER_STAT_GROUP_RESPONSE_TIME){
4247 gtk_ui_manager_add_ui (ui_manager_main_menubar, merge_id,
4248 "/Menubar/StatisticsMenu", /* path */
4250 entry->path, /* action */
4251 GTK_UI_MANAGER_MENU, /* type */
4252 FALSE); /* "top" if TRUE, the UI element is added before its siblings */
4259 static void merge_all_tap_menus(GList *node) {
4260 GtkItemFactoryEntry *sep_entry;
4262 sep_entry = g_malloc0(sizeof (GtkItemFactoryEntry));
4263 sep_entry->item_type = "<Separator>";
4264 sep_entry->path = "/Statistics/";
4265 #ifdef MAIN_MENU_USE_UIMANAGER
4266 /* build the new menus */
4268 merge_id = gtk_ui_manager_new_merge_id (ui_manager_main_menubar);
4272 * merge only the menu items of the specific group,
4273 * and then append a seperator
4275 if (merge_tap_menus_layered(node, REGISTER_STAT_GROUP_GENERIC)) {
4276 #ifdef MAIN_MENU_USE_UIMANAGER
4279 gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);
4280 #endif /* MAIN_MENU_USE_UIMANAGER */
4282 if (merge_tap_menus_layered(node, REGISTER_STAT_GROUP_CONVERSATION_LIST)) {
4283 /*gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);*/
4285 if (merge_tap_menus_layered(node, REGISTER_STAT_GROUP_ENDPOINT_LIST)) {
4286 /*gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);*/
4288 if (merge_tap_menus_layered(node, REGISTER_STAT_GROUP_RESPONSE_TIME)) {
4289 #ifdef MAIN_MENU_USE_UIMANAGER
4292 gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);
4293 #endif /* MAIN_MENU_USE_UIMANAGER */
4295 if (merge_tap_menus_layered(node, REGISTER_STAT_GROUP_TELEPHONY)) {
4296 /*gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);*/
4298 if (merge_tap_menus_layered(node, REGISTER_STAT_GROUP_UNSORTED)) {
4299 /*gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);*/
4301 if (merge_tap_menus_layered(node, REGISTER_ANALYZE_GROUP_UNSORTED)) {
4302 sep_entry->path = "/Analyze/";
4303 /*gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);*/
4305 if (merge_tap_menus_layered(node, REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER)) {
4306 sep_entry->path = "/Analyze/Conversation Filter/";
4307 /*gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);*/
4309 if (merge_tap_menus_layered(node, REGISTER_TOOLS_GROUP_UNSORTED)) {
4310 /*gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);*/
4317 * Enable/disable menu sensitivity.
4320 set_menu_sensitivity(GtkUIManager *ui_manager, const gchar *path, gint val)
4324 action = gtk_ui_manager_get_action(ui_manager, path);
4327 fprintf (stderr, "Warning: couldn't find action path= %s\n",
4332 #if GLIB_CHECK_VERSION(2,6,0)
4333 gtk_action_set_sensitive (action,
4334 val); /* TRUE to make the action sensitive */
4336 g_object_set (G_OBJECT (action), "sensitive", val, NULL);
4340 #ifndef MAIN_MENU_USE_UIMANAGER
4342 * Enable/disable menu sensitivity for the old menubar code.
4345 set_menu_sensitivity_old(const gchar *path, gint val)
4347 GtkWidget *menu_item;
4350 /* the underscore character regularly confuses things, as it will prevent finding
4351 * the menu_item, so it has to be removed first */
4352 dup = g_strdup(path);
4363 if ((menu_item = gtk_item_factory_get_widget(main_menu_factory, dup)) != NULL) {
4364 if (GTK_IS_MENU(menu_item)) {
4366 * "dup" refers to a submenu; "gtk_item_factory_get_widget()"
4367 * gets the menu, not the item that, when selected, pops up
4370 * We have to change the latter item's sensitivity, so that
4371 * it shows up normally if sensitive and grayed-out if
4374 menu_item = gtk_menu_get_attach_widget(GTK_MENU(menu_item));
4376 gtk_widget_set_sensitive(menu_item, val);
4378 #ifndef NEW_PACKET_LIST
4379 /* be sure this menu item *is* existing */
4380 g_assert_not_reached();
4387 #endif /* MAIN_MENU_USE_UIMANAGER */
4390 set_menu_object_data_meat(GtkUIManager *ui_manager, const gchar *path, const gchar *key, gpointer data)
4392 GtkWidget *menu = NULL;
4394 if ((menu = gtk_ui_manager_get_widget(ui_manager, path)) != NULL){
4395 g_object_set_data(G_OBJECT(menu), key, data);
4398 g_warning("set_menu_object_data_meat: no menu, path: %s",path);
4403 #ifndef MAIN_MENU_USE_UIMANAGER
4405 set_menu_object_data_meat_old(const gchar *path, const gchar *key, gpointer data)
4407 GtkWidget *menu = NULL;
4409 if ((menu = gtk_item_factory_get_widget(main_menu_factory, path)) != NULL){
4410 g_object_set_data(G_OBJECT(menu), key, data);
4416 set_menu_object_data_old (const gchar *path, const gchar *key, gpointer data) {
4418 set_menu_object_data_meat_old(path, key, data);
4422 set_menu_object_data (const gchar *path, const gchar *key, gpointer data) {
4424 if (strncmp (path,"/Menubar",8) == 0){
4425 set_menu_object_data_meat(ui_manager_main_menubar, path, key, data);
4426 }else if (strncmp (path,"/PacketListMenuPopup",20) == 0){
4427 set_menu_object_data_meat(ui_manager_packet_list_menu, path, key, data);
4428 }else if (strncmp (path,"/TreeViewPopup",14) == 0){
4429 set_menu_object_data_meat(ui_manager_tree_view_menu, path, key, data);
4430 }else if (strncmp (path,"/BytesMenuPopup",15) == 0){
4431 set_menu_object_data_meat(ui_manager_bytes_menu, path, key, data);
4432 }else if (strncmp (path,"/ProfilesMenuPopup",18) == 0){
4433 set_menu_object_data_meat(ui_manager_statusbar_profiles_menu, path, key, data);
4438 /* Recently used capture files submenu:
4439 * Submenu containing the recently used capture files.
4440 * The capture filenames are always kept with the absolute path, to be independant
4441 * of the current path.
4442 * They are only stored inside the labels of the submenu (no separate list). */
4444 #define MENU_RECENT_FILES_PATH_OLD "/File/Open Recent"
4445 #define MENU_RECENT_FILES_PATH "/Menubar/FileMenu/OpenRecent"
4446 #define MENU_RECENT_FILES_KEY "Recent File Name"
4449 #ifndef MAIN_MENU_USE_UIMANAGER
4451 update_menu_recent_capture_file1(GtkWidget *widget, gpointer cnt) {
4452 gchar *widget_cf_name;
4454 widget_cf_name = g_object_get_data(G_OBJECT(widget), MENU_RECENT_FILES_KEY);
4456 /* if this menu item is a file, count it */
4457 if (widget_cf_name) {
4459 main_welcome_add_recent_capture_files(widget_cf_name);
4463 /* update the menu */
4465 update_menu_recent_capture_file(GtkWidget *submenu_recent_files) {
4467 GtkWidget *menu_item;
4470 main_welcome_reset_recent_capture_files();
4472 gtk_container_foreach(GTK_CONTAINER(submenu_recent_files),
4473 update_menu_recent_capture_file1, &cnt);
4477 menu_item = gtk_menu_item_new_with_label("No recently used files");
4478 gtk_menu_shell_append (GTK_MENU_SHELL(submenu_recent_files), menu_item);
4479 gtk_widget_show (menu_item);
4482 /* make parent menu item sensitive only, if we have any valid files in the list */
4483 set_menu_sensitivity_old(MENU_RECENT_FILES_PATH_OLD, cnt);
4486 #endif /* MAIN_MENU_USE_UIMANAGER */
4488 #ifndef MAIN_MENU_USE_UIMANAGER
4489 /* remove the capture filename from the "Recent Files" menu */
4491 remove_menu_recent_capture_filename(gchar *cf_name) {
4492 GtkWidget *submenu_recent_files;
4494 GList* child_list_item;
4495 GtkWidget *menu_item_child;
4496 const gchar *menu_item_cf_name;
4498 /* get the submenu container item */
4499 #ifdef MAIN_MENU_USE_UIMANAGER
4500 submenu_recent_files = gtk_ui_manager_get_widget(ui_manager_main_menubar, MENU_RECENT_FILES_PATH);
4501 if(!submenu_recent_files){
4502 g_warning("remove_menu_recent_capture_filename: No submenu_recent_files found, path= MENU_RECENT_FILES_PATH");
4505 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH_OLD);
4507 /* find the corresponding menu item to be removed */
4508 child_list = gtk_container_get_children(GTK_CONTAINER(submenu_recent_files));
4509 child_list_item = child_list;
4510 while(child_list_item) {
4511 menu_item_child = (GTK_BIN(child_list_item->data))->child;
4512 if (menu_item_child != NULL) { /* Note: there are two "extra" items on the end of the child_list: */
4513 /* - a separator (with no menu_item_child and thus no text label) */
4514 /* - a 2nd item with a menu_child with text label "Clear" */
4515 /* [See add_menu_recent_capture_file_absolute() ] */
4516 /* 'if (menu_item_child != NULL)' skips the separator item; */
4517 /* An absolute filename in cf_name will never match "Clear". */
4518 menu_item_cf_name = gtk_label_get_text(GTK_LABEL(menu_item_child));
4519 if(strcmp(menu_item_cf_name, cf_name) == 0) {
4520 /* XXX: is this all we need to do, to free the menu item and its label?
4521 The reference count of widget will go to 0, so it'll be freed;
4522 will that free the label? */
4523 gtk_container_remove(GTK_CONTAINER(submenu_recent_files), child_list_item->data);
4526 child_list_item = g_list_next(child_list_item);
4528 g_list_free(child_list);
4530 update_menu_recent_capture_file(submenu_recent_files);
4533 /* remove the capture filename from the "Recent Files" menu */
4535 remove_menu_recent_capture_file(GtkWidget *widget, gpointer unused _U_) {
4536 GtkWidget *submenu_recent_files;
4537 gchar *widget_cf_name;
4540 widget_cf_name = g_object_get_data(G_OBJECT(widget), MENU_RECENT_FILES_KEY);
4541 g_free(widget_cf_name);
4543 /* get the submenu container item */
4544 #ifdef MAIN_MENU_USE_UIMANAGER
4545 submenu_recent_files = gtk_ui_manager_get_widget(ui_manager_main_menubar, MENU_RECENT_FILES_PATH);
4546 if(!submenu_recent_files){
4547 g_warning("remove_menu_recent_capture_file: No submenu_recent_files found, path= MENU_RECENT_FILES_PATH");
4550 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH_OLD);
4552 /* XXX: is this all we need to do, to free the menu item and its label?
4553 The reference count of widget will go to 0, so it'll be freed;
4554 will that free the label? */
4555 gtk_container_remove(GTK_CONTAINER(submenu_recent_files), widget);
4559 #ifdef MAIN_MENU_USE_UIMANAGER
4560 /* Add a file name to the top of the list, if its allrady present remove it first */
4562 remove_present_file_name(GList *recent_files_list, const gchar *cf_name){
4564 gchar *widget_cf_name;
4566 for (li = g_list_first(recent_files_list); li; li = li->next) {
4567 widget_cf_name = li->data;
4570 /* do a case insensitive compare on win32 */
4571 g_ascii_strncasecmp(widget_cf_name, cf_name, 1000) == 0){
4573 /* do a case sensitive compare on unix */
4574 strncmp(widget_cf_name, cf_name, 1000) == 0 ){
4576 recent_files_list = g_list_remove(recent_files_list,widget_cf_name);
4580 return recent_files_list;
4584 recent_changed_cb (GtkUIManager *ui_manager,
4585 gpointer user_data _U_)
4588 GList *action_groups, *l;
4591 merge_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (ui_manager),
4592 "recent-files-merge-id"));
4595 gtk_ui_manager_remove_ui (ui_manager, merge_id);
4597 /* remove the action group; gtk_ui_manager_remove_action_group()
4598 * should really take the action group's name instead of its
4601 action_groups = gtk_ui_manager_get_action_groups (ui_manager);
4602 for (l = action_groups; l != NULL; l = l->next)
4604 GtkActionGroup *group = l->data;
4606 if (strcmp (gtk_action_group_get_name (group), "recent-files-group") == 0){
4607 /* this unrefs the action group and all of its actions */
4608 gtk_ui_manager_remove_action_group (ui_manager, group);
4613 /* generate a new merge id and re-add everything */
4614 merge_id = gtk_ui_manager_new_merge_id (ui_manager);
4615 add_recent_items (merge_id, ui_manager);
4619 recent_clear_cb(GtkAction *action _U_, gpointer user_data _U_)
4621 GtkWidget *submenu_recent_files;
4622 GList *recent_files_list;
4624 /* Get the list of recent files, free the list and store the empty list with the widget */
4625 submenu_recent_files = gtk_ui_manager_get_widget(ui_manager_main_menubar, MENU_RECENT_FILES_PATH);
4626 recent_files_list = g_object_get_data(G_OBJECT(submenu_recent_files), "recent-files-list");
4627 /* Free the name strings ?? */
4628 g_list_free(recent_files_list);
4629 recent_files_list = NULL;
4630 g_object_set_data(G_OBJECT(submenu_recent_files), "recent-files-list", recent_files_list);
4631 /* Calling recent_changed_cb will rebuild the GUI call add_recent_items which will in turn call
4632 * main_welcome_reset_recent_capture_files
4634 recent_changed_cb(ui_manager_main_menubar, NULL);
4638 add_recent_items (guint merge_id, GtkUIManager *ui_manager)
4640 GtkActionGroup *action_group;
4642 GtkWidget *submenu_recent_files;
4648 /* Reset the recent files list in the welcome screen */
4649 main_welcome_reset_recent_capture_files();
4651 action_group = gtk_action_group_new ("recent-files-group");
4653 submenu_recent_files = gtk_ui_manager_get_widget(ui_manager_main_menubar, MENU_RECENT_FILES_PATH);
4654 if(!submenu_recent_files){
4655 g_warning("add_recent_items: No submenu_recent_files found, path= MENU_RECENT_FILES_PATH");
4657 items = g_object_get_data(G_OBJECT(submenu_recent_files), "recent-files-list");
4659 gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
4660 g_object_set_data (G_OBJECT (ui_manager),
4661 "recent-files-merge-id", GUINT_TO_POINTER (merge_id));
4666 action = g_object_new (GTK_TYPE_ACTION,
4667 "name", "recent-info-empty",
4668 "label", "No recently used files",
4671 gtk_action_group_add_action (action_group, action);
4672 g_object_unref (action);
4674 gtk_ui_manager_add_ui (ui_manager, merge_id,
4675 "/Menubar/FileMenu/OpenRecent/RecentFiles",
4676 "recent-info-empty",
4677 "recent-info-empty",
4678 GTK_UI_MANAGER_MENUITEM,
4684 for (i = 0, l = items;
4685 i < prefs.gui_recent_files_count_max && l != NULL;
4688 gchar *item_name = l->data;
4689 name = g_strdup_printf ("recent-info-%u", i);
4690 action_name = g_strdup (name);
4692 action = g_object_new (GTK_TYPE_ACTION,
4693 "name", action_name,
4695 "stock_id", WIRESHARK_STOCK_FILE,
4697 g_signal_connect (action, "activate",
4698 G_CALLBACK (menu_open_recent_file_cmd_cb), NULL);
4699 gtk_action_group_add_action (action_group, action);
4700 g_object_unref (action);
4702 gtk_ui_manager_add_ui (ui_manager, merge_id,
4703 "/Menubar/FileMenu/OpenRecent/RecentFiles",
4706 GTK_UI_MANAGER_MENUITEM,
4709 /* Add the file name to the recent files list on the Welcome screen */
4710 main_welcome_add_recent_capture_files(item_name);
4712 g_free (action_name);
4715 /* Add a Separator */
4716 gtk_ui_manager_add_ui (ui_manager, merge_id,
4717 "/Menubar/FileMenu/OpenRecent/RecentFiles",
4718 "separator-recent-info",
4720 GTK_UI_MANAGER_SEPARATOR,
4723 /* Add a clear Icon */
4724 action = g_object_new (GTK_TYPE_ACTION,
4725 "name", "clear-recent-info",
4726 "label", "Clear the recent files list",
4727 "stock_id", GTK_STOCK_CLEAR,
4730 g_signal_connect (action, "activate",
4731 G_CALLBACK (recent_clear_cb), NULL);
4733 gtk_action_group_add_action (action_group, action);
4734 g_object_unref (action);
4736 gtk_ui_manager_add_ui (ui_manager, merge_id,
4737 "/Menubar/FileMenu/OpenRecent/RecentFiles",
4738 "clear-recent-info",
4739 "clear-recent-info",
4740 GTK_UI_MANAGER_MENUITEM,
4744 #endif /* MAIN_MENU_USE_UIMANAGER */
4746 #ifndef MAIN_MENU_USE_UIMANAGER
4747 /* callback, if the user pushed the <Clear> menu item */
4749 clear_menu_recent_capture_file_cmd_cb(GtkWidget *w _U_, gpointer unused _U_) {
4750 GtkWidget *submenu_recent_files;
4752 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH_OLD);
4754 gtk_container_foreach(GTK_CONTAINER(submenu_recent_files),
4755 remove_menu_recent_capture_file, NULL);
4757 update_menu_recent_capture_file(submenu_recent_files);
4759 #endif /* MAIN_MENU_USE_UIMANAGER */
4761 /* Open a file by it's name
4762 (Beware: will not ask to close existing capture file!) */
4764 menu_open_filename(gchar *cf_name)
4766 GtkWidget *submenu_recent_files;
4768 #ifdef MAIN_MENU_USE_UIMANAGER
4769 GList *recent_files_list;
4772 submenu_recent_files = gtk_ui_manager_get_widget(ui_manager_main_menubar, MENU_RECENT_FILES_PATH);
4773 if(!submenu_recent_files){
4774 g_warning("menu_open_filename: No submenu_recent_files found, path= MENU_RECENT_FILES_PATH");
4776 recent_files_list = g_object_get_data(G_OBJECT(submenu_recent_files), "recent-files-list");
4777 /* XXX: ask user to remove item, it's maybe only a temporary problem */
4778 /* open and read the capture file (this will close an existing file) */
4779 if (cf_open(&cfile, cf_name, FALSE, &err) == CF_OK) {
4780 cf_read(&cfile, FALSE);
4782 recent_files_list = remove_present_file_name(recent_files_list, cf_name);
4783 g_object_set_data(G_OBJECT(submenu_recent_files), "recent-files-list", recent_files_list);
4784 /* Calling recent_changed_cb will rebuild the GUI call add_recent_items which will in turn call
4785 * main_welcome_reset_recent_capture_files
4787 recent_changed_cb(ui_manager_main_menubar, NULL);
4790 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH_OLD);
4791 /* open and read the capture file (this will close an existing file) */
4792 if (cf_open(&cfile, cf_name, FALSE, &err) == CF_OK) {
4793 cf_read(&cfile, FALSE);
4795 /* the capture file apparently no longer exists; remove menu item */
4796 /* XXX: ask user to remove item, it's maybe only a temporary problem */
4797 remove_menu_recent_capture_filename(cf_name);
4800 update_menu_recent_capture_file(submenu_recent_files);
4801 #endif /* MAIN_MENU_USE_UIMANAGER */
4804 #ifdef MAIN_MENU_USE_UIMANAGER
4806 menu_open_recent_file_cmd(GtkAction *action)
4808 GtkWidget *submenu_recent_files;
4809 GList *recent_files_list;
4810 const gchar *cf_name;
4813 cf_name = gtk_action_get_label(action);
4815 /* open and read the capture file (this will close an existing file) */
4816 if (cf_open(&cfile, cf_name, FALSE, &err) == CF_OK) {
4817 cf_read(&cfile, FALSE);
4819 submenu_recent_files = gtk_ui_manager_get_widget(ui_manager_main_menubar, MENU_RECENT_FILES_PATH);
4820 recent_files_list = g_object_get_data(G_OBJECT(submenu_recent_files), "recent-files-list");
4822 recent_files_list = remove_present_file_name(recent_files_list, cf_name);
4823 g_object_set_data(G_OBJECT(submenu_recent_files), "recent-files-list", recent_files_list);
4824 /* Calling recent_changed_cb will rebuild the GUI call add_recent_items which will in turn call
4825 * main_welcome_reset_recent_capture_files
4827 recent_changed_cb(ui_manager_main_menubar, NULL);
4831 /* callback, if the user pushed a recent file submenu item */
4833 menu_open_recent_file_cmd(GtkWidget *w)
4835 GtkWidget *submenu_recent_files;
4836 GtkWidget *menu_item_child;
4837 const gchar *cf_name;
4841 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH_OLD);
4843 /* get capture filename from the menu item label */
4844 menu_item_child = (GTK_BIN(w))->child;
4845 cf_name = gtk_label_get_text(GTK_LABEL(menu_item_child));
4847 /* open and read the capture file (this will close an existing file) */
4848 if (cf_open(&cfile, cf_name, FALSE, &err) == CF_OK) {
4849 cf_read(&cfile, FALSE);
4851 /* the capture file apparently no longer exists; remove menu item */
4852 /* XXX: ask user to remove item, it's maybe only a temporary problem */
4853 remove_menu_recent_capture_file(w, NULL);
4856 update_menu_recent_capture_file(submenu_recent_files);
4858 #endif /* MAIN_MENU_USE_UIMANAGER */
4860 static void menu_open_recent_file_answered_cb(gpointer dialog _U_, gint btn, gpointer data)
4864 /* save file first */
4865 file_save_as_cmd(after_save_open_recent_file, data);
4869 menu_open_recent_file_cmd(data);
4871 case(ESD_BTN_CANCEL):
4874 g_assert_not_reached();
4877 #ifdef MAIN_MENU_USE_UIMANAGER
4879 menu_open_recent_file_cmd_cb(GtkAction *action, gpointer data _U_) {
4883 if((cfile.state != FILE_CLOSED) && !cfile.user_saved && prefs.gui_ask_unsaved) {
4884 /* user didn't saved his current file, ask him */
4885 dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_YES_NO_CANCEL,
4886 "%sSave capture file before opening a new one?%s\n\n"
4887 "If you open a new capture file without saving, your current capture data will be discarded.",
4888 simple_dialog_primary_start(), simple_dialog_primary_end());
4889 simple_dialog_set_cb(dialog, menu_open_recent_file_answered_cb, action);
4891 /* unchanged file */
4892 menu_open_recent_file_cmd(action);
4897 menu_open_recent_file_cmd_cb(GtkWidget *widget, gpointer data _U_) {
4901 if((cfile.state != FILE_CLOSED) && !cfile.user_saved && prefs.gui_ask_unsaved) {
4902 /* user didn't saved his current file, ask him */
4903 dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_YES_NO_CANCEL,
4904 "%sSave capture file before opening a new one?%s\n\n"
4905 "If you open a new capture file without saving, your current capture data will be discarded.",
4906 simple_dialog_primary_start(), simple_dialog_primary_end());
4907 simple_dialog_set_cb(dialog, menu_open_recent_file_answered_cb, widget);
4909 /* unchanged file */
4910 menu_open_recent_file_cmd(widget);
4913 #endif /* MAIN_MENU_USE_UIMANAGER */
4915 #ifdef MAIN_MENU_USE_UIMANAGER
4917 add_menu_recent_capture_file_absolute(gchar *cf_name) {
4918 GtkWidget *submenu_recent_files;
4920 gchar *widget_cf_name;
4921 gchar *normalized_cf_name;
4923 GList *recent_files_list;
4925 normalized_cf_name = g_strdup(cf_name);
4927 /* replace all slashes by backslashes */
4928 g_strdelimit(normalized_cf_name, "/", '\\');
4931 /* get the submenu container item */
4932 submenu_recent_files = gtk_ui_manager_get_widget(ui_manager_main_menubar, MENU_RECENT_FILES_PATH);
4933 if(!submenu_recent_files){
4934 g_warning("add_menu_recent_capture_file_absolute: No submenu_recent_files found, path= MENU_RECENT_FILES_PATH");
4937 recent_files_list = g_object_get_data(G_OBJECT(submenu_recent_files), "recent-files-list");
4939 for (li = g_list_first(recent_files_list); li; li = li->next, cnt++) {
4940 widget_cf_name = li->data;
4943 /* do a case insensitive compare on win32 */
4944 g_ascii_strncasecmp(widget_cf_name, normalized_cf_name, 1000) == 0 ||
4946 /* do a case sensitive compare on unix */
4947 strncmp(widget_cf_name, normalized_cf_name, 1000) == 0 ||
4949 cnt >= prefs.gui_recent_files_count_max) {
4950 recent_files_list = g_list_remove(recent_files_list,widget_cf_name);
4954 recent_files_list = g_list_prepend(recent_files_list, normalized_cf_name);
4955 g_object_set_data(G_OBJECT(submenu_recent_files), "recent-files-list", recent_files_list);
4956 recent_changed_cb( ui_manager_main_menubar, NULL);
4959 #else /* MAIN_MENU_USE_UIMANAGER */
4961 /* add the capture filename (with an absolute path) to the "Recent Files" menu */
4963 add_menu_recent_capture_file_absolute(gchar *cf_name) {
4964 GtkWidget *submenu_recent_files;
4965 GList *menu_item_list_old;
4967 gchar *widget_cf_name;
4968 gchar *normalized_cf_name;
4969 GtkWidget *menu_item;
4972 normalized_cf_name = g_strdup(cf_name);
4974 /* replace all slashes by backslashes */
4975 g_strdelimit(normalized_cf_name, "/", '\\');
4977 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH_OLD);
4978 /* convert container to a GList */
4979 menu_item_list_old = gtk_container_get_children(GTK_CONTAINER(submenu_recent_files));
4981 /* iterate through list items of menu_item_list,
4982 * removing special items, a maybe duplicate entry and every item above count_max */
4984 for (li = g_list_first(menu_item_list_old); li; li = li->next, cnt++) {
4985 /* get capture filename */
4986 menu_item = GTK_WIDGET(li->data);
4987 widget_cf_name = g_object_get_data(G_OBJECT(menu_item), MENU_RECENT_FILES_KEY);
4989 /* if this element string is one of our special items (seperator, ...) or
4990 * already in the list or
4991 * this element is above maximum count (too old), remove it
4993 if (!widget_cf_name ||
4995 /* do a case insensitive compare on win32 */
4996 g_ascii_strncasecmp(widget_cf_name, normalized_cf_name, 1000) == 0 ||
4998 /* do a case sensitive compare on unix */
4999 strncmp(widget_cf_name, normalized_cf_name, 1000) == 0 ||
5001 cnt >= prefs.gui_recent_files_count_max) {
5002 remove_menu_recent_capture_file(li->data, NULL);
5007 g_list_free(menu_item_list_old);
5009 /* add new item at latest position */
5010 menu_item = gtk_menu_item_new_with_label(normalized_cf_name);
5011 g_object_set_data(G_OBJECT(menu_item), MENU_RECENT_FILES_KEY, normalized_cf_name);
5012 gtk_menu_shell_prepend (GTK_MENU_SHELL(submenu_recent_files), menu_item);
5013 g_signal_connect_swapped(GTK_OBJECT(menu_item), "activate",
5014 G_CALLBACK(menu_open_recent_file_cmd_cb), (GtkObject *) menu_item);
5015 gtk_widget_show (menu_item);
5017 /* add seperator at last position */
5018 menu_item = gtk_menu_item_new();
5019 gtk_menu_shell_append (GTK_MENU_SHELL(submenu_recent_files), menu_item);
5020 gtk_widget_show (menu_item);
5022 /* add new "clear list" item at last position */
5023 menu_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_CLEAR, NULL);
5024 gtk_menu_shell_append (GTK_MENU_SHELL(submenu_recent_files), menu_item);
5025 g_signal_connect_swapped(GTK_OBJECT(menu_item), "activate",
5026 G_CALLBACK(clear_menu_recent_capture_file_cmd_cb), (GtkObject *) menu_item);
5027 gtk_widget_show (menu_item);
5029 update_menu_recent_capture_file(submenu_recent_files);
5031 #endif /* MAIN_MENU_USE_UIMANAGER */
5033 /* add the capture filename to the "Recent Files" menu */
5034 /* (will change nothing, if this filename is already in the menu) */
5036 * XXX - We might want to call SHAddToRecentDocs under Windows 7:
5037 * http://stackoverflow.com/questions/437212/how-do-you-register-a-most-recently-used-list-with-windows-in-preparation-for-win
5040 add_menu_recent_capture_file(gchar *cf_name) {
5045 /* if this filename is an absolute path, we can use it directly */
5046 if (g_path_is_absolute(cf_name)) {
5047 add_menu_recent_capture_file_absolute(cf_name);
5051 /* this filename is not an absolute path, prepend the current dir */
5052 curr = g_get_current_dir();
5053 absolute = g_strdup_printf("%s%s%s", curr, G_DIR_SEPARATOR_S, cf_name);
5054 add_menu_recent_capture_file_absolute(absolute);
5060 /* write all capture filenames of the menu to the user's recent file */
5062 menu_recent_file_write_all(FILE *rf) {
5063 GtkWidget *submenu_recent_files;
5067 #ifdef MAIN_MENU_USE_UIMANAGER
5068 GList *recent_files_list, *list;
5070 submenu_recent_files = gtk_ui_manager_get_widget(ui_manager_main_menubar, MENU_RECENT_FILES_PATH);
5071 if(!submenu_recent_files){
5072 g_warning("menu_recent_file_write_all: No submenu_recent_files found, path= MENU_RECENT_FILES_PATH");
5074 recent_files_list = g_object_get_data(G_OBJECT(submenu_recent_files), "recent-files-list");
5075 list = g_list_last(recent_files_list);
5076 while(list != NULL) {
5077 cf_name = list->data;
5080 fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", u3_contract_device_path(cf_name));
5082 fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", cf_name);
5084 list = g_list_previous(list);
5086 g_list_free(recent_files_list);
5090 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH_OLD);
5092 /* we have to iterate backwards through the children's list,
5093 * so we get the latest item last in the file.
5094 * (don't use gtk_container_foreach() here, it will return the wrong iteration order) */
5095 children = gtk_container_get_children(GTK_CONTAINER(submenu_recent_files));
5096 child = g_list_last(children);
5097 while(child != NULL) {
5098 /* get capture filename from the menu item label */
5099 cf_name = g_object_get_data(G_OBJECT(child->data), MENU_RECENT_FILES_KEY);
5102 fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", u3_contract_device_path(cf_name));
5104 fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", cf_name);
5107 child = g_list_previous(child);
5110 g_list_free(children);
5115 show_hide_cb(GtkWidget *w, gpointer data _U_, gint action)
5118 /* save current setting in recent */
5120 case(SHOW_HIDE_MAIN_TOOLBAR):
5121 recent.main_toolbar_show = GTK_CHECK_MENU_ITEM(w)->active;
5123 case(SHOW_HIDE_FILTER_TOOLBAR):
5124 recent.filter_toolbar_show = GTK_CHECK_MENU_ITEM(w)->active;
5127 case(SHOW_HIDE_AIRPCAP_TOOLBAR):
5128 recent.airpcap_toolbar_show = GTK_CHECK_MENU_ITEM(w)->active;
5131 case(SHOW_HIDE_STATUSBAR):
5132 recent.statusbar_show = GTK_CHECK_MENU_ITEM(w)->active;
5134 case(SHOW_HIDE_PACKET_LIST):
5135 recent.packet_list_show = GTK_CHECK_MENU_ITEM(w)->active;
5137 case(SHOW_HIDE_TREE_VIEW):
5138 recent.tree_view_show = GTK_CHECK_MENU_ITEM(w)->active;
5140 case(SHOW_HIDE_BYTE_VIEW):
5141 recent.byte_view_show = GTK_CHECK_MENU_ITEM(w)->active;
5144 g_assert_not_reached();
5147 main_widgets_show_or_hide();
5150 #ifndef MAIN_MENU_USE_UIMANAGER
5152 timestamp_format_cb(GtkWidget *w _U_, gpointer d _U_, gint action)
5154 if (recent.gui_time_format != action) {
5155 timestamp_set_type(action);
5156 recent.gui_time_format = action;
5157 #ifdef NEW_PACKET_LIST
5158 /* This call adjusts column width */
5159 cf_timestamp_auto_precision(&cfile);
5160 new_packet_list_queue_draw();
5162 cf_change_time_formats(&cfile);
5169 timestamp_precision_cb(GtkWidget *w _U_, gpointer d _U_, gint action)
5171 if (recent.gui_time_precision != action) {
5172 /* the actual precision will be set in cf_change_time_formats() below */
5173 if (action == TS_PREC_AUTO) {
5174 timestamp_set_precision(TS_PREC_AUTO_SEC);
5176 timestamp_set_precision(action);
5178 recent.gui_time_precision = action;
5179 #ifdef NEW_PACKET_LIST
5180 /* This call adjusts column width */
5181 cf_timestamp_auto_precision(&cfile);
5182 new_packet_list_queue_draw();
5184 cf_change_time_formats(&cfile);
5191 timestamp_seconds_time_cb(GtkWidget *w, gpointer d _U_, gint action _U_)
5193 if (GTK_CHECK_MENU_ITEM(w)->active) {
5194 recent.gui_seconds_format = TS_SECONDS_HOUR_MIN_SEC;
5196 recent.gui_seconds_format = TS_SECONDS_DEFAULT;
5198 timestamp_set_seconds_type (recent.gui_seconds_format);
5200 #ifdef NEW_PACKET_LIST
5201 /* This call adjusts column width */
5202 cf_timestamp_auto_precision(&cfile);
5203 new_packet_list_queue_draw();
5205 cf_change_time_formats(&cfile);
5210 menu_name_resolution_changed(void)
5212 GtkWidget *menu = NULL;
5213 #ifdef MAIN_MENU_USE_UIMANAGER
5214 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/EnableforMACLayer");
5216 g_warning("menu_name_resolution_changed: No menu found, path= /Menubar/ViewMenu/NameResolution/EnableforMACLayer");
5218 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), gbl_resolv_flags & RESOLV_MAC);
5220 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/EnableforNetworkLayer");
5222 g_warning("menu_name_resolution_changed: No menu found, path= /Menubar/ViewMenu/NameResolution/EnableforNetworkLayer");
5224 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), gbl_resolv_flags & RESOLV_NETWORK);
5226 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/EnableforTransportLayer");
5228 g_warning("menu_name_resolution_changed: No menu found, path= /Menubar/ViewMenu/NameResolution/EnableforTransportLayer");
5230 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), gbl_resolv_flags & RESOLV_TRANSPORT);
5233 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Name Resolution/Enable for MAC Layer");
5234 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), gbl_resolv_flags & RESOLV_MAC);
5236 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Name Resolution/Enable for Network Layer");
5237 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), gbl_resolv_flags & RESOLV_NETWORK);
5239 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Name Resolution/Enable for Transport Layer");
5240 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), gbl_resolv_flags & RESOLV_TRANSPORT);
5241 #endif /* MAIN_MENU_USE_UIMANAGER */
5245 name_resolution_cb(GtkWidget *w, gpointer d _U_, gint action)
5247 if (GTK_CHECK_MENU_ITEM(w)->active) {
5248 gbl_resolv_flags |= action;
5250 gbl_resolv_flags &= ~action;
5256 menu_auto_scroll_live_changed(gboolean auto_scroll_live_in) {
5260 /* tell menu about it */
5261 #ifdef MAIN_MENU_USE_UIMANAGER
5262 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/AutoScrollinLiveCapture");
5264 g_warning("menu_auto_scroll_live_changed: No menu found, path= /Menubar/ViewMenu/AutoScrollinLiveCapture");
5267 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Auto Scroll in Live Capture");
5268 #endif /* MAIN_MENU_USE_UIMANAGER */
5269 if( ((gboolean) GTK_CHECK_MENU_ITEM(menu)->active) != auto_scroll_live_in) {
5270 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), auto_scroll_live_in);
5273 /* tell toolbar about it */
5274 toolbar_auto_scroll_live_changed(auto_scroll_live_in);
5276 /* change auto scroll */
5277 if(auto_scroll_live_in != auto_scroll_live) {
5278 auto_scroll_live = auto_scroll_live_in;
5282 #ifndef MAIN_MENU_USE_UIMANAGER
5284 auto_scroll_live_cb(GtkWidget *w _U_, gpointer d _U_)
5286 menu_auto_scroll_live_changed(GTK_CHECK_MENU_ITEM(w)->active);
5288 #endif /* MAIN_MENU_USE_UIMANAGER */
5290 #endif /*HAVE_LIBPCAP */
5294 menu_colorize_changed(gboolean packet_list_colorize) {
5298 /* tell menu about it */
5299 #ifdef MAIN_MENU_USE_UIMANAGER
5300 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/ColorizePacketList");
5302 g_warning("menu_colorize_changed: No menu found, path= /Menubar/ViewMenu/ColorizePacketList");
5305 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Colorize Packet List");
5306 #endif /* MAIN_MENU_USE_UIMANAGER */
5307 if( ((gboolean) GTK_CHECK_MENU_ITEM(menu)->active) != packet_list_colorize) {
5308 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), packet_list_colorize);
5311 /* tell toolbar about it */
5312 toolbar_colorize_changed(packet_list_colorize);
5314 /* change colorization */
5315 if(packet_list_colorize != recent.packet_list_colorize) {
5316 recent.packet_list_colorize = packet_list_colorize;
5317 color_filters_enable(packet_list_colorize);
5318 #ifdef NEW_PACKET_LIST
5319 new_packet_list_colorize_packets();
5321 cf_colorize_packets(&cfile);
5327 colorize_cb(GtkWidget *w, gpointer d _U_)
5329 menu_colorize_changed(GTK_CHECK_MENU_ITEM(w)->active);
5333 /* the recent file read has finished, update the menu corresponding */
5335 menu_recent_read_finished(void) {
5336 GtkWidget *menu = NULL;
5338 #ifdef MAIN_MENU_USE_UIMANAGER
5339 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/MainToolbar");
5341 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/MainToolbar");
5343 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.main_toolbar_show);
5345 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/FilterToolbar");
5347 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/FilterToolbar");
5349 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.filter_toolbar_show);
5351 #else /* MAIN_MENU_USE_UIMANAGER */
5352 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Main Toolbar");
5353 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.main_toolbar_show);
5355 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Filter Toolbar");
5356 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.filter_toolbar_show);
5357 #endif /* MAIN_MENU_USE_UIMANAGER*/
5359 #ifdef MAIN_MENU_USE_UIMANAGER
5360 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/WirelessToolbar");
5362 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/WirelessToolbar");
5364 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.airpcap_toolbar_show);
5366 #else /* MAIN_MENU_USE_UIMANAGER */
5367 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Wireless Toolbar");
5368 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.airpcap_toolbar_show);
5369 #endif /* MAIN_MENU_USE_UIMANAGER */
5370 #endif /* HAVE_AIRPCAP */
5372 #ifdef MAIN_MENU_USE_UIMANAGER
5374 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/Statusbar");
5376 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/Statusbar");
5378 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.statusbar_show);
5381 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/PacketList");
5383 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/PacketList");
5385 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.packet_list_show);
5388 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/PacketDetails");
5390 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/PacketDetails");
5392 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.tree_view_show);
5395 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/PacketBytes");
5397 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/PacketBytes");
5399 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.byte_view_show);
5402 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/ColorizePacketList");
5404 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/ColorizePacketList");
5406 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.packet_list_colorize);
5408 #else /* MAIN_MENU_USE_UIMANAGER */
5409 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Statusbar");
5410 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.statusbar_show);
5412 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Packet List");
5413 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.packet_list_show);
5415 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Packet Details");
5416 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.tree_view_show);
5418 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Packet Bytes");
5419 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.byte_view_show);
5421 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Colorize Packet List");
5422 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.packet_list_colorize);
5423 #endif /* MAIN_MENU_USE_UIMANAGER*/
5425 menu_name_resolution_changed();
5428 #ifdef MAIN_MENU_USE_UIMANAGER
5429 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/AutoScrollinLiveCapture");
5431 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/AutoScrollinLiveCapture");
5433 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), auto_scroll_live);
5435 #else /* MAIN_MENU_USE_UIMANAGER */
5436 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Auto Scroll in Live Capture");
5437 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), auto_scroll_live);
5438 #endif /* MAIN_MENU_USE_UIMANAGER*/
5439 #endif /* HAVE_LIBPCAP */
5441 main_widgets_rearrange();
5443 /* don't change the time format, if we had a command line value */
5444 if (timestamp_get_type() != TS_NOT_SET) {
5445 recent.gui_time_format = timestamp_get_type();
5448 #ifdef MAIN_MENU_USE_UIMANAGER
5450 timestamp_set_type(recent.gui_time_format);
5451 #ifdef NEW_PACKET_LIST
5452 /* This call adjusts column width */
5453 cf_timestamp_auto_precision(&cfile);
5454 new_packet_list_queue_draw();
5455 #else /* NEW_PACKET_LIST */
5456 cf_change_time_formats(&cfile);
5457 #endif /* NEW_PACKET_LIST */
5459 /* This should not be needed as we set the active radioItem when we crate the actiongroup */
5460 switch(recent.gui_time_format) {
5461 case(TS_ABSOLUTE_WITH_DATE):
5462 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/TimeDisplayFormat/DateandTimeofDay");
5464 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/TimeDisplayFormat/DateandTimeofDay");
5468 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/TimeDisplayFormat/TimeofDay");
5470 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/TimeDisplayFormat/TimeofDay");
5474 g_warning("TS_RELATIVE");
5475 action = gtk_ui_manager_get_action(ui_manager_main_menubar, "/Menubar/ViewMenu/TimeDisplayFormat/SecondsSinceBeginningofCapture");
5476 gtk_action_activate(action);
5477 if(gtk_action_is_sensitive(action))
5478 g_warning("ACTION IS SENSIBLE");
5480 g_warning("NO ACTION");
5483 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/TimeDisplayFormat/SecondsSinceBeginningofCapture");
5485 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/TimeDisplayFormat/SecondsSinceBeginningofCapture");
5489 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/TimeDisplayFormat/SecondsSincePreviousCapturedPacket");
5491 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/TimeDisplayFormat/SecondsSincePreviousCapturedPacket");
5495 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/TimeDisplayFormat/SecondsSincePreviousDisplayedPacket");
5497 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/TimeDisplayFormat/SecondsSincePreviousDisplayedPacket");
5501 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/TimeDisplayFormat/SecondsSinceEpoch");
5503 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/TimeDisplayFormat/SecondsSinceEpoch");
5507 g_assert_not_reached();
5509 /* set_active will not trigger the callback when activating an active item! */
5510 recent.gui_time_format = -1;
5511 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), FALSE);
5512 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
5514 #else /* MAIN_MENU_USE_UIMANAGER */
5515 switch(recent.gui_time_format) {
5516 case(TS_ABSOLUTE_WITH_DATE):
5517 menu = gtk_item_factory_get_widget(main_menu_factory,
5518 "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456");
5521 menu = gtk_item_factory_get_widget(main_menu_factory,
5522 "/View/Time Display Format/Time of Day: 01:02:03.123456");
5525 menu = gtk_item_factory_get_widget(main_menu_factory,
5526 "/View/Time Display Format/Seconds Since Beginning of Capture: 123.123456");
5529 menu = gtk_item_factory_get_widget(main_menu_factory,
5530 "/View/Time Display Format/Seconds Since Previous Captured Packet: 1.123456");
5533 menu = gtk_item_factory_get_widget(main_menu_factory,
5534 "/View/Time Display Format/Seconds Since Previous Displayed Packet: 1.123456");
5537 menu = gtk_item_factory_get_widget(main_menu_factory,
5538 "/View/Time Display Format/Seconds Since Epoch (1970-01-01): 1234567890.123456");
5541 g_assert_not_reached();
5543 /* set_active will not trigger the callback when activating an active item! */
5544 recent.gui_time_format = -1;
5545 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), FALSE);
5546 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
5547 #endif /* MAIN_MENU_USE_UIMANAGER */
5548 #ifdef MAIN_MENU_USE_UIMANAGER
5549 /* the actual precision will be set in cf_change_time_formats() below */
5550 if (recent.gui_time_precision == TS_PREC_AUTO) {
5551 timestamp_set_precision(TS_PREC_AUTO_SEC);
5553 timestamp_set_precision(recent.gui_time_precision);
5555 #ifdef NEW_PACKET_LIST
5556 /* This call adjusts column width */
5557 cf_timestamp_auto_precision(&cfile);
5558 new_packet_list_queue_draw();
5559 #else /* NEW_PACKET_LIST */
5560 cf_change_time_formats(&cfile);
5561 #endif /* NEW_PACKET_LIST */
5562 #else /* MAIN_MENU_USE_UIMANAGER */
5563 switch(recent.gui_time_precision) {
5565 menu = gtk_item_factory_get_widget(main_menu_factory,
5566 "/View/Time Display Format/Automatic (File Format Precision)");
5568 case(TS_PREC_FIXED_SEC):
5569 menu = gtk_item_factory_get_widget(main_menu_factory,
5570 "/View/Time Display Format/Seconds: 0");
5572 case(TS_PREC_FIXED_DSEC):
5573 menu = gtk_item_factory_get_widget(main_menu_factory,
5574 "/View/Time Display Format/Deciseconds: 0.1");
5576 case(TS_PREC_FIXED_CSEC):
5577 menu = gtk_item_factory_get_widget(main_menu_factory,
5578 "/View/Time Display Format/Centiseconds: 0.12");
5580 case(TS_PREC_FIXED_MSEC):
5581 menu = gtk_item_factory_get_widget(main_menu_factory,
5582 "/View/Time Display Format/Milliseconds: 0.123");
5584 case(TS_PREC_FIXED_USEC):
5585 menu = gtk_item_factory_get_widget(main_menu_factory,
5586 "/View/Time Display Format/Microseconds: 0.123456");
5588 case(TS_PREC_FIXED_NSEC):
5589 menu = gtk_item_factory_get_widget(main_menu_factory,
5590 "/View/Time Display Format/Nanoseconds: 0.123456789");
5593 g_assert_not_reached();
5596 /* set_active will not trigger the callback when activating an active item! */
5597 recent.gui_time_precision = -1;
5598 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), FALSE);
5599 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
5600 #endif /* MAIN_MENU_USE_UIMANAGER */
5602 /* don't change the seconds format, if we had a command line value */
5603 if (timestamp_get_seconds_type() != TS_SECONDS_NOT_SET) {
5604 recent.gui_seconds_format = timestamp_get_seconds_type();
5606 #ifdef MAIN_MENU_USE_UIMANAGER
5607 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/TimeDisplayFormat/DisplaySecondsWithHoursAndMinutes");
5609 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/TimeDisplayFormat/DisplaySecondsWithHoursAndMinutes");
5611 #else /* MAIN_MENU_USE_UIMANAGER */
5612 menu = gtk_item_factory_get_widget(main_menu_factory,
5613 "/View/Time Display Format/Display Seconds with hours and minutes");
5614 #endif /* MAIN_MENU_USE_UIMANAGER */
5616 switch (recent.gui_seconds_format) {
5617 case TS_SECONDS_DEFAULT:
5618 recent.gui_seconds_format = -1;
5619 /* set_active will not trigger the callback when deactivating an inactive item! */
5620 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
5621 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), FALSE);
5623 case TS_SECONDS_HOUR_MIN_SEC:
5624 recent.gui_seconds_format = -1;
5625 /* set_active will not trigger the callback when activating an active item! */
5626 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), FALSE);
5627 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
5630 g_assert_not_reached();
5633 menu_colorize_changed(recent.packet_list_colorize);
5638 popup_menu_handler(GtkWidget *widget, GdkEvent *event, gpointer data)
5640 GtkWidget *menu = (GtkWidget *)data;
5641 GdkEventButton *event_button = NULL;
5644 if(widget == NULL || event == NULL || data == NULL) {
5649 * If we ever want to make the menu differ based on what row
5650 * and/or column we're above, we'd use "eth_clist_get_selection_info()"
5651 * to find the row and column number for the coordinates; a CTree is,
5652 * I guess, like a CList with one column(?) and the expander widget
5655 /* Check if we are on packet_list object */
5656 if (widget == g_object_get_data(G_OBJECT(popup_menu_object), E_MPACKET_LIST_KEY) &&
5657 ((GdkEventButton *)event)->button != 1) {
5658 #ifdef NEW_PACKET_LIST
5660 if (new_packet_list_get_event_row_column((GdkEventButton *)event, &physical_row, &row, &column)) {
5662 if (packet_list_get_event_row_column(widget, (GdkEventButton *)event, &row, &column)) {
5664 g_object_set_data(G_OBJECT(popup_menu_object), E_MPACKET_LIST_ROW_KEY,
5665 #ifdef NEW_PACKET_LIST
5666 GINT_TO_POINTER(row));
5668 GINT_TO_POINTER(row));
5670 g_object_set_data(G_OBJECT(popup_menu_object), E_MPACKET_LIST_COL_KEY,
5671 GINT_TO_POINTER(column));
5672 #ifdef NEW_PACKET_LIST
5673 new_packet_list_set_selected_row(row);
5675 packet_list_set_selected_row(row);
5680 /* Check if we are on tree_view object */
5681 if (widget == tree_view_gbl) {
5682 tree_view_select(widget, (GdkEventButton *) event);
5685 /* context menu handler */
5686 if(event->type == GDK_BUTTON_PRESS) {
5687 event_button = (GdkEventButton *) event;
5689 /* To quote the "Gdk Event Structures" doc:
5690 * "Normally button 1 is the left mouse button, 2 is the middle button, and 3 is the right button" */
5691 if(event_button->button == 3) {
5692 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
5693 event_button->button,
5694 event_button->time);
5695 g_signal_stop_emission_by_name(widget, "button_press_event");
5700 /* Check if we are on byte_view object */
5701 if(widget == get_notebook_bv_ptr(byte_nb_ptr_gbl)) {
5702 byte_view_select(widget, (GdkEventButton *) event);
5705 /* GDK_2BUTTON_PRESS is a doubleclick -> expand/collapse tree row */
5706 /* GTK version 1 seems to be doing this automatically */
5707 if (widget == tree_view_gbl && event->type == GDK_2BUTTON_PRESS) {
5710 if (gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(widget),
5711 (gint) (((GdkEventButton *)event)->x),
5712 (gint) (((GdkEventButton *)event)->y),
5713 &path, NULL, NULL, NULL))
5715 if (gtk_tree_view_row_expanded(GTK_TREE_VIEW(widget), path))
5716 gtk_tree_view_collapse_row(GTK_TREE_VIEW(widget), path);
5718 gtk_tree_view_expand_row(GTK_TREE_VIEW(widget), path,
5720 gtk_tree_path_free(path);
5726 /* Enable or disable menu items based on whether you have a capture file
5727 you've finished reading and, if you have one, whether it's been saved
5728 and whether it could be saved except by copying the raw packet data. */
5730 set_menus_for_capture_file(capture_file *cf)
5733 /* We have no capture file */
5734 #ifdef MAIN_MENU_USE_UIMANAGER
5735 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Merge", FALSE);
5736 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Close", FALSE);
5737 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Save", FALSE);
5738 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/SaveAs", FALSE);
5739 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Export", FALSE);
5740 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/Reload", FALSE);
5741 #else /* MAIN_MENU_USE_UIMANAGER */
5742 set_menu_sensitivity_old("/File/Merge...", FALSE);
5743 set_menu_sensitivity_old("/File/Close", FALSE);
5744 set_menu_sensitivity_old("/File/Save", FALSE);
5745 set_menu_sensitivity_old("/File/Save As...", FALSE);
5746 set_menu_sensitivity_old("/File/Export", FALSE);
5747 set_menu_sensitivity_old("/View/Reload", FALSE);
5748 #endif /* MAIN_MENU_USE_UIMANAGER */
5750 set_toolbar_for_capture_file(FALSE);
5751 set_toolbar_for_unsaved_capture_file(FALSE);
5753 #ifdef MAIN_MENU_USE_UIMANAGER
5754 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Merge", TRUE);
5755 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Close", TRUE);
5756 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Save", !cf->user_saved);
5758 * "Save As..." works only if we can write the file out in at least
5759 * one format (so we can save the whole file or just a subset) or
5760 * if we have an unsaved capture (so writing the whole file out
5761 * with a raw data copy makes sense).
5763 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/SaveAs",
5764 cf_can_save_as(cf) || !cf->user_saved);
5765 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Export", TRUE);
5766 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/Reload", TRUE);
5767 #else /* MAIN_MENU_USE_UIMANAGER */
5768 set_menu_sensitivity_old("/File/Merge...", TRUE);
5769 set_menu_sensitivity_old("/File/Close", TRUE);
5770 set_menu_sensitivity_old("/File/Save", !cf->user_saved);
5772 * "Save As..." works only if we can write the file out in at least
5773 * one format (so we can save the whole file or just a subset) or
5774 * if we have an unsaved capture (so writing the whole file out
5775 * with a raw data copy makes sense).
5777 set_menu_sensitivity_old("/File/Save As...",
5778 cf_can_save_as(cf) || !cf->user_saved);
5779 set_menu_sensitivity_old("/File/Export", TRUE);
5780 set_menu_sensitivity_old("/View/Reload", TRUE);
5781 #endif /* MAIN_MENU_USE_UIMANAGER */
5782 set_toolbar_for_unsaved_capture_file(!cf->user_saved);
5783 set_toolbar_for_capture_file(TRUE);
5787 /* Enable or disable menu items based on whether there's a capture in
5790 set_menus_for_capture_in_progress(gboolean capture_in_progress)
5792 #ifdef MAIN_MENU_USE_UIMANAGER
5793 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Open",
5794 !capture_in_progress);
5795 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/OpenRecent",
5796 !capture_in_progress);
5797 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Export",
5798 capture_in_progress);
5799 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Set",
5800 !capture_in_progress);
5801 #else /* MAIN_MENU_USE_UIMANAGER */
5802 set_menu_sensitivity_old("/File/Open...",
5803 !capture_in_progress);
5804 set_menu_sensitivity_old("/File/Open Recent",
5805 !capture_in_progress);
5806 set_menu_sensitivity_old("/File/Export",
5807 capture_in_progress);
5808 set_menu_sensitivity_old("/File/File Set",
5809 !capture_in_progress);
5810 #endif /* MAIN_MENU_USE_UIMANAGER */
5811 set_menu_sensitivity(ui_manager_packet_list_heading, "/PacketListHeadingPopup/SortAscending",
5812 !capture_in_progress);
5813 set_menu_sensitivity(ui_manager_packet_list_heading, "/PacketListHeadingPopup/SortDescending",
5814 !capture_in_progress);
5815 set_menu_sensitivity(ui_manager_packet_list_heading, "/PacketListHeadingPopup/NoSorting",
5816 !capture_in_progress);
5819 #ifdef MAIN_MENU_USE_UIMANAGER
5820 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/CaptureMenu/Options",
5821 !capture_in_progress);
5822 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/CaptureMenu/Start",
5823 !capture_in_progress);
5824 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/CaptureMenu/Stop",
5825 capture_in_progress);
5826 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/CaptureMenu/Restart",
5827 capture_in_progress);
5828 #else /* MAIN_MENU_USE_UIMANAGER */
5829 set_menu_sensitivity_old("/Capture/Options...",
5830 !capture_in_progress);
5831 set_menu_sensitivity_old("/Capture/Start",
5832 !capture_in_progress);
5833 set_menu_sensitivity_old("/Capture/Stop",
5834 capture_in_progress);
5835 set_menu_sensitivity_old("/Capture/Restart",
5836 capture_in_progress);
5837 #endif /* MAIN_MENU_USE_UIMANAGER */
5838 set_toolbar_for_capture_in_progress(capture_in_progress);
5840 set_capture_if_dialog_for_capture_in_progress(capture_in_progress);
5841 #endif /* HAVE_LIBPCAP */
5844 /* Enable or disable menu items based on whether you have some captured
5847 walk_menu_tree_for_captured_packets(GList *node,
5848 gboolean have_captured_packets)
5850 gboolean is_enabled;
5852 menu_item_t *node_data = node->data;
5855 * Is this a leaf node or an interior node?
5857 if (node_data->children == NULL) {
5861 * If it has no "selected_packet_enabled()" or
5862 * "selected_tree_row_enabled()" routines, we enable
5863 * it. This allows tap windows to be popped up even
5864 * if you have no capture file; this is done to let
5865 * the user pop up multiple tap windows before reading
5866 * in a capture file, so that they can be processed in
5867 * parallel while the capture file is being read rather
5868 * than one at at time as you pop up the windows, and to
5869 * let the user pop up tap windows before starting an
5870 * "Update list of packets in real time" capture, so that
5871 * the statistics can be displayed while the capture is
5874 * If it has either of those routines, we disable it for
5875 * now - as long as, when a capture is first available,
5876 * we don't get called after a packet or tree row is
5877 * selected, that's OK.
5878 * XXX - that should be done better.
5880 if (node_data->selected_packet_enabled == NULL &&
5881 node_data->selected_tree_row_enabled == NULL)
5882 node_data->enabled = TRUE;
5884 node_data->enabled = FALSE;
5887 * It's an interior node; call
5888 * "walk_menu_tree_for_captured_packets()" on all its
5889 * children and, if any of them are enabled, enable
5890 * this node, otherwise disable it.
5892 * XXX - should we just leave all interior nodes enabled?
5893 * Which is a better UI choice?
5896 for (child = node_data->children; child != NULL; child =
5898 if (walk_menu_tree_for_captured_packets(child,
5899 have_captured_packets))
5902 node_data->enabled = is_enabled;
5906 * The root node doesn't correspond to a menu tree item; it
5907 * has a null name pointer.
5909 if (node_data->name != NULL) {
5910 #ifdef MAIN_MENU_USE_UIMANAGER
5911 set_menu_sensitivity(ui_manager_main_menubar, node_data->name,
5912 node_data->enabled);
5914 set_menu_sensitivity_old(node_data->name,
5915 node_data->enabled);
5918 return node_data->enabled;
5922 set_menus_for_captured_packets(gboolean have_captured_packets)
5924 #ifdef MAIN_MENU_USE_UIMANAGER
5925 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Print",
5926 have_captured_packets);
5927 #else /* MAIN_MENU_USE_UIMANAGER */
5928 set_menu_sensitivity_old("/File/Print...",
5929 have_captured_packets);
5930 #endif /* MAIN_MENU_USE_UIMANAGER */
5931 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/Print",
5932 have_captured_packets);
5934 #ifdef MAIN_MENU_USE_UIMANAGER
5935 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/FindPacket",
5936 have_captured_packets);
5937 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/FindNext",
5938 have_captured_packets);
5939 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/FindPrevious",
5940 have_captured_packets);
5941 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ZoomIn",
5942 have_captured_packets);
5943 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ZoomOut",
5944 have_captured_packets);
5945 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/NormalSize",
5946 have_captured_packets);
5947 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/GotoCorrespondingPacket",
5948 have_captured_packets);
5949 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/PreviousPacket",
5950 have_captured_packets);
5951 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/NextPacket",
5952 have_captured_packets);
5953 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/FirstPacket",
5954 have_captured_packets);
5955 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/LastPacket",
5956 have_captured_packets);
5957 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/PreviousPacketInConversation",
5958 have_captured_packets);
5959 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/NextPacketInConversation",
5960 have_captured_packets);
5961 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/StatisticsMenu/Summary",
5962 have_captured_packets);
5963 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/StatisticsMenu/ProtocolHierarchy",
5964 have_captured_packets);
5965 #else /* MAIN_MENU_USE_UIMANAGER */
5966 set_menu_sensitivity_old("/Edit/Find Packet...",
5967 have_captured_packets);
5968 set_menu_sensitivity_old("/Edit/Find Next",
5969 have_captured_packets);
5970 set_menu_sensitivity_old("/Edit/Find Previous",
5971 have_captured_packets);
5972 set_menu_sensitivity_old("/View/Zoom In",
5973 have_captured_packets);
5974 set_menu_sensitivity_old("/View/Zoom Out",
5975 have_captured_packets);
5976 set_menu_sensitivity_old("/View/Normal Size",
5977 have_captured_packets);
5978 set_menu_sensitivity_old("/Go/Go to Packet...",
5979 have_captured_packets);
5980 set_menu_sensitivity_old("/Go/Previous Packet",
5981 have_captured_packets);
5982 set_menu_sensitivity_old("/Go/Next Packet",
5983 have_captured_packets);
5984 set_menu_sensitivity_old("/Go/First Packet",
5985 have_captured_packets);
5986 set_menu_sensitivity_old("/Go/Last Packet",
5987 have_captured_packets);
5988 set_menu_sensitivity_old("/Go/Previous Packet In Conversation",
5989 have_captured_packets);
5990 set_menu_sensitivity_old("/Go/Next Packet In Conversation",
5991 have_captured_packets);
5992 set_menu_sensitivity_old("/Statistics/Summary",
5993 have_captured_packets);
5994 set_menu_sensitivity_old("/Statistics/Protocol Hierarchy",
5995 have_captured_packets);
5996 #endif /* MAIN_MENU_USE_UIMANAGER */
5997 walk_menu_tree_for_captured_packets(tap_menu_tree_root,
5998 have_captured_packets);
5999 set_toolbar_for_captured_packets(have_captured_packets);
6002 /* Enable or disable menu items based on whether a packet is selected and,
6003 if so, on the properties of the packet. */
6005 walk_menu_tree_for_selected_packet(GList *node, frame_data *fd,
6006 epan_dissect_t *edt)
6008 gboolean is_enabled;
6010 menu_item_t *node_data = node->data;
6013 * Is this a leaf node or an interior node?
6015 if (node_data->children == NULL) {
6019 * If it has no "selected_packet_enabled()" routine,
6020 * leave its enabled/disabled status alone - it
6021 * doesn't depend on whether we have a packet selected
6022 * or not or on the selected packet.
6024 * If it has a "selected_packet_enabled()" routine,
6025 * call it and set the item's enabled/disabled status
6026 * based on its return value.
6028 if (node_data->selected_packet_enabled != NULL)
6029 node_data->enabled = node_data->selected_packet_enabled(fd, edt, node_data->callback_data);
6032 * It's an interior node; call
6033 * "walk_menu_tree_for_selected_packet()" on all its
6034 * children and, if any of them are enabled, enable
6035 * this node, otherwise disable it.
6037 * XXX - should we just leave all interior nodes enabled?
6038 * Which is a better UI choice?
6041 for (child = node_data->children; child != NULL; child =
6043 if (walk_menu_tree_for_selected_packet(child, fd, edt))
6046 node_data->enabled = is_enabled;
6050 * The root node doesn't correspond to a menu tree item; it
6051 * has a null name pointer.
6053 if (node_data->name != NULL) {
6054 #ifdef MAIN_MENU_USE_UIMANAGER
6055 set_menu_sensitivity(ui_manager_main_menubar, node_data->name,
6056 node_data->enabled);
6057 #else /* MAIN_MENU_USE_UIMANAGER */
6058 set_menu_sensitivity_old(node_data->name,
6059 node_data->enabled);
6060 #endif /* MAIN_MENU_USE_UIMANAGER */
6062 return node_data->enabled;
6066 packet_is_ssl(epan_dissect_t* edt)
6072 if (!edt || !edt->tree)
6074 ssl_id = proto_get_id_by_filter_name("ssl");
6077 array = proto_find_finfo(edt->tree, ssl_id);
6078 is_ssl = (array->len > 0) ? TRUE : FALSE;
6079 g_ptr_array_free(array, TRUE);
6084 set_menus_for_selected_packet(capture_file *cf)
6086 /* Making the menu context-sensitive allows for easier selection of the
6087 desired item and has the added benefit, with large captures, of
6088 avoiding needless looping through huge lists for marked, ignored,
6089 or time-referenced packets. */
6090 gboolean is_ssl = packet_is_ssl(cf->edt);
6091 gboolean frame_selected = cf->current_frame != NULL;
6092 /* A frame is selected */
6093 gboolean have_marked = frame_selected && cf->marked_count > 0;
6094 /* We have marked frames. (XXX - why check frame_selected?) */
6095 gboolean another_is_marked = have_marked &&
6096 !(cf->marked_count == 1 && cf->current_frame->flags.marked);
6097 /* We have a marked frame other than the current frame (i.e.,
6098 we have at least one marked frame, and either there's more
6099 than one marked frame or the current frame isn't marked). */
6100 gboolean have_time_ref = cf->ref_time_count > 0;
6101 gboolean another_is_time_ref = frame_selected && have_time_ref &&
6102 !(cf->ref_time_count == 1 && cf->current_frame->flags.ref_time);
6103 /* We have a time reference frame other than the current frame (i.e.,
6104 we have at least one time reference frame, and either there's more
6105 than one time reference frame or the current frame isn't a
6106 time reference frame). (XXX - why check frame_selected?) */
6108 #ifdef MAIN_MENU_USE_UIMANAGER
6109 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/MarkPacket",
6111 #else /* MAIN_MENU_USE_UIMANAGER */
6112 set_menu_sensitivity_old("/Edit/Mark Packet (toggle)",
6114 #endif /* MAIN_MENU_USE_UIMANAGER */
6115 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/MarkPacket",
6117 #ifdef MAIN_MENU_USE_UIMANAGER
6118 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/MarkAllDisplayedPackets",
6119 cf->displayed_count > 0);
6120 /* Unlike un-ignore, do not allow unmark of all frames when no frames are displayed */
6121 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/UnmarkAllPackets",
6123 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/FindNextMark",
6125 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/FindPreviousMark",
6128 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/IgnorePacket",
6130 #else /* MAIN_MENU_USE_UIMANAGER */
6131 set_menu_sensitivity_old("/Edit/Mark All Displayed Packets (toggle)",
6132 cf->displayed_count > 0);
6133 /* Unlike un-ignore, do not allow unmark of all frames when no frames are displayed */
6134 set_menu_sensitivity_old("/Edit/Unmark All Packets",
6136 set_menu_sensitivity_old("/Edit/Find Next Mark",
6138 set_menu_sensitivity_old("/Edit/Find Previous Mark",
6141 set_menu_sensitivity_old("/Edit/Ignore Packet (toggle)",
6143 #endif /* MAIN_MENU_USE_UIMANAGER */
6144 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/IgnorePacket",
6146 #ifdef MAIN_MENU_USE_UIMANAGER
6147 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/IgnoreAllDisplayedPackets",
6148 cf->displayed_count > 0 && cf->displayed_count != cf->count);
6149 /* Allow un-ignore of all frames even with no frames currently displayed */
6150 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Un-IgnoreAllPackets",
6151 cf->ignored_count > 0);
6153 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/SetTimeReference",
6155 #else /* MAIN_MENU_USE_UIMANAGER */
6156 set_menu_sensitivity_old("/Edit/Ignore All Displayed Packets (toggle)",
6157 cf->displayed_count > 0 && cf->displayed_count != cf->count);
6158 /* Allow un-ignore of all frames even with no frames currently displayed */
6159 set_menu_sensitivity_old("/Edit/Un-Ignore All Packets",
6160 cf->ignored_count > 0);
6162 set_menu_sensitivity_old("/Edit/Set Time Reference (toggle)",
6164 #endif /* MAIN_MENU_USE_UIMANAGER */
6165 #ifdef NEW_PACKET_LIST
6166 #ifdef MAIN_MENU_USE_UIMANAGER
6167 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Un-TimeReferenceAllPackets",
6169 #else /* MAIN_MENU_USE_UIMANAGER */
6170 set_menu_sensitivity_old("/Edit/Un-Time Reference All Packets",
6172 #endif /* MAIN_MENU_USE_UIMANAGER */
6173 #endif /* NEW_PACKET_LIST */
6174 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/SetTimeReference",
6176 #ifdef MAIN_MENU_USE_UIMANAGER
6177 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/FindNextTimeReference",
6178 another_is_time_ref);
6179 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/FindPreviousTimeReference",
6180 another_is_time_ref);
6182 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ResizeAllColumns",
6184 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/CollapseAll",
6186 #else /* MAIN_MENU_USE_UIMANAGER */
6187 set_menu_sensitivity_old("/Edit/Find Next Time Reference",
6188 another_is_time_ref);
6189 set_menu_sensitivity_old("/Edit/Find Previous Time Reference",
6190 another_is_time_ref);
6192 set_menu_sensitivity_old("/View/Resize All Columns",
6194 set_menu_sensitivity_old("/View/Collapse All",
6196 #endif /* MAIN_MENU_USE_UIMANAGER */
6197 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/CollapseAll",
6199 #ifdef MAIN_MENU_USE_UIMANAGER
6200 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ExpandAll",
6202 #else /* MAIN_MENU_USE_UIMANAGER */
6203 set_menu_sensitivity_old("/View/Expand All",
6205 #endif /* MAIN_MENU_USE_UIMANAGER */
6206 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ExpandAll",
6208 #ifdef MAIN_MENU_USE_UIMANAGER
6209 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ColorizeConversation",
6211 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ResetColoring1-10",
6212 tmp_color_filters_used());
6213 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ShowPacketinNewWindow",
6215 #else /* MAIN_MENU_USE_UIMANAGER */
6216 set_menu_sensitivity_old("/View/Colorize Conversation",
6218 set_menu_sensitivity_old("/View/Reset Coloring 1-10",
6219 tmp_color_filters_used());
6220 set_menu_sensitivity_old("/View/Show Packet in New Window",
6222 #endif /* MAIN_MENU_USE_UIMANAGER */
6223 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ShowPacketinNewWindow",
6225 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ManuallyResolveAddress",
6226 frame_selected ? ((cf->edt->pi.ethertype == ETHERTYPE_IP)||(cf->edt->pi.ethertype == ETHERTYPE_IPv6)) : FALSE);
6227 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/SCTP",
6228 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_SCTP) : FALSE);
6229 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/FollowTCPStream",
6230 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
6231 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FollowTCPStream",
6232 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
6233 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/FollowUDPStream",
6234 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
6235 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/FollowSSLStream",
6236 frame_selected ? is_ssl : FALSE);
6237 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FollowSSLStream",
6238 frame_selected ? is_ssl : FALSE);
6239 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter",
6241 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/Ethernet",
6242 frame_selected ? (cf->edt->pi.dl_src.type == AT_ETHER) : FALSE);
6243 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/IP",
6244 frame_selected ? ((cf->edt->pi.ethertype == ETHERTYPE_IP)||(cf->edt->pi.ethertype == ETHERTYPE_IPv6)) : FALSE);
6245 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/TCP",
6246 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
6247 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/UDP",
6248 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
6249 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FollowUDPStream",
6250 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
6251 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/PN-CBA",
6252 frame_selected ? (cf->edt->pi.profinet_type != 0 && cf->edt->pi.profinet_type < 10) : FALSE);
6253 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation",
6255 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/Ethernet",
6256 frame_selected ? (cf->edt->pi.dl_src.type == AT_ETHER) : FALSE);
6257 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/IP",
6258 frame_selected ? ((cf->edt->pi.ethertype == ETHERTYPE_IP)||(cf->edt->pi.ethertype == ETHERTYPE_IPv6)) : FALSE);
6259 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/TCP",
6260 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
6261 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/UDP",
6262 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
6263 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/PN-CBA",
6264 frame_selected ? (cf->edt->pi.profinet_type != 0 && cf->edt->pi.profinet_type < 10) : FALSE);
6265 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/DecodeAs",
6266 frame_selected && decode_as_ok());
6267 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/DecodeAs",
6268 frame_selected && decode_as_ok());
6269 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/Copy",
6271 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ApplyAsFilter",
6273 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/PrepareaFilter",
6275 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ResolveName",
6276 frame_selected && (gbl_resolv_flags & RESOLV_ALL_ADDRS) != RESOLV_ALL_ADDRS);
6277 #ifdef MAIN_MENU_USE_UIMANAGER
6278 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/FollowTCPStream",
6279 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
6280 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/FollowUDPStream",
6281 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
6282 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/FollowSSLStream",
6283 frame_selected ? is_ssl : FALSE);
6284 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/DecodeAs",
6285 frame_selected && decode_as_ok());
6286 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/ResolveName",
6287 frame_selected && (gbl_resolv_flags & RESOLV_ALL_ADDRS) != RESOLV_ALL_ADDRS);
6288 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ToolsMenu/FirewallACLRules",
6291 #else /* MAIN_MENU_USE_UIMANAGER */
6292 set_menu_sensitivity_old("/Analyze/Follow TCP Stream",
6293 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
6294 set_menu_sensitivity_old("/Analyze/Follow UDP Stream",
6295 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
6296 set_menu_sensitivity_old("/Analyze/Follow SSL Stream",
6297 frame_selected ? is_ssl : FALSE);
6298 set_menu_sensitivity_old("/Analyze/Decode As...",
6299 frame_selected && decode_as_ok());
6300 set_menu_sensitivity_old("/View/Name Resolution/Resolve Name",
6301 frame_selected && (gbl_resolv_flags & RESOLV_ALL_ADDRS) != RESOLV_ALL_ADDRS);
6302 set_menu_sensitivity_old("/Tools/Firewall ACL Rules",
6304 #endif /* MAIN_MENU_USE_UIMANAGER */
6305 walk_menu_tree_for_selected_packet(tap_menu_tree_root, cf->current_frame,
6309 /* Enable or disable menu items based on whether a tree row is selected
6310 and, if so, on the properties of the tree row. */
6312 walk_menu_tree_for_selected_tree_row(GList *node, field_info *fi)
6314 gboolean is_enabled;
6316 menu_item_t *node_data = node->data;
6319 * Is this a leaf node or an interior node?
6321 if (node_data->children == NULL) {
6325 * If it has no "selected_tree_row_enabled()" routine,
6326 * leave its enabled/disabled status alone - it
6327 * doesn't depend on whether we have a tree row selected
6328 * or not or on the selected tree row.
6330 * If it has a "selected_tree_row_enabled()" routine,
6331 * call it and set the item's enabled/disabled status
6332 * based on its return value.
6334 if (node_data->selected_tree_row_enabled != NULL)
6335 node_data->enabled = node_data->selected_tree_row_enabled(fi, node_data->callback_data);
6338 * It's an interior node; call
6339 * "walk_menu_tree_for_selected_tree_row()" on all its
6340 * children and, if any of them are enabled, enable
6341 * this node, otherwise disable it.
6343 * XXX - should we just leave all interior nodes enabled?
6344 * Which is a better UI choice?
6347 for (child = node_data->children; child != NULL; child =
6349 if (walk_menu_tree_for_selected_tree_row(child, fi))
6352 node_data->enabled = is_enabled;
6356 * The root node doesn't correspond to a menu tree item; it
6357 * has a null name pointer.
6359 if (node_data->name != NULL) {
6360 #ifdef MAIN_MENU_USE_UIMANAGER
6361 set_menu_sensitivity(ui_manager_main_menubar, node_data->name,
6362 node_data->enabled);
6363 #else /* MAIN_MENU_USE_UIMANAGER */
6364 set_menu_sensitivity_old(node_data->name,
6365 node_data->enabled);
6366 #endif /* MAIN_MENU_USE_UIMANAGER */
6368 return node_data->enabled;
6372 menu_prefs_toggle_bool (GtkWidget *w, gpointer data)
6374 gboolean *value = data;
6375 module_t *module = g_object_get_data (G_OBJECT(w), "module");
6377 module->prefs_changed = TRUE;
6380 prefs_apply (module);
6381 if (!prefs.gui_use_pref_save) {
6384 redissect_packets();
6388 menu_prefs_change_enum (GtkWidget *w, gpointer data)
6391 module_t *module = g_object_get_data (G_OBJECT(w), "module");
6392 gint new_value = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(w), "enumval"));
6394 if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM(w)))
6397 if (*value != new_value) {
6398 module->prefs_changed = TRUE;
6401 prefs_apply (module);
6402 if (!prefs.gui_use_pref_save) {
6405 redissect_packets();
6410 menu_prefs_reset(void)
6412 g_free (g_object_get_data(G_OBJECT(ui_manager_tree_view_menu), "menu_abbrev"));
6413 g_object_set_data(G_OBJECT(ui_manager_tree_view_menu), "menu_abbrev", NULL);
6417 menu_prefs_change_ok (GtkWidget *w, gpointer parent_w)
6419 GtkWidget *entry = g_object_get_data (G_OBJECT(w), "entry");
6420 module_t *module = g_object_get_data (G_OBJECT(w), "module");
6421 pref_t *pref = g_object_get_data (G_OBJECT(w), "pref");
6422 const gchar *new_value = gtk_entry_get_text(GTK_ENTRY(entry));
6427 switch (pref->type) {
6429 uval = strtoul(new_value, &p, pref->info.base);
6430 if (p == new_value || *p != '\0') {
6431 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
6432 "The value \"%s\" isn't a valid number.",
6436 if (*pref->varp.uint != uval) {
6437 module->prefs_changed = TRUE;
6438 *pref->varp.uint = uval;
6442 if (strcmp (*pref->varp.string, new_value) != 0) {
6443 module->prefs_changed = TRUE;
6444 g_free((void*)*pref->varp.string);
6445 *pref->varp.string = g_strdup(new_value);
6449 if (range_convert_str(&newrange, new_value, pref->info.max_value) != CVT_NO_ERROR) {
6450 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
6451 "The value \"%s\" isn't a valid range.",
6455 if (!ranges_are_equal(*pref->varp.range, newrange)) {
6456 module->prefs_changed = TRUE;
6457 g_free(*pref->varp.range);
6458 *pref->varp.range = newrange;
6464 g_assert_not_reached();
6468 if (module->prefs_changed) {
6469 /* Ensure we reload the sub menu */
6471 prefs_apply (module);
6472 if (!prefs.gui_use_pref_save) {
6475 redissect_packets();
6478 window_destroy(GTK_WIDGET(parent_w));
6482 menu_prefs_change_cancel (GtkWidget *w _U_, gpointer parent_w)
6484 window_destroy(GTK_WIDGET(parent_w));
6488 menu_prefs_edit_dlg (GtkWidget *w, gpointer data)
6490 pref_t *pref = data;
6491 module_t *module = g_object_get_data (G_OBJECT(w), "module");
6492 gchar *value = NULL;
6494 GtkWidget *win, *main_tb, *main_vb, *bbox, *cancel_bt, *ok_bt;
6495 GtkWidget *entry, *label;
6496 GtkTooltips *tooltips;
6498 switch (pref->type) {
6500 switch (pref->info.base) {
6502 value = g_strdup_printf("%o", *pref->varp.uint);
6505 value = g_strdup_printf("%u", *pref->varp.uint);
6508 value = g_strdup_printf("%x", *pref->varp.uint);
6511 g_assert_not_reached();
6516 value = g_strdup(*pref->varp.string);
6519 value = g_strdup(range_convert_range (*pref->varp.range));
6522 g_assert_not_reached();
6526 tooltips = gtk_tooltips_new();
6528 win = dlg_window_new(module->description);
6530 gtk_window_set_resizable(GTK_WINDOW(win),FALSE);
6531 gtk_window_resize(GTK_WINDOW(win), 400, 100);
6533 main_vb = gtk_vbox_new(FALSE, 5);
6534 gtk_container_add(GTK_CONTAINER(win), main_vb);
6535 gtk_container_set_border_width(GTK_CONTAINER(main_vb), 6);
6537 main_tb = gtk_table_new(2, 2, FALSE);
6538 gtk_box_pack_start(GTK_BOX(main_vb), main_tb, FALSE, FALSE, 0);
6539 gtk_table_set_col_spacings(GTK_TABLE(main_tb), 10);
6541 label = gtk_label_new(ep_strdup_printf("%s:", pref->title));
6542 gtk_table_attach_defaults(GTK_TABLE(main_tb), label, 0, 1, 1, 2);
6543 gtk_misc_set_alignment(GTK_MISC(label), 1.0f, 0.5f);
6544 if (pref->description)
6545 gtk_tooltips_set_tip(tooltips, label, pref->description, NULL);
6547 entry = gtk_entry_new();
6548 gtk_table_attach_defaults(GTK_TABLE(main_tb), entry, 1, 2, 1, 2);
6549 gtk_entry_set_text(GTK_ENTRY(entry), value);
6550 if (pref->description)
6551 gtk_tooltips_set_tip(tooltips, entry, pref->description, NULL);
6553 bbox = dlg_button_row_new(GTK_STOCK_CANCEL,GTK_STOCK_OK, NULL);
6554 gtk_box_pack_end(GTK_BOX(main_vb), bbox, FALSE, FALSE, 0);
6556 ok_bt = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_OK);
6557 g_object_set_data (G_OBJECT(ok_bt), "module", module);
6558 g_object_set_data (G_OBJECT(ok_bt), "entry", entry);
6559 g_object_set_data (G_OBJECT(ok_bt), "pref", pref);
6560 g_signal_connect(ok_bt, "clicked", G_CALLBACK(menu_prefs_change_ok), win);
6562 dlg_set_activate(entry, ok_bt);
6564 cancel_bt = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_CANCEL);
6565 g_signal_connect(cancel_bt, "clicked", G_CALLBACK(menu_prefs_change_cancel), win);
6566 window_set_cancel_button(win, cancel_bt, NULL);
6568 gtk_widget_grab_default(ok_bt);
6569 gtk_widget_show_all(win);
6574 add_protocol_prefs_menu (pref_t *pref, gpointer data)
6576 GtkWidget *menu_preferences;
6577 GtkWidget *menu_item, *menu_sub_item, *sub_menu;
6578 GSList *group = NULL;
6579 module_t *module = data;
6580 const enum_val_t *enum_valp;
6581 gchar *label = NULL;
6583 switch (pref->type) {
6585 switch (pref->info.base) {
6587 label = g_strdup_printf ("%s: %o", pref->title, *pref->varp.uint);
6590 label = g_strdup_printf ("%s: %u", pref->title, *pref->varp.uint);
6593 label = g_strdup_printf ("%s: %x", pref->title, *pref->varp.uint);
6596 g_assert_not_reached();
6599 menu_item = gtk_menu_item_new_with_label(label);
6600 g_object_set_data (G_OBJECT(menu_item), "module", module);
6601 g_signal_connect(menu_item, "activate", G_CALLBACK(menu_prefs_edit_dlg), pref);
6605 menu_item = gtk_check_menu_item_new_with_label(pref->title);
6606 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menu_item), *pref->varp.boolp);
6607 g_object_set_data (G_OBJECT(menu_item), "module", module);
6608 g_signal_connect(menu_item, "activate", G_CALLBACK(menu_prefs_toggle_bool), pref->varp.boolp);
6611 menu_item = gtk_menu_item_new_with_label(pref->title);
6612 sub_menu = gtk_menu_new();
6613 gtk_menu_item_set_submenu (GTK_MENU_ITEM(menu_item), sub_menu);
6614 enum_valp = pref->info.enum_info.enumvals;
6615 while (enum_valp->name != NULL) {
6616 menu_sub_item = gtk_radio_menu_item_new_with_label(group, enum_valp->description);
6617 group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_sub_item));
6618 if (enum_valp->value == *pref->varp.enump) {
6619 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menu_sub_item), TRUE);
6621 g_object_set_data (G_OBJECT(menu_sub_item), "module", module);
6622 g_object_set_data (G_OBJECT(menu_sub_item), "enumval", GINT_TO_POINTER(enum_valp->value));
6623 g_signal_connect(menu_sub_item, "activate", G_CALLBACK(menu_prefs_change_enum), pref->varp.enump);
6624 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_sub_item);
6625 gtk_widget_show (menu_sub_item);
6630 label = g_strdup_printf ("%s: %s", pref->title, *pref->varp.string);
6631 menu_item = gtk_menu_item_new_with_label(label);
6632 g_object_set_data (G_OBJECT(menu_item), "module", module);
6633 g_signal_connect(menu_item, "activate", G_CALLBACK(menu_prefs_edit_dlg), pref);
6637 label = g_strdup_printf ("%s: %s", pref->title, range_convert_range (*pref->varp.range));
6638 menu_item = gtk_menu_item_new_with_label(label);
6639 g_object_set_data (G_OBJECT(menu_item), "module", module);
6640 g_signal_connect(menu_item, "activate", G_CALLBACK(menu_prefs_edit_dlg), pref);
6644 label = g_strdup_printf ("%s...", pref->title);
6645 menu_item = gtk_menu_item_new_with_label(label);
6646 g_signal_connect (menu_item, "activate", G_CALLBACK(uat_window_cb), pref->varp.uat);
6649 case PREF_STATIC_TEXT:
6652 /* Nothing to add */
6656 menu_preferences = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/ProtocolPreferences");
6657 if(!menu_preferences)
6658 g_warning("menu_preferences Not found path:TreeViewPopup/ProtocolPreferences");
6659 sub_menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM(menu_preferences));
6660 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
6661 gtk_widget_show (menu_item);
6667 rebuild_protocol_prefs_menu (module_t *prefs_module_p, gboolean preferences)
6669 GtkWidget *menu_preferences, *menu_item;
6670 GtkWidget *sub_menu;
6673 menu_preferences = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/ProtocolPreferences");
6675 sub_menu = gtk_menu_new();
6676 gtk_menu_item_set_submenu (GTK_MENU_ITEM(menu_preferences), sub_menu);
6678 label = g_strdup_printf ("%s Preferences...", prefs_module_p->description);
6679 menu_item = gtk_image_menu_item_new_with_label (label);
6680 gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM(menu_item),
6681 gtk_image_new_from_stock(GTK_STOCK_PREFERENCES, GTK_ICON_SIZE_MENU));
6682 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
6683 g_signal_connect_swapped(GTK_OBJECT(menu_item), "activate",
6684 G_CALLBACK(properties_cb), (GtkObject *) menu_item);
6685 gtk_widget_show (menu_item);
6688 menu_item = gtk_menu_item_new();
6689 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
6690 gtk_widget_show (menu_item);
6692 prefs_pref_foreach(prefs_module_p, add_protocol_prefs_menu, prefs_module_p);
6694 /* No preferences, remove sub menu */
6695 gtk_menu_item_set_submenu (GTK_MENU_ITEM(menu_preferences), NULL);
6700 #ifdef NEW_PACKET_LIST
6702 menu_visible_column_toggle (GtkWidget *w _U_, gpointer data)
6704 new_packet_list_toggle_visible_column (GPOINTER_TO_INT(data));
6708 rebuild_visible_columns_menu (void)
6710 GtkWidget *menu_columns[2], *menu_item;
6711 GtkWidget *sub_menu;
6715 gint i, col_id, cur_fmt;
6716 #ifdef MAIN_MENU_USE_UIMANAGER
6717 menu_columns[0] = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/DisplayedColumns");
6718 if(! menu_columns[0]){
6719 fprintf (stderr, "Warning: couldn't find menu_columns[0] path=/Menubar/ViewMenu/DisplayedColumns");
6721 #else /* MAIN_MENU_USE_UIMANAGER */
6722 menu_columns[0] = gtk_item_factory_get_widget(main_menu_factory, "/View/Displayed Columns");
6723 #endif /* MAIN_MENU_USE_UIMANAGER */
6724 menu_columns[1] = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/DisplayedColumns");
6726 if(! menu_columns[1]){
6727 fprintf (stderr, "Warning: couldn't find menu_columns[1] path=/PacketListHeadingPopup/DisplayedColumns");
6730 for (i = 0; i < 2; i++) {
6731 sub_menu = gtk_menu_new();
6732 gtk_menu_item_set_submenu (GTK_MENU_ITEM(menu_columns[i]), sub_menu);
6734 clp = g_list_first (prefs.col_list);
6737 cfmt = (fmt_data *) clp->data;
6738 cur_fmt = get_column_format_from_str(cfmt->fmt);
6739 if (cfmt->title[0]) {
6740 if (cur_fmt == COL_CUSTOM) {
6741 title = g_strdup_printf ("%s (%s)", cfmt->title, cfmt->custom_field);
6743 title = g_strdup_printf ("%s (%s)", cfmt->title, col_format_desc (cur_fmt));
6746 if (cur_fmt == COL_CUSTOM) {
6747 title = g_strdup_printf ("(%s)", cfmt->custom_field);
6749 title = g_strdup_printf ("(%s)", col_format_desc (cur_fmt));
6752 menu_item = gtk_check_menu_item_new_with_label(title);
6754 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menu_item), cfmt->visible);
6755 g_signal_connect(menu_item, "activate", G_CALLBACK(menu_visible_column_toggle), GINT_TO_POINTER(col_id));
6756 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
6757 gtk_widget_show (menu_item);
6758 clp = g_list_next (clp);
6762 menu_item = gtk_menu_item_new();
6763 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
6764 gtk_widget_show (menu_item);
6766 menu_item = gtk_menu_item_new_with_label ("Display All");
6767 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
6768 g_signal_connect(menu_item, "activate", G_CALLBACK(packet_list_heading_activate_all_columns_cb), NULL);
6769 gtk_widget_show (menu_item);
6772 #endif /* NEW_PACKET_LIST */
6775 menus_set_column_resolved (gboolean resolved, gboolean can_resolve)
6779 menu = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/ShowResolved");
6781 fprintf (stderr, "Warning: couldn't find menu path=/PacketListHeadingPopup/ShowResolved");
6783 g_object_set_data(G_OBJECT(menu), "skip-update", (void *)1);
6784 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), resolved && can_resolve);
6785 set_menu_sensitivity(ui_manager_packet_list_heading, "/PacketListHeadingPopup/ShowResolved", can_resolve);
6786 g_object_set_data(G_OBJECT(menu), "skip-update", NULL);
6790 menus_set_column_align_default (gboolean right_justify)
6792 GtkWidget *submenu, *menu_item_child;
6793 GList *child_list, *child_list_item;
6794 const gchar *menu_item_name;
6795 size_t menu_item_len;
6797 /* get the submenu container item */
6798 submenu = gtk_ui_manager_get_widget (ui_manager_packet_list_heading, "/PacketListHeadingPopup");
6800 fprintf (stderr, "Warning: couldn't find submenu path=/PacketListHeadingPopup");
6803 /* find the corresponding menu items to update */
6804 child_list = gtk_container_get_children(GTK_CONTAINER(submenu));
6805 child_list_item = child_list;
6806 while(child_list_item) {
6807 menu_item_child = (GTK_BIN(child_list_item->data))->child;
6808 if (menu_item_child != NULL) {
6809 menu_item_name = gtk_label_get_text(GTK_LABEL(menu_item_child));
6810 menu_item_len = strlen (menu_item_name);
6811 if(strncmp(menu_item_name, "Align Left", 10) == 0) {
6812 if (!right_justify && menu_item_len == 10) {
6813 gtk_label_set_text(GTK_LABEL(menu_item_child), "Align Left\t(default)");
6814 } else if (right_justify && menu_item_len > 10) {
6815 gtk_label_set_text(GTK_LABEL(menu_item_child), "Align Left");
6817 } else if (strncmp (menu_item_name, "Align Right", 11) == 0) {
6818 if (right_justify && menu_item_len == 11) {
6819 gtk_label_set_text(GTK_LABEL(menu_item_child), "Align Right\t(default)");
6820 } else if (!right_justify && menu_item_len > 11) {
6821 gtk_label_set_text(GTK_LABEL(menu_item_child), "Align Right");
6825 child_list_item = g_list_next(child_list_item);
6827 g_list_free(child_list);
6831 set_menus_for_selected_tree_row(capture_file *cf)
6833 gboolean properties;
6836 if (cf->finfo_selected != NULL) {
6837 header_field_info *hfinfo = cf->finfo_selected->hfinfo;
6841 if (hfinfo->parent == -1) {
6842 abbrev = hfinfo->abbrev;
6843 id = (hfinfo->type == FT_PROTOCOL) ? proto_get_id((protocol_t *)hfinfo->strings) : -1;
6845 abbrev = proto_registrar_get_abbrev(hfinfo->parent);
6846 id = hfinfo->parent;
6848 properties = prefs_is_registered_protocol(abbrev);
6849 set_menu_sensitivity(ui_manager_tree_view_menu,
6850 "/TreeViewPopup/GotoCorrespondingPacket", hfinfo->type == FT_FRAMENUM);
6851 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/Copy",
6853 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/Copy/AsFilter",
6854 proto_can_match_selected(cf->finfo_selected, cf->edt));
6855 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyasColumn",
6856 hfinfo->type != FT_NONE);
6857 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter",
6858 proto_can_match_selected(cf->finfo_selected, cf->edt));
6859 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter",
6860 proto_can_match_selected(cf->finfo_selected, cf->edt));
6861 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ColorizewithFilter",
6862 proto_can_match_selected(cf->finfo_selected, cf->edt));
6863 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ProtocolPreferences",
6865 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/DisableProtocol",
6866 (id == -1) ? FALSE : proto_can_toggle_protocol(id));
6867 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ExpandSubtrees",
6868 cf->finfo_selected->tree_type != -1);
6869 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/WikiProtocolPage",
6870 (id == -1) ? FALSE : TRUE);
6871 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FilterFieldReference",
6872 (id == -1) ? FALSE : TRUE);
6873 #ifdef MAIN_MENU_USE_UIMANAGER
6874 set_menu_sensitivity(ui_manager_tree_view_menu,
6875 "/Menubar/MenuFile/Export/SelectedPacketBytes", TRUE);
6876 set_menu_sensitivity(ui_manager_tree_view_menu,
6877 "/Menubar/MenuGo/GotoCorrespondingPacket", hfinfo->type == FT_FRAMENUM);
6878 set_menu_sensitivity(ui_manager_tree_view_menu, "/Menubar/MenuEdit/Copy/Description",
6879 proto_can_match_selected(cf->finfo_selected, cf->edt));
6880 set_menu_sensitivity(ui_manager_tree_view_menu, "/Menubar/MenuEdit/Copy/Fieldname",
6881 proto_can_match_selected(cf->finfo_selected, cf->edt));
6882 set_menu_sensitivity(ui_manager_tree_view_menu, "/Menubar/MenuEdit/Copy/Value",
6883 proto_can_match_selected(cf->finfo_selected, cf->edt));
6884 set_menu_sensitivity(ui_manager_tree_view_menu, "/Menubar/MenuEdit/Copy/AsFilter",
6885 proto_can_match_selected(cf->finfo_selected, cf->edt));
6886 set_menu_sensitivity(ui_manager_tree_view_menu, "/Menubar/MenuAnalyze/ApplyasColumn",
6887 hfinfo->type != FT_NONE);
6888 set_menu_sensitivity(ui_manager_tree_view_menu, "/Menubar/MenuAnalyze/ApplyAsFilter",
6889 proto_can_match_selected(cf->finfo_selected, cf->edt));
6890 set_menu_sensitivity(ui_manager_tree_view_menu, "/Menubar/MenuAnalyze/PrepareaFilter",
6891 proto_can_match_selected(cf->finfo_selected, cf->edt));
6892 set_menu_sensitivity(ui_manager_tree_view_menu, "/Menubar/MenuView/ExpandSubtrees",
6893 cf->finfo_selected->tree_type != -1);
6895 set_menu_sensitivity_old(
6896 "/File/Export/Selected Packet Bytes...", TRUE);
6897 set_menu_sensitivity_old(
6898 "/Go/Go to Corresponding Packet", hfinfo->type == FT_FRAMENUM);
6899 set_menu_sensitivity_old("/Edit/Copy/Description",
6900 proto_can_match_selected(cf->finfo_selected, cf->edt));
6901 set_menu_sensitivity_old("/Edit/Copy/Fieldname",
6902 proto_can_match_selected(cf->finfo_selected, cf->edt));
6903 set_menu_sensitivity_old("/Edit/Copy/Value",
6904 proto_can_match_selected(cf->finfo_selected, cf->edt));
6905 set_menu_sensitivity_old("/Edit/Copy/As Filter",
6906 proto_can_match_selected(cf->finfo_selected, cf->edt));
6907 set_menu_sensitivity_old("/Analyze/Apply as Column",
6908 hfinfo->type != FT_NONE);
6909 set_menu_sensitivity_old("/Analyze/Apply as Filter",
6910 proto_can_match_selected(cf->finfo_selected, cf->edt));
6911 set_menu_sensitivity_old("/Analyze/Prepare a Filter",
6912 proto_can_match_selected(cf->finfo_selected, cf->edt));
6913 set_menu_sensitivity_old("/View/Expand Subtrees",
6914 cf->finfo_selected->tree_type != -1);
6916 prev_abbrev = g_object_get_data(G_OBJECT(ui_manager_tree_view_menu), "menu_abbrev");
6917 if (!prev_abbrev || (strcmp (prev_abbrev, abbrev) != 0)) {
6918 /* No previous protocol or protocol changed - update Protocol Preferences menu */
6919 module_t *prefs_module_p = prefs_find_module(abbrev);
6920 rebuild_protocol_prefs_menu (prefs_module_p, properties);
6922 g_object_set_data(G_OBJECT(ui_manager_tree_view_menu), "menu_abbrev", g_strdup(abbrev));
6923 g_free (prev_abbrev);
6926 set_menu_sensitivity(ui_manager_tree_view_menu,
6927 "/TreeViewPopup/GotoCorrespondingPacket", FALSE);
6928 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/Copy", FALSE);
6929 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyasColumn", FALSE);
6930 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter", FALSE);
6931 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter", FALSE);
6932 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ColorizewithFilter", FALSE);
6933 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ProtocolPreferences",
6935 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/DisableProtocol", FALSE);
6936 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ExpandSubtrees", FALSE);
6937 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/WikiProtocolPage",
6939 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FilterFieldReference",
6941 #ifdef MAIN_MENU_USE_UIMANAGER
6942 set_menu_sensitivity(ui_manager_main_menubar,
6943 "/Menubar/FileMenu/Export/SelectedPacketBytes", FALSE);
6944 set_menu_sensitivity(ui_manager_main_menubar,
6945 "/Menubar/GoMenu/GotoCorrespondingPacket", FALSE);
6946 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Copy/Description", FALSE);
6947 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Copy/Fieldname", FALSE);
6948 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Copy/Value", FALSE);
6949 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Copy/AsFilter", FALSE);
6950 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/ApplyasColumn", FALSE);
6951 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/ApplyAsFilter", FALSE);
6952 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/PrepareaFilter", FALSE);
6953 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ExpandSubtrees", FALSE);
6954 #else /* MAIN_MENU_USE_UIMANAGER */
6955 set_menu_sensitivity_old("/File/Export/Selected Packet Bytes...", FALSE);
6956 set_menu_sensitivity_old("/Go/Go to Corresponding Packet", FALSE);
6957 set_menu_sensitivity_old("/Edit/Copy/Description", FALSE);
6958 set_menu_sensitivity_old("/Edit/Copy/Fieldname", FALSE);
6959 set_menu_sensitivity_old("/Edit/Copy/Value", FALSE);
6960 set_menu_sensitivity_old("/Edit/Copy/As Filter", FALSE);
6961 set_menu_sensitivity_old("/Analyze/Apply as Column", FALSE);
6962 set_menu_sensitivity_old("/Analyze/Apply as Filter", FALSE);
6963 set_menu_sensitivity_old("/Analyze/Prepare a Filter", FALSE);
6964 set_menu_sensitivity_old("/View/Expand Subtrees", FALSE);
6965 #endif /* MAIN_MENU_USE_UIMANAGER */
6968 walk_menu_tree_for_selected_tree_row(tap_menu_tree_root, cf->finfo_selected);
6971 void set_menus_for_packet_history(gboolean back_history, gboolean forward_history) {
6972 #ifdef MAIN_MENU_USE_UIMANAGER
6973 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/Back", back_history);
6974 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/Forward", forward_history);
6975 #else /* MAIN_MENU_USE_UIMANAGER */
6976 set_menu_sensitivity_old("/Go/Back", back_history);
6977 set_menu_sensitivity_old("/Go/Forward", forward_history);
6978 #endif /* MAIN_MENU_USE_UIMANAGER */
6979 set_toolbar_for_packet_history(back_history, forward_history);
6983 void set_menus_for_file_set(gboolean file_set, gboolean previous_file, gboolean next_file) {
6984 #ifdef MAIN_MENU_USE_UIMANAGER
6985 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Set/ListFiles", file_set);
6986 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Set/PreviousFile", previous_file);
6987 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Set/NextFile", next_file);
6988 #else /* MAIN_MENU_USE_UIMANAGER */
6989 set_menu_sensitivity_old("/File/File Set/List Files", file_set);
6990 set_menu_sensitivity_old("/File/File Set/Previous File", previous_file);
6991 set_menu_sensitivity_old("/File/File Set/Next File", next_file);
6992 #endif /* MAIN_MENU_USE_UIMANAGER */
6995 GtkWidget *menus_get_profiles_menu (void)
6997 return gtk_ui_manager_get_widget(ui_manager_statusbar_profiles_menu, "/ProfilesMenuPopup/Change");
7000 void set_menus_for_profiles(gboolean default_profile)
7002 set_menu_sensitivity(ui_manager_statusbar_profiles_menu, "/ProfilesMenuPopup/Delete", !default_profile);
7003 set_menu_sensitivity(ui_manager_statusbar_profiles_menu, "/ProfilesMenuPopup/Rename", !default_profile);
7012 * indent-tabs-mode: nil
7015 * ex: set shiftwidth=4 tabstop=8 expandtab
7016 * :indentSize=4:tabSize=8:noTabs=true: