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.
28 #ifndef MAIN_MENU_USE_UIMANAGER
29 /* UIManager code is in main_menubar.c */
31 #undef GTK_DISABLE_DEPRECATED
38 #include <epan/packet.h>
39 #include <epan/addr_resolv.h>
40 #include <epan/prefs.h>
41 #include <epan/prefs-int.h>
43 #include <epan/timestamp.h>
44 #include <epan/etypes.h>
45 #include <epan/ipproto.h>
46 #include <epan/dissector_filters.h>
47 #include <epan/strutil.h>
48 #include <epan/plugins.h>
49 #include <epan/epan_dissect.h>
50 #include <epan/column.h>
53 #include "../ui_util.h"
54 #include "../simple_dialog.h"
55 #include "../main_statusbar.h"
56 #include "../color_filters.h"
57 #include "../stat_menu.h"
60 #include "gtk/about_dlg.h"
61 #include "gtk/capture_dlg.h"
62 #include "gtk/capture_if_dlg.h"
63 #include "gtk/color_dlg.h"
64 #include "gtk/filter_dlg.h"
65 #include "gtk/profile_dlg.h"
66 #include "gtk/dlg_utils.h"
67 #include "gtk/capture_file_dlg.h"
68 #include "gtk/fileset_dlg.h"
69 #include "gtk/file_import_dlg.h"
70 #include "gtk/find_dlg.h"
71 #include "gtk/goto_dlg.h"
72 #include "gtk/summary_dlg.h"
73 #include "gtk/prefs_dlg.h"
74 #include "gtk/packet_win.h"
75 #include "gtk/follow_tcp.h"
76 #include "gtk/follow_udp.h"
77 #include "gtk/follow_ssl.h"
78 #include "gtk/decode_as_dlg.h"
79 #include "gtk/help_dlg.h"
80 #include "gtk/supported_protos_dlg.h"
81 #include "gtk/proto_dlg.h"
82 #include "gtk/proto_hier_stats_dlg.h"
84 #include "gtk/stock_icons.h"
85 #include "gtk/gtkglobals.h"
86 #include "gtk/recent.h"
87 #include "gtk/main_proto_draw.h"
88 #include "gtk/conversations_table.h"
89 #include "gtk/hostlist_table.h"
90 #include "gtk/packet_history.h"
91 #include "gtk/sctp_stat.h"
92 #include "gtk/firewall_dlg.h"
93 #include "gtk/macros_dlg.h"
94 #include "gtk/export_object.h"
95 #include "epan/dissectors/packet-ssl-utils.h"
96 #include "gtk/export_sslkeys.h"
97 #include "gtk/gui_stat_menu.h"
99 #include "gtk/menus.h"
100 #include "gtk/main_toolbar.h"
101 #include "gtk/main_welcome.h"
102 #include "gtk/uat_gui.h"
103 #include "gtk/gui_utils.h"
104 #include "gtk/manual_addr_resolv.h"
105 #include "gtk/proto_help.h"
106 #include "gtk/dissector_tables_dlg.h"
107 #include "gtk/utf8_entities.h"
108 #include "gtk/expert_comp_dlg.h"
109 #include "gtk/time_shift_dlg.h"
111 #include "gtk/new_packet_list.h"
114 #include "capture_opts.h"
115 #include "gtk/capture_globals.h"
117 #ifdef HAVE_IGE_MAC_INTEGRATION
118 #include <ige-mac-menu.h>
121 #ifdef HAVE_GTKOSXAPPLICATION
122 #include <igemacintegration/gtkosxapplication.h>
125 static int initialize = TRUE;
126 static GtkItemFactory *main_menu_factory = NULL;
127 static GtkUIManager *ui_manager_packet_list_heading = NULL;
128 static GtkUIManager *ui_manager_packet_list_menu = NULL;
129 static GtkUIManager *ui_manager_tree_view_menu = NULL;
130 static GtkUIManager *ui_manager_bytes_menu = NULL;
131 static GtkUIManager *ui_manager_statusbar_profiles_menu = NULL;
132 static GSList *popup_menu_list = NULL;
134 static GtkAccelGroup *grp;
136 typedef struct _menu_item {
138 const char *gui_path;
140 const char *stock_id;
142 const char *accelerator;
143 const gchar *tooltip;
144 GtkItemFactoryCallback callback;
146 gpointer callback_data;
147 gboolean (*selected_packet_enabled)(frame_data *, epan_dissect_t *, gpointer callback_data);
148 gboolean (*selected_tree_row_enabled)(field_info *, gpointer callback_data);
152 static GList *tap_menu_tree_root = NULL;
154 GtkWidget *popup_menu_object;
157 #define GTK_MENU_FUNC(a) ((GtkItemFactoryCallback)(a))
159 static void merge_all_tap_menus(GList *node);
161 static void menus_init(void);
162 static void set_menu_sensitivity (GtkUIManager *ui_manager, const gchar *, gint);
163 static void clear_menu_recent_capture_file_cmd_cb(GtkWidget *w, gpointer unused _U_);
164 static void set_menu_sensitivity_old (const gchar *, gint);
165 static void show_hide_cb(GtkWidget *w, gpointer data, gint action);
166 static void timestamp_format_cb(GtkWidget *w, gpointer d, gint action);
167 static void timestamp_precision_cb(GtkWidget *w, gpointer d, gint action);
168 static void timestamp_seconds_time_cb(GtkWidget *w, gpointer d, gint action);
169 static void name_resolution_cb(GtkWidget *w, gpointer d, gint action);
171 static void auto_scroll_live_cb(GtkWidget *w, gpointer d);
173 static void colorize_cb(GtkWidget *w, gpointer d);
176 /* As a general GUI guideline, we try to follow the Gnome Human Interface Guidelines, which can be found at:
177 http://developer.gnome.org/projects/gup/hig/1.0/index.html
179 Please note: there are some differences between the Gnome HIG menu suggestions and our implementation:
181 File/Open Recent: the Gnome HIG suggests putting the list of recently used files as elements into the File menuitem.
182 As this is ok for only a few items, this will become unhandy for 10 or even more list entries.
183 For this reason, we use a submenu for this.
185 File/Close: the Gnome HIG suggests putting this item just above the Quit item.
186 This results in unintuitive behaviour as both Close and Quit items are very near together.
187 By putting the Close item near the open item(s), it better suggests that it will close the
188 currently opened/captured file only.
192 SHOW_HIDE_MAIN_TOOLBAR = 1,
193 SHOW_HIDE_FILTER_TOOLBAR,
194 SHOW_HIDE_AIRPCAP_TOOLBAR,
196 SHOW_HIDE_PACKET_LIST,
199 } show_hide_values_e;
210 build_conversation_filter(int action, gboolean show_dialog)
212 packet_info *pi = &cfile.edt->pi;
218 if (pi->profinet_type == 0) {
220 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
221 "Error filtering conversation. Please make\n"
222 "sure you have a PROFINET CBA packet selected.");
227 if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4
228 && pi->ipproto == IP_PROTO_TCP ) {
230 switch(pi->profinet_type) {
232 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)",
233 ip_to_str( pi->net_dst.data),
234 ip_to_str( pi->net_src.data),
235 ip_to_str( pi->net_src.data),
236 ip_to_str( pi->net_dst.data));
239 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)",
240 ip_to_str( pi->net_src.data),
241 ip_to_str( pi->net_dst.data),
242 ip_to_str( pi->net_dst.data),
243 ip_to_str( pi->net_src.data));
246 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)",
247 ip_to_str( pi->net_dst.data),
248 ip_to_str( pi->net_src.data),
249 ip_to_str( pi->net_src.data),
250 ip_to_str( pi->net_dst.data));
253 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)",
254 ip_to_str( pi->net_src.data),
255 ip_to_str( pi->net_dst.data),
256 ip_to_str( pi->net_dst.data),
257 ip_to_str( pi->net_src.data));
267 if (pi->ipproto != IP_PROTO_TCP) {
269 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
270 "Error filtering conversation. Please make\n"
271 "sure you have a TCP packet selected.");
276 if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4 ) {
278 buf = g_strdup_printf("(ip.addr eq %s and ip.addr eq %s) and (tcp.port eq %d and tcp.port eq %d)",
279 ip_to_str( pi->net_src.data),
280 ip_to_str( pi->net_dst.data),
281 pi->srcport, pi->destport );
282 } else if( pi->net_src.type == AT_IPv6 && pi->net_dst.type == AT_IPv6 ) {
284 buf = g_strdup_printf("(ipv6.addr eq %s and ipv6.addr eq %s) and (tcp.port eq %d and tcp.port eq %d)",
285 ip6_to_str((const struct e_in6_addr *)pi->net_src.data),
286 ip6_to_str((const struct e_in6_addr *)pi->net_dst.data),
287 pi->srcport, pi->destport );
293 if (pi->ipproto != IP_PROTO_UDP) {
295 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
296 "Error filtering conversation. Please make\n"
297 "sure you have a UDP packet selected.");
302 if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4 ) {
304 buf = g_strdup_printf("(ip.addr eq %s and ip.addr eq %s) and (udp.port eq %d and udp.port eq %d)",
305 ip_to_str( pi->net_src.data),
306 ip_to_str( pi->net_dst.data),
307 pi->srcport, pi->destport );
308 } else if( pi->net_src.type == AT_IPv6 && pi->net_dst.type == AT_IPv6 ) {
310 buf = g_strdup_printf("(ipv6.addr eq %s and ipv6.addr eq %s) and (udp.port eq %d and udp.port eq %d)",
311 ip6_to_str((const struct e_in6_addr *)pi->net_src.data),
312 ip6_to_str((const struct e_in6_addr *)pi->net_dst.data),
313 pi->srcport, pi->destport );
319 if ((pi->ethertype != ETHERTYPE_IP) && (pi->ethertype != ETHERTYPE_IPv6)) {
321 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
322 "Error filtering conversation. Please make\n"
323 "sure you have a IP packet selected.");
328 if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4 ) {
330 buf = g_strdup_printf("ip.addr eq %s and ip.addr eq %s",
331 ip_to_str( pi->net_src.data),
332 ip_to_str( pi->net_dst.data));
333 } else if( pi->net_src.type == AT_IPv6 && pi->net_dst.type == AT_IPv6 ) {
335 buf = g_strdup_printf("ipv6.addr eq %s and ipv6.addr eq %s",
336 ip6_to_str((const struct e_in6_addr *)pi->net_src.data),
337 ip6_to_str((const struct e_in6_addr *)pi->net_dst.data));
343 /* XXX - is this the right way to check for Ethernet? */
344 /* check for the data link address type */
345 /* (ethertype will be 0 when used as length field) */
346 if (pi->dl_src.type != AT_ETHER) {
348 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
349 "Error filtering conversation. Please make\n"
350 "sure you have a Ethernet packet selected.");
355 if( pi->dl_src.type == AT_ETHER && pi->dl_dst.type == AT_ETHER ) {
357 buf = g_strdup_printf("eth.addr eq %s and eth.addr eq %s",
358 ether_to_str( pi->dl_src.data),
359 ether_to_str( pi->dl_dst.data));
372 new_window_cb(GtkWidget *widget)
374 new_packet_window(widget, FALSE);
377 #ifdef WANT_PACKET_EDITOR
379 edit_window_cb(GtkWidget *widget)
381 new_packet_window(widget, TRUE);
386 conversation_cb(GtkAction *a _U_, gpointer data _U_, int action)
389 GtkWidget *filter_te;
391 if (cfile.current_frame) {
392 /* create a filter-string based on the selected packet and action */
393 filter = build_conversation_filter(action, TRUE);
395 /* Run the display filter so it goes in effect - even if it's the
396 same as the previous display filter. */
397 filter_te = gtk_bin_get_child(GTK_BIN(g_object_get_data(G_OBJECT(top_level), E_DFILTER_CM_KEY)));
399 gtk_entry_set_text(GTK_ENTRY(filter_te), filter);
400 main_filter_packets(&cfile, filter, TRUE);
407 colorize_conversation_cb(GtkWidget * w _U_, gpointer data _U_, int action)
409 gchar *filter = NULL;
411 if( (action>>8) == 255 ) {
412 color_filters_reset_tmp();
413 new_packet_list_colorize_packets();
414 } else if (cfile.current_frame) {
415 if( (action&0xff) == 0 ) {
416 /* colorize_conversation_cb was called from the window-menu
417 * or through an accelerator key. Try to build a conversation
418 * filter in the order TCP, UDP, IP, Ethernet and apply the
420 filter = build_conversation_filter(CONV_TCP,FALSE);
422 filter = build_conversation_filter(CONV_UDP,FALSE);
424 filter = build_conversation_filter(CONV_IP,FALSE);
426 filter = build_conversation_filter(CONV_ETHER,FALSE);
427 if( filter == NULL ) {
428 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Unable to build conversation filter.");
432 /* create a filter-string based on the selected packet and action */
433 filter = build_conversation_filter(action&0xff, TRUE);
436 if( (action>>8) == 0) {
437 /* Open the "new coloring filter" dialog with the filter */
438 color_display_with_filter(filter);
440 /* Set one of the temporary coloring filters */
441 color_filters_set_tmp((guint8)(action>>8),filter,FALSE);
442 new_packet_list_colorize_packets();
450 goto_conversation_frame(gboolean dir)
453 dfilter_t *dfcode = NULL;
454 gboolean found_packet=FALSE;
456 filter = build_conversation_filter(CONV_TCP,FALSE);
458 filter = build_conversation_filter(CONV_UDP,FALSE);
460 filter = build_conversation_filter(CONV_IP,FALSE);
461 if( filter == NULL ) {
462 statusbar_push_temporary_msg("Unable to build conversation filter.");
467 if (!dfilter_compile(filter, &dfcode)) {
468 /* The attempt failed; report an error. */
469 statusbar_push_temporary_msg("Error compiling filter for this conversation.");
474 found_packet = cf_find_packet_dfilter(&cfile, dfcode, dir);
477 /* We didn't find a packet */
478 statusbar_push_temporary_msg("No previous/next packet in conversation.");
481 dfilter_free(dfcode);
486 goto_next_frame_conversation_cb(GtkWidget *w _U_, gpointer d _U_)
488 goto_conversation_frame(FALSE);
492 goto_previous_frame_conversation_cb(GtkWidget *w _U_, gpointer d _U_)
494 goto_conversation_frame(TRUE);
502 tree_view_menu_apply_selected_cb(GtkAction *action _U_, gpointer user_data)
504 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter/Selected");
505 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_REPLACE|MATCH_SELECTED_APPLY_NOW);
509 tree_view_menu_apply_not_selected_cb(GtkAction *action _U_, gpointer user_data)
511 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter/NotSelected");
512 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_NOT|MATCH_SELECTED_APPLY_NOW);
516 tree_view_menu_apply_and_selected_cb(GtkAction *action _U_, gpointer user_data)
518 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter/AndSelected");
519 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_AND|MATCH_SELECTED_APPLY_NOW);
523 tree_view_menu_apply_or_selected_cb(GtkAction *action _U_, gpointer user_data)
525 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter/OrSelected");
526 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_OR|MATCH_SELECTED_APPLY_NOW);
530 tree_view_menu_apply_and_not_selected_cb(GtkAction *action _U_, gpointer user_data)
532 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter/AndNotSelected");
533 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_AND_NOT|MATCH_SELECTED_APPLY_NOW);
537 tree_view_menu_apply_or_not_selected_cb(GtkAction *action _U_, gpointer user_data)
539 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter/OrNotSelected");
540 match_selected_ptree_cb( widget , user_data,MATCH_SELECTED_OR_NOT|MATCH_SELECTED_APPLY_NOW);
542 /* Prepare a filter */
544 tree_view_menu_prepare_selected_cb(GtkAction *action _U_, gpointer user_data)
546 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter/Selected");
547 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_REPLACE);
551 tree_view_menu_prepare_not_selected_cb(GtkAction *action _U_, gpointer user_data)
553 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter/NotSelected");
554 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_NOT);
558 tree_view_menu_prepare_and_selected_cb(GtkAction *action _U_, gpointer user_data)
560 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter/AndSelected");
561 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_AND);
565 tree_view_menu_prepare_or_selected_cb(GtkAction *action _U_, gpointer user_data)
567 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter/OrSelected");
568 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_OR);
572 tree_view_menu_prepare_and_not_selected_cb(GtkAction *action _U_, gpointer user_data)
574 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter/AndNotSelected");
575 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_AND_NOT);
579 tree_view_menu_prepare_or_not_selected_cb(GtkAction *action _U_, gpointer user_data)
581 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter/OrNotSelected");
582 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_OR_NOT);
585 /* Prepare for use of GTKUImanager */
589 * Please do not use keystrokes that are used as "universal" shortcuts in
590 * various desktop environments:
593 * http://support.microsoft.com/kb/126449
596 * http://library.gnome.org/users/user-guide/nightly/keyboard-skills.html.en
599 * http://developer.kde.org/documentation/standards/kde/style/keys/shortcuts.html
601 * In particular, do not use the following <control> sequences for anything
602 * other than their standard purposes:
604 * <control>O File->Open
605 * <control>S File->Save
606 * <control>P File->Print
607 * <control>W File->Close
608 * <control>Q File->Quit
609 * <control>Z Edit->Undo (which we don't currently have)
610 * <control>X Edit->Cut (which we don't currently have)
611 * <control>C Edit->Copy (which we don't currently have)
612 * <control>V Edit->Paste (which we don't currently have)
613 * <control>A Edit->Select All (which we don't currently have)
615 * Note that some if not all of the Edit keys above already perform those
616 * functions in text boxes, such as the Filter box. Do no, under any
617 * circumstances, make a change that keeps them from doing so.
620 /* This is the GtkItemFactoryEntry structure used to generate new menus.
621 Item 1: The menu path. The letter after the underscore indicates an
622 accelerator key once the menu is open.
623 Item 2: The accelerator key for the entry
624 Item 3: The callback function.
625 Item 4: The callback action. This changes the parameters with
626 which the function is called. The default is 0.
627 Item 5: The item type, used to define what kind of an item it is.
628 Here are the possible values:
632 "<Title>" -> create a title item
633 "<Item>" -> create a simple item
634 "<ImageItem>" -> create an item holding an image
635 "<StockItem>" -> create an item holding a stock image
636 "<CheckItem>" -> create a check item
637 "<ToggleItem>" -> create a toggle item
638 "<RadioItem>" -> create a radio item
639 <path> -> path of a radio item to link against
640 "<Separator>" -> create a separator
641 "<Tearoff>" -> create a tearoff separator
642 "<Branch>" -> create an item to hold sub items (optional)
643 "<LastBranch>" -> create a right justified branch
644 Item 6: extra data needed for ImageItem and StockItem
646 static GtkItemFactoryEntry menu_items[] =
648 {"/_File", NULL, NULL, 0, "<Branch>", NULL,},
649 {"/File/_Open...", "<control>O", GTK_MENU_FUNC(file_open_cmd_cb),
650 0, "<StockItem>", GTK_STOCK_OPEN,},
651 {"/File/Open _Recent", NULL, NULL, 0, "<Branch>", NULL,},
652 {"/File/_Merge...", NULL, GTK_MENU_FUNC(file_merge_cmd_cb), 0, NULL, NULL,},
653 {"/File/_Import...", NULL, GTK_MENU_FUNC(file_import_cmd_cb), 0, NULL, NULL,},
654 {"/File/_Close", "<control>W", GTK_MENU_FUNC(file_close_cmd_cb),
655 0, "<StockItem>", GTK_STOCK_CLOSE,},
656 {"/File/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
657 {"/File/_Save", "<control>S", GTK_MENU_FUNC(file_save_cmd_cb),
658 0, "<StockItem>", GTK_STOCK_SAVE,},
659 {"/File/Save _As...", "<shift><control>S", GTK_MENU_FUNC(file_save_as_cmd_cb),
660 0, "<StockItem>", GTK_STOCK_SAVE_AS,},
661 {"/File/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
662 {"/File/File Set", NULL, NULL, 0, "<Branch>", NULL,},
663 {"/File/File Set/List Files", NULL, GTK_MENU_FUNC(fileset_cb), 0, "<StockItem>", WIRESHARK_STOCK_FILE_SET_LIST,},
664 {"/File/File Set/Next File", NULL, GTK_MENU_FUNC(fileset_next_cb), 0, "<StockItem>", WIRESHARK_STOCK_FILE_SET_NEXT,},
665 {"/File/File Set/Previous File", NULL, GTK_MENU_FUNC(fileset_previous_cb), 0, "<StockItem>", WIRESHARK_STOCK_FILE_SET_PREVIOUS,},
666 {"/File/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
667 {"/File/_Export", NULL, NULL, 0, "<Branch>", NULL,},
669 {"/File/Export/File...", NULL, GTK_MENU_FUNC(export_text_cmd_cb),
672 {"/File/Export/as \"Plain _Text\" file...", NULL, GTK_MENU_FUNC(export_text_cmd_cb),
674 {"/File/Export/as \"_PostScript\" file...", NULL, GTK_MENU_FUNC(export_ps_cmd_cb),
676 {"/File/Export/as \"_CSV\" (Comma Separated Values packet summary) file...",
677 NULL, GTK_MENU_FUNC(export_csv_cmd_cb), 0, NULL, NULL,},
678 {"/File/Export/as \"C _Arrays\" (packet bytes) file...", NULL, GTK_MENU_FUNC(export_carrays_cmd_cb),
680 {"/File/Export/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
681 {"/File/Export/as XML - \"P_SML\" (packet summary) file...", NULL, GTK_MENU_FUNC(export_psml_cmd_cb),
683 {"/File/Export/as XML - \"P_DML\" (packet details) file...", NULL, GTK_MENU_FUNC(export_pdml_cmd_cb),
685 {"/File/Export/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
687 {"/File/Export/Selected Packet _Bytes...", "<control>H", GTK_MENU_FUNC(savehex_cb),
689 {"/File/Export/SSL Session Keys...", NULL, GTK_MENU_FUNC(savesslkeys_cb),
691 {"/File/Export/_Objects/_HTTP", NULL, GTK_MENU_FUNC(eo_http_cb), 0, NULL, NULL,},
692 {"/File/Export/_Objects/_DICOM", NULL, GTK_MENU_FUNC(eo_dicom_cb), 0, NULL, NULL,},
693 {"/File/Export/_Objects/_SMB", NULL, GTK_MENU_FUNC(eo_smb_cb), 0, NULL, NULL,},
694 {"/File/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
695 {"/File/_Print...", "<control>P", GTK_MENU_FUNC(file_print_cmd_cb),
696 0, "<StockItem>", GTK_STOCK_PRINT,},
697 {"/File/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
698 {"/File/_Quit", "<control>Q", GTK_MENU_FUNC(file_quit_cmd_cb),
699 0, "<StockItem>", GTK_STOCK_QUIT,},
700 {"/_Edit", NULL, NULL, 0, "<Branch>", NULL,},
701 {"/Edit/Copy", NULL, NULL, 0, "<Branch>", NULL,},
702 {"/Edit/Copy/Description", "<shift><control>D", GTK_MENU_FUNC(copy_selected_plist_cb), COPY_SELECTED_DESCRIPTION, NULL, NULL,},
703 {"/Edit/Copy/Fieldname", "<shift><control>F", GTK_MENU_FUNC(copy_selected_plist_cb), COPY_SELECTED_FIELDNAME, NULL, NULL,},
704 {"/Edit/Copy/Value", "<shift><control>V", GTK_MENU_FUNC(copy_selected_plist_cb), COPY_SELECTED_VALUE, NULL, NULL,},
705 {"/Edit/Copy/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
706 {"/Edit/Copy/As Filter", "<shift><control>C", GTK_MENU_FUNC(match_selected_ptree_cb),
707 MATCH_SELECTED_REPLACE|MATCH_SELECTED_COPY_ONLY, NULL, NULL,},
710 * Un-#if this when we actually implement Cut/Copy/Paste for the
711 * packet list and packet detail windows.
713 * Note: when we implement Cut/Copy/Paste in those windows, we
714 * will almost certainly want to allow multiple packets to be
715 * selected in the packet list pane and multiple packet detail
716 * items to be selected in the packet detail pane, so that
717 * the user can, for example, copy the summaries of multiple
718 * packets to the clipboard from the packet list pane and multiple
719 * packet detail items - perhaps *all* packet detail items - from
720 * the packet detail pane. Given that, we'll also want to
721 * implement Select All.
723 * If multiple packets are selected, we would probably display nothing
724 * in the packet detail pane, just as we do if no packet is selected,
725 * and any menu items etc. that would pertain only to a single packet
728 * If multiple packet detail items are selected, we would probably
729 * disable all items that pertain only to a single packet detail
730 * item, such as some items in the status bar.
732 * XXX - the actions for these will be different depending on what
733 * widget we're in; ^C should copy from the filter text widget if
734 * we're in that widget, the packet list if we're in that widget
735 * (presumably copying the summaries of selected packets to the
736 * clipboard, e.g. the text copy would be the text of the columns),
737 * the packet detail if we're in that widget (presumably copying
738 * the contents of selected protocol tree items to the clipboard,
739 * e.g. the text copy would be the text displayed for those items),
742 * Given that those menu items should also affect text widgets
743 * such as the filter box, we would again want Select All, and,
744 * at least for the filter box, we would also want Undo and Redo.
745 * We would only want Cut, Paste, Undo, and Redo for the packet
746 * list and packet detail panes if we support modifying them.
748 {"/Edit/_Undo", "<control>Z", NULL,
749 0, "<StockItem>", GTK_STOCK_UNDO,},
750 {"/Edit/_Redo", "<shift><control>Z", NULL,
751 0, "<StockItem>", GTK_STOCK_REDO,},
752 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
753 {"/Edit/Cu_t", "<control>X", NULL,
754 0, "<StockItem>", GTK_STOCK_CUT,},
755 {"/Edit/_Copy", "<control>C", NULL,
756 0, "<StockItem>", GTK_STOCK_COPY,},
757 {"/Edit/_Paste", "<control>V", NULL,
758 0, "<StockItem>", GTK_STOCK_PASTE,},
759 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
760 {"/Edit/Select _All", "<control>A", NULL, 0,
761 #ifdef GTK_STOCK_SELECT_ALL /* first appeared in 2.10 */
762 "<StockItem>", GTK_STOCK_SELECT_ALL,
765 #endif /* GTK_STOCK_SELECT_ALL */
768 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
769 {"/Edit/_Find Packet...", "<control>F", GTK_MENU_FUNC(find_frame_cb), 0, "<StockItem>", GTK_STOCK_FIND,},
770 {"/Edit/Find Ne_xt", "<control>N", GTK_MENU_FUNC(find_next_cb), 0, NULL, NULL,},
771 {"/Edit/Find Pre_vious", "<control>B", GTK_MENU_FUNC(find_previous_cb), 0, NULL, NULL,},
772 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
773 {"/Edit/_Mark Packet (toggle)", "<control>M", GTK_MENU_FUNC(new_packet_list_mark_frame_cb),0, NULL, NULL,},
774 {"/Edit/Toggle Marking Of All Displayed Packets", "<shift><alt><control>M", GTK_MENU_FUNC(new_packet_list_toggle_mark_all_displayed_frames_cb), 0, NULL, NULL,},
775 {"/Edit/Mark All Displayed Packets", "<shift><control>M", GTK_MENU_FUNC(new_packet_list_mark_all_displayed_frames_cb), 0, NULL, NULL,},
776 {"/Edit/Unmark All Displayed Packets", "<alt><control>M", GTK_MENU_FUNC(new_packet_list_unmark_all_displayed_frames_cb), 0, NULL, NULL,},
777 {"/Edit/Find Next Mark", "<shift><control>N", GTK_MENU_FUNC(find_next_mark_cb), 0, NULL, NULL,},
778 {"/Edit/Find Previous Mark", "<shift><control>B", GTK_MENU_FUNC(find_prev_mark_cb), 0, NULL, NULL,},
779 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
780 {"/Edit/_Ignore Packet (toggle)", "<control>D", GTK_MENU_FUNC(new_packet_list_ignore_frame_cb), 0, NULL, NULL,},
782 * XXX - this next one overrides /Edit/Copy/Description
784 {"/Edit/Ignore All Displayed Packets (toggle)","<shift><control>D", GTK_MENU_FUNC(new_packet_list_ignore_all_displayed_frames_cb), 0, NULL, NULL,},
785 {"/Edit/U_n-Ignore All Packets", "<alt><control>D", GTK_MENU_FUNC(new_packet_list_unignore_all_frames_cb), 0, NULL, NULL,},
786 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
787 {"/Edit/Set Time Reference (toggle)", "<control>T", GTK_MENU_FUNC(reftime_frame_cb), REFTIME_TOGGLE, "<StockItem>", WIRESHARK_STOCK_TIME,},
788 {"/Edit/Un-Time Reference All Packets", "<alt><control>T", GTK_MENU_FUNC(new_packet_list_untime_reference_all_frames_cb), 0, NULL, NULL,},
789 {"/Edit/Time Shift...", NULL, GTK_MENU_FUNC(time_shift_cb), 0, "<StockItem>", WIRESHARK_STOCK_TIME,},
790 {"/Edit/Find Next Time Reference", "<alt><control>N", GTK_MENU_FUNC(reftime_frame_cb), REFTIME_FIND_NEXT, NULL, NULL,},
791 {"/Edit/Find Previous Time Reference", "<alt><control>B", GTK_MENU_FUNC(reftime_frame_cb), REFTIME_FIND_PREV, NULL, NULL,},
792 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
793 #ifdef WANT_PACKET_EDITOR
794 {"/Edit/Edit packet", NULL, GTK_MENU_FUNC(edit_window_cb), 0, NULL, NULL, },
795 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
797 {"/Edit/_Configuration Profiles...", "<shift><control>A", GTK_MENU_FUNC(profile_dialog_cb), 0, NULL, NULL,},
798 {"/Edit/_Preferences...", "<shift><control>P", GTK_MENU_FUNC(prefs_page_cb),
799 PREFS_PAGE_USER_INTERFACE, "<StockItem>", GTK_STOCK_PREFERENCES,},
800 {"/_View", NULL, NULL, 0, "<Branch>", NULL,},
801 {"/View/_Main Toolbar", NULL, GTK_MENU_FUNC(show_hide_cb), SHOW_HIDE_MAIN_TOOLBAR, "<CheckItem>", NULL,},
802 {"/View/_Filter Toolbar", NULL, GTK_MENU_FUNC(show_hide_cb), SHOW_HIDE_FILTER_TOOLBAR, "<CheckItem>", NULL,},
804 {"/View/_Wireless Toolbar", NULL, GTK_MENU_FUNC(show_hide_cb), SHOW_HIDE_AIRPCAP_TOOLBAR, "<CheckItem>", NULL,},
806 {"/View/_Statusbar", NULL, GTK_MENU_FUNC(show_hide_cb), SHOW_HIDE_STATUSBAR, "<CheckItem>", NULL,},
807 {"/View/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
808 {"/View/Packet _List", NULL, GTK_MENU_FUNC(show_hide_cb), SHOW_HIDE_PACKET_LIST, "<CheckItem>", NULL,},
809 {"/View/Packet _Details", NULL, GTK_MENU_FUNC(show_hide_cb), SHOW_HIDE_TREE_VIEW, "<CheckItem>", NULL,},
810 {"/View/Packet _Bytes", NULL, GTK_MENU_FUNC(show_hide_cb), SHOW_HIDE_BYTE_VIEW, "<CheckItem>", NULL,},
811 {"/View/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
812 {"/View/_Time Display Format", NULL, NULL, 0, "<Branch>", NULL,},
813 {"/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),
814 TS_ABSOLUTE_WITH_DATE, "<RadioItem>", NULL,},
815 {"/View/Time Display Format/Time of Day: 01:02:03.123456", "<alt><control>2", GTK_MENU_FUNC(timestamp_format_cb),
816 TS_ABSOLUTE, "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456", NULL,},
817 {"/View/Time Display Format/Seconds Since Epoch (1970-01-01): 1234567890.123456", "<alt><control>3", GTK_MENU_FUNC(timestamp_format_cb),
818 TS_EPOCH, "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456", NULL,},
819 {"/View/Time Display Format/Seconds Since Beginning of Capture: 123.123456", "<alt><control>4", GTK_MENU_FUNC(timestamp_format_cb),
820 TS_RELATIVE, "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456", NULL,},
821 {"/View/Time Display Format/Seconds Since Previous Captured Packet: 1.123456", "<alt><control>5", GTK_MENU_FUNC(timestamp_format_cb),
822 TS_DELTA, "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456", NULL,},
823 {"/View/Time Display Format/Seconds Since Previous Displayed Packet: 1.123456", "<alt><control>6", GTK_MENU_FUNC(timestamp_format_cb),
824 TS_DELTA_DIS, "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456", NULL,},
825 {"/View/Time Display Format/UTC Date and Time of Day: 1970-01-01 01:02:03.123456", "<alt><control>7", GTK_MENU_FUNC(timestamp_format_cb),
826 TS_UTC_WITH_DATE, "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456", NULL,},
827 {"/View/Time Display Format/UTC Time of Day: 01:02:03.123456", "<alt><control>8", GTK_MENU_FUNC(timestamp_format_cb),
828 TS_UTC, "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456", NULL,},
829 {"/View/Time Display Format/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
830 {"/View/Time Display Format/Automatic (File Format Precision)", NULL, GTK_MENU_FUNC(timestamp_precision_cb),
831 TS_PREC_AUTO, "<RadioItem>", NULL,},
832 {"/View/Time Display Format/Seconds: 0", NULL, GTK_MENU_FUNC(timestamp_precision_cb),
833 TS_PREC_FIXED_SEC, "/View/Time Display Format/Automatic (File Format Precision)", NULL,},
834 {"/View/Time Display Format/Deciseconds: 0.1", NULL, GTK_MENU_FUNC(timestamp_precision_cb),
835 TS_PREC_FIXED_DSEC, "/View/Time Display Format/Automatic (File Format Precision)", NULL,},
836 {"/View/Time Display Format/Centiseconds: 0.12", NULL, GTK_MENU_FUNC(timestamp_precision_cb),
837 TS_PREC_FIXED_CSEC, "/View/Time Display Format/Automatic (File Format Precision)", NULL,},
838 {"/View/Time Display Format/Milliseconds: 0.123", NULL, GTK_MENU_FUNC(timestamp_precision_cb),
839 TS_PREC_FIXED_MSEC, "/View/Time Display Format/Automatic (File Format Precision)", NULL,},
840 {"/View/Time Display Format/Microseconds: 0.123456", NULL, GTK_MENU_FUNC(timestamp_precision_cb),
841 TS_PREC_FIXED_USEC, "/View/Time Display Format/Automatic (File Format Precision)", NULL,},
842 {"/View/Time Display Format/Nanoseconds: 0.123456789", NULL, GTK_MENU_FUNC(timestamp_precision_cb),
843 TS_PREC_FIXED_NSEC, "/View/Time Display Format/Automatic (File Format Precision)", NULL,},
844 {"/View/Time Display Format/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
845 {"/View/Time Display Format/Display Seconds with hours and minutes", "<alt><control>0", GTK_MENU_FUNC(timestamp_seconds_time_cb), 0, "<CheckItem>", NULL,},
846 {"/View/Name Resol_ution", NULL, NULL, 0, "<Branch>", NULL,},
847 {"/View/Name Resolution/_Resolve Name", NULL, GTK_MENU_FUNC(resolve_name_cb), 0, NULL, NULL,},
848 {"/View/Name Resolution/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
849 {"/View/Name Resolution/Enable for _MAC Layer", NULL, GTK_MENU_FUNC(name_resolution_cb), RESOLV_MAC, "<CheckItem>", NULL,},
850 {"/View/Name Resolution/Enable for _Network Layer", NULL, GTK_MENU_FUNC(name_resolution_cb), RESOLV_NETWORK, "<CheckItem>", NULL,},
851 {"/View/Name Resolution/Enable for _Transport Layer", NULL, GTK_MENU_FUNC(name_resolution_cb), RESOLV_TRANSPORT, "<CheckItem>", NULL,},
852 {"/View/Colorize Packet List", NULL, colorize_cb, 0, "<CheckItem>", NULL,},
854 {"/View/Auto Scroll in Li_ve Capture", NULL, GTK_MENU_FUNC(auto_scroll_live_cb), 0, "<CheckItem>", NULL,},
856 {"/View/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
857 {"/View/_Zoom In", "<control>plus", GTK_MENU_FUNC(view_zoom_in_cb),
858 0, "<StockItem>", GTK_STOCK_ZOOM_IN,},
859 {"/View/Zoom _Out", "<control>minus", GTK_MENU_FUNC(view_zoom_out_cb),
860 0, "<StockItem>", GTK_STOCK_ZOOM_OUT,},
861 {"/View/_Normal Size", "<control>equal", GTK_MENU_FUNC(view_zoom_100_cb),
862 0, "<StockItem>", GTK_STOCK_ZOOM_100,},
863 {"/View/Resize All Columns", "<shift><control>R", GTK_MENU_FUNC(new_packet_list_resize_columns_cb),
864 0, "<StockItem>", WIRESHARK_STOCK_RESIZE_COLUMNS,},
865 {"/View/Displayed Columns", NULL, NULL, 0, NULL, NULL,},
866 {"/View/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
867 {"/View/E_xpand Subtrees", "<shift>Right", GTK_MENU_FUNC(expand_tree_cb), 0, NULL, NULL,},
868 {"/View/_Expand All", "<control>Right", GTK_MENU_FUNC(expand_all_cb),
870 {"/View/Collapse _All", "<control>Left", GTK_MENU_FUNC(collapse_all_cb),
872 {"/View/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
873 {"/View/Colorize Conversation", NULL, NULL, 0, "<Branch>",NULL,},
874 {"/View/Colorize Conversation/Color 1", "<control>1",
875 GTK_MENU_FUNC(colorize_conversation_cb), 1*256, "<StockItem>", WIRESHARK_STOCK_COLOR1,},
876 {"/View/Colorize Conversation/Color 2", "<control>2",
877 GTK_MENU_FUNC(colorize_conversation_cb), 2*256, "<StockItem>", WIRESHARK_STOCK_COLOR2,},
878 {"/View/Colorize Conversation/Color 3", "<control>3",
879 GTK_MENU_FUNC(colorize_conversation_cb), 3*256, "<StockItem>", WIRESHARK_STOCK_COLOR3,},
880 {"/View/Colorize Conversation/Color 4", "<control>4",
881 GTK_MENU_FUNC(colorize_conversation_cb), 4*256, "<StockItem>", WIRESHARK_STOCK_COLOR4,},
882 {"/View/Colorize Conversation/Color 5", "<control>5",
883 GTK_MENU_FUNC(colorize_conversation_cb), 5*256, "<StockItem>", WIRESHARK_STOCK_COLOR5,},
884 {"/View/Colorize Conversation/Color 6", "<control>6",
885 GTK_MENU_FUNC(colorize_conversation_cb), 6*256, "<StockItem>", WIRESHARK_STOCK_COLOR6,},
886 {"/View/Colorize Conversation/Color 7", "<control>7",
887 GTK_MENU_FUNC(colorize_conversation_cb), 7*256, "<StockItem>", WIRESHARK_STOCK_COLOR7,},
888 {"/View/Colorize Conversation/Color 8", "<control>8",
889 GTK_MENU_FUNC(colorize_conversation_cb), 8*256, "<StockItem>", WIRESHARK_STOCK_COLOR8,},
890 {"/View/Colorize Conversation/Color 9", "<control>9",
891 GTK_MENU_FUNC(colorize_conversation_cb), 9*256, "<StockItem>", WIRESHARK_STOCK_COLOR9,},
892 {"/View/Colorize Conversation/Color 10", "<control>0",
893 GTK_MENU_FUNC(colorize_conversation_cb), 10*256, "<StockItem>", WIRESHARK_STOCK_COLOR0,},
894 {"/View/Colorize Conversation/<separator>", NULL,
895 NULL, 0, "<Separator>",NULL,},
896 {"/View/Colorize Conversation/New Coloring Rule...", NULL,
897 GTK_MENU_FUNC(colorize_conversation_cb), 0, "<StockItem>", GTK_STOCK_SELECT_COLOR,},
898 {"/View/Reset Coloring 1-10", "<control>space",
899 GTK_MENU_FUNC(colorize_conversation_cb), 255*256, NULL, NULL,},
900 {"/View/_Coloring Rules...", NULL, color_display_cb,
901 0, "<StockItem>", GTK_STOCK_SELECT_COLOR,},
902 {"/View/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
905 {"/View/Show Packet in New _Window", NULL,
906 GTK_MENU_FUNC(new_window_cb), 0, NULL, NULL,},
907 {"/View/_Reload", "<control>R", GTK_MENU_FUNC(file_reload_cmd_cb),
908 0, "<StockItem>", GTK_STOCK_REFRESH,},
909 {"/_Go", NULL, NULL, 0, "<Branch>", NULL,},
910 {"/Go/_Back", "<alt>Left",
911 GTK_MENU_FUNC(history_back_cb), 0, "<StockItem>", GTK_STOCK_GO_BACK,},
912 {"/Go/_Forward", "<alt>Right",
913 GTK_MENU_FUNC(history_forward_cb), 0, "<StockItem>", GTK_STOCK_GO_FORWARD,},
914 {"/Go/_Go to Packet...", "<control>G",
915 GTK_MENU_FUNC(goto_frame_cb), 0, "<StockItem>", GTK_STOCK_JUMP_TO,},
916 {"/Go/Go to _Corresponding Packet", NULL, GTK_MENU_FUNC(goto_framenum_cb),
918 {"/Go/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
919 {"/Go/Previous Packet", "<control>Up",
920 GTK_MENU_FUNC(goto_previous_frame_cb), 0, "<StockItem>", GTK_STOCK_GO_UP,},
921 {"/Go/Next Packet", "<control>Down",
922 GTK_MENU_FUNC(goto_next_frame_cb), 0, "<StockItem>", GTK_STOCK_GO_DOWN,},
923 {"/Go/F_irst Packet", "<control>Home",
924 GTK_MENU_FUNC(goto_top_frame_cb), 0, "<StockItem>", GTK_STOCK_GOTO_TOP,},
925 {"/Go/_Last Packet", "<control>End",
926 GTK_MENU_FUNC(goto_bottom_frame_cb), 0, "<StockItem>", GTK_STOCK_GOTO_BOTTOM,},
927 {"/Go/Previous Packet In Conversation", "<control>comma",
928 GTK_MENU_FUNC(goto_previous_frame_conversation_cb), 0, NULL, NULL,},
929 {"/Go/Next Packet In Conversation", "<control>period",
930 GTK_MENU_FUNC(goto_next_frame_conversation_cb), 0, NULL, NULL,},
932 {"/_Capture", NULL, NULL, 0, "<Branch>", NULL,},
933 {"/Capture/_Interfaces...", "<control>I",
934 GTK_MENU_FUNC(capture_if_cb), 0, "<StockItem>", WIRESHARK_STOCK_CAPTURE_INTERFACES,},
935 {"/Capture/_Options...", "<control>K",
936 GTK_MENU_FUNC(capture_prep_cb), 0, "<StockItem>", WIRESHARK_STOCK_CAPTURE_OPTIONS,},
937 {"/Capture/_Start", "<control>E",
938 GTK_MENU_FUNC(capture_start_cb), 0, "<StockItem>", WIRESHARK_STOCK_CAPTURE_START,},
939 {"/Capture/S_top", "<control>E", GTK_MENU_FUNC(capture_stop_cb),
940 0, "<StockItem>", WIRESHARK_STOCK_CAPTURE_STOP,},
941 {"/Capture/_Restart", "<control>R", GTK_MENU_FUNC(capture_restart_cb),
942 0, "<StockItem>", WIRESHARK_STOCK_CAPTURE_RESTART,},
943 {"/Capture/Capture _Filters...", NULL, GTK_MENU_FUNC(cfilter_dialog_cb),
944 0, "<StockItem>", WIRESHARK_STOCK_CAPTURE_FILTER,},
945 #endif /* HAVE_LIBPCAP */
946 {"/_Analyze", NULL, NULL, 0, "<Branch>", NULL,},
947 {"/Analyze/_Display Filters...", NULL, GTK_MENU_FUNC(dfilter_dialog_cb),
948 0, "<StockItem>", WIRESHARK_STOCK_DISPLAY_FILTER,},
949 {"/Analyze/Display Filter _Macros...", NULL, GTK_MENU_FUNC(macros_dialog_cb), 0, NULL, NULL,},
950 {"/Analyze/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
951 {"/Analyze/Apply as Column", NULL, GTK_MENU_FUNC(apply_as_custom_column_cb), 0, NULL, NULL},
952 {"/Analyze/Appl_y as Filter", NULL, NULL, 0, "<Branch>", NULL,},
953 {"/Analyze/Apply as Filter/_Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
954 MATCH_SELECTED_REPLACE|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
955 {"/Analyze/Apply as Filter/_Not Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
956 MATCH_SELECTED_NOT|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
957 {"/Analyze/Apply as Filter/" UTF8_HORIZONTAL_ELLIPSIS " _and Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
958 MATCH_SELECTED_AND|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
959 {"/Analyze/Apply as Filter/" UTF8_HORIZONTAL_ELLIPSIS " _or Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
960 MATCH_SELECTED_OR|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
961 {"/Analyze/Apply as Filter/" UTF8_HORIZONTAL_ELLIPSIS " a_nd not Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
962 MATCH_SELECTED_AND_NOT|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
963 {"/Analyze/Apply as Filter/" UTF8_HORIZONTAL_ELLIPSIS " o_r not Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
964 MATCH_SELECTED_OR_NOT|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
965 {"/Analyze/_Prepare a Filter", NULL, NULL, 0, "<Branch>", NULL,},
966 {"/Analyze/Prepare a Filter/_Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
967 MATCH_SELECTED_REPLACE, NULL, NULL,},
968 {"/Analyze/Prepare a Filter/_Not Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
969 MATCH_SELECTED_NOT, NULL, NULL,},
970 {"/Analyze/Prepare a Filter/" UTF8_HORIZONTAL_ELLIPSIS " _and Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
971 MATCH_SELECTED_AND, NULL, NULL,},
972 {"/Analyze/Prepare a Filter/" UTF8_HORIZONTAL_ELLIPSIS " _or Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
973 MATCH_SELECTED_OR, NULL, NULL,},
974 {"/Analyze/Prepare a Filter/" UTF8_HORIZONTAL_ELLIPSIS " a_nd not Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
975 MATCH_SELECTED_AND_NOT, NULL, NULL,},
976 {"/Analyze/Prepare a Filter/" UTF8_HORIZONTAL_ELLIPSIS " o_r not Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
977 MATCH_SELECTED_OR_NOT, NULL, NULL,},
978 {"/Analyze/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
979 {"/Analyze/_Enabled Protocols...", "<shift><control>E", GTK_MENU_FUNC(proto_cb),
980 0, "<StockItem>", WIRESHARK_STOCK_CHECKBOX,},
981 {"/Analyze/Decode _As...", NULL, GTK_MENU_FUNC(decode_as_cb),
982 0, "<StockItem>", WIRESHARK_STOCK_DECODE_AS,},
983 {"/Analyze/_User Specified Decodes...", NULL,
984 GTK_MENU_FUNC(decode_show_cb), 0, "<StockItem>", WIRESHARK_STOCK_DECODE_AS,},
985 {"/Analyze/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
986 {"/Analyze/_Follow TCP Stream", NULL,
987 GTK_MENU_FUNC(follow_tcp_stream_cb), 0, NULL, NULL,},
988 {"/Analyze/_Follow UDP Stream", NULL,
989 GTK_MENU_FUNC(follow_udp_stream_cb), 0, NULL, NULL,},
990 {"/Analyze/_Follow SSL Stream", NULL,
991 GTK_MENU_FUNC(follow_ssl_stream_cb), 0, NULL, NULL,},
992 {"/_Statistics", NULL, NULL, 0, "<Branch>", NULL,},
993 {"/Statistics/_Summary", NULL, GTK_MENU_FUNC(summary_open_cb), 0, "<StockItem>", GTK_STOCK_PROPERTIES,},
994 {"/Statistics/_Protocol Hierarchy", NULL,
995 GTK_MENU_FUNC(proto_hier_stats_cb), 0, NULL, NULL,},
996 {"/Statistics/Conversations", NULL,
997 GTK_MENU_FUNC(init_conversation_notebook_cb), 0, "<StockItem>", WIRESHARK_STOCK_CONVERSATIONS,},
998 {"/Statistics/Endpoints", NULL,
999 GTK_MENU_FUNC(init_hostlist_notebook_cb), 0, "<StockItem>", WIRESHARK_STOCK_ENDPOINTS,},
1000 {"/Telephon_y", NULL, NULL, 0, "<Branch>", NULL,},
1001 {"/_Tools", NULL, NULL, 0, "<Branch>", NULL,},
1002 {"/Tools/Firewall ACL Rules", NULL,
1003 firewall_rule_cb, 0, NULL, NULL,},
1004 {"/_Internals", NULL, NULL, 0, "<Branch>", NULL,},
1005 {"/Internals/_Dissector tables", NULL, GTK_MENU_FUNC(dissector_tables_dlg_cb), 0, NULL, NULL,},
1006 {"/Internals/_Supported Protocols (slow!)", NULL, GTK_MENU_FUNC(supported_cb), 0, NULL, NULL,},
1007 {"/_Help", NULL, NULL, 0, "<Branch>", NULL,},
1008 {"/Help/_Contents", "F1", GTK_MENU_FUNC(topic_menu_cb), HELP_CONTENT, "<StockItem>", GTK_STOCK_HELP,},
1009 {"/Help/Manual Pages", NULL, NULL, 0, "<Branch>", NULL,},
1010 {"/Help/Manual Pages/Wireshark", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_WIRESHARK, NULL, NULL,},
1011 {"/Help/Manual Pages/Wireshark Filter", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_WIRESHARK_FILTER, NULL, NULL,},
1012 {"/Help/Manual Pages/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1013 {"/Help/Manual Pages/TShark", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_TSHARK, NULL, NULL,},
1014 {"/Help/Manual Pages/RawShark", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_RAWSHARK, NULL, NULL,},
1015 {"/Help/Manual Pages/Dumpcap", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_DUMPCAP, NULL, NULL,},
1016 {"/Help/Manual Pages/Mergecap", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_MERGECAP, NULL, NULL,},
1017 {"/Help/Manual Pages/Editcap", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_EDITCAP, NULL, NULL,},
1018 {"/Help/Manual Pages/Text2pcap", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_TEXT2PCAP, NULL, NULL,},
1019 {"/Help/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1020 {"/Help/Website", NULL, GTK_MENU_FUNC(topic_menu_cb), ONLINEPAGE_HOME, "<StockItem>", GTK_STOCK_HOME,},
1021 {"/Help/FAQ's", NULL, GTK_MENU_FUNC(topic_menu_cb), ONLINEPAGE_FAQ, NULL, NULL,},
1022 {"/Help/Downloads", NULL, GTK_MENU_FUNC(topic_menu_cb), ONLINEPAGE_DOWNLOAD, NULL, NULL,},
1023 {"/Help/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1024 {"/Help/Wiki", NULL, GTK_MENU_FUNC(topic_menu_cb), ONLINEPAGE_WIKI, "<StockItem>", WIRESHARK_STOCK_WIKI,},
1025 {"/Help/Sample Captures", NULL, GTK_MENU_FUNC(topic_menu_cb), ONLINEPAGE_SAMPLE_FILES, NULL, NULL,},
1026 {"/Help/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1027 {"/Help/_About Wireshark", NULL, GTK_MENU_FUNC(about_wireshark_cb),
1028 0, "<StockItem>", WIRESHARK_STOCK_ABOUT}
1031 /* calculate the number of menu_items */
1032 static int nmenu_items = sizeof(menu_items) / sizeof(menu_items[0]);
1036 select_bytes_view_cb (GtkRadioAction *action, GtkRadioAction *current _U_, gpointer user_data _U_)
1040 value = gtk_radio_action_get_current_value (action);
1042 select_bytes_view( NULL, NULL, value);
1046 sort_ascending_cb(GtkAction *action _U_, gpointer user_data)
1048 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/SortAscending");
1049 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_SORT_ASCENDING);
1053 sort_descending_cb(GtkAction *action _U_, gpointer user_data)
1055 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/SortDescending");
1056 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_SORT_DESCENDING);
1060 no_sorting_cb(GtkAction *action _U_, gpointer user_data)
1062 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/NoSorting");
1063 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_SORT_NONE);
1067 packet_list_heading_show_resolved_cb(GtkAction *action _U_, gpointer user_data _U_)
1069 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/ShowResolved");
1071 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_TOGGLE_RESOLVED);
1075 packet_list_heading_align_left_cb(GtkAction *action _U_, gpointer user_data)
1077 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/AlignLeft");
1078 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_ALIGN_LEFT);
1082 packet_list_heading_align_center_cb(GtkAction *action _U_, gpointer user_data)
1084 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/AlignCenter");
1085 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_ALIGN_CENTER);
1089 packet_list_heading_align_right_cb(GtkAction *action _U_, gpointer user_data)
1091 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/AlignRight");
1092 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_ALIGN_RIGHT);
1096 packet_list_heading_col_pref_cb(GtkAction *action _U_, gpointer user_data)
1098 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/ColumnPreferences");
1099 prefs_page_cb( widget , user_data, PREFS_PAGE_COLUMNS);
1103 packet_list_heading_resize_col_cb(GtkAction *action _U_, gpointer user_data)
1105 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/ResizeColumn");
1106 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_RESIZE);
1110 packet_list_heading_change_col_cb(GtkAction *action _U_, gpointer user_data)
1112 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/EditColumnDetails");
1113 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_CHANGE);
1117 packet_list_heading_activate_all_columns_cb(GtkAction *action _U_, gpointer user_data _U_)
1119 new_packet_list_set_all_columns_visible ();
1123 packet_list_heading_hide_col_cb(GtkAction *action _U_, gpointer user_data)
1125 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/HideColumn");
1126 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_HIDE);
1130 packet_list_heading_remove_col_cb(GtkAction *action _U_, gpointer user_data)
1132 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/RemoveColumn");
1133 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_REMOVE);
1137 packet_list_menu_set_ref_time_cb(GtkAction *action _U_, gpointer user_data)
1139 reftime_frame_cb( NULL /* widget _U_ */ , user_data, REFTIME_TOGGLE);
1144 packet_list_menu_apply_selected_cb(GtkAction *action _U_, gpointer user_data)
1146 match_selected_plist_cb( NULL /* widget _U_ */, user_data, MATCH_SELECTED_REPLACE|MATCH_SELECTED_APPLY_NOW);
1150 packet_list_menu_apply_not_selected_cb(GtkAction *action _U_, gpointer user_data)
1152 match_selected_plist_cb( NULL /* widget _U_ */ , user_data, MATCH_SELECTED_NOT|MATCH_SELECTED_APPLY_NOW);
1156 packet_list_menu_apply_and_selected_cb(GtkAction *action _U_, gpointer user_data)
1158 match_selected_plist_cb( NULL /* widget _U_ */ , user_data, MATCH_SELECTED_AND|MATCH_SELECTED_APPLY_NOW);
1162 packet_list_menu_apply_or_selected_cb(GtkAction *action _U_, gpointer user_data)
1164 match_selected_plist_cb( NULL /* widget _U_ */ , user_data, MATCH_SELECTED_OR|MATCH_SELECTED_APPLY_NOW);
1168 packet_list_menu_apply_and_not_selected_cb(GtkAction *action _U_, gpointer user_data)
1170 match_selected_plist_cb( NULL /* widget _U_ */ , user_data, MATCH_SELECTED_AND_NOT|MATCH_SELECTED_APPLY_NOW);
1174 packet_list_menu_apply_or_not_selected_cb(GtkAction *action _U_, gpointer user_data)
1176 match_selected_plist_cb( NULL /* widget _U_ */ , user_data,MATCH_SELECTED_OR_NOT|MATCH_SELECTED_APPLY_NOW);
1178 /* Prepare a filter */
1180 packet_list_menu_prepare_selected_cb(GtkAction *action _U_, gpointer user_data)
1182 match_selected_plist_cb( NULL /* widget _U_ */ , user_data, MATCH_SELECTED_REPLACE);
1186 packet_list_menu_prepare_not_selected_cb(GtkAction *action _U_, gpointer user_data)
1188 match_selected_plist_cb( NULL /* widget _U_ */ , user_data, MATCH_SELECTED_NOT);
1192 packet_list_menu_prepare_and_selected_cb(GtkAction *action _U_, gpointer user_data)
1194 match_selected_plist_cb( NULL /* widget _U_ */ , user_data, MATCH_SELECTED_AND);
1198 packet_list_menu_prepare_or_selected_cb(GtkAction *action _U_, gpointer user_data)
1200 match_selected_plist_cb( NULL /* widget _U_ */ , user_data, MATCH_SELECTED_OR);
1204 packet_list_menu_prepare_and_not_selected_cb(GtkAction *action _U_, gpointer user_data)
1206 match_selected_plist_cb( NULL /* widget _U_ */ , user_data, MATCH_SELECTED_AND_NOT);
1210 packet_list_menu_prepare_or_not_selected_cb(GtkAction *action _U_, gpointer user_data)
1212 match_selected_plist_cb( NULL /* widget _U_ */ , user_data, MATCH_SELECTED_OR_NOT);
1216 packet_list_menu_conversation_ethernet_cb(GtkAction *action, gpointer user_data)
1218 conversation_cb( action, user_data, CONV_ETHER);
1222 packet_list_menu_conversation_ip_cb(GtkAction *action _U_, gpointer user_data)
1224 conversation_cb( action, user_data, CONV_IP);
1228 packet_list_menu_conversation_tcp_cb(GtkAction *action _U_, gpointer user_data)
1230 conversation_cb( action, user_data, CONV_TCP);
1234 packet_list_menu_conversation_udp_cb(GtkAction *action _U_, gpointer user_data)
1236 conversation_cb( action, user_data, CONV_UDP);
1240 packet_list_menu_conversation_pn_cba_cb(GtkAction *action _U_, gpointer user_data)
1242 conversation_cb( action, user_data, CONV_CBA);
1248 packet_list_menu_color_conv_ethernet_color1_cb(GtkAction *action _U_, gpointer user_data)
1250 colorize_conversation_cb( NULL /* widget _U_ */, user_data, CONV_ETHER+1*256);
1254 packet_list_menu_color_conv_ethernet_color2_cb(GtkAction *action _U_, gpointer user_data)
1256 colorize_conversation_cb( NULL/* widget _U_ */ , user_data, CONV_ETHER+1*256);
1260 packet_list_menu_color_conv_ethernet_color3_cb(GtkAction *action _U_, gpointer user_data)
1262 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_ETHER+3*256);
1266 packet_list_menu_color_conv_ethernet_color4_cb(GtkAction *action _U_, gpointer user_data)
1268 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_ETHER+4*256);
1272 packet_list_menu_color_conv_ethernet_color5_cb(GtkAction *action _U_, gpointer user_data)
1274 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_ETHER+5*256);
1278 packet_list_menu_color_conv_ethernet_color6_cb(GtkAction *action _U_, gpointer user_data)
1280 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_ETHER+6*256);
1284 packet_list_menu_color_conv_ethernet_color7_cb(GtkAction *action _U_, gpointer user_data)
1286 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_ETHER+7*256);
1290 packet_list_menu_color_conv_ethernet_color8_cb(GtkAction *action _U_, gpointer user_data)
1292 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_ETHER+8*256);
1296 packet_list_menu_color_conv_ethernet_color9_cb(GtkAction *action _U_, gpointer user_data)
1298 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_ETHER+9*256);
1302 packet_list_menu_color_conv_ethernet_color10_cb(GtkAction *action _U_, gpointer user_data)
1304 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_ETHER+10*256);
1308 packet_list_menu_color_conv_ethernet_new_rule_cb(GtkAction *action _U_, gpointer user_data)
1310 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_ETHER);
1316 packet_list_menu_color_conv_ip_color1_cb(GtkAction *action _U_, gpointer user_data)
1318 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_IP+1*256);
1322 packet_list_menu_color_conv_ip_color2_cb(GtkAction *action _U_, gpointer user_data)
1324 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_IP+1*256);
1328 packet_list_menu_color_conv_ip_color3_cb(GtkAction *action _U_, gpointer user_data)
1330 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_IP+3*256);
1334 packet_list_menu_color_conv_ip_color4_cb(GtkAction *action _U_, gpointer user_data)
1336 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_IP+4*256);
1340 packet_list_menu_color_conv_ip_color5_cb(GtkAction *action _U_, gpointer user_data)
1342 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_IP+5*256);
1346 packet_list_menu_color_conv_ip_color6_cb(GtkAction *action _U_, gpointer user_data)
1348 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_IP+6*256);
1352 packet_list_menu_color_conv_ip_color7_cb(GtkAction *action _U_, gpointer user_data)
1354 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_IP+7*256);
1358 packet_list_menu_color_conv_ip_color8_cb(GtkAction *action _U_, gpointer user_data)
1360 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_IP+8*256);
1364 packet_list_menu_color_conv_ip_color9_cb(GtkAction *action _U_, gpointer user_data)
1366 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_IP+9*256);
1370 packet_list_menu_color_conv_ip_color10_cb(GtkAction *action _U_, gpointer user_data)
1372 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_IP+10*256);
1376 packet_list_menu_color_conv_ip_new_rule_cb(GtkAction *action _U_, gpointer user_data)
1378 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_TCP);
1384 packet_list_menu_color_conv_tcp_color1_cb(GtkAction *action _U_, gpointer user_data)
1386 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_TCP+1*256);
1390 packet_list_menu_color_conv_tcp_color2_cb(GtkAction *action _U_, gpointer user_data)
1392 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_TCP+1*256);
1396 packet_list_menu_color_conv_tcp_color3_cb(GtkAction *action _U_, gpointer user_data)
1398 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_TCP+3*256);
1402 packet_list_menu_color_conv_tcp_color4_cb(GtkAction *action _U_, gpointer user_data)
1404 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_TCP+4*256);
1408 packet_list_menu_color_conv_tcp_color5_cb(GtkAction *action _U_, gpointer user_data)
1410 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_TCP+5*256);
1414 packet_list_menu_color_conv_tcp_color6_cb(GtkAction *action _U_, gpointer user_data)
1416 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_TCP+6*256);
1420 packet_list_menu_color_conv_tcp_color7_cb(GtkAction *action _U_, gpointer user_data)
1422 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_TCP+7*256);
1426 packet_list_menu_color_conv_tcp_color8_cb(GtkAction *action _U_, gpointer user_data)
1428 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_TCP+8*256);
1432 packet_list_menu_color_conv_tcp_color9_cb(GtkAction *action _U_, gpointer user_data)
1434 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_TCP+9*256);
1438 packet_list_menu_color_conv_tcp_color10_cb(GtkAction *action _U_, gpointer user_data)
1440 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_TCP+10*256);
1444 packet_list_menu_color_conv_tcp_new_rule_cb(GtkAction *action _U_, gpointer user_data)
1446 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_TCP);
1452 packet_list_menu_color_conv_udp_color1_cb(GtkAction *action _U_, gpointer user_data)
1454 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_UDP+1*256);
1458 packet_list_menu_color_conv_udp_color2_cb(GtkAction *action _U_, gpointer user_data)
1460 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_UDP+1*256);
1464 packet_list_menu_color_conv_udp_color3_cb(GtkAction *action _U_, gpointer user_data)
1466 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_UDP+3*256);
1470 packet_list_menu_color_conv_udp_color4_cb(GtkAction *action _U_, gpointer user_data)
1472 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_UDP+4*256);
1476 packet_list_menu_color_conv_udp_color5_cb(GtkAction *action _U_, gpointer user_data)
1478 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_UDP+5*256);
1482 packet_list_menu_color_conv_udp_color6_cb(GtkAction *action _U_, gpointer user_data)
1484 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_UDP+6*256);
1488 packet_list_menu_color_conv_udp_color7_cb(GtkAction *action _U_, gpointer user_data)
1490 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_UDP+7*256);
1494 packet_list_menu_color_conv_udp_color8_cb(GtkAction *action _U_, gpointer user_data)
1496 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_UDP+8*256);
1500 packet_list_menu_color_conv_udp_color9_cb(GtkAction *action _U_, gpointer user_data)
1502 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_UDP+9*256);
1506 packet_list_menu_color_conv_udp_color10_cb(GtkAction *action _U_, gpointer user_data)
1508 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_UDP+10*256);
1512 packet_list_menu_color_conv_udp_new_rule_cb(GtkAction *action _U_, gpointer user_data)
1514 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_UDP);
1520 packet_list_menu_color_conv_cba_color1_cb(GtkAction *action _U_, gpointer user_data)
1522 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_CBA+1*256);
1526 packet_list_menu_color_conv_cba_color2_cb(GtkAction *action _U_, gpointer user_data)
1528 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_CBA+1*256);
1532 packet_list_menu_color_conv_cba_color3_cb(GtkAction *action _U_, gpointer user_data)
1534 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_CBA+3*256);
1538 packet_list_menu_color_conv_cba_color4_cb(GtkAction *action _U_, gpointer user_data)
1540 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_CBA+4*256);
1544 packet_list_menu_color_conv_cba_color5_cb(GtkAction *action _U_, gpointer user_data)
1546 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_CBA+5*256);
1550 packet_list_menu_color_conv_cba_color6_cb(GtkAction *action _U_, gpointer user_data)
1552 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_CBA+6*256);
1556 packet_list_menu_color_conv_cba_color7_cb(GtkAction *action _U_, gpointer user_data)
1558 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_CBA+7*256);
1562 packet_list_menu_color_conv_cba_color8_cb(GtkAction *action _U_, gpointer user_data)
1564 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_CBA+8*256);
1568 packet_list_menu_color_conv_cba_color9_cb(GtkAction *action _U_, gpointer user_data)
1570 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_CBA+9*256);
1574 packet_list_menu_color_conv_cba_color10_cb(GtkAction *action _U_, gpointer user_data)
1576 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_CBA+10*256);
1580 packet_list_menu_color_conv_cba_new_rule_cb(GtkAction *action _U_, gpointer user_data)
1582 colorize_conversation_cb( NULL /* widget _U_ */ , user_data, CONV_CBA);
1586 packet_list_menu_copy_sum_txt(GtkAction *action _U_, gpointer user_data)
1588 new_packet_list_copy_summary_cb(user_data, CS_TEXT);
1592 packet_list_menu_copy_sum_csv(GtkAction *action _U_, gpointer user_data)
1594 new_packet_list_copy_summary_cb(user_data, CS_CSV);
1598 packet_list_menu_copy_as_flt(GtkAction *action _U_, gpointer user_data)
1600 match_selected_plist_cb( NULL /* widget _U_ */ , user_data, MATCH_SELECTED_REPLACE|MATCH_SELECTED_COPY_ONLY);
1604 packet_list_menu_copy_bytes_oht_cb(GtkAction *action _U_, gpointer user_data)
1606 copy_hex_cb( NULL /* widget _U_ */ , user_data, CD_ALLINFO | CD_FLAGS_SELECTEDONLY);
1610 packet_list_menu_copy_bytes_oh_cb(GtkAction *action _U_, gpointer user_data)
1612 copy_hex_cb( NULL /* widget _U_ */ , user_data, CD_HEXCOLUMNS | CD_FLAGS_SELECTEDONLY);
1616 packet_list_menu_copy_bytes_text_cb(GtkAction *action _U_, gpointer user_data)
1618 copy_hex_cb( NULL /* widget _U_ */ , user_data, CD_TEXTONLY | CD_FLAGS_SELECTEDONLY);
1622 packet_list_menu_copy_bytes_hex_strm_cb(GtkAction *action _U_, gpointer user_data)
1624 copy_hex_cb( NULL /* widget _U_ */ , user_data, CD_HEX | CD_FLAGS_SELECTEDONLY);
1628 packet_list_menu_copy_bytes_bin_strm_cb(GtkAction *action _U_, gpointer user_data)
1630 copy_hex_cb( NULL /* widget _U_ */ , user_data, CD_BINARY | CD_FLAGS_SELECTEDONLY);
1636 tree_view_menu_color_with_flt_color1_cb(GtkAction *action _U_, gpointer user_data)
1638 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 1);
1642 tree_view_menu_color_with_flt_color2_cb(GtkAction *action _U_, gpointer user_data)
1644 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 2);
1648 tree_view_menu_color_with_flt_color3_cb(GtkAction *action _U_, gpointer user_data)
1650 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 3);
1654 tree_view_menu_color_with_flt_color4_cb(GtkAction *action _U_, gpointer user_data)
1656 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 4);
1660 tree_view_menu_color_with_flt_color5_cb(GtkAction *action _U_, gpointer user_data)
1662 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 5);
1666 tree_view_menu_color_with_flt_color6_cb(GtkAction *action _U_, gpointer user_data)
1668 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 6);
1672 tree_view_menu_color_with_flt_color7_cb(GtkAction *action _U_, gpointer user_data)
1674 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 7);
1678 tree_view_menu_color_with_flt_color8_cb(GtkAction *action _U_, gpointer user_data)
1680 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 8);
1684 tree_view_menu_color_with_flt_color9_cb(GtkAction *action _U_, gpointer user_data)
1686 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 9);
1690 tree_view_menu_color_with_flt_color10_cb(GtkAction *action _U_, gpointer user_data)
1692 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 10);
1696 tree_view_menu_color_with_flt_new_rule_cb(GtkAction *action _U_, gpointer user_data)
1698 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 0);
1703 tree_view_menu_copy_desc(GtkAction *action _U_, gpointer user_data)
1705 copy_selected_plist_cb( NULL /* widget _U_ */ , user_data, COPY_SELECTED_DESCRIPTION);
1709 tree_view_menu_copy_field(GtkAction *action _U_, gpointer user_data)
1711 copy_selected_plist_cb( NULL /* widget _U_ */ , user_data, COPY_SELECTED_FIELDNAME);
1715 tree_view_menu_copy_value(GtkAction *action _U_, gpointer user_data)
1717 copy_selected_plist_cb( NULL /* widget _U_ */ , user_data, COPY_SELECTED_VALUE);
1721 tree_view_menu_copy_as_flt(GtkAction *action _U_, gpointer user_data)
1723 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/Copy/AsFilter");
1724 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_REPLACE|MATCH_SELECTED_COPY_ONLY);
1727 static const char *ui_desc_packet_list_heading_menu_popup =
1729 " <popup name='PacketListHeadingPopup' action='PopupAction'>\n"
1730 " <menuitem name='SortAscending' action='/Sort Ascending'/>\n"
1731 " <menuitem name='SortDescending' action='/Sort Descending'/>\n"
1732 " <menuitem name='NoSorting' action='/No Sorting'/>\n"
1734 " <menuitem name='ShowResolved' action='/Show Resolved'/>\n"
1736 " <menuitem name='AlignLeft' action='/Align Left'/>\n"
1737 " <menuitem name='AlignCenter' action='/Align Center'/>\n"
1738 " <menuitem name='AlignRight' action='/Align Right'/>\n"
1740 " <menuitem name='ColumnPreferences' action='/Column Preferences'/>\n"
1741 " <menuitem name='EditColumnDetails' action='/Edit Column Details'/>\n"
1742 " <menuitem name='ResizeColumn' action='/Resize Column'/>\n"
1744 " <menu name='DisplayedColumns' action='/Displayed Columns'>\n"
1745 " <menuitem name='Display All' action='/Displayed Columns/Display All'/>\n"
1747 " <menuitem name='HideColumn' action='/Hide Column'/>\n"
1748 " <menuitem name='RemoveColumn' action='/Remove Column'/>\n"
1752 static const GtkActionEntry packet_list_heading_menu_popup_action_entries[] = {
1753 { "/Sort Ascending", GTK_STOCK_SORT_ASCENDING, "Sort Ascending", NULL, NULL, G_CALLBACK(sort_ascending_cb) },
1754 { "/Sort Descending", GTK_STOCK_SORT_DESCENDING, "Sort Descending", NULL, NULL, G_CALLBACK(sort_descending_cb) },
1755 { "/No Sorting", NULL, "No Sorting", NULL, NULL, G_CALLBACK(no_sorting_cb) },
1756 { "/Align Left", GTK_STOCK_JUSTIFY_LEFT, "Align Left", NULL, NULL, G_CALLBACK(packet_list_heading_align_left_cb) },
1757 { "/Align Center", GTK_STOCK_JUSTIFY_CENTER, "Align Center", NULL, NULL, G_CALLBACK(packet_list_heading_align_center_cb) },
1758 { "/Align Right", GTK_STOCK_JUSTIFY_RIGHT, "Align Right", NULL, NULL, G_CALLBACK(packet_list_heading_align_right_cb) },
1759 { "/Column Preferences", GTK_STOCK_PREFERENCES, "Column Preferences...", NULL, NULL, G_CALLBACK(packet_list_heading_col_pref_cb) },
1760 { "/Edit Column Details", WIRESHARK_STOCK_EDIT, "Edit Column Details...", NULL, NULL, G_CALLBACK(packet_list_heading_change_col_cb) },
1761 { "/Resize Column", WIRESHARK_STOCK_RESIZE_COLUMNS, "Resize Column", NULL, NULL, G_CALLBACK(packet_list_heading_resize_col_cb) },
1762 { "/Displayed Columns", NULL, "Displayed Columns", NULL, NULL, NULL },
1763 { "/Displayed Columns/Display All", NULL, "Display All", NULL, NULL, G_CALLBACK(packet_list_heading_activate_all_columns_cb) },
1764 { "/Hide Column", NULL, "Hide Column", NULL, NULL, G_CALLBACK(packet_list_heading_hide_col_cb) },
1765 { "/Remove Column", GTK_STOCK_DELETE, "Remove Column", NULL, NULL, G_CALLBACK(packet_list_heading_remove_col_cb) },
1768 static const GtkToggleActionEntry packet_list_heading_menu_toggle_action_entries[] =
1770 /* name, stock id, label, accel, tooltip, callback, is_active */
1771 {"/Show Resolved", NULL, "Show Resolved", NULL, NULL, G_CALLBACK(packet_list_heading_show_resolved_cb), FALSE},
1774 static const char *ui_desc_packet_list_menu_popup =
1776 " <popup name='PacketListMenuPopup' action='PopupAction'>\n"
1777 " <menuitem name='MarkPacket' action='/MarkPacket'/>\n"
1778 " <menuitem name='IgnorePacket' action='/IgnorePacket'/>\n"
1779 " <menuitem name='SetTimeReference' action='/Set Time Reference'/>\n"
1780 " <menuitem name='TimeShift' action='/TimeShift'/>\n"
1782 " <menuitem name='ManuallyResolveAddress' action='/ManuallyResolveAddress'/>\n"
1784 " <menu name= 'ApplyAsFilter' action='/Apply as Filter'>\n"
1785 " <menuitem name='Selected' action='/Apply as Filter/Selected'/>\n"
1786 " <menuitem name='NotSelected' action='/Apply as Filter/Not Selected'/>\n"
1787 " <menuitem name='AndSelected' action='/Apply as Filter/AndSelected'/>\n"
1788 " <menuitem name='OrSelected' action='/Apply as Filter/OrSelected'/>\n"
1789 " <menuitem name='AndNotSelected' action='/Apply as Filter/AndNotSelected'/>\n"
1790 " <menuitem name='OrNotSelected' action='/Apply as Filter/OrNotSelected'/>\n"
1792 " <menu name= 'PrepareaFilter' action='/Prepare a Filter'>\n"
1793 " <menuitem name='Selected' action='/Prepare a Filter/Selected'/>\n"
1794 " <menuitem name='NotSelected' action='/Prepare a Filter/Not Selected'/>\n"
1795 " <menuitem name='AndSelected' action='/Prepare a Filter/AndSelected'/>\n"
1796 " <menuitem name='OrSelected' action='/Prepare a Filter/OrSelected'/>\n"
1797 " <menuitem name='AndNotSelected' action='/Prepare a Filter/AndNotSelected'/>\n"
1798 " <menuitem name='OrNotSelected' action='/Prepare a Filter/OrNotSelected'/>\n"
1800 " <menu name= 'ConversationFilter' action='/Conversation Filter'>\n"
1801 " <menuitem name='Ethernet' action='/Conversation Filter/Ethernet'/>\n"
1802 " <menuitem name='IP' action='/Conversation Filter/IP'/>\n"
1803 " <menuitem name='TCP' action='/Conversation Filter/TCP'/>\n"
1804 " <menuitem name='UDP' action='/Conversation Filter/UDP'/>\n"
1805 " <menuitem name='PN-CBA' action='/Conversation Filter/PN-CBA'/>\n"
1807 " <menu name= 'ColorizeConversation' action='/Colorize Conversation'>\n"
1808 " <menu name= 'Ethernet' action='/Colorize Conversation/Ethernet'>\n"
1809 " <menuitem name='Color1' action='/Colorize Conversation/Ethernet/Color 1'/>\n"
1810 " <menuitem name='Color2' action='/Colorize Conversation/Ethernet/Color 2'/>\n"
1811 " <menuitem name='Color3' action='/Colorize Conversation/Ethernet/Color 3'/>\n"
1812 " <menuitem name='Color4' action='/Colorize Conversation/Ethernet/Color 4'/>\n"
1813 " <menuitem name='Color5' action='/Colorize Conversation/Ethernet/Color 5'/>\n"
1814 " <menuitem name='Color6' action='/Colorize Conversation/Ethernet/Color 6'/>\n"
1815 " <menuitem name='Color7' action='/Colorize Conversation/Ethernet/Color 7'/>\n"
1816 " <menuitem name='Color8' action='/Colorize Conversation/Ethernet/Color 8'/>\n"
1817 " <menuitem name='Color9' action='/Colorize Conversation/Ethernet/Color 9'/>\n"
1818 " <menuitem name='Color10' action='/Colorize Conversation/Ethernet/Color 10'/>\n"
1819 " <menuitem name='NewColoringRule' action='/Colorize Conversation/Ethernet/New Coloring Rule'/>\n"
1821 " <menu name= 'IP' action='/Colorize Conversation/IP'>\n"
1822 " <menuitem name='Color1' action='/Colorize Conversation/IP/Color 1'/>\n"
1823 " <menuitem name='Color2' action='/Colorize Conversation/IP/Color 2'/>\n"
1824 " <menuitem name='Color3' action='/Colorize Conversation/IP/Color 3'/>\n"
1825 " <menuitem name='Color4' action='/Colorize Conversation/IP/Color 4'/>\n"
1826 " <menuitem name='Color5' action='/Colorize Conversation/IP/Color 5'/>\n"
1827 " <menuitem name='Color6' action='/Colorize Conversation/IP/Color 6'/>\n"
1828 " <menuitem name='Color7' action='/Colorize Conversation/IP/Color 7'/>\n"
1829 " <menuitem name='Color8' action='/Colorize Conversation/IP/Color 8'/>\n"
1830 " <menuitem name='Color9' action='/Colorize Conversation/IP/Color 9'/>\n"
1831 " <menuitem name='Color10' action='/Colorize Conversation/IP/Color 10'/>\n"
1832 " <menuitem name='NewColoringRule' action='/Colorize Conversation/IP/New Coloring Rule'/>\n"
1834 " <menu name= 'TCP' action='/Colorize Conversation/TCP'>\n"
1835 " <menuitem name='Color1' action='/Colorize Conversation/TCP/Color 1'/>\n"
1836 " <menuitem name='Color2' action='/Colorize Conversation/TCP/Color 2'/>\n"
1837 " <menuitem name='Color3' action='/Colorize Conversation/TCP/Color 3'/>\n"
1838 " <menuitem name='Color4' action='/Colorize Conversation/TCP/Color 4'/>\n"
1839 " <menuitem name='Color5' action='/Colorize Conversation/TCP/Color 5'/>\n"
1840 " <menuitem name='Color6' action='/Colorize Conversation/TCP/Color 6'/>\n"
1841 " <menuitem name='Color7' action='/Colorize Conversation/TCP/Color 7'/>\n"
1842 " <menuitem name='Color8' action='/Colorize Conversation/TCP/Color 8'/>\n"
1843 " <menuitem name='Color9' action='/Colorize Conversation/TCP/Color 9'/>\n"
1844 " <menuitem name='Color10' action='/Colorize Conversation/TCP/Color 10'/>\n"
1845 " <menuitem name='NewColoringRule' action='/Colorize Conversation/TCP/New Coloring Rule'/>\n"
1847 " <menu name= 'UDP' action='/Colorize Conversation/UDP'>\n"
1848 " <menuitem name='Color1' action='/Colorize Conversation/UDP/Color 1'/>\n"
1849 " <menuitem name='Color2' action='/Colorize Conversation/UDP/Color 2'/>\n"
1850 " <menuitem name='Color3' action='/Colorize Conversation/UDP/Color 3'/>\n"
1851 " <menuitem name='Color4' action='/Colorize Conversation/UDP/Color 4'/>\n"
1852 " <menuitem name='Color5' action='/Colorize Conversation/UDP/Color 5'/>\n"
1853 " <menuitem name='Color6' action='/Colorize Conversation/UDP/Color 6'/>\n"
1854 " <menuitem name='Color7' action='/Colorize Conversation/UDP/Color 7'/>\n"
1855 " <menuitem name='Color8' action='/Colorize Conversation/UDP/Color 8'/>\n"
1856 " <menuitem name='Color9' action='/Colorize Conversation/UDP/Color 9'/>\n"
1857 " <menuitem name='Color10' action='/Colorize Conversation/UDP/Color 10'/>\n"
1858 " <menuitem name='NewColoringRule' action='/Colorize Conversation/UDP/New Coloring Rule'/>\n"
1860 " <menu name= 'PN-CBA' action='/Colorize Conversation/PN-CBA'>\n"
1861 " <menuitem name='Color1' action='/Colorize Conversation/PN-CBA/Color 1'/>\n"
1862 " <menuitem name='Color2' action='/Colorize Conversation/PN-CBA/Color 2'/>\n"
1863 " <menuitem name='Color3' action='/Colorize Conversation/PN-CBA/Color 3'/>\n"
1864 " <menuitem name='Color4' action='/Colorize Conversation/PN-CBA/Color 4'/>\n"
1865 " <menuitem name='Color5' action='/Colorize Conversation/PN-CBA/Color 5'/>\n"
1866 " <menuitem name='Color6' action='/Colorize Conversation/PN-CBA/Color 6'/>\n"
1867 " <menuitem name='Color7' action='/Colorize Conversation/PN-CBA/Color 7'/>\n"
1868 " <menuitem name='Color8' action='/Colorize Conversation/PN-CBA/Color 8'/>\n"
1869 " <menuitem name='Color9' action='/Colorize Conversation/PN-CBA/Color 9'/>\n"
1870 " <menuitem name='Color10' action='/Colorize Conversation/PN-CBA/Color 10'/>\n"
1871 " <menuitem name='NewColoringRule' action='/Colorize Conversation/PN-CBA/New Coloring Rule'/>\n"
1874 " <menu name= 'SCTP' action='/SCTP'>\n"
1875 " <menuitem name='AnalysethisAssociation' action='/SCTP/Analyse this Association'/>\n"
1876 " <menuitem name='PrepareFilterforthisAssociation' action='/SCTP/Prepare Filter for this Association'/>\n"
1878 " <menuitem name='FollowTCPStream' action='/Follow TCP Stream'/>\n"
1879 " <menuitem name='FollowUDPStream' action='/Follow UDP Stream'/>\n"
1880 " <menuitem name='FollowSSLStream' action='/Follow SSL Stream'/>\n"
1882 " <menu name= 'Copy' action='/Copy'>\n"
1883 " <menuitem name='SummaryTxt' action='/Copy/SummaryTxt'/>\n"
1884 " <menuitem name='SummaryCSV' action='/Copy/SummaryCSV'/>\n"
1885 " <menuitem name='AsFilter' action='/Copy/AsFilter'/>\n"
1887 " <menu name= 'Bytes' action='/Copy/Bytes'>\n"
1888 " <menuitem name='OffsetHexText' action='/Copy/Bytes/OffsetHexText'/>\n"
1889 " <menuitem name='OffsetHex' action='/Copy/Bytes/OffsetHex'/>\n"
1890 " <menuitem name='PrintableTextOnly' action='/Copy/Bytes/PrintableTextOnly'/>\n"
1892 " <menuitem name='HexStream' action='/Copy/Bytes/HexStream'/>\n"
1893 " <menuitem name='BinaryStream' action='/Copy/Bytes/BinaryStream'/>\n"
1897 " <menuitem name='DecodeAs' action='/DecodeAs'/>\n"
1898 " <menuitem name='Print' action='/Print'/>\n"
1899 " <menuitem name='ShowPacketinNewWindow' action='/ShowPacketinNewWindow'/>\n"
1903 static const GtkActionEntry packet_list_menu_popup_action_entries[] = {
1904 { "/MarkPacket", NULL, "Mark Packet (toggle)", NULL, NULL, G_CALLBACK(new_packet_list_mark_frame_cb) },
1905 { "/IgnorePacket", NULL, "Ignore Packet (toggle)", NULL, NULL, G_CALLBACK(new_packet_list_ignore_frame_cb) },
1906 { "/Set Time Reference", WIRESHARK_STOCK_TIME, "Set Time Reference (toggle)", NULL, NULL, G_CALLBACK(packet_list_menu_set_ref_time_cb) },
1907 { "/TimeShift", WIRESHARK_STOCK_TIME, "Time Shift...", NULL, NULL, G_CALLBACK(time_shift_cb) },
1908 { "/ManuallyResolveAddress", NULL, "Manually Resolve Address", NULL, NULL, G_CALLBACK(manual_addr_resolv_dlg) },
1909 { "/Apply as Filter", NULL, "Apply as Filter", NULL, NULL, NULL },
1911 { "/Apply as Filter/Selected", NULL, "_Selected" , NULL, NULL, G_CALLBACK(packet_list_menu_apply_selected_cb) },
1912 { "/Apply as Filter/Not Selected", NULL, "_Not Selected", NULL, NULL, G_CALLBACK(packet_list_menu_apply_not_selected_cb) },
1913 { "/Apply as Filter/AndSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _and Selected", NULL, NULL, G_CALLBACK(packet_list_menu_apply_and_selected_cb) },
1914 { "/Apply as Filter/OrSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _or Selected", NULL, NULL, G_CALLBACK(packet_list_menu_apply_or_selected_cb) },
1915 { "/Apply as Filter/AndNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " a_nd not Selected", NULL, NULL, G_CALLBACK(packet_list_menu_apply_and_not_selected_cb) },
1916 { "/Apply as Filter/OrNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " o_r not Selected", NULL, NULL, G_CALLBACK(packet_list_menu_apply_or_not_selected_cb) },
1918 { "/Prepare a Filter", NULL, "Prepare a Filter", NULL, NULL, NULL },
1919 { "/Prepare a Filter/Selected", NULL, "_Selected" , NULL, NULL, G_CALLBACK(packet_list_menu_prepare_selected_cb) },
1920 { "/Prepare a Filter/Not Selected", NULL, "_Not Selected", NULL, NULL, G_CALLBACK(packet_list_menu_prepare_not_selected_cb) },
1921 { "/Prepare a Filter/AndSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _and Selected", NULL, NULL, G_CALLBACK(packet_list_menu_prepare_and_selected_cb) },
1922 { "/Prepare a Filter/OrSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _or Selected", NULL, NULL, G_CALLBACK(packet_list_menu_prepare_or_selected_cb) },
1923 { "/Prepare a Filter/AndNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " a_nd not Selected", NULL, NULL, G_CALLBACK(packet_list_menu_prepare_and_not_selected_cb) },
1924 { "/Prepare a Filter/OrNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " o_r not Selected", NULL, NULL, G_CALLBACK(packet_list_menu_prepare_or_not_selected_cb) },
1926 { "/Conversation Filter", NULL, "Conversation Filter", NULL, NULL, NULL },
1927 { "/Conversation Filter/Ethernet", NULL, "Ethernet", NULL, NULL, G_CALLBACK(packet_list_menu_conversation_ethernet_cb) },
1928 { "/Conversation Filter/IP", NULL, "IP", NULL, NULL, G_CALLBACK(packet_list_menu_conversation_ip_cb) },
1929 { "/Conversation Filter/TCP", NULL, "TCP", NULL, NULL, G_CALLBACK(packet_list_menu_conversation_tcp_cb) },
1930 { "/Conversation Filter/UDP", NULL, "UDP", NULL, NULL, G_CALLBACK(packet_list_menu_conversation_udp_cb) },
1931 { "/Conversation Filter/PN-CBA", NULL, "PN-CBA", NULL, NULL, G_CALLBACK(packet_list_menu_conversation_pn_cba_cb) },
1933 { "/Colorize Conversation", NULL, "Colorize Conversation", NULL, NULL, NULL },
1935 { "/Colorize Conversation/Ethernet", NULL, "Ethernet", NULL, NULL, NULL },
1937 { "/Colorize Conversation/Ethernet/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color1_cb) },
1938 { "/Colorize Conversation/Ethernet/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color2_cb) },
1939 { "/Colorize Conversation/Ethernet/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color3_cb) },
1940 { "/Colorize Conversation/Ethernet/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color4_cb) },
1941 { "/Colorize Conversation/Ethernet/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color5_cb) },
1942 { "/Colorize Conversation/Ethernet/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color6_cb) },
1943 { "/Colorize Conversation/Ethernet/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color7_cb) },
1944 { "/Colorize Conversation/Ethernet/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color8_cb) },
1945 { "/Colorize Conversation/Ethernet/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color9_cb) },
1946 { "/Colorize Conversation/Ethernet/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color10_cb) },
1947 { "/Colorize Conversation/Ethernet/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_new_rule_cb) },
1949 { "/Colorize Conversation/IP", NULL, "IP", NULL, NULL, NULL },
1951 { "/Colorize Conversation/IP/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color1_cb) },
1952 { "/Colorize Conversation/IP/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color2_cb) },
1953 { "/Colorize Conversation/IP/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color3_cb) },
1954 { "/Colorize Conversation/IP/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color4_cb) },
1955 { "/Colorize Conversation/IP/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color5_cb) },
1956 { "/Colorize Conversation/IP/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color6_cb) },
1957 { "/Colorize Conversation/IP/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color7_cb) },
1958 { "/Colorize Conversation/IP/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color8_cb) },
1959 { "/Colorize Conversation/IP/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color9_cb) },
1960 { "/Colorize Conversation/IP/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color10_cb) },
1961 { "/Colorize Conversation/IP/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_new_rule_cb) },
1963 { "/Colorize Conversation/TCP", NULL, "TCP", NULL, NULL, NULL },
1965 { "/Colorize Conversation/TCP/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color1_cb) },
1966 { "/Colorize Conversation/TCP/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color2_cb) },
1967 { "/Colorize Conversation/TCP/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color3_cb) },
1968 { "/Colorize Conversation/TCP/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color4_cb) },
1969 { "/Colorize Conversation/TCP/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color5_cb) },
1970 { "/Colorize Conversation/TCP/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color6_cb) },
1971 { "/Colorize Conversation/TCP/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color7_cb) },
1972 { "/Colorize Conversation/TCP/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color8_cb) },
1973 { "/Colorize Conversation/TCP/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color9_cb) },
1974 { "/Colorize Conversation/TCP/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color10_cb) },
1975 { "/Colorize Conversation/TCP/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_new_rule_cb) },
1977 { "/Colorize Conversation/UDP", NULL, "UDP", NULL, NULL, NULL },
1979 { "/Colorize Conversation/UDP/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color1_cb) },
1980 { "/Colorize Conversation/UDP/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color2_cb) },
1981 { "/Colorize Conversation/UDP/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color3_cb) },
1982 { "/Colorize Conversation/UDP/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color4_cb) },
1983 { "/Colorize Conversation/UDP/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color5_cb) },
1984 { "/Colorize Conversation/UDP/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color6_cb) },
1985 { "/Colorize Conversation/UDP/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color7_cb) },
1986 { "/Colorize Conversation/UDP/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color8_cb) },
1987 { "/Colorize Conversation/UDP/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color9_cb) },
1988 { "/Colorize Conversation/UDP/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color10_cb) },
1989 { "/Colorize Conversation/UDP/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_new_rule_cb) },
1991 { "/Colorize Conversation/PN-CBA", NULL, "PN-CBA Server", NULL, NULL, NULL },
1993 { "/Colorize Conversation/PN-CBA/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color1_cb) },
1994 { "/Colorize Conversation/PN-CBA/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color2_cb) },
1995 { "/Colorize Conversation/PN-CBA/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color3_cb) },
1996 { "/Colorize Conversation/PN-CBA/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color4_cb) },
1997 { "/Colorize Conversation/PN-CBA/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color5_cb) },
1998 { "/Colorize Conversation/PN-CBA/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color6_cb) },
1999 { "/Colorize Conversation/PN-CBA/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color7_cb) },
2000 { "/Colorize Conversation/PN-CBA/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color8_cb) },
2001 { "/Colorize Conversation/PN-CBA/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color9_cb) },
2002 { "/Colorize Conversation/PN-CBA/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color10_cb) },
2003 { "/Colorize Conversation/PN-CBA/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_new_rule_cb) },
2005 { "/SCTP", NULL, "SCTP", NULL, NULL, NULL },
2006 { "/SCTP/Analyse this Association", NULL, "Analyse this Association", NULL, NULL, G_CALLBACK(sctp_analyse_start) },
2007 { "/SCTP/Prepare Filter for this Association", NULL, "Prepare Filter for this Association", NULL, NULL, G_CALLBACK(sctp_set_assoc_filter) },
2010 { "/Follow TCP Stream", NULL, "Follow TCP Stream", NULL, NULL, G_CALLBACK(follow_tcp_stream_cb) },
2011 { "/Follow UDP Stream", NULL, "Follow UDP Stream", NULL, NULL, G_CALLBACK(follow_udp_stream_cb) },
2012 { "/Follow SSL Stream", NULL, "Follow SSL Stream", NULL, NULL, G_CALLBACK(follow_ssl_stream_cb) },
2014 { "/Copy", NULL, "Copy", NULL, NULL, NULL },
2015 { "/Copy/SummaryTxt", NULL, "Summary (Text)", NULL, NULL, G_CALLBACK(packet_list_menu_copy_sum_txt) },
2016 { "/Copy/SummaryCSV", NULL, "Summary (CSV)", NULL, NULL, G_CALLBACK(packet_list_menu_copy_sum_csv) },
2017 { "/Copy/AsFilter", NULL, "As Filter", NULL, NULL, G_CALLBACK(packet_list_menu_copy_as_flt) },
2020 { "/Copy/Bytes", NULL, "Bytes", NULL, NULL, NULL },
2021 { "/Copy/Bytes/OffsetHexText", NULL, "Offset Hex Text", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_oht_cb) },
2022 { "/Copy/Bytes/OffsetHex", NULL, "Offset Hex", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_oh_cb) },
2023 { "/Copy/Bytes/PrintableTextOnly", NULL, "Printable Text Only", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_text_cb) },
2025 { "/Copy/Bytes/HexStream", NULL, "Hex Stream", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_hex_strm_cb) },
2026 { "/Copy/Bytes/BinaryStream", NULL, "Binary Stream", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_bin_strm_cb) },
2028 { "/DecodeAs", WIRESHARK_STOCK_DECODE_AS, "Decode As...", NULL, NULL, G_CALLBACK(decode_as_cb) },
2029 { "/Print", GTK_STOCK_PRINT, "Print...", NULL, NULL, G_CALLBACK(file_print_selected_cmd_cb) },
2030 { "/ShowPacketinNewWindow", NULL, "Show Packet in New Window", NULL, NULL, G_CALLBACK(new_window_cb) },
2034 static const char *ui_desc_tree_view_menu_popup =
2036 " <popup name='TreeViewPopup' action='PopupAction'>\n"
2037 " <menuitem name='ExpandSubtrees' action='/ExpandSubtrees'/>\n"
2038 " <menuitem name='ExpandAll' action='/ExpandAll'/>\n"
2039 " <menuitem name='CollapseAll' action='/CollapseAll'/>\n"
2041 " <menuitem name='ApplyasColumn' action='/Apply as Column'/>\n"
2043 " <menu name= 'ApplyAsFilter' action='/Apply as Filter'>\n"
2044 " <menuitem name='Selected' action='/Apply as Filter/Selected'/>\n"
2045 " <menuitem name='NotSelected' action='/Apply as Filter/Not Selected'/>\n"
2046 " <menuitem name='AndSelected' action='/Apply as Filter/AndSelected'/>\n"
2047 " <menuitem name='OrSelected' action='/Apply as Filter/OrSelected'/>\n"
2048 " <menuitem name='AndNotSelected' action='/Apply as Filter/AndNotSelected'/>\n"
2049 " <menuitem name='OrNotSelected' action='/Apply as Filter/OrNotSelected'/>\n"
2051 " <menu name= 'PrepareaFilter' action='/Prepare a Filter'>\n"
2052 " <menuitem name='Selected' action='/Prepare a Filter/Selected'/>\n"
2053 " <menuitem name='NotSelected' action='/Prepare a Filter/Not Selected'/>\n"
2054 " <menuitem name='AndSelected' action='/Prepare a Filter/AndSelected'/>\n"
2055 " <menuitem name='OrSelected' action='/Prepare a Filter/OrSelected'/>\n"
2056 " <menuitem name='AndNotSelected' action='/Prepare a Filter/AndNotSelected'/>\n"
2057 " <menuitem name='OrNotSelected' action='/Prepare a Filter/OrNotSelected'/>\n"
2059 " <menu name= 'ColorizewithFilter' action='/Colorize with Filter'>\n"
2060 " <menuitem name='Color1' action='/Colorize with Filter/Color 1'/>\n"
2061 " <menuitem name='Color2' action='/Colorize with Filter/Color 2'/>\n"
2062 " <menuitem name='Color3' action='/Colorize with Filter/Color 3'/>\n"
2063 " <menuitem name='Color4' action='/Colorize with Filter/Color 4'/>\n"
2064 " <menuitem name='Color5' action='/Colorize with Filter/Color 5'/>\n"
2065 " <menuitem name='Color6' action='/Colorize with Filter/Color 6'/>\n"
2066 " <menuitem name='Color7' action='/Colorize with Filter/Color 7'/>\n"
2067 " <menuitem name='Color8' action='/Colorize with Filter/Color 8'/>\n"
2068 " <menuitem name='Color9' action='/Colorize with Filter/Color 9'/>\n"
2069 " <menuitem name='Color10' action='/Colorize with Filter/Color 10'/>\n"
2070 " <menuitem name='NewColoringRule' action='/Colorize with Filter/New Coloring Rule'/>\n"
2072 " <menuitem name='FollowTCPStream' action='/Follow TCP Stream'/>\n"
2073 " <menuitem name='FollowUDPStream' action='/Follow UDP Stream'/>\n"
2074 " <menuitem name='FollowSSLStream' action='/Follow SSL Stream'/>\n"
2076 " <menu name= 'Copy' action='/Copy'>\n"
2077 " <menuitem name='Description' action='/Copy/Description'/>\n"
2078 " <menuitem name='Fieldname' action='/Copy/Fieldname'/>\n"
2079 " <menuitem name='Value' action='/Copy/Value'/>\n"
2081 " <menuitem name='AsFilter' action='/Copy/AsFilter'/>\n"
2083 " <menu name= 'Bytes' action='/Copy/Bytes'>\n"
2084 " <menuitem name='OffsetHexText' action='/Copy/Bytes/OffsetHexText'/>\n"
2085 " <menuitem name='OffsetHex' action='/Copy/Bytes/OffsetHex'/>\n"
2086 " <menuitem name='PrintableTextOnly' action='/Copy/Bytes/PrintableTextOnly'/>\n"
2088 " <menuitem name='HexStream' action='/Copy/Bytes/HexStream'/>\n"
2089 " <menuitem name='BinaryStream' action='/Copy/Bytes/BinaryStream'/>\n"
2092 " <menuitem name='ExportSelectedPacketBytes' action='/ExportSelectedPacketBytes'/>\n"
2094 " <menuitem name='WikiProtocolPage' action='/WikiProtocolPage'/>\n"
2095 " <menuitem name='FilterFieldReference' action='/FilterFieldReference'/>\n"
2096 " <menuitem name='ProtocolHelp' action='/ProtocolHelp'/>\n"
2097 " <menuitem name='ProtocolPreferences' action='/ProtocolPreferences'/>\n"
2099 " <menuitem name='DecodeAs' action='/DecodeAs'/>\n"
2100 " <menuitem name='DisableProtocol' action='/DisableProtocol'/>\n"
2101 " <menuitem name='ResolveName' action='/ResolveName'/>\n"
2102 " <menuitem name='GotoCorrespondingPacket' action='/GotoCorrespondingPacket'/>\n"
2106 static const GtkActionEntry tree_view_menu_popup_action_entries[] = {
2107 { "/ExpandSubtrees", NULL, "Expand Subtrees", NULL, NULL, G_CALLBACK(expand_tree_cb) },
2108 { "/ExpandAll", NULL, "Expand All", NULL, NULL, G_CALLBACK(expand_all_cb) },
2109 { "/CollapseAll", NULL, "Collapse All", NULL, NULL, G_CALLBACK(collapse_all_cb) },
2110 { "/Apply as Column", NULL, "Apply as Column", NULL, NULL, G_CALLBACK(apply_as_custom_column_cb) },
2111 { "/Apply as Filter", NULL, "Apply as Filter", NULL, NULL, NULL },
2113 { "/Apply as Filter/Selected", NULL, "_Selected" , NULL, NULL, G_CALLBACK(tree_view_menu_apply_selected_cb) },
2114 { "/Apply as Filter/Not Selected", NULL, "_Not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_not_selected_cb) },
2115 { "/Apply as Filter/AndSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _and Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_and_selected_cb) },
2116 { "/Apply as Filter/OrSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _or Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_or_selected_cb) },
2117 { "/Apply as Filter/AndNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " a_nd not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_and_not_selected_cb) },
2118 { "/Apply as Filter/OrNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " o_r not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_or_not_selected_cb) },
2120 { "/Prepare a Filter", NULL, "Prepare a Filter", NULL, NULL, NULL },
2121 { "/Prepare a Filter/Selected", NULL, "_Selected" , NULL, NULL, G_CALLBACK(tree_view_menu_prepare_selected_cb) },
2122 { "/Prepare a Filter/Not Selected", NULL, "_Not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_not_selected_cb) },
2123 { "/Prepare a Filter/AndSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _and Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_and_selected_cb) },
2124 { "/Prepare a Filter/OrSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _or Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_or_selected_cb) },
2125 { "/Prepare a Filter/AndNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " a_nd not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_and_not_selected_cb) },
2126 { "/Prepare a Filter/OrNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " o_r not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_or_not_selected_cb) },
2128 { "/Colorize with Filter", NULL, "Colorize with Filter", NULL, NULL, NULL },
2129 { "/Colorize with Filter/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color1_cb) },
2130 { "/Colorize with Filter/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color2_cb) },
2131 { "/Colorize with Filter/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color3_cb) },
2132 { "/Colorize with Filter/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color4_cb) },
2133 { "/Colorize with Filter/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color5_cb) },
2134 { "/Colorize with Filter/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color6_cb) },
2135 { "/Colorize with Filter/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color7_cb) },
2136 { "/Colorize with Filter/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color8_cb) },
2137 { "/Colorize with Filter/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color9_cb) },
2138 { "/Colorize with Filter/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color10_cb) },
2139 { "/Colorize with Filter/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_new_rule_cb) },
2141 { "/Follow TCP Stream", NULL, "Follow TCP Stream", NULL, NULL, G_CALLBACK(follow_tcp_stream_cb) },
2142 { "/Follow UDP Stream", NULL, "Follow UDP Stream", NULL, NULL, G_CALLBACK(follow_udp_stream_cb) },
2143 { "/Follow SSL Stream", NULL, "Follow SSL Stream", NULL, NULL, G_CALLBACK(follow_ssl_stream_cb) },
2145 { "/Copy", NULL, "Copy", NULL, NULL, NULL },
2146 { "/Copy/Description", NULL, "Description", NULL, NULL, G_CALLBACK(tree_view_menu_copy_desc) },
2147 { "/Copy/Fieldname", NULL, "Fieldname", NULL, NULL, G_CALLBACK(tree_view_menu_copy_field) },
2148 { "/Copy/Value", NULL, "Value", NULL, NULL, G_CALLBACK(tree_view_menu_copy_value) },
2150 { "/Copy/AsFilter", NULL, "As Filter", NULL, NULL, G_CALLBACK(tree_view_menu_copy_as_flt) },
2152 { "/Copy/Bytes", NULL, "Bytes", NULL, NULL, NULL },
2153 { "/Copy/Bytes/OffsetHexText", NULL, "Offset Hex Text", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_oht_cb) },
2154 { "/Copy/Bytes/OffsetHex", NULL, "Offset Hex", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_oh_cb) },
2155 { "/Copy/Bytes/PrintableTextOnly", NULL, "Printable Text Only", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_text_cb) },
2157 { "/Copy/Bytes/HexStream", NULL, "Hex Stream", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_hex_strm_cb) },
2158 { "/Copy/Bytes/BinaryStream", NULL, "Binary Stream", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_bin_strm_cb) },
2160 { "/ExportSelectedPacketBytes", NULL, "Export Selected Packet Bytes...", NULL, NULL, G_CALLBACK(savehex_cb) },
2162 { "/WikiProtocolPage", WIRESHARK_STOCK_WIKI, "Wiki Protocol Page", NULL, NULL, G_CALLBACK(selected_ptree_info_cb) },
2163 { "/FilterFieldReference", WIRESHARK_STOCK_INTERNET, "Filter Field Reference", NULL, NULL, G_CALLBACK(selected_ptree_ref_cb) },
2164 { "/ProtocolHelp", NULL, "Protocol Help", NULL, NULL, NULL },
2165 { "/ProtocolPreferences", NULL, "Protocol Preferences", NULL, NULL, NULL },
2166 { "/DecodeAs", WIRESHARK_STOCK_DECODE_AS, "Decode As...", NULL, NULL, G_CALLBACK(decode_as_cb) },
2167 { "/DisableProtocol", WIRESHARK_STOCK_CHECKBOX, "Disable Protocol...", NULL, NULL, G_CALLBACK(proto_disable_cb) },
2168 { "/ResolveName", NULL, "_Resolve Name", NULL, NULL, G_CALLBACK(resolve_name_cb) },
2169 { "/GotoCorrespondingPacket", NULL, "_Go to Corresponding Packet", NULL, NULL, G_CALLBACK(goto_framenum_cb) },
2172 static const char *ui_desc_bytes_menu_popup =
2174 " <popup name='BytesMenuPopup' action='PopupAction'>\n"
2175 " <menuitem name='HexView' action='/HexView'/>\n"
2176 " <menuitem name='BitsView' action='/BitsView'/>\n"
2179 static const GtkRadioActionEntry bytes_menu_radio_action_entries [] =
2181 /* name, stock id, label, accel, tooltip, value */
2182 { "/HexView", NULL, "Hex View", NULL, NULL, BYTES_HEX },
2183 { "/BitsView", NULL, "Bits View", NULL, NULL, BYTES_BITS },
2186 static const char *ui_statusbar_profiles_menu_popup =
2188 " <popup name='ProfilesMenuPopup' action='PopupAction'>\n"
2189 " <menuitem name='Profiles' action='/Profiles'/>\n"
2191 " <menuitem name='New' action='/New'/>\n"
2192 " <menuitem name='Edit' action='/Edit'/>\n"
2193 " <menuitem name='Delete' action='/Delete'/>\n"
2195 " <menu name='Change' action='/Change'>\n"
2196 " <menuitem name='Default' action='/Change/Default'/>\n"
2200 static const GtkActionEntry statusbar_profiles_menu_action_entries [] =
2202 { "/Profiles", NULL, "Configuration Profiles...", NULL, NULL, G_CALLBACK(profile_dialog_cb) },
2203 { "/New", GTK_STOCK_NEW, "New...", NULL, NULL, G_CALLBACK(profile_new_cb) },
2204 { "/Edit", GTK_STOCK_EDIT, "Edit...", NULL, NULL, G_CALLBACK(profile_edit_cb) },
2205 { "/Delete", GTK_STOCK_DELETE, "Delete", NULL, NULL, G_CALLBACK(profile_delete_cb) },
2206 { "/Change", NULL, "Change", NULL, NULL, NULL },
2207 { "/Change/Default", NULL, "Default", NULL, NULL, NULL },
2211 main_menu_new(GtkAccelGroup ** table) {
2213 #ifdef HAVE_IGE_MAC_INTEGRATION
2214 GtkWidget *quit_item, *about_item, *preferences_item;
2215 IgeMacMenuGroup *group;
2217 #ifdef HAVE_GTKOSXAPPLICATION
2218 GtkOSXApplication *theApp;
2220 GtkOSXApplicationMenuGroup *group;
2221 GtkWidget * dock_menu;
2224 grp = gtk_accel_group_new();
2229 menubar = main_menu_factory->widget;
2230 #ifdef HAVE_IGE_MAC_INTEGRATION
2231 if(prefs.gui_macosx_style) {
2232 ige_mac_menu_set_menu_bar(GTK_MENU_SHELL(menubar));
2233 ige_mac_menu_set_global_key_handler_enabled(TRUE);
2235 /* Create menu items to populate the application menu with. We have to
2236 * do this because we are still using the old GtkItemFactory API for
2238 group = ige_mac_menu_add_app_menu_group();
2239 about_item = gtk_menu_item_new_with_label("About");
2240 g_signal_connect(about_item, "activate", G_CALLBACK(about_wireshark_cb),
2242 ige_mac_menu_add_app_menu_item(group, GTK_MENU_ITEM(about_item), NULL);
2244 group = ige_mac_menu_add_app_menu_group();
2245 preferences_item = gtk_menu_item_new_with_label("Preferences");
2246 g_signal_connect(preferences_item, "activate", G_CALLBACK(prefs_cb),
2248 ige_mac_menu_add_app_menu_item(group, GTK_MENU_ITEM(preferences_item),
2252 /* The quit item in the application menu shows up whenever ige mac
2253 * integration is enabled, even if the OS X UI style in Wireshark isn't
2255 quit_item = gtk_menu_item_new_with_label("Quit");
2256 g_signal_connect(quit_item, "activate", G_CALLBACK(file_quit_cmd_cb), NULL);
2257 ige_mac_menu_set_quit_menu_item(GTK_MENU_ITEM(quit_item));
2260 #ifdef HAVE_GTKOSXAPPLICATION
2261 theApp = g_object_new(GTK_TYPE_OSX_APPLICATION, NULL);
2263 if(prefs.gui_macosx_style) {
2264 gtk_osxapplication_set_menu_bar(theApp, GTK_MENU_SHELL(menubar));
2265 gtk_osxapplication_set_use_quartz_accelerators(theApp, TRUE);
2267 group = gtk_osxapplication_add_app_menu_group (theApp);
2268 item = gtk_item_factory_get_item(main_menu_factory,"/Help/About Wireshark");
2269 gtk_osxapplication_add_app_menu_item(theApp, group,GTK_MENU_ITEM (item));
2271 group = gtk_osxapplication_add_app_menu_group (theApp);
2272 item = gtk_item_factory_get_item(main_menu_factory,"/Edit/Preferences...");
2273 gtk_osxapplication_add_app_menu_item(theApp, group,GTK_MENU_ITEM (item));
2275 group = gtk_osxapplication_add_app_menu_group (theApp);
2276 item = gtk_item_factory_get_item(main_menu_factory,"/Help");
2277 gtk_osxapplication_set_help_menu(theApp,GTK_MENU_ITEM(item));
2279 /* Quit item is not needed */
2280 gtk_item_factory_delete_item(main_menu_factory,"/File/Quit");
2283 /* generate dock menu */
2284 dock_menu = gtk_menu_new();
2286 item = gtk_menu_item_new_with_label("Start");
2287 g_signal_connect(item, "activate", G_CALLBACK (capture_start_cb), NULL);
2288 gtk_menu_shell_append(GTK_MENU_SHELL(dock_menu), item);
2290 item = gtk_menu_item_new_with_label("Stop");
2291 g_signal_connect(item, "activate", G_CALLBACK (capture_stop_cb), NULL);
2292 gtk_menu_shell_append(GTK_MENU_SHELL(dock_menu), item);
2294 item = gtk_menu_item_new_with_label("Restart");
2295 g_signal_connect(item, "activate", G_CALLBACK (capture_restart_cb), NULL);
2296 gtk_menu_shell_append(GTK_MENU_SHELL(dock_menu), item);
2298 gtk_osxapplication_set_dock_menu(theApp, GTK_MENU_SHELL(dock_menu));
2308 menu_dissector_filter_cb( GtkWidget *widget _U_,
2309 gpointer callback_data,
2310 guint callback_action _U_)
2312 dissector_filter_t *filter_entry = callback_data;
2313 GtkWidget *filter_te;
2316 filter_te = gtk_bin_get_child(GTK_BIN(g_object_get_data(G_OBJECT(top_level), E_DFILTER_CM_KEY)));
2318 /* XXX - this gets the packet_info of the last dissected packet, */
2319 /* which is not necessarily the last selected packet */
2320 /* e.g. "Update list of packets in real time" won't work correct */
2321 buf = filter_entry->build_filter_string(&cfile.edt->pi);
2323 gtk_entry_set_text(GTK_ENTRY(filter_te), buf);
2325 /* Run the display filter so it goes in effect - even if it's the
2326 same as the previous display filter. */
2327 main_filter_packets(&cfile, buf, TRUE);
2329 g_free( (void *) buf);
2332 static gboolean menu_dissector_filter_spe_cb(frame_data *fd _U_, epan_dissect_t *edt, gpointer callback_data) {
2333 dissector_filter_t *filter_entry = callback_data;
2335 /* XXX - this gets the packet_info of the last dissected packet, */
2336 /* which is not necessarily the last selected packet */
2337 /* e.g. "Update list of packets in real time" won't work correct */
2338 return (edt != NULL) ? filter_entry->is_filter_valid(&edt->pi) : FALSE;
2341 static void menu_dissector_filter(void) {
2342 GList *list_entry = dissector_filter_list;
2343 dissector_filter_t *filter_entry;
2345 while(list_entry != NULL) {
2346 filter_entry = list_entry->data;
2348 register_stat_menu_item(filter_entry->name, REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER,
2349 menu_dissector_filter_cb,
2350 menu_dissector_filter_spe_cb,
2351 NULL /* selected_tree_row_enabled */,
2354 list_entry = g_list_next(list_entry);
2361 GtkActionGroup *packet_list_heading_action_group, *packet_list_action_group,
2362 *packet_list_details_action_group, *packet_list_byte_menu_action_group,
2363 *statusbar_profiles_action_group;
2364 GError *error = NULL;
2369 popup_menu_object = gtk_menu_new();
2371 /* packet list heading pop-up menu */
2372 packet_list_heading_action_group = gtk_action_group_new ("PacketListHeadingPopUpMenuActionGroup");
2374 gtk_action_group_add_actions (packet_list_heading_action_group, /* the action group */
2375 (gpointer)packet_list_heading_menu_popup_action_entries, /* an array of action descriptions */
2376 G_N_ELEMENTS(packet_list_heading_menu_popup_action_entries), /* the number of entries */
2377 popup_menu_object); /* data to pass to the action callbacks */
2379 gtk_action_group_add_toggle_actions(packet_list_heading_action_group, /* the action group */
2380 (gpointer)packet_list_heading_menu_toggle_action_entries, /* an array of action descriptions */
2381 G_N_ELEMENTS(packet_list_heading_menu_toggle_action_entries), /* the number of entries */
2382 NULL); /* data to pass to the action callbacks */
2384 ui_manager_packet_list_heading = gtk_ui_manager_new ();
2385 gtk_ui_manager_insert_action_group (ui_manager_packet_list_heading,
2386 packet_list_heading_action_group,
2387 0); /* the position at which the group will be inserted. */
2389 gtk_ui_manager_add_ui_from_string (ui_manager_packet_list_heading,ui_desc_packet_list_heading_menu_popup, -1, &error);
2392 fprintf (stderr, "Warning: building Packet List Heading Pop-Up failed: %s\n",
2394 g_error_free (error);
2398 g_object_set_data(G_OBJECT(popup_menu_object), PM_PACKET_LIST_COL_KEY,
2399 gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup"));
2401 popup_menu_list = g_slist_append((GSList *)popup_menu_list, ui_manager_packet_list_heading);
2403 /* packet list pop-up menu */
2404 packet_list_action_group = gtk_action_group_new ("PacketListPopUpMenuActionGroup");
2406 gtk_action_group_add_actions (packet_list_action_group, /* the action group */
2407 (gpointer)packet_list_menu_popup_action_entries, /* an array of action descriptions */
2408 G_N_ELEMENTS(packet_list_menu_popup_action_entries), /* the number of entries */
2409 popup_menu_object); /* data to pass to the action callbacks */
2411 ui_manager_packet_list_menu = gtk_ui_manager_new ();
2413 gtk_ui_manager_insert_action_group (ui_manager_packet_list_menu,
2414 packet_list_action_group,
2415 0); /* the position at which the group will be inserted. */
2417 gtk_ui_manager_add_ui_from_string (ui_manager_packet_list_menu, ui_desc_packet_list_menu_popup, -1, &error);
2420 fprintf (stderr, "Warning: building Packet List Pop-Up menu failed: %s\n",
2422 g_error_free (error);
2426 g_object_set_data(G_OBJECT(popup_menu_object), PM_PACKET_LIST_KEY,
2427 gtk_ui_manager_get_widget(ui_manager_packet_list_menu, "/PacketListMenuPopup"));
2429 popup_menu_list = g_slist_append((GSList *)popup_menu_list, ui_manager_packet_list_menu);
2432 /* packet detail pop-up menu */
2433 packet_list_details_action_group = gtk_action_group_new ("PacketListDetailsMenuPopUpActionGroup");
2435 gtk_action_group_add_actions (packet_list_details_action_group, /* the action group */
2436 (gpointer)tree_view_menu_popup_action_entries, /* an array of action descriptions */
2437 G_N_ELEMENTS(tree_view_menu_popup_action_entries), /* the number of entries */
2438 popup_menu_object); /* data to pass to the action callbacks */
2440 ui_manager_tree_view_menu = gtk_ui_manager_new ();
2442 gtk_ui_manager_insert_action_group (ui_manager_tree_view_menu,
2443 packet_list_details_action_group,
2444 0); /* the position at which the group will be inserted. */
2446 gtk_ui_manager_add_ui_from_string (ui_manager_tree_view_menu, ui_desc_tree_view_menu_popup, -1, &error);
2449 fprintf (stderr, "Warning: building TreeWiew Pop-Up menu failed: %s\n",
2451 g_error_free (error);
2455 g_object_set_data(G_OBJECT(popup_menu_object), PM_TREE_VIEW_KEY,
2456 gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup"));
2458 popup_menu_list = g_slist_append((GSList *)popup_menu_list, ui_manager_tree_view_menu);
2461 * Hex dump pop-up menu.
2462 * We provide our own empty menu to suppress the default pop-up menu
2465 packet_list_byte_menu_action_group = gtk_action_group_new ("PacketListByteMenuPopUpActionGroup");
2468 gtk_action_group_add_radio_actions (packet_list_byte_menu_action_group, /* the action group */
2469 (gpointer)bytes_menu_radio_action_entries, /* an array of radio action descriptions */
2470 G_N_ELEMENTS(bytes_menu_radio_action_entries), /* the number of entries */
2471 recent.gui_bytes_view, /* the value of the action to activate initially, or -1 if no action should be activated */
2472 G_CALLBACK(select_bytes_view_cb), /* the callback to connect to the changed signal */
2473 popup_menu_object); /* data to pass to the action callbacks */
2475 ui_manager_bytes_menu = gtk_ui_manager_new ();
2477 gtk_ui_manager_insert_action_group (ui_manager_bytes_menu,
2478 packet_list_byte_menu_action_group,
2479 0); /* the position at which the group will be inserted. */
2481 gtk_ui_manager_add_ui_from_string (ui_manager_bytes_menu, ui_desc_bytes_menu_popup, -1, &error);
2484 fprintf (stderr, "Warning: building Bytes Pop-Up menu failed: %s\n",
2486 g_error_free (error);
2490 g_object_unref(packet_list_byte_menu_action_group);
2492 g_object_set_data(G_OBJECT(popup_menu_object), PM_BYTES_VIEW_KEY,
2493 gtk_ui_manager_get_widget(ui_manager_bytes_menu, "/BytesMenuPopup"));
2495 popup_menu_list = g_slist_append((GSList *)popup_menu_list, ui_manager_bytes_menu);
2498 main_menu_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", grp);
2499 gtk_item_factory_create_items_ac(main_menu_factory, nmenu_items, menu_items, NULL, 2);
2501 statusbar_profiles_action_group = gtk_action_group_new ("StatusBarProfilesPopUpMenuActionGroup");
2503 gtk_action_group_add_actions (statusbar_profiles_action_group, /* the action group */
2504 (gpointer)statusbar_profiles_menu_action_entries, /* an array of action descriptions */
2505 G_N_ELEMENTS(statusbar_profiles_menu_action_entries), /* the number of entries */
2506 popup_menu_object); /* data to pass to the action callbacks */
2508 ui_manager_statusbar_profiles_menu = gtk_ui_manager_new ();
2509 gtk_ui_manager_insert_action_group (ui_manager_statusbar_profiles_menu,
2510 statusbar_profiles_action_group,
2511 0); /* the position at which the group will be inserted. */
2513 gtk_ui_manager_add_ui_from_string (ui_manager_statusbar_profiles_menu,ui_statusbar_profiles_menu_popup, -1, &error);
2516 fprintf (stderr, "Warning: building Statusbar Profiles Pop-Up failed: %s\n",
2518 g_error_free (error);
2522 g_object_unref(statusbar_profiles_action_group);
2524 g_object_set_data(G_OBJECT(popup_menu_object), PM_STATUSBAR_PROFILES_KEY,
2525 gtk_ui_manager_get_widget(ui_manager_statusbar_profiles_menu, "/ProfilesMenuPopup"));
2527 popup_menu_list = g_slist_append((GSList *)popup_menu_list, ui_manager_statusbar_profiles_menu);
2529 menu_dissector_filter();
2530 merge_all_tap_menus(tap_menu_tree_root);
2532 /* Initialize enabled/disabled state of menu items */
2533 set_menus_for_capture_file(NULL);
2535 /* Un-#if this when we actually implement Cut/Copy/Paste.
2536 Then make sure you enable them when they can be done. */
2537 set_menu_sensitivity_old("/Edit/Cut", FALSE);
2538 set_menu_sensitivity_old("/Edit/Copy", FALSE);
2539 set_menu_sensitivity_old("/Edit/Paste", FALSE);
2542 set_menus_for_captured_packets(FALSE);
2543 set_menus_for_selected_packet(&cfile);
2544 set_menus_for_selected_tree_row(&cfile);
2545 set_menus_for_capture_in_progress(FALSE);
2546 set_menus_for_file_set(/* dialog */TRUE, /* previous file */ FALSE, /* next_file */ FALSE);
2548 /* Init with an empty recent files list */
2549 clear_menu_recent_capture_file_cmd_cb(NULL, NULL);
2550 /* Protocol help links */
2551 proto_help_menu_init(gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup"));
2556 static gint tap_menu_item_add_compare(gconstpointer a, gconstpointer b)
2559 ((const menu_item_t *) a)->name,
2560 ((const menu_item_t *) b)->name);
2564 /* add a menuitem below the current node */
2565 static GList * tap_menu_item_add(
2567 const char *gui_path,
2570 const char *stock_id,
2571 const char *accelerator,
2572 const char *tooltip,
2573 GtkItemFactoryCallback callback,
2575 gboolean (*selected_packet_enabled)(frame_data *, epan_dissect_t *, gpointer callback_data),
2576 gboolean (*selected_tree_row_enabled)(field_info *, gpointer callback_data),
2577 gpointer callback_data,
2583 child = g_malloc(sizeof (menu_item_t));
2584 child->group = group;
2585 child->gui_path = gui_path;
2587 child->label = label;
2588 child->stock_id = stock_id;
2589 child->accelerator = accelerator;
2590 child->stock_id = stock_id;
2591 child->tooltip = tooltip;
2592 child->callback = callback;
2593 child->enabled = enabled;
2594 child->selected_packet_enabled = selected_packet_enabled;
2595 child->selected_tree_row_enabled = selected_tree_row_enabled;
2596 child->callback_data = callback_data;
2597 child->children = NULL;
2599 /* insert the new child node into the parent */
2600 curr = curnode->data;
2601 curr->children = g_list_insert_sorted(curr->children, child, tap_menu_item_add_compare);
2603 /* return the new node */
2604 /* XXX: improve this */
2605 return g_list_find(curr->children, child);
2609 * Add a new menu item for a tap.
2610 * This must be called after we've created the main menu, so it can't
2611 * be called from the routine that registers taps - we have to introduce
2612 * another per-tap registration routine.
2614 * "callback" gets called when the menu item is selected; it should do
2615 * the work of creating the tap window.
2617 * "selected_packet_enabled" gets called by "set_menus_for_selected_packet()";
2618 * it's passed a Boolean that's TRUE if a packet is selected and FALSE
2619 * otherwise, and should return TRUE if the tap will work now (which
2620 * might depend on whether a packet is selected and, if one is, on the
2621 * packet) and FALSE if not.
2623 * "selected_tree_row_enabled" gets called by
2624 * "set_menus_for_selected_tree_row()"; it's passed a Boolean that's TRUE if
2625 * a protocol tree row is selected and FALSE otherwise, and should return
2626 * TRUE if the tap will work now (which might depend on whether a tree row
2627 * is selected and, if one is, on the tree row) and FALSE if not.
2631 register_stat_menu_item_stock(
2633 register_stat_group_t group,
2634 const char *stock_id,
2636 gboolean (*selected_packet_enabled)(frame_data *, epan_dissect_t *, gpointer callback_data),
2637 gboolean (*selected_tree_row_enabled)(field_info *, gpointer callback_data),
2638 gpointer callback_data
2641 const char *gui_path = NULL;
2642 const char *label = name;
2643 const char *accelerator = NULL;
2644 const char *tooltip = NULL;
2645 gboolean enabled = FALSE;
2646 /*static const char toolspath[] = "/Statistics/";*/
2647 const char *toolspath;
2656 * The menu path must be relative.
2658 g_assert(*name != '/');
2660 case(REGISTER_STAT_GROUP_GENERIC): toolspath = "/Statistics/"; break;
2661 case(REGISTER_STAT_GROUP_CONVERSATION_LIST): toolspath = "/Statistics/_Conversation List/"; break;
2662 case(REGISTER_STAT_GROUP_ENDPOINT_LIST): toolspath = "/Statistics/_Endpoint List/"; break;
2663 case(REGISTER_STAT_GROUP_RESPONSE_TIME): toolspath = "/Statistics/Service _Response Time/"; break;
2664 case(REGISTER_STAT_GROUP_UNSORTED): toolspath = "/Statistics/"; break;
2665 case(REGISTER_ANALYZE_GROUP_UNSORTED): toolspath = "/Analyze/"; break;
2666 case(REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER): toolspath = "/Analyze/Conversation Filter/"; break;
2667 case(REGISTER_STAT_GROUP_TELEPHONY): toolspath = "/Telephony/"; break;
2668 case(REGISTER_TOOLS_GROUP_UNSORTED): toolspath = "/Tools/"; break;
2670 g_assert(!"no such menu group");
2673 /* add the (empty) root node, if not already done */
2674 if(tap_menu_tree_root == NULL) {
2675 child = g_malloc0(sizeof (menu_item_t));
2676 tap_menu_tree_root = g_list_append(NULL, child);
2680 * Create any submenus required.
2682 curnode = tap_menu_tree_root;
2684 while ((p = strchr(p, '/')) != NULL) {
2686 * OK, everything between "name" and "p" is
2687 * a menu relative subtree into which the menu item
2690 * Construct the absolute path name of that subtree.
2692 menupathlen = strlen(toolspath) + 1 + (p - name);
2693 menupath = g_malloc(menupathlen);
2694 g_strlcpy(menupath, toolspath, menupathlen);
2695 g_strlcat(menupath, name, menupathlen);
2698 * Does there exist an entry with that path at this
2699 * level of the Analyze menu tree?
2701 child = curnode->data;
2702 for (childnode = child->children; childnode != NULL; childnode = childnode->next) {
2703 child = childnode->data;
2704 if (strcmp(child->gui_path, menupath) == 0)
2707 if (childnode == NULL) {
2709 * No. Create such an item as a subtree, and
2710 * add it to the Tools menu tree.
2712 childnode = tap_menu_item_add(
2713 group, (const char*)menupath, name, name, NULL, NULL, NULL, NULL ,FALSE, NULL, NULL, NULL, curnode);
2716 * Yes. We don't need this "menupath" any longer.
2720 curnode = childnode;
2723 * Skip over the '/' we found.
2729 * Construct the main menu path for the menu item.
2731 menupathlen = strlen(toolspath) + 1 + strlen(name);
2732 menupath = g_malloc(menupathlen);
2733 g_strlcpy(menupath, toolspath, menupathlen);
2734 g_strlcat(menupath, name, menupathlen);
2736 gui_path = menupath;
2738 * Construct an item factory entry for the item, and add it to
2742 group, gui_path, name, label, stock_id,
2743 accelerator, tooltip, callback, enabled,
2744 selected_packet_enabled, selected_tree_row_enabled,
2745 callback_data, curnode);
2749 * Add a new menu item for a stat.
2750 * This must be called after we've created the main menu, so it can't
2751 * be called from the routine that registers stats - we have to introduce
2752 * another per-stat registration routine.
2754 * @param name the menu label
2756 * @param group the menu group this stat should be registered to
2758 * @param callback gets called when the menu item is selected; it should do
2759 * the work of creating the stat window.
2761 * @param selected_packet_enabled gets called by set_menus_for_selected_packet();
2762 * it's passed a pointer to the "frame_data" structure for the current frame,
2763 * if any, and to the "epan_dissect_t" structure for that frame, if any, and
2764 * should return TRUE if the stat will work now (which might depend on whether
2765 * a frame is selected and, if one is, on the frame) and FALSE if not.
2767 * @param selected_tree_row_enabled gets called by
2768 * set_menus_for_selected_tree_row(); it's passed a pointer to the
2769 * "field_info" structure for the currently selected field, if any,
2770 * and should return TRUE if the stat will work now (which might depend on
2771 * whether a tree row is selected and, if one is, on the tree row) and
2774 * @param callback_data data for callback function
2777 register_stat_menu_item(
2779 register_stat_group_t group,
2781 gboolean (*selected_packet_enabled)(frame_data *, epan_dissect_t *, gpointer callback_data),
2782 gboolean (*selected_tree_row_enabled)(field_info *, gpointer callback_data),
2783 gpointer callback_data)
2785 register_stat_menu_item_stock(
2788 NULL, /* stock_id */
2790 selected_packet_enabled,
2791 selected_tree_row_enabled,
2795 static guint merge_tap_menus_layered(GList *node, gint group) {
2796 GtkItemFactoryEntry *entry;
2800 menu_item_t *node_data = node->data;
2804 * Is this a leaf node or an interior node?
2806 if (node_data->children == NULL) {
2812 * The root node doesn't correspond to a menu tree item; it
2813 * has a null name pointer.
2815 if (node_data->gui_path != NULL && group == node_data->group) {
2816 entry = g_malloc0(sizeof (GtkItemFactoryEntry));
2817 namelen = strlen(node_data->gui_path) + 1;
2818 entry->path = g_malloc(namelen);
2819 g_strlcpy(entry->path, node_data->gui_path, namelen);
2820 entry->callback = node_data->callback;
2822 case(REGISTER_STAT_GROUP_UNSORTED):
2824 case(REGISTER_STAT_GROUP_GENERIC):
2826 case(REGISTER_STAT_GROUP_CONVERSATION_LIST):
2827 entry->item_type = "<StockItem>";
2828 entry->extra_data = WIRESHARK_STOCK_CONVERSATIONS;
2830 case(REGISTER_STAT_GROUP_ENDPOINT_LIST):
2831 entry->item_type = "<StockItem>";
2832 entry->extra_data = WIRESHARK_STOCK_ENDPOINTS;
2834 case(REGISTER_STAT_GROUP_RESPONSE_TIME):
2835 entry->item_type = "<StockItem>";
2836 entry->extra_data = WIRESHARK_STOCK_TIME;
2838 case(REGISTER_STAT_GROUP_TELEPHONY):
2840 case(REGISTER_ANALYZE_GROUP_UNSORTED):
2842 case(REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER):
2844 case(REGISTER_TOOLS_GROUP_UNSORTED):
2847 g_assert_not_reached();
2849 if(node_data->stock_id!= NULL) {
2850 entry->item_type = "<StockItem>";
2851 entry->extra_data = node_data->stock_id;
2853 gtk_item_factory_create_item(main_menu_factory, entry, node_data->callback_data, /* callback_type */ 2);
2854 set_menu_sensitivity_old(node_data->gui_path, FALSE); /* no capture file yet */
2860 * It's an interior node; call
2861 * "merge_tap_menus_layered()" on all its children
2865 * The root node doesn't correspond to a menu tree item; it
2866 * has a null name pointer.
2868 if (node_data->gui_path != NULL && group == node_data->group) {
2869 entry = g_malloc0(sizeof (GtkItemFactoryEntry));
2870 namelen = strlen(node_data->gui_path) + 1;
2871 entry->path = g_malloc(namelen);
2872 g_strlcpy(entry->path, node_data->gui_path, namelen);
2873 entry->item_type = "<Branch>";
2875 gtk_item_factory_create_item(main_menu_factory, entry,
2877 set_menu_sensitivity_old(node_data->gui_path, FALSE); /* no children yet */
2882 for (child = node_data->children; child != NULL; child =
2884 added += merge_tap_menus_layered(child, group);
2893 static void merge_all_tap_menus(GList *node) {
2894 GtkItemFactoryEntry *sep_entry;
2896 sep_entry = g_malloc0(sizeof (GtkItemFactoryEntry));
2897 sep_entry->item_type = "<Separator>";
2898 sep_entry->path = "/Statistics/";
2900 * merge only the menu items of the specific group,
2901 * and then append a seperator
2903 if (merge_tap_menus_layered(node, REGISTER_STAT_GROUP_GENERIC)) {
2904 gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);
2906 if (merge_tap_menus_layered(node, REGISTER_STAT_GROUP_CONVERSATION_LIST)) {
2907 /*gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);*/
2909 if (merge_tap_menus_layered(node, REGISTER_STAT_GROUP_ENDPOINT_LIST)) {
2910 /*gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);*/
2912 if (merge_tap_menus_layered(node, REGISTER_STAT_GROUP_RESPONSE_TIME)) {
2913 gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);
2915 if (merge_tap_menus_layered(node, REGISTER_STAT_GROUP_TELEPHONY)) {
2916 /*gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);*/
2918 if (merge_tap_menus_layered(node, REGISTER_STAT_GROUP_UNSORTED)) {
2919 /*gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);*/
2921 if (merge_tap_menus_layered(node, REGISTER_ANALYZE_GROUP_UNSORTED)) {
2922 /* sep_entry->path = "/Analyze/";*/
2923 /*gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);*/
2925 if (merge_tap_menus_layered(node, REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER)) {
2926 /*sep_entry->path = "/Analyze/Conversation Filter/";*/
2927 /*gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);*/
2929 if (merge_tap_menus_layered(node, REGISTER_TOOLS_GROUP_UNSORTED)) {
2930 /*gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);*/
2936 * Enable/disable menu sensitivity.
2939 set_menu_sensitivity(GtkUIManager *ui_manager, const gchar *path, gint val)
2943 action = gtk_ui_manager_get_action(ui_manager, path);
2946 fprintf (stderr, "Warning: couldn't find action path= %s\n",
2951 gtk_action_set_sensitive (action,
2952 val); /* TRUE to make the action sensitive */
2956 * Enable/disable menu sensitivity for the old menubar code.
2959 set_menu_sensitivity_old(const gchar *path, gint val)
2961 GtkWidget *menu_item;
2964 /* the underscore character regularly confuses things, as it will prevent finding
2965 * the menu_item, so it has to be removed first */
2966 dup = g_strdup(path);
2977 if ((menu_item = gtk_item_factory_get_widget(main_menu_factory, dup)) != NULL) {
2978 if (GTK_IS_MENU(menu_item)) {
2980 * "dup" refers to a submenu; "gtk_item_factory_get_widget()"
2981 * gets the menu, not the item that, when selected, pops up
2984 * We have to change the latter item's sensitivity, so that
2985 * it shows up normally if sensitive and grayed-out if
2988 menu_item = gtk_menu_get_attach_widget(GTK_MENU(menu_item));
2990 gtk_widget_set_sensitive(menu_item, val);
2998 set_menu_object_data_meat_old(const gchar *path, const gchar *key, gpointer data)
3000 GtkWidget *menu = NULL;
3002 if ((menu = gtk_item_factory_get_widget(main_menu_factory, path)) != NULL){
3003 g_object_set_data(G_OBJECT(menu), key, data);
3008 set_menu_object_data (const gchar *path, const gchar *key, gpointer data) {
3009 set_menu_object_data_meat_old(path, key, data);
3013 /* Recently used capture files submenu:
3014 * Submenu containing the recently used capture files.
3015 * The capture filenames are always kept with the absolute path, to be independant
3016 * of the current path.
3017 * They are only stored inside the labels of the submenu (no separate list). */
3019 #define MENU_RECENT_FILES_PATH_OLD "/File/Open Recent"
3020 #define MENU_RECENT_FILES_PATH "/Menubar/FileMenu/OpenRecent"
3021 #define MENU_RECENT_FILES_KEY "Recent File Name"
3025 update_menu_recent_capture_file1(GtkWidget *widget, gpointer cnt) {
3026 gchar *widget_cf_name;
3028 widget_cf_name = g_object_get_data(G_OBJECT(widget), MENU_RECENT_FILES_KEY);
3030 /* if this menu item is a file, count it */
3031 if (widget_cf_name) {
3033 gtk_widget_set_sensitive(widget, FALSE);
3034 main_welcome_add_recent_capture_file(widget_cf_name, G_OBJECT(widget));
3038 /* update the menu */
3040 update_menu_recent_capture_file(GtkWidget *submenu_recent_files) {
3042 GtkWidget *menu_item;
3045 main_welcome_reset_recent_capture_files();
3047 gtk_container_foreach(GTK_CONTAINER(submenu_recent_files),
3048 update_menu_recent_capture_file1, &cnt);
3052 menu_item = gtk_menu_item_new_with_label("No recently used files");
3053 gtk_menu_shell_append (GTK_MENU_SHELL(submenu_recent_files), menu_item);
3054 gtk_widget_set_sensitive(menu_item, FALSE);
3055 gtk_widget_show (menu_item);
3060 /* remove the capture filename from the "Recent Files" menu */
3062 remove_menu_recent_capture_filename(gchar *cf_name) {
3063 GtkWidget *submenu_recent_files;
3065 GList* child_list_item;
3066 GtkWidget *menu_item_child;
3067 const gchar *menu_item_cf_name;
3069 /* get the submenu container item */
3070 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH_OLD);
3071 /* find the corresponding menu item to be removed */
3072 child_list = gtk_container_get_children(GTK_CONTAINER(submenu_recent_files));
3073 child_list_item = child_list;
3074 while(child_list_item) {
3075 menu_item_child = gtk_bin_get_child(GTK_BIN(child_list_item->data));
3076 if (menu_item_child != NULL) { /* Note: there are two "extra" items on the end of the child_list: */
3077 /* - a separator (with no menu_item_child and thus no text label) */
3078 /* - a 2nd item with a menu_child with text label "Clear" */
3079 /* [See add_menu_recent_capture_file_absolute() ] */
3080 /* 'if (menu_item_child != NULL)' skips the separator item; */
3081 /* An absolute filename in cf_name will never match "Clear". */
3082 menu_item_cf_name = gtk_label_get_text(GTK_LABEL(menu_item_child));
3083 if(strcmp(menu_item_cf_name, cf_name) == 0) {
3084 /* XXX: is this all we need to do, to free the menu item and its label?
3085 The reference count of widget will go to 0, so it'll be freed;
3086 will that free the label? */
3087 gtk_container_remove(GTK_CONTAINER(submenu_recent_files), child_list_item->data);
3090 child_list_item = g_list_next(child_list_item);
3092 g_list_free(child_list);
3094 update_menu_recent_capture_file(submenu_recent_files);
3097 /* remove the capture filename from the "Recent Files" menu */
3099 remove_menu_recent_capture_file(GtkWidget *widget, gpointer unused _U_) {
3100 GtkWidget *submenu_recent_files;
3101 gchar *widget_cf_name;
3104 widget_cf_name = g_object_get_data(G_OBJECT(widget), MENU_RECENT_FILES_KEY);
3105 g_free(widget_cf_name);
3107 /* get the submenu container item */
3108 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH_OLD);
3109 /* XXX: is this all we need to do, to free the menu item and its label?
3110 The reference count of widget will go to 0, so it'll be freed;
3111 will that free the label? */
3112 gtk_container_remove(GTK_CONTAINER(submenu_recent_files), widget);
3116 /* callback, if the user pushed the <Clear> menu item */
3118 clear_menu_recent_capture_file_cmd_cb(GtkWidget *w _U_, gpointer unused _U_) {
3119 GtkWidget *submenu_recent_files;
3121 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH_OLD);
3123 gtk_container_foreach(GTK_CONTAINER(submenu_recent_files),
3124 remove_menu_recent_capture_file, NULL);
3126 update_menu_recent_capture_file(submenu_recent_files);
3129 /* Open a file by it's name
3130 (Beware: will not ask to close existing capture file!) */
3132 menu_open_filename(gchar *cf_name)
3134 GtkWidget *submenu_recent_files;
3136 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH_OLD);
3137 /* open and read the capture file (this will close an existing file) */
3138 if (cf_open(&cfile, cf_name, FALSE, &err) == CF_OK) {
3139 cf_read(&cfile, FALSE);
3141 /* the capture file apparently no longer exists; remove menu item */
3142 /* XXX: ask user to remove item, it's maybe only a temporary problem */
3143 remove_menu_recent_capture_filename(cf_name);
3146 update_menu_recent_capture_file(submenu_recent_files);
3149 /* callback, if the user pushed a recent file submenu item */
3151 menu_open_recent_file_cmd(gpointer action)
3153 GtkWidget *submenu_recent_files;
3154 GtkWidget *menu_item_child;
3155 const gchar *cf_name;
3159 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH_OLD);
3161 /* get capture filename from the menu item label */
3162 menu_item_child = gtk_bin_get_child(GTK_BIN(action));
3163 cf_name = gtk_label_get_text(GTK_LABEL(menu_item_child));
3165 /* open and read the capture file (this will close an existing file) */
3166 if (cf_open(&cfile, cf_name, FALSE, &err) == CF_OK) {
3167 cf_read(&cfile, FALSE);
3169 /* the capture file apparently no longer exists; remove menu item */
3170 /* XXX: ask user to remove item, it's maybe only a temporary problem */
3171 remove_menu_recent_capture_file(action, NULL);
3174 update_menu_recent_capture_file(submenu_recent_files);
3177 static void menu_open_recent_file_answered_cb(gpointer dialog _U_, gint btn, gpointer data)
3181 /* save file first */
3182 file_save_as_cmd(after_save_open_recent_file, data);
3186 menu_open_recent_file_cmd(data);
3188 case(ESD_BTN_CANCEL):
3191 g_assert_not_reached();
3195 menu_open_recent_file_cmd_cb(GtkWidget *widget, gpointer data _U_) {
3199 if((cfile.state != FILE_CLOSED) && !cfile.user_saved && prefs.gui_ask_unsaved) {
3200 /* user didn't saved his current file, ask him */
3201 dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_YES_NO_CANCEL,
3202 "%sSave capture file before opening a new one?%s\n\n"
3203 "If you open a new capture file without saving, your current capture data will be discarded.",
3204 simple_dialog_primary_start(), simple_dialog_primary_end());
3205 simple_dialog_set_cb(dialog, menu_open_recent_file_answered_cb, widget);
3207 /* unchanged file */
3208 menu_open_recent_file_cmd(widget);
3213 /* add the capture filename (with an absolute path) to the "Recent Files" menu */
3215 add_menu_recent_capture_file_absolute(gchar *cf_name) {
3216 GtkWidget *submenu_recent_files;
3217 GList *menu_item_list_old;
3219 gchar *widget_cf_name;
3220 gchar *normalized_cf_name;
3221 GtkWidget *menu_item;
3224 normalized_cf_name = g_strdup(cf_name);
3226 /* replace all slashes by backslashes */
3227 g_strdelimit(normalized_cf_name, "/", '\\');
3229 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH_OLD);
3230 /* convert container to a GList */
3231 menu_item_list_old = gtk_container_get_children(GTK_CONTAINER(submenu_recent_files));
3233 /* iterate through list items of menu_item_list,
3234 * removing special items, a maybe duplicate entry and every item above count_max */
3236 for (li = g_list_first(menu_item_list_old); li; li = li->next, cnt++) {
3237 /* get capture filename */
3238 menu_item = GTK_WIDGET(li->data);
3239 widget_cf_name = g_object_get_data(G_OBJECT(menu_item), MENU_RECENT_FILES_KEY);
3241 /* if this element string is one of our special items (seperator, ...) or
3242 * already in the list or
3243 * this element is above maximum count (too old), remove it
3245 if (!widget_cf_name ||
3247 /* do a case insensitive compare on win32 */
3248 g_ascii_strncasecmp(widget_cf_name, normalized_cf_name, 1000) == 0 ||
3250 /* do a case sensitive compare on unix */
3251 strncmp(widget_cf_name, normalized_cf_name, 1000) == 0 ||
3253 cnt >= prefs.gui_recent_files_count_max) {
3254 remove_menu_recent_capture_file(li->data, NULL);
3259 g_list_free(menu_item_list_old);
3261 /* add new item at latest position */
3262 menu_item = gtk_menu_item_new_with_label(normalized_cf_name);
3263 g_object_set_data(G_OBJECT(menu_item), MENU_RECENT_FILES_KEY, normalized_cf_name);
3264 gtk_menu_shell_prepend (GTK_MENU_SHELL(submenu_recent_files), menu_item);
3265 g_signal_connect_swapped(G_OBJECT(menu_item), "activate",
3266 G_CALLBACK(menu_open_recent_file_cmd_cb), (GObject *) menu_item);
3267 gtk_widget_show (menu_item);
3269 /* add seperator at last position */
3270 menu_item = gtk_menu_item_new();
3271 gtk_menu_shell_append (GTK_MENU_SHELL(submenu_recent_files), menu_item);
3272 gtk_widget_show (menu_item);
3274 /* add new "clear list" item at last position */
3275 menu_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_CLEAR, NULL);
3276 gtk_menu_shell_append (GTK_MENU_SHELL(submenu_recent_files), menu_item);
3277 g_signal_connect_swapped(G_OBJECT(menu_item), "activate",
3278 G_CALLBACK(clear_menu_recent_capture_file_cmd_cb), (GObject *) menu_item);
3279 gtk_widget_show (menu_item);
3281 update_menu_recent_capture_file(submenu_recent_files);
3284 /* add the capture filename to the "Recent Files" menu */
3285 /* (will change nothing, if this filename is already in the menu) */
3287 * XXX - We might want to call SHAddToRecentDocs under Windows 7:
3288 * http://stackoverflow.com/questions/437212/how-do-you-register-a-most-recently-used-list-with-windows-in-preparation-for-win
3291 add_menu_recent_capture_file(gchar *cf_name) {
3296 /* if this filename is an absolute path, we can use it directly */
3297 if (g_path_is_absolute(cf_name)) {
3298 add_menu_recent_capture_file_absolute(cf_name);
3302 /* this filename is not an absolute path, prepend the current dir */
3303 curr = g_get_current_dir();
3304 absolute = g_strdup_printf("%s%s%s", curr, G_DIR_SEPARATOR_S, cf_name);
3305 add_menu_recent_capture_file_absolute(absolute);
3311 /* write all capture filenames of the menu to the user's recent file */
3313 menu_recent_file_write_all(FILE *rf) {
3314 GtkWidget *submenu_recent_files;
3318 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH_OLD);
3319 /* we have to iterate backwards through the children's list,
3320 * so we get the latest item last in the file.
3321 * (don't use gtk_container_foreach() here, it will return the wrong iteration order) */
3322 children = gtk_container_get_children(GTK_CONTAINER(submenu_recent_files));
3323 child = g_list_last(children);
3324 while(child != NULL) {
3325 /* get capture filename from the menu item label */
3326 cf_name = g_object_get_data(G_OBJECT(child->data), MENU_RECENT_FILES_KEY);
3329 fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", u3_contract_device_path(cf_name));
3331 fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", cf_name);
3334 child = g_list_previous(child);
3337 g_list_free(children);
3342 show_hide_cb(GtkWidget *w, gpointer data _U_, gint action)
3345 /* save current setting in recent */
3347 case(SHOW_HIDE_MAIN_TOOLBAR):
3348 recent.main_toolbar_show = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w));
3350 case(SHOW_HIDE_FILTER_TOOLBAR):
3351 recent.filter_toolbar_show = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w));
3354 case(SHOW_HIDE_AIRPCAP_TOOLBAR):
3355 recent.airpcap_toolbar_show = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w));
3358 case(SHOW_HIDE_STATUSBAR):
3359 recent.statusbar_show = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w));
3361 case(SHOW_HIDE_PACKET_LIST):
3362 recent.packet_list_show = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w));
3364 case(SHOW_HIDE_TREE_VIEW):
3365 recent.tree_view_show = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w));
3367 case(SHOW_HIDE_BYTE_VIEW):
3368 recent.byte_view_show = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w));
3371 g_assert_not_reached();
3374 main_widgets_show_or_hide();
3378 timestamp_format_cb(GtkWidget *w _U_, gpointer d _U_, gint action)
3380 if (recent.gui_time_format != action) {
3381 timestamp_set_type(action);
3382 recent.gui_time_format = action;
3383 /* This call adjusts column width */
3384 cf_timestamp_auto_precision(&cfile);
3385 new_packet_list_queue_draw();
3391 timestamp_precision_cb(GtkWidget *w _U_, gpointer d _U_, gint action)
3393 if (recent.gui_time_precision != action) {
3394 /* the actual precision will be set in new_packet_list_queue_draw() below */
3395 if (action == TS_PREC_AUTO) {
3396 timestamp_set_precision(TS_PREC_AUTO_SEC);
3398 timestamp_set_precision(action);
3400 recent.gui_time_precision = action;
3401 /* This call adjusts column width */
3402 cf_timestamp_auto_precision(&cfile);
3403 new_packet_list_queue_draw();
3408 timestamp_seconds_time_cb(GtkWidget *w, gpointer d _U_, gint action _U_)
3410 if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w))) {
3411 recent.gui_seconds_format = TS_SECONDS_HOUR_MIN_SEC;
3413 recent.gui_seconds_format = TS_SECONDS_DEFAULT;
3415 timestamp_set_seconds_type (recent.gui_seconds_format);
3417 /* This call adjusts column width */
3418 cf_timestamp_auto_precision(&cfile);
3419 new_packet_list_queue_draw();
3423 menu_name_resolution_changed(void)
3425 GtkWidget *menu = NULL;
3426 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Name Resolution/Enable for MAC Layer");
3427 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), gbl_resolv_flags & RESOLV_MAC);
3429 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Name Resolution/Enable for Network Layer");
3430 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), gbl_resolv_flags & RESOLV_NETWORK);
3432 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Name Resolution/Enable for Transport Layer");
3433 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), gbl_resolv_flags & RESOLV_TRANSPORT);
3437 name_resolution_cb(GtkWidget *w, gpointer d _U_, gint action)
3439 if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w))) {
3440 gbl_resolv_flags |= action;
3442 gbl_resolv_flags &= ~action;
3448 menu_auto_scroll_live_changed(gboolean auto_scroll_live_in) {
3452 /* tell menu about it */
3453 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Auto Scroll in Live Capture");
3454 if( ((gboolean) gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menu)) != auto_scroll_live_in) ) {
3455 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), auto_scroll_live_in);
3458 /* tell toolbar about it */
3459 toolbar_auto_scroll_live_changed(auto_scroll_live_in);
3461 /* change auto scroll */
3462 if(auto_scroll_live_in != auto_scroll_live) {
3463 auto_scroll_live = auto_scroll_live_in;
3468 auto_scroll_live_cb(GtkWidget *w _U_, gpointer d _U_)
3470 menu_auto_scroll_live_changed(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w)));
3473 #endif /*HAVE_LIBPCAP */
3477 menu_colorize_changed(gboolean packet_list_colorize) {
3481 /* tell menu about it */
3482 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Colorize Packet List");
3483 if( (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menu)) != packet_list_colorize) ) {
3484 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), packet_list_colorize);
3487 /* tell toolbar about it */
3488 toolbar_colorize_changed(packet_list_colorize);
3490 /* change colorization */
3491 if(packet_list_colorize != recent.packet_list_colorize) {
3492 recent.packet_list_colorize = packet_list_colorize;
3493 color_filters_enable(packet_list_colorize);
3494 new_packet_list_colorize_packets();
3499 colorize_cb(GtkWidget *w, gpointer d _U_)
3501 menu_colorize_changed(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w)));
3505 /* the recent file read has finished, update the menu corresponding */
3507 menu_recent_read_finished(void) {
3508 GtkWidget *menu = NULL;
3510 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Main Toolbar");
3511 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.main_toolbar_show);
3513 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Filter Toolbar");
3514 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.filter_toolbar_show);
3516 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Wireless Toolbar");
3517 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.airpcap_toolbar_show);
3518 #endif /* HAVE_AIRPCAP */
3520 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Statusbar");
3521 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.statusbar_show);
3523 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Packet List");
3524 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.packet_list_show);
3526 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Packet Details");
3527 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.tree_view_show);
3529 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Packet Bytes");
3530 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.byte_view_show);
3532 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Colorize Packet List");
3533 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.packet_list_colorize);
3535 menu_name_resolution_changed();
3538 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Auto Scroll in Live Capture");
3539 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), auto_scroll_live);
3540 #endif /* HAVE_LIBPCAP */
3542 main_widgets_rearrange();
3544 /* don't change the time format, if we had a command line value */
3545 if (timestamp_get_type() != TS_NOT_SET) {
3546 recent.gui_time_format = timestamp_get_type();
3549 switch(recent.gui_time_format) {
3550 case(TS_ABSOLUTE_WITH_DATE):
3551 menu = gtk_item_factory_get_widget(main_menu_factory,
3552 "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456");
3555 menu = gtk_item_factory_get_widget(main_menu_factory,
3556 "/View/Time Display Format/Time of Day: 01:02:03.123456");
3559 menu = gtk_item_factory_get_widget(main_menu_factory,
3560 "/View/Time Display Format/Seconds Since Beginning of Capture: 123.123456");
3563 menu = gtk_item_factory_get_widget(main_menu_factory,
3564 "/View/Time Display Format/Seconds Since Previous Captured Packet: 1.123456");
3567 menu = gtk_item_factory_get_widget(main_menu_factory,
3568 "/View/Time Display Format/Seconds Since Previous Displayed Packet: 1.123456");
3571 menu = gtk_item_factory_get_widget(main_menu_factory,
3572 "/View/Time Display Format/Seconds Since Epoch (1970-01-01): 1234567890.123456");
3574 case(TS_UTC_WITH_DATE):
3575 menu = gtk_item_factory_get_widget(main_menu_factory,
3576 "/View/Time Display Format/UTC Date and Time of Day: 1970-01-01 01:02:03.123456");
3579 menu = gtk_item_factory_get_widget(main_menu_factory,
3580 "/View/Time Display Format/UTC Time of Day: 01:02:03.123456");
3583 g_assert_not_reached();
3585 /* set_active will not trigger the callback when activating an active item! */
3586 recent.gui_time_format = -1;
3587 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), FALSE);
3588 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
3589 switch(recent.gui_time_precision) {
3591 menu = gtk_item_factory_get_widget(main_menu_factory,
3592 "/View/Time Display Format/Automatic (File Format Precision)");
3594 case(TS_PREC_FIXED_SEC):
3595 menu = gtk_item_factory_get_widget(main_menu_factory,
3596 "/View/Time Display Format/Seconds: 0");
3598 case(TS_PREC_FIXED_DSEC):
3599 menu = gtk_item_factory_get_widget(main_menu_factory,
3600 "/View/Time Display Format/Deciseconds: 0.1");
3602 case(TS_PREC_FIXED_CSEC):
3603 menu = gtk_item_factory_get_widget(main_menu_factory,
3604 "/View/Time Display Format/Centiseconds: 0.12");
3606 case(TS_PREC_FIXED_MSEC):
3607 menu = gtk_item_factory_get_widget(main_menu_factory,
3608 "/View/Time Display Format/Milliseconds: 0.123");
3610 case(TS_PREC_FIXED_USEC):
3611 menu = gtk_item_factory_get_widget(main_menu_factory,
3612 "/View/Time Display Format/Microseconds: 0.123456");
3614 case(TS_PREC_FIXED_NSEC):
3615 menu = gtk_item_factory_get_widget(main_menu_factory,
3616 "/View/Time Display Format/Nanoseconds: 0.123456789");
3619 g_assert_not_reached();
3622 /* set_active will not trigger the callback when activating an active item! */
3623 recent.gui_time_precision = -1;
3624 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), FALSE);
3625 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
3627 /* don't change the seconds format, if we had a command line value */
3628 if (timestamp_get_seconds_type() != TS_SECONDS_NOT_SET) {
3629 recent.gui_seconds_format = timestamp_get_seconds_type();
3631 menu = gtk_item_factory_get_widget(main_menu_factory,
3632 "/View/Time Display Format/Display Seconds with hours and minutes");
3634 switch (recent.gui_seconds_format) {
3635 case TS_SECONDS_DEFAULT:
3636 recent.gui_seconds_format = -1;
3637 /* set_active will not trigger the callback when deactivating an inactive item! */
3638 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
3639 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), FALSE);
3641 case TS_SECONDS_HOUR_MIN_SEC:
3642 recent.gui_seconds_format = -1;
3643 /* set_active will not trigger the callback when activating an active item! */
3644 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), FALSE);
3645 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
3648 g_assert_not_reached();
3651 menu_colorize_changed(recent.packet_list_colorize);
3656 popup_menu_handler(GtkWidget *widget, GdkEvent *event, gpointer data)
3658 GtkWidget *menu = (GtkWidget *)data;
3659 GdkEventButton *event_button = NULL;
3662 if(widget == NULL || event == NULL || data == NULL) {
3667 * If we ever want to make the menu differ based on what row
3668 * and/or column we're above, we'd use "eth_clist_get_selection_info()"
3669 * to find the row and column number for the coordinates; a CTree is,
3670 * I guess, like a CList with one column(?) and the expander widget
3673 /* Check if we are on packet_list object */
3674 if (widget == g_object_get_data(G_OBJECT(popup_menu_object), E_MPACKET_LIST_KEY) &&
3675 ((GdkEventButton *)event)->button != 1) {
3677 if (new_packet_list_get_event_row_column((GdkEventButton *)event, &physical_row, &row, &column)) {
3678 g_object_set_data(G_OBJECT(popup_menu_object), E_MPACKET_LIST_ROW_KEY,
3679 GINT_TO_POINTER(row));
3680 g_object_set_data(G_OBJECT(popup_menu_object), E_MPACKET_LIST_COL_KEY,
3681 GINT_TO_POINTER(column));
3682 new_packet_list_set_selected_row(row);
3686 /* Check if we are on tree_view object */
3687 if (widget == tree_view_gbl) {
3688 tree_view_select(widget, (GdkEventButton *) event);
3691 /* context menu handler */
3692 if(event->type == GDK_BUTTON_PRESS) {
3693 event_button = (GdkEventButton *) event;
3695 /* To quote the "Gdk Event Structures" doc:
3696 * "Normally button 1 is the left mouse button, 2 is the middle button, and 3 is the right button" */
3697 if(event_button->button == 3) {
3698 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
3699 event_button->button,
3700 event_button->time);
3701 g_signal_stop_emission_by_name(widget, "button_press_event");
3706 /* Check if we are on byte_view object */
3707 if(widget == get_notebook_bv_ptr(byte_nb_ptr_gbl)) {
3708 byte_view_select(widget, (GdkEventButton *) event);
3711 /* GDK_2BUTTON_PRESS is a doubleclick -> expand/collapse tree row */
3712 /* GTK version 1 seems to be doing this automatically */
3713 if (widget == tree_view_gbl && event->type == GDK_2BUTTON_PRESS) {
3716 if (gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(widget),
3717 (gint) (((GdkEventButton *)event)->x),
3718 (gint) (((GdkEventButton *)event)->y),
3719 &path, NULL, NULL, NULL))
3721 if (gtk_tree_view_row_expanded(GTK_TREE_VIEW(widget), path))
3722 gtk_tree_view_collapse_row(GTK_TREE_VIEW(widget), path);
3724 gtk_tree_view_expand_row(GTK_TREE_VIEW(widget), path,
3726 gtk_tree_path_free(path);
3732 /* Enable or disable menu items based on whether you have a capture file
3733 you've finished reading and, if you have one, whether it's been saved
3734 and whether it could be saved except by copying the raw packet data. */
3736 set_menus_for_capture_file(capture_file *cf)
3739 /* We have no capture file */
3740 set_menu_sensitivity_old("/File/Merge...", FALSE);
3741 set_menu_sensitivity_old("/File/Close", FALSE);
3742 set_menu_sensitivity_old("/File/Save", FALSE);
3743 set_menu_sensitivity_old("/File/Save As...", FALSE);
3744 set_menu_sensitivity_old("/File/Export", FALSE);
3745 set_menu_sensitivity_old("/View/Reload", FALSE);
3747 set_toolbar_for_capture_file(FALSE);
3748 set_toolbar_for_unsaved_capture_file(FALSE);
3750 set_menu_sensitivity_old("/File/Merge...", TRUE);
3751 set_menu_sensitivity_old("/File/Close", TRUE);
3752 set_menu_sensitivity_old("/File/Save", !cf->user_saved);
3754 * "Save As..." works only if we can write the file out in at least
3755 * one format (so we can save the whole file or just a subset) or
3756 * if we have an unsaved capture (so writing the whole file out
3757 * with a raw data copy makes sense).
3759 set_menu_sensitivity_old("/File/Save As...",
3760 cf_can_save_as(cf) || !cf->user_saved);
3761 set_menu_sensitivity_old("/File/Export", TRUE);
3762 set_menu_sensitivity_old("/View/Reload", TRUE);
3763 set_toolbar_for_unsaved_capture_file(!cf->user_saved);
3764 set_toolbar_for_capture_file(TRUE);
3768 /* Enable or disable menu items based on whether there's a capture in
3771 set_menus_for_capture_in_progress(gboolean capture_in_progress)
3773 set_menu_sensitivity_old("/File/Open...",
3774 !capture_in_progress);
3775 set_menu_sensitivity_old("/File/Open Recent",
3776 !capture_in_progress);
3777 set_menu_sensitivity_old("/File/Export",
3778 capture_in_progress);
3779 set_menu_sensitivity_old("/File/File Set",
3780 !capture_in_progress);
3781 set_menu_sensitivity(ui_manager_packet_list_heading, "/PacketListHeadingPopup/SortAscending",
3782 !capture_in_progress);
3783 set_menu_sensitivity(ui_manager_packet_list_heading, "/PacketListHeadingPopup/SortDescending",
3784 !capture_in_progress);
3785 set_menu_sensitivity(ui_manager_packet_list_heading, "/PacketListHeadingPopup/NoSorting",
3786 !capture_in_progress);
3789 set_menu_sensitivity_old("/Capture/Options...",
3790 !capture_in_progress);
3791 set_menu_sensitivity_old("/Capture/Start",
3792 !capture_in_progress);
3793 set_menu_sensitivity_old("/Capture/Stop",
3794 capture_in_progress);
3795 set_menu_sensitivity_old("/Capture/Restart",
3796 capture_in_progress);
3797 set_toolbar_for_capture_in_progress(capture_in_progress);
3799 set_capture_if_dialog_for_capture_in_progress(capture_in_progress);
3800 #endif /* HAVE_LIBPCAP */
3803 /* Enable or disable menu items based on whether you have some captured
3806 walk_menu_tree_for_captured_packets(GList *node,
3807 gboolean have_captured_packets)
3809 gboolean is_enabled;
3811 menu_item_t *node_data = node->data;
3814 * Is this a leaf node or an interior node?
3816 if (node_data->children == NULL) {
3820 * If it has no "selected_packet_enabled()" or
3821 * "selected_tree_row_enabled()" routines, we enable
3822 * it. This allows tap windows to be popped up even
3823 * if you have no capture file; this is done to let
3824 * the user pop up multiple tap windows before reading
3825 * in a capture file, so that they can be processed in
3826 * parallel while the capture file is being read rather
3827 * than one at at time as you pop up the windows, and to
3828 * let the user pop up tap windows before starting an
3829 * "Update list of packets in real time" capture, so that
3830 * the statistics can be displayed while the capture is
3833 * If it has either of those routines, we disable it for
3834 * now - as long as, when a capture is first available,
3835 * we don't get called after a packet or tree row is
3836 * selected, that's OK.
3837 * XXX - that should be done better.
3839 if (node_data->selected_packet_enabled == NULL &&
3840 node_data->selected_tree_row_enabled == NULL)
3841 node_data->enabled = TRUE;
3843 node_data->enabled = FALSE;
3846 * It's an interior node; call
3847 * "walk_menu_tree_for_captured_packets()" on all its
3848 * children and, if any of them are enabled, enable
3849 * this node, otherwise disable it.
3851 * XXX - should we just leave all interior nodes enabled?
3852 * Which is a better UI choice?
3855 for (child = node_data->children; child != NULL; child =
3857 if (walk_menu_tree_for_captured_packets(child,
3858 have_captured_packets))
3861 node_data->enabled = is_enabled;
3865 * The root node doesn't correspond to a menu tree item; it
3866 * has a null name pointer.
3868 if (node_data->gui_path != NULL) {
3869 set_menu_sensitivity_old(node_data->gui_path,
3870 node_data->enabled);
3872 return node_data->enabled;
3876 set_menus_for_captured_packets(gboolean have_captured_packets)
3878 set_menu_sensitivity_old("/File/Print...",
3879 have_captured_packets);
3880 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/Print",
3881 have_captured_packets);
3883 set_menu_sensitivity_old("/Edit/Find Packet...",
3884 have_captured_packets);
3885 set_menu_sensitivity_old("/Edit/Find Next",
3886 have_captured_packets);
3887 set_menu_sensitivity_old("/Edit/Find Previous",
3888 have_captured_packets);
3889 set_menu_sensitivity_old("/View/Zoom In",
3890 have_captured_packets);
3891 set_menu_sensitivity_old("/View/Zoom Out",
3892 have_captured_packets);
3893 set_menu_sensitivity_old("/View/Normal Size",
3894 have_captured_packets);
3895 set_menu_sensitivity_old("/Go/Go to Packet...",
3896 have_captured_packets);
3897 set_menu_sensitivity_old("/Go/Previous Packet",
3898 have_captured_packets);
3899 set_menu_sensitivity_old("/Go/Next Packet",
3900 have_captured_packets);
3901 set_menu_sensitivity_old("/Go/First Packet",
3902 have_captured_packets);
3903 set_menu_sensitivity_old("/Go/Last Packet",
3904 have_captured_packets);
3905 set_menu_sensitivity_old("/Go/Previous Packet In Conversation",
3906 have_captured_packets);
3907 set_menu_sensitivity_old("/Go/Next Packet In Conversation",
3908 have_captured_packets);
3909 set_menu_sensitivity_old("/Statistics/Summary",
3910 have_captured_packets);
3911 set_menu_sensitivity_old("/Statistics/Protocol Hierarchy",
3912 have_captured_packets);
3913 walk_menu_tree_for_captured_packets(tap_menu_tree_root,
3914 have_captured_packets);
3915 set_toolbar_for_captured_packets(have_captured_packets);
3918 /* Enable or disable menu items based on whether a packet is selected and,
3919 if so, on the properties of the packet. */
3921 walk_menu_tree_for_selected_packet(GList *node, frame_data *fd,
3922 epan_dissect_t *edt)
3924 gboolean is_enabled;
3926 menu_item_t *node_data = node->data;
3929 * Is this a leaf node or an interior node?
3931 if (node_data->children == NULL) {
3935 * If it has no "selected_packet_enabled()" routine,
3936 * leave its enabled/disabled status alone - it
3937 * doesn't depend on whether we have a packet selected
3938 * or not or on the selected packet.
3940 * If it has a "selected_packet_enabled()" routine,
3941 * call it and set the item's enabled/disabled status
3942 * based on its return value.
3944 if (node_data->selected_packet_enabled != NULL)
3945 node_data->enabled = node_data->selected_packet_enabled(fd, edt, node_data->callback_data);
3948 * It's an interior node; call
3949 * "walk_menu_tree_for_selected_packet()" on all its
3950 * children and, if any of them are enabled, enable
3951 * this node, otherwise disable it.
3953 * XXX - should we just leave all interior nodes enabled?
3954 * Which is a better UI choice?
3957 for (child = node_data->children; child != NULL; child =
3959 if (walk_menu_tree_for_selected_packet(child, fd, edt))
3962 node_data->enabled = is_enabled;
3966 * The root node doesn't correspond to a menu tree item; it
3967 * has a null name pointer.
3969 if (node_data->gui_path != NULL) {
3970 set_menu_sensitivity_old(node_data->gui_path,
3971 node_data->enabled);
3973 return node_data->enabled;
3977 packet_is_ssl(epan_dissect_t* edt)
3983 if (!edt || !edt->tree)
3985 ssl_id = proto_get_id_by_filter_name("ssl");
3988 array = proto_find_finfo(edt->tree, ssl_id);
3989 is_ssl = (array->len > 0) ? TRUE : FALSE;
3990 g_ptr_array_free(array, TRUE);
3995 set_menus_for_selected_packet(capture_file *cf)
3997 /* Making the menu context-sensitive allows for easier selection of the
3998 desired item and has the added benefit, with large captures, of
3999 avoiding needless looping through huge lists for marked, ignored,
4000 or time-referenced packets. */
4001 gboolean is_ssl = packet_is_ssl(cf->edt);
4002 gboolean frame_selected = cf->current_frame != NULL;
4003 /* A frame is selected */
4004 gboolean have_marked = frame_selected && cf->marked_count > 0;
4005 /* We have marked frames. (XXX - why check frame_selected?) */
4006 gboolean another_is_marked = have_marked &&
4007 !(cf->marked_count == 1 && cf->current_frame->flags.marked);
4008 /* We have a marked frame other than the current frame (i.e.,
4009 we have at least one marked frame, and either there's more
4010 than one marked frame or the current frame isn't marked). */
4011 gboolean have_time_ref = cf->ref_time_count > 0;
4012 gboolean another_is_time_ref = frame_selected && have_time_ref &&
4013 !(cf->ref_time_count == 1 && cf->current_frame->flags.ref_time);
4014 /* We have a time reference frame other than the current frame (i.e.,
4015 we have at least one time reference frame, and either there's more
4016 than one time reference frame or the current frame isn't a
4017 time reference frame). (XXX - why check frame_selected?) */
4019 set_menu_sensitivity_old("/Edit/Mark Packet (toggle)",
4021 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/MarkPacket",
4023 set_menu_sensitivity_old("/Edit/Mark All Displayed Packets (toggle)",
4024 cf->displayed_count > 0);
4025 /* Unlike un-ignore, do not allow unmark of all frames when no frames are displayed */
4026 set_menu_sensitivity_old("/Edit/Unmark All Packets",
4028 set_menu_sensitivity_old("/Edit/Find Next Mark",
4030 set_menu_sensitivity_old("/Edit/Find Previous Mark",
4033 set_menu_sensitivity_old("/Edit/Ignore Packet (toggle)",
4035 set_menu_sensitivity_old("/Edit/Edit packet",
4037 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/IgnorePacket",
4039 set_menu_sensitivity_old("/Edit/Ignore All Displayed Packets (toggle)",
4040 cf->displayed_count > 0 && cf->displayed_count != cf->count);
4041 /* Allow un-ignore of all frames even with no frames currently displayed */
4042 set_menu_sensitivity_old("/Edit/Un-Ignore All Packets",
4043 cf->ignored_count > 0);
4045 set_menu_sensitivity_old("/Edit/Set Time Reference (toggle)",
4047 set_menu_sensitivity_old("/Edit/Un-Time Reference All Packets",
4049 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/SetTimeReference",
4051 set_menu_sensitivity_old("/Edit/Find Next Time Reference",
4052 another_is_time_ref);
4053 set_menu_sensitivity_old("/Edit/Find Previous Time Reference",
4054 another_is_time_ref);
4056 set_menu_sensitivity_old("/View/Resize All Columns",
4058 set_menu_sensitivity_old("/View/Collapse All",
4060 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/CollapseAll",
4062 set_menu_sensitivity_old("/View/Expand All",
4064 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ExpandAll",
4066 set_menu_sensitivity_old("/View/Colorize Conversation",
4068 set_menu_sensitivity_old("/View/Reset Coloring 1-10",
4069 tmp_color_filters_used());
4070 set_menu_sensitivity_old("/View/Show Packet in New Window",
4072 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ShowPacketinNewWindow",
4074 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ManuallyResolveAddress",
4075 frame_selected ? ((cf->edt->pi.ethertype == ETHERTYPE_IP)||(cf->edt->pi.ethertype == ETHERTYPE_IPv6)) : FALSE);
4076 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/SCTP",
4077 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_SCTP) : FALSE);
4078 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/FollowTCPStream",
4079 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
4080 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FollowTCPStream",
4081 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
4082 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/FollowUDPStream",
4083 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
4084 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/FollowSSLStream",
4085 frame_selected ? is_ssl : FALSE);
4086 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FollowSSLStream",
4087 frame_selected ? is_ssl : FALSE);
4088 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter",
4090 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/Ethernet",
4091 frame_selected ? (cf->edt->pi.dl_src.type == AT_ETHER) : FALSE);
4092 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/IP",
4093 frame_selected ? ((cf->edt->pi.ethertype == ETHERTYPE_IP)||(cf->edt->pi.ethertype == ETHERTYPE_IPv6)) : FALSE);
4094 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/TCP",
4095 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
4096 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/UDP",
4097 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
4098 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FollowUDPStream",
4099 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
4100 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/PN-CBA",
4101 frame_selected ? (cf->edt->pi.profinet_type != 0 && cf->edt->pi.profinet_type < 10) : FALSE);
4102 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation",
4104 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/Ethernet",
4105 frame_selected ? (cf->edt->pi.dl_src.type == AT_ETHER) : FALSE);
4106 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/IP",
4107 frame_selected ? ((cf->edt->pi.ethertype == ETHERTYPE_IP)||(cf->edt->pi.ethertype == ETHERTYPE_IPv6)) : FALSE);
4108 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/TCP",
4109 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
4110 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/UDP",
4111 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
4112 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/PN-CBA",
4113 frame_selected ? (cf->edt->pi.profinet_type != 0 && cf->edt->pi.profinet_type < 10) : FALSE);
4114 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/DecodeAs",
4115 frame_selected && decode_as_ok());
4116 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/DecodeAs",
4117 frame_selected && decode_as_ok());
4118 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/Copy",
4120 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ApplyAsFilter",
4122 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/PrepareaFilter",
4124 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ResolveName",
4125 frame_selected && (gbl_resolv_flags & RESOLV_ALL_ADDRS) != RESOLV_ALL_ADDRS);
4126 set_menu_sensitivity_old("/Analyze/Follow TCP Stream",
4127 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
4128 set_menu_sensitivity_old("/Analyze/Follow UDP Stream",
4129 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
4130 set_menu_sensitivity_old("/Analyze/Follow SSL Stream",
4131 frame_selected ? is_ssl : FALSE);
4132 set_menu_sensitivity_old("/Analyze/Decode As...",
4133 frame_selected && decode_as_ok());
4134 set_menu_sensitivity_old("/View/Name Resolution/Resolve Name",
4135 frame_selected && (gbl_resolv_flags & RESOLV_ALL_ADDRS) != RESOLV_ALL_ADDRS);
4136 set_menu_sensitivity_old("/Tools/Firewall ACL Rules",
4138 walk_menu_tree_for_selected_packet(tap_menu_tree_root, cf->current_frame,
4142 /* Enable or disable menu items based on whether a tree row is selected
4143 and, if so, on the properties of the tree row. */
4145 walk_menu_tree_for_selected_tree_row(GList *node, field_info *fi)
4147 gboolean is_enabled;
4149 menu_item_t *node_data = node->data;
4152 * Is this a leaf node or an interior node?
4154 if (node_data->children == NULL) {
4158 * If it has no "selected_tree_row_enabled()" routine,
4159 * leave its enabled/disabled status alone - it
4160 * doesn't depend on whether we have a tree row selected
4161 * or not or on the selected tree row.
4163 * If it has a "selected_tree_row_enabled()" routine,
4164 * call it and set the item's enabled/disabled status
4165 * based on its return value.
4167 if (node_data->selected_tree_row_enabled != NULL)
4168 node_data->enabled = node_data->selected_tree_row_enabled(fi, node_data->callback_data);
4171 * It's an interior node; call
4172 * "walk_menu_tree_for_selected_tree_row()" on all its
4173 * children and, if any of them are enabled, enable
4174 * this node, otherwise disable it.
4176 * XXX - should we just leave all interior nodes enabled?
4177 * Which is a better UI choice?
4180 for (child = node_data->children; child != NULL; child =
4182 if (walk_menu_tree_for_selected_tree_row(child, fi))
4185 node_data->enabled = is_enabled;
4189 * The root node doesn't correspond to a menu tree item; it
4190 * has a null name pointer.
4192 if (node_data->gui_path != NULL) {
4193 set_menu_sensitivity_old(node_data->gui_path,
4194 node_data->enabled);
4196 return node_data->enabled;
4200 menu_prefs_toggle_bool (GtkWidget *w, gpointer data)
4202 gboolean *value = data;
4203 module_t *module = g_object_get_data (G_OBJECT(w), "module");
4205 module->prefs_changed = TRUE;
4208 prefs_apply (module);
4209 if (!prefs.gui_use_pref_save) {
4212 redissect_packets();
4216 menu_prefs_change_enum (GtkWidget *w, gpointer data)
4219 module_t *module = g_object_get_data (G_OBJECT(w), "module");
4220 gint new_value = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(w), "enumval"));
4222 if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM(w)))
4225 if (*value != new_value) {
4226 module->prefs_changed = TRUE;
4229 prefs_apply (module);
4230 if (!prefs.gui_use_pref_save) {
4233 redissect_packets();
4238 menu_prefs_reset(void)
4240 g_free (g_object_get_data(G_OBJECT(ui_manager_tree_view_menu), "menu_abbrev"));
4241 g_object_set_data(G_OBJECT(ui_manager_tree_view_menu), "menu_abbrev", NULL);
4245 menu_prefs_change_ok (GtkWidget *w, gpointer parent_w)
4247 GtkWidget *entry = g_object_get_data (G_OBJECT(w), "entry");
4248 module_t *module = g_object_get_data (G_OBJECT(w), "module");
4249 pref_t *pref = g_object_get_data (G_OBJECT(w), "pref");
4250 const gchar *new_value = gtk_entry_get_text(GTK_ENTRY(entry));
4255 switch (pref->type) {
4257 uval = strtoul(new_value, &p, pref->info.base);
4258 if (p == new_value || *p != '\0') {
4259 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
4260 "The value \"%s\" isn't a valid number.",
4264 if (*pref->varp.uint != uval) {
4265 module->prefs_changed = TRUE;
4266 *pref->varp.uint = uval;
4270 if (strcmp (*pref->varp.string, new_value) != 0) {
4271 module->prefs_changed = TRUE;
4272 g_free((void*)*pref->varp.string);
4273 *pref->varp.string = g_strdup(new_value);
4277 if (range_convert_str(&newrange, new_value, pref->info.max_value) != CVT_NO_ERROR) {
4278 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
4279 "The value \"%s\" isn't a valid range.",
4283 if (!ranges_are_equal(*pref->varp.range, newrange)) {
4284 module->prefs_changed = TRUE;
4285 g_free(*pref->varp.range);
4286 *pref->varp.range = newrange;
4292 g_assert_not_reached();
4296 if (module->prefs_changed) {
4297 /* Ensure we reload the sub menu */
4299 prefs_apply (module);
4300 if (!prefs.gui_use_pref_save) {
4303 redissect_packets();
4306 window_destroy(GTK_WIDGET(parent_w));
4310 menu_prefs_change_cancel (GtkWidget *w _U_, gpointer parent_w)
4312 window_destroy(GTK_WIDGET(parent_w));
4316 menu_prefs_edit_dlg (GtkWidget *w, gpointer data)
4318 pref_t *pref = data;
4319 module_t *module = g_object_get_data (G_OBJECT(w), "module");
4320 gchar *value = NULL;
4322 GtkWidget *win, *main_tb, *main_vb, *bbox, *cancel_bt, *ok_bt;
4323 GtkWidget *entry, *label;
4325 switch (pref->type) {
4327 switch (pref->info.base) {
4329 value = g_strdup_printf("%o", *pref->varp.uint);
4332 value = g_strdup_printf("%u", *pref->varp.uint);
4335 value = g_strdup_printf("%x", *pref->varp.uint);
4338 g_assert_not_reached();
4343 value = g_strdup(*pref->varp.string);
4346 value = g_strdup(range_convert_range (*pref->varp.range));
4349 g_assert_not_reached();
4353 win = dlg_window_new(module->description);
4355 gtk_window_set_resizable(GTK_WINDOW(win),FALSE);
4356 gtk_window_resize(GTK_WINDOW(win), 400, 100);
4358 main_vb = gtk_vbox_new(FALSE, 5);
4359 gtk_container_add(GTK_CONTAINER(win), main_vb);
4360 gtk_container_set_border_width(GTK_CONTAINER(main_vb), 6);
4362 main_tb = gtk_table_new(2, 2, FALSE);
4363 gtk_box_pack_start(GTK_BOX(main_vb), main_tb, FALSE, FALSE, 0);
4364 gtk_table_set_col_spacings(GTK_TABLE(main_tb), 10);
4366 label = gtk_label_new(ep_strdup_printf("%s:", pref->title));
4367 gtk_table_attach_defaults(GTK_TABLE(main_tb), label, 0, 1, 1, 2);
4368 gtk_misc_set_alignment(GTK_MISC(label), 1.0f, 0.5f);
4369 if (pref->description)
4370 gtk_widget_set_tooltip_text(label, pref->description);
4372 entry = gtk_entry_new();
4373 gtk_table_attach_defaults(GTK_TABLE(main_tb), entry, 1, 2, 1, 2);
4374 gtk_entry_set_text(GTK_ENTRY(entry), value);
4375 if (pref->description)
4376 gtk_widget_set_tooltip_text(entry, pref->description);
4378 bbox = dlg_button_row_new(GTK_STOCK_CANCEL,GTK_STOCK_OK, NULL);
4379 gtk_box_pack_end(GTK_BOX(main_vb), bbox, FALSE, FALSE, 0);
4381 ok_bt = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_OK);
4382 g_object_set_data (G_OBJECT(ok_bt), "module", module);
4383 g_object_set_data (G_OBJECT(ok_bt), "entry", entry);
4384 g_object_set_data (G_OBJECT(ok_bt), "pref", pref);
4385 g_signal_connect(ok_bt, "clicked", G_CALLBACK(menu_prefs_change_ok), win);
4387 dlg_set_activate(entry, ok_bt);
4389 cancel_bt = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_CANCEL);
4390 g_signal_connect(cancel_bt, "clicked", G_CALLBACK(menu_prefs_change_cancel), win);
4391 window_set_cancel_button(win, cancel_bt, NULL);
4393 gtk_widget_grab_default(ok_bt);
4394 gtk_widget_show_all(win);
4399 add_protocol_prefs_menu (pref_t *pref, gpointer data)
4401 GtkWidget *menu_preferences;
4402 GtkWidget *menu_item, *menu_sub_item, *sub_menu;
4403 GSList *group = NULL;
4404 module_t *module = data;
4405 const enum_val_t *enum_valp;
4406 gchar *label = NULL;
4408 switch (pref->type) {
4410 switch (pref->info.base) {
4412 label = g_strdup_printf ("%s: %o", pref->title, *pref->varp.uint);
4415 label = g_strdup_printf ("%s: %u", pref->title, *pref->varp.uint);
4418 label = g_strdup_printf ("%s: %x", pref->title, *pref->varp.uint);
4421 g_assert_not_reached();
4424 menu_item = gtk_menu_item_new_with_label(label);
4425 g_object_set_data (G_OBJECT(menu_item), "module", module);
4426 g_signal_connect(menu_item, "activate", G_CALLBACK(menu_prefs_edit_dlg), pref);
4430 menu_item = gtk_check_menu_item_new_with_label(pref->title);
4431 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menu_item), *pref->varp.boolp);
4432 g_object_set_data (G_OBJECT(menu_item), "module", module);
4433 g_signal_connect(menu_item, "activate", G_CALLBACK(menu_prefs_toggle_bool), pref->varp.boolp);
4436 menu_item = gtk_menu_item_new_with_label(pref->title);
4437 sub_menu = gtk_menu_new();
4438 gtk_menu_item_set_submenu (GTK_MENU_ITEM(menu_item), sub_menu);
4439 enum_valp = pref->info.enum_info.enumvals;
4440 while (enum_valp->name != NULL) {
4441 menu_sub_item = gtk_radio_menu_item_new_with_label(group, enum_valp->description);
4442 group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_sub_item));
4443 if (enum_valp->value == *pref->varp.enump) {
4444 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menu_sub_item), TRUE);
4446 g_object_set_data (G_OBJECT(menu_sub_item), "module", module);
4447 g_object_set_data (G_OBJECT(menu_sub_item), "enumval", GINT_TO_POINTER(enum_valp->value));
4448 g_signal_connect(menu_sub_item, "activate", G_CALLBACK(menu_prefs_change_enum), pref->varp.enump);
4449 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_sub_item);
4450 gtk_widget_show (menu_sub_item);
4455 label = g_strdup_printf ("%s: %s", pref->title, *pref->varp.string);
4456 menu_item = gtk_menu_item_new_with_label(label);
4457 g_object_set_data (G_OBJECT(menu_item), "module", module);
4458 g_signal_connect(menu_item, "activate", G_CALLBACK(menu_prefs_edit_dlg), pref);
4462 label = g_strdup_printf ("%s: %s", pref->title, range_convert_range (*pref->varp.range));
4463 menu_item = gtk_menu_item_new_with_label(label);
4464 g_object_set_data (G_OBJECT(menu_item), "module", module);
4465 g_signal_connect(menu_item, "activate", G_CALLBACK(menu_prefs_edit_dlg), pref);
4469 label = g_strdup_printf ("%s...", pref->title);
4470 menu_item = gtk_menu_item_new_with_label(label);
4471 g_signal_connect (menu_item, "activate", G_CALLBACK(uat_window_cb), pref->varp.uat);
4474 case PREF_STATIC_TEXT:
4477 /* Nothing to add */
4481 menu_preferences = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/ProtocolPreferences");
4482 if(!menu_preferences)
4483 g_warning("menu_preferences Not found path:TreeViewPopup/ProtocolPreferences");
4484 sub_menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM(menu_preferences));
4485 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
4486 gtk_widget_show (menu_item);
4492 rebuild_protocol_prefs_menu (module_t *prefs_module_p, gboolean preferences)
4494 GtkWidget *menu_preferences, *menu_item;
4495 GtkWidget *sub_menu;
4498 menu_preferences = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/ProtocolPreferences");
4499 if (prefs_module_p && preferences) {
4500 sub_menu = gtk_menu_new();
4501 gtk_menu_item_set_submenu (GTK_MENU_ITEM(menu_preferences), sub_menu);
4503 label = g_strdup_printf ("%s Preferences...", prefs_module_p->description);
4504 menu_item = gtk_image_menu_item_new_with_label (label);
4505 gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM(menu_item),
4506 gtk_image_new_from_stock(GTK_STOCK_PREFERENCES, GTK_ICON_SIZE_MENU));
4507 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
4508 g_signal_connect_swapped(G_OBJECT(menu_item), "activate",
4509 G_CALLBACK(properties_cb), (GObject *) menu_item);
4510 gtk_widget_show (menu_item);
4513 menu_item = gtk_menu_item_new();
4514 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
4515 gtk_widget_show (menu_item);
4517 prefs_pref_foreach(prefs_module_p, add_protocol_prefs_menu, prefs_module_p);
4519 /* No preferences, remove sub menu */
4520 gtk_menu_item_set_submenu (GTK_MENU_ITEM(menu_preferences), NULL);
4526 menu_visible_column_toggle (GtkWidget *w _U_, gpointer data)
4528 new_packet_list_toggle_visible_column (GPOINTER_TO_INT(data));
4532 rebuild_visible_columns_menu (void)
4534 GtkWidget *menu_columns[2], *menu_item;
4535 GtkWidget *sub_menu;
4539 gint i, col_id, cur_fmt;
4540 menu_columns[0] = gtk_item_factory_get_widget(main_menu_factory, "/View/Displayed Columns");
4541 menu_columns[1] = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/DisplayedColumns");
4543 if(! menu_columns[1]){
4544 fprintf (stderr, "Warning: couldn't find menu_columns[1] path=/PacketListHeadingPopup/DisplayedColumns");
4547 for (i = 0; i < 2; i++) {
4548 sub_menu = gtk_menu_new();
4549 gtk_menu_item_set_submenu (GTK_MENU_ITEM(menu_columns[i]), sub_menu);
4551 clp = g_list_first (prefs.col_list);
4554 cfmt = (fmt_data *) clp->data;
4555 cur_fmt = get_column_format_from_str(cfmt->fmt);
4556 if (cfmt->title[0]) {
4557 if (cur_fmt == COL_CUSTOM) {
4558 title = g_strdup_printf ("%s (%s)", cfmt->title, cfmt->custom_field);
4560 title = g_strdup_printf ("%s (%s)", cfmt->title, col_format_desc (cur_fmt));
4563 if (cur_fmt == COL_CUSTOM) {
4564 title = g_strdup_printf ("(%s)", cfmt->custom_field);
4566 title = g_strdup_printf ("(%s)", col_format_desc (cur_fmt));
4569 menu_item = gtk_check_menu_item_new_with_label(title);
4571 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menu_item), cfmt->visible);
4572 g_signal_connect(menu_item, "activate", G_CALLBACK(menu_visible_column_toggle), GINT_TO_POINTER(col_id));
4573 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
4574 gtk_widget_show (menu_item);
4575 clp = g_list_next (clp);
4579 menu_item = gtk_menu_item_new();
4580 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
4581 gtk_widget_show (menu_item);
4583 menu_item = gtk_menu_item_new_with_label ("Display All");
4584 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
4585 g_signal_connect(menu_item, "activate", G_CALLBACK(packet_list_heading_activate_all_columns_cb), NULL);
4586 gtk_widget_show (menu_item);
4591 menus_set_column_resolved (gboolean resolved, gboolean can_resolve)
4595 menu = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/ShowResolved");
4597 fprintf (stderr, "Warning: couldn't find menu path=/PacketListHeadingPopup/ShowResolved");
4599 g_object_set_data(G_OBJECT(menu), "skip-update", (void *)1);
4600 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), resolved && can_resolve);
4601 set_menu_sensitivity(ui_manager_packet_list_heading, "/PacketListHeadingPopup/ShowResolved", can_resolve);
4602 g_object_set_data(G_OBJECT(menu), "skip-update", NULL);
4606 menus_set_column_align_default (gboolean right_justify)
4608 GtkWidget *submenu, *menu_item_child;
4609 GList *child_list, *child_list_item;
4610 const gchar *menu_item_name;
4611 size_t menu_item_len;
4613 /* get the submenu container item */
4614 submenu = gtk_ui_manager_get_widget (ui_manager_packet_list_heading, "/PacketListHeadingPopup");
4616 fprintf (stderr, "Warning: couldn't find submenu path=/PacketListHeadingPopup");
4619 /* find the corresponding menu items to update */
4620 child_list = gtk_container_get_children(GTK_CONTAINER(submenu));
4621 child_list_item = child_list;
4622 while(child_list_item) {
4623 menu_item_child = gtk_bin_get_child(GTK_BIN(child_list_item->data));
4624 if (menu_item_child != NULL) {
4625 menu_item_name = gtk_label_get_text(GTK_LABEL(menu_item_child));
4626 menu_item_len = strlen (menu_item_name);
4627 if(strncmp(menu_item_name, "Align Left", 10) == 0) {
4628 if (!right_justify && menu_item_len == 10) {
4629 gtk_label_set_text(GTK_LABEL(menu_item_child), "Align Left\t(default)");
4630 } else if (right_justify && menu_item_len > 10) {
4631 gtk_label_set_text(GTK_LABEL(menu_item_child), "Align Left");
4633 } else if (strncmp (menu_item_name, "Align Right", 11) == 0) {
4634 if (right_justify && menu_item_len == 11) {
4635 gtk_label_set_text(GTK_LABEL(menu_item_child), "Align Right\t(default)");
4636 } else if (!right_justify && menu_item_len > 11) {
4637 gtk_label_set_text(GTK_LABEL(menu_item_child), "Align Right");
4641 child_list_item = g_list_next(child_list_item);
4643 g_list_free(child_list);
4647 set_menus_for_selected_tree_row(capture_file *cf)
4649 gboolean properties;
4652 if (cf->finfo_selected != NULL) {
4653 header_field_info *hfinfo = cf->finfo_selected->hfinfo;
4657 if (hfinfo->parent == -1) {
4658 abbrev = hfinfo->abbrev;
4659 id = (hfinfo->type == FT_PROTOCOL) ? proto_get_id((protocol_t *)hfinfo->strings) : -1;
4661 abbrev = proto_registrar_get_abbrev(hfinfo->parent);
4662 id = hfinfo->parent;
4664 properties = prefs_is_registered_protocol(abbrev);
4665 set_menu_sensitivity(ui_manager_tree_view_menu,
4666 "/TreeViewPopup/GotoCorrespondingPacket", hfinfo->type == FT_FRAMENUM);
4667 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/Copy",
4669 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/Copy/AsFilter",
4670 proto_can_match_selected(cf->finfo_selected, cf->edt));
4671 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyasColumn",
4672 hfinfo->type != FT_NONE);
4673 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter",
4674 proto_can_match_selected(cf->finfo_selected, cf->edt));
4675 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter",
4676 proto_can_match_selected(cf->finfo_selected, cf->edt));
4677 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ColorizewithFilter",
4678 proto_can_match_selected(cf->finfo_selected, cf->edt));
4679 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ProtocolPreferences",
4681 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/DisableProtocol",
4682 (id == -1) ? FALSE : proto_can_toggle_protocol(id));
4683 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ExpandSubtrees",
4684 cf->finfo_selected->tree_type != -1);
4685 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/WikiProtocolPage",
4686 (id == -1) ? FALSE : TRUE);
4687 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FilterFieldReference",
4688 (id == -1) ? FALSE : TRUE);
4689 set_menu_sensitivity_old(
4690 "/File/Export/Selected Packet Bytes...", TRUE);
4691 set_menu_sensitivity_old(
4692 "/Go/Go to Corresponding Packet", hfinfo->type == FT_FRAMENUM);
4693 set_menu_sensitivity_old("/Edit/Copy/Description",
4694 proto_can_match_selected(cf->finfo_selected, cf->edt));
4695 set_menu_sensitivity_old("/Edit/Copy/Fieldname",
4696 proto_can_match_selected(cf->finfo_selected, cf->edt));
4697 set_menu_sensitivity_old("/Edit/Copy/Value",
4698 proto_can_match_selected(cf->finfo_selected, cf->edt));
4699 set_menu_sensitivity_old("/Edit/Copy/As Filter",
4700 proto_can_match_selected(cf->finfo_selected, cf->edt));
4701 set_menu_sensitivity_old("/Analyze/Apply as Column",
4702 hfinfo->type != FT_NONE);
4703 set_menu_sensitivity_old("/Analyze/Apply as Filter",
4704 proto_can_match_selected(cf->finfo_selected, cf->edt));
4705 set_menu_sensitivity_old("/Analyze/Prepare a Filter",
4706 proto_can_match_selected(cf->finfo_selected, cf->edt));
4707 set_menu_sensitivity_old("/View/Expand Subtrees",
4708 cf->finfo_selected->tree_type != -1);
4709 prev_abbrev = g_object_get_data(G_OBJECT(ui_manager_tree_view_menu), "menu_abbrev");
4710 if (!prev_abbrev || (strcmp (prev_abbrev, abbrev) != 0)) {
4711 /* No previous protocol or protocol changed - update Protocol Preferences menu */
4712 module_t *prefs_module_p = prefs_find_module(abbrev);
4713 rebuild_protocol_prefs_menu (prefs_module_p, properties);
4715 g_object_set_data(G_OBJECT(ui_manager_tree_view_menu), "menu_abbrev", g_strdup(abbrev));
4716 g_free (prev_abbrev);
4719 set_menu_sensitivity(ui_manager_tree_view_menu,
4720 "/TreeViewPopup/GotoCorrespondingPacket", FALSE);
4721 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/Copy", FALSE);
4722 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyasColumn", FALSE);
4723 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter", FALSE);
4724 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter", FALSE);
4725 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ColorizewithFilter", FALSE);
4726 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ProtocolPreferences",
4728 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/DisableProtocol", FALSE);
4729 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ExpandSubtrees", FALSE);
4730 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/WikiProtocolPage",
4732 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FilterFieldReference",
4734 set_menu_sensitivity_old("/File/Export/Selected Packet Bytes...", FALSE);
4735 set_menu_sensitivity_old("/Go/Go to Corresponding Packet", FALSE);
4736 set_menu_sensitivity_old("/Edit/Copy/Description", FALSE);
4737 set_menu_sensitivity_old("/Edit/Copy/Fieldname", FALSE);
4738 set_menu_sensitivity_old("/Edit/Copy/Value", FALSE);
4739 set_menu_sensitivity_old("/Edit/Copy/As Filter", FALSE);
4740 set_menu_sensitivity_old("/Analyze/Apply as Column", FALSE);
4741 set_menu_sensitivity_old("/Analyze/Apply as Filter", FALSE);
4742 set_menu_sensitivity_old("/Analyze/Prepare a Filter", FALSE);
4743 set_menu_sensitivity_old("/View/Expand Subtrees", FALSE);
4747 walk_menu_tree_for_selected_tree_row(tap_menu_tree_root, cf->finfo_selected);
4750 void set_menus_for_packet_history(gboolean back_history, gboolean forward_history) {
4751 set_menu_sensitivity_old("/Go/Back", back_history);
4752 set_menu_sensitivity_old("/Go/Forward", forward_history);
4753 set_toolbar_for_packet_history(back_history, forward_history);
4757 void set_menus_for_file_set(gboolean file_set, gboolean previous_file, gboolean next_file) {
4758 set_menu_sensitivity_old("/File/File Set/List Files", file_set);
4759 set_menu_sensitivity_old("/File/File Set/Previous File", previous_file);
4760 set_menu_sensitivity_old("/File/File Set/Next File", next_file);
4763 GtkWidget *menus_get_profiles_edit_menu (void)
4765 return gtk_ui_manager_get_widget(ui_manager_statusbar_profiles_menu, "/ProfilesMenuPopup/Edit");
4768 GtkWidget *menus_get_profiles_delete_menu (void)
4770 return gtk_ui_manager_get_widget(ui_manager_statusbar_profiles_menu, "/ProfilesMenuPopup/Delete");
4773 GtkWidget *menus_get_profiles_change_menu (void)
4775 return gtk_ui_manager_get_widget(ui_manager_statusbar_profiles_menu, "/ProfilesMenuPopup/Change");
4778 void set_menus_for_profiles(gboolean default_profile)
4780 set_menu_sensitivity(ui_manager_statusbar_profiles_menu, "/ProfilesMenuPopup/Edit", !default_profile);
4781 set_menu_sensitivity(ui_manager_statusbar_profiles_menu, "/ProfilesMenuPopup/Delete", !default_profile);
4790 * indent-tabs-mode: nil
4793 * ex: set shiftwidth=4 tabstop=8 expandtab
4794 * :indentSize=4:tabSize=8:noTabs=true:
4796 #endif /* MAIN_MENU_USE_UIMANAGER */