6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
34 #include <epan/packet.h>
35 #include <epan/addr_resolv.h>
36 #include <epan/prefs.h>
37 #include <epan/prefs-int.h>
39 #include <epan/timestamp.h>
40 #include <epan/etypes.h>
41 #include <epan/ipproto.h>
42 #include <epan/dissector_filters.h>
43 #include <epan/strutil.h>
44 #include <epan/plugins.h>
45 #include <epan/epan_dissect.h>
46 #include <epan/column.h>
47 #include "gtk/dissector_tables_dlg.h"
50 #include "../ui_util.h"
51 #include "../simple_dialog.h"
52 #include "../color_filters.h"
53 #include "../stat_menu.h"
55 #include "gtk/about_dlg.h"
56 #include "gtk/capture_dlg.h"
57 #include "gtk/capture_if_dlg.h"
58 #include "gtk/color_dlg.h"
59 #include "gtk/filter_dlg.h"
60 #include "gtk/profile_dlg.h"
61 #include "gtk/dlg_utils.h"
62 #include "gtk/capture_file_dlg.h"
63 #include "gtk/fileset_dlg.h"
64 #include "gtk/find_dlg.h"
65 #include "gtk/goto_dlg.h"
66 #include "gtk/summary_dlg.h"
67 #include "gtk/prefs_dlg.h"
68 #include "gtk/packet_win.h"
69 #include "gtk/follow_tcp.h"
70 #include "gtk/follow_udp.h"
71 #include "gtk/follow_ssl.h"
72 #include "gtk/decode_as_dlg.h"
73 #include "gtk/help_dlg.h"
74 #include "gtk/supported_protos_dlg.h"
75 #include "gtk/proto_dlg.h"
76 #include "gtk/proto_hier_stats_dlg.h"
78 #include "gtk/stock_icons.h"
79 #include "gtk/gtkglobals.h"
80 #include "gtk/recent.h"
81 #include "gtk/main_proto_draw.h"
82 #include "gtk/conversations_table.h"
83 #include "gtk/hostlist_table.h"
84 #include "gtk/packet_history.h"
85 #include "gtk/sctp_stat.h"
86 #include "gtk/firewall_dlg.h"
88 #include "gtk/macros_dlg.h"
89 #include "gtk/export_object.h"
90 #include "gtk/gui_stat_menu.h"
92 #include "gtk/menus.h"
93 #include "gtk/main_toolbar.h"
94 #include "gtk/main_welcome.h"
95 #include "gtk/uat_gui.h"
96 #include "gtk/gui_utils.h"
97 #include "gtk/manual_addr_resolv.h"
98 #include "gtk/proto_help.h"
100 #define MENUS_USE_UIMANAGER 1
103 #ifdef NEW_PACKET_LIST
104 #include "gtk/new_packet_list.h"
106 #include "gtk/main_packet_list.h"
109 #ifdef HAVE_IGE_MAC_INTEGRATION
110 #include <ige-mac-menu.h>
113 #ifdef HAVE_GTKOSXAPPLICATION
114 #include <igemacintegration/gtkosxapplication.h>
117 typedef struct _menu_item {
120 const char *stock_id;
122 GtkItemFactoryCallback callback;
123 gpointer callback_data;
124 gboolean (*selected_packet_enabled)(frame_data *, epan_dissect_t *, gpointer callback_data);
125 gboolean (*selected_tree_row_enabled)(field_info *, gpointer callback_data);
129 static GList *tap_menu_tree_root = NULL;
131 GtkWidget *popup_menu_object;
134 #define GTK_MENU_FUNC(a) ((GtkItemFactoryCallback)(a))
136 static void merge_all_tap_menus(GList *node);
137 static void clear_menu_recent_capture_file_cmd_cb(GtkWidget *w, gpointer unused _U_);
139 static void menus_init(void);
140 #ifdef MENUS_USE_UIMANAGER
141 static void set_menu_sensitivity (GtkUIManager *ui_manager, const gchar *, gint);
143 static void set_menu_sensitivity_old (GtkItemFactory *, const gchar *, gint);
144 static void show_hide_cb(GtkWidget *w, gpointer data, gint action);
145 static void timestamp_format_cb(GtkWidget *w, gpointer d, gint action);
146 static void timestamp_precision_cb(GtkWidget *w, gpointer d, gint action);
147 static void timestamp_seconds_time_cb(GtkWidget *w, gpointer d, gint action);
148 static void name_resolution_cb(GtkWidget *w, gpointer d, gint action);
150 static void auto_scroll_live_cb(GtkWidget *w, gpointer d);
152 static void colorize_cb(GtkWidget *w, gpointer d);
155 /* This is the GtkItemFactoryEntry structure used to generate new menus.
156 Item 1: The menu path. The letter after the underscore indicates an
157 accelerator key once the menu is open.
158 Item 2: The accelerator key for the entry
159 Item 3: The callback function.
160 Item 4: The callback action. This changes the parameters with
161 which the function is called. The default is 0.
162 Item 5: The item type, used to define what kind of an item it is.
163 Here are the possible values:
167 "<Title>" -> create a title item
168 "<Item>" -> create a simple item
169 "<ImageItem>" -> create an item holding an image (gtk2)
170 "<StockItem>" -> create an item holding a stock image (gtk2)
171 "<CheckItem>" -> create a check item
172 "<ToggleItem>" -> create a toggle item
173 "<RadioItem>" -> create a radio item
174 <path> -> path of a radio item to link against
175 "<Separator>" -> create a separator
176 "<Tearoff>" -> create a tearoff separator (gtk2)
177 "<Branch>" -> create an item to hold sub items (optional)
178 "<LastBranch>" -> create a right justified branch
179 Item 6: extra data needed for ImageItem and StockItem (gtk2)
182 /* As a general GUI guideline, we try to follow the Gnome Human Interface Guidelines, which can be found at:
183 http://developer.gnome.org/projects/gup/hig/1.0/index.html
185 Please note: there are some differences between the Gnome HIG menu suggestions and our implementation:
187 File/Open Recent: the Gnome HIG suggests putting the list of recently used files as elements into the File menuitem.
188 As this is ok for only a few items, this will become unhandy for 10 or even more list entries.
189 For this reason, we use a submenu for this.
191 File/Close: the Gnome HIG suggests putting this item just above the Quit item.
192 This results in unintuitive behaviour as both Close and Quit items are very near together.
193 By putting the Close item near the open item(s), it better suggests that it will close the
194 currently opened/captured file only.
198 SHOW_HIDE_MAIN_TOOLBAR = 1,
199 SHOW_HIDE_FILTER_TOOLBAR,
200 SHOW_HIDE_AIRPCAP_TOOLBAR,
202 SHOW_HIDE_PACKET_LIST,
205 } show_hide_values_e;
216 build_conversation_filter(int action, gboolean show_dialog)
218 packet_info *pi = &cfile.edt->pi;
224 if (pi->profinet_type == 0) {
226 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
227 "Error filtering conversation. Please make\n"
228 "sure you have a PROFINET CBA packet selected.");
233 if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4
234 && pi->ipproto == IP_PROTO_TCP ) {
236 switch(pi->profinet_type) {
238 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)",
239 ip_to_str( pi->net_dst.data),
240 ip_to_str( pi->net_src.data),
241 ip_to_str( pi->net_src.data),
242 ip_to_str( pi->net_dst.data));
245 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)",
246 ip_to_str( pi->net_src.data),
247 ip_to_str( pi->net_dst.data),
248 ip_to_str( pi->net_dst.data),
249 ip_to_str( pi->net_src.data));
252 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)",
253 ip_to_str( pi->net_dst.data),
254 ip_to_str( pi->net_src.data),
255 ip_to_str( pi->net_src.data),
256 ip_to_str( pi->net_dst.data));
259 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)",
260 ip_to_str( pi->net_src.data),
261 ip_to_str( pi->net_dst.data),
262 ip_to_str( pi->net_dst.data),
263 ip_to_str( pi->net_src.data));
273 if (pi->ipproto != IP_PROTO_TCP) {
275 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
276 "Error filtering conversation. Please make\n"
277 "sure you have a TCP packet selected.");
282 if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4 ) {
284 buf = g_strdup_printf("(ip.addr eq %s and ip.addr eq %s) and (tcp.port eq %d and tcp.port eq %d)",
285 ip_to_str( pi->net_src.data),
286 ip_to_str( pi->net_dst.data),
287 pi->srcport, pi->destport );
288 } else if( pi->net_src.type == AT_IPv6 && pi->net_dst.type == AT_IPv6 ) {
290 buf = g_strdup_printf("(ipv6.addr eq %s and ipv6.addr eq %s) and (tcp.port eq %d and tcp.port eq %d)",
291 ip6_to_str((const struct e_in6_addr *)pi->net_src.data),
292 ip6_to_str((const struct e_in6_addr *)pi->net_dst.data),
293 pi->srcport, pi->destport );
299 if (pi->ipproto != IP_PROTO_UDP) {
301 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
302 "Error filtering conversation. Please make\n"
303 "sure you have a UDP packet selected.");
308 if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4 ) {
310 buf = g_strdup_printf("(ip.addr eq %s and ip.addr eq %s) and (udp.port eq %d and udp.port eq %d)",
311 ip_to_str( pi->net_src.data),
312 ip_to_str( pi->net_dst.data),
313 pi->srcport, pi->destport );
314 } else if( pi->net_src.type == AT_IPv6 && pi->net_dst.type == AT_IPv6 ) {
316 buf = g_strdup_printf("(ipv6.addr eq %s and ipv6.addr eq %s) and (udp.port eq %d and udp.port eq %d)",
317 ip6_to_str((const struct e_in6_addr *)pi->net_src.data),
318 ip6_to_str((const struct e_in6_addr *)pi->net_dst.data),
319 pi->srcport, pi->destport );
325 if ((pi->ethertype != ETHERTYPE_IP) && (pi->ethertype != ETHERTYPE_IPv6)) {
327 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
328 "Error filtering conversation. Please make\n"
329 "sure you have a IP packet selected.");
334 if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4 ) {
336 buf = g_strdup_printf("ip.addr eq %s and ip.addr eq %s",
337 ip_to_str( pi->net_src.data),
338 ip_to_str( pi->net_dst.data));
339 } else if( pi->net_src.type == AT_IPv6 && pi->net_dst.type == AT_IPv6 ) {
341 buf = g_strdup_printf("ipv6.addr eq %s and ipv6.addr eq %s",
342 ip6_to_str((const struct e_in6_addr *)pi->net_src.data),
343 ip6_to_str((const struct e_in6_addr *)pi->net_dst.data));
349 /* XXX - is this the right way to check for Ethernet? */
350 /* check for the data link address type */
351 /* (ethertype will be 0 when used as length field) */
352 if (pi->dl_src.type != AT_ETHER) {
354 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
355 "Error filtering conversation. Please make\n"
356 "sure you have a Ethernet packet selected.");
361 if( pi->dl_src.type == AT_ETHER && pi->dl_dst.type == AT_ETHER ) {
363 buf = g_strdup_printf("eth.addr eq %s and eth.addr eq %s",
364 ether_to_str( pi->dl_src.data),
365 ether_to_str( pi->dl_dst.data));
378 conversation_cb(GtkWidget * w, gpointer data _U_, int action)
381 GtkWidget *filter_te;
383 if (cfile.current_frame) {
384 /* create a filter-string based on the selected packet and action */
385 filter = build_conversation_filter(action, TRUE);
387 /* Run the display filter so it goes in effect - even if it's the
388 same as the previous display filter. */
389 filter_te = g_object_get_data(G_OBJECT(w), E_DFILTER_TE_KEY);
390 gtk_entry_set_text(GTK_ENTRY(filter_te), filter);
391 main_filter_packets(&cfile, filter, TRUE);
398 colorize_conversation_cb(GtkWidget * w _U_, gpointer data _U_, int action)
400 gchar *filter = NULL;
402 if( (action>>8) == 255 ) {
403 color_filters_reset_tmp();
404 #ifdef NEW_PACKET_LIST
405 new_packet_list_colorize_packets();
407 cf_colorize_packets(&cfile);
409 } else if (cfile.current_frame) {
410 if( (action&0xff) == 0 ) {
411 /* colorize_conversation_cb was called from the window-menu
412 * or through an accelerator key. Try to build a conversation
413 * filter in the order TCP, UDP, IP, Ethernet and apply the
415 filter = build_conversation_filter(CONV_TCP,FALSE);
417 filter = build_conversation_filter(CONV_UDP,FALSE);
419 filter = build_conversation_filter(CONV_IP,FALSE);
421 filter = build_conversation_filter(CONV_ETHER,FALSE);
422 if( filter == NULL ) {
423 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Unable to build conversation filter.");
427 /* create a filter-string based on the selected packet and action */
428 filter = build_conversation_filter(action&0xff, TRUE);
431 if( (action>>8) == 0) {
432 /* Open the "new coloring filter" dialog with the filter */
433 color_display_with_filter(filter);
435 /* Set one of the temporary coloring filters */
436 color_filters_set_tmp((guint8)(action>>8),filter,FALSE);
437 #ifdef NEW_PACKET_LIST
438 new_packet_list_colorize_packets();
440 cf_colorize_packets(&cfile);
451 * Please do not use keystrokes that are used as "universal" shortcuts in
452 * various desktop environments:
455 * http://support.microsoft.com/kb/126449
458 * http://library.gnome.org/users/user-guide/nightly/keyboard-skills.html.en
461 * http://developer.kde.org/documentation/standards/kde/style/keys/shortcuts.html
463 * In particular, do not use the following <control> sequences for anything
464 * other than their standard purposes:
466 * <control>O File->Open
467 * <control>S File->Save
468 * <control>P File->Print
469 * <control>W File->Close
470 * <control>Q File->Quit
471 * <control>Z Edit->Undo (which we don't currently have)
472 * <control>X Edit->Cut (which we don't currently have)
473 * <control>C Edit->Copy (which we don't currently have)
474 * <control>V Edit->Paste (which we don't currently have)
475 * <control>A Edit->Select All (which we don't currently have)
477 * Note that some if not all of the Edit keys above already perform those
478 * functions in text boxes, such as the Filter box. Do no, under any
479 * circumstances, make a change that keeps them from doing so.
481 static GtkItemFactoryEntry menu_items[] =
483 {"/_File", NULL, NULL, 0, "<Branch>", NULL,},
484 {"/File/_Open...", "<control>O", GTK_MENU_FUNC(file_open_cmd_cb),
485 0, "<StockItem>", GTK_STOCK_OPEN,},
486 {"/File/Open _Recent", NULL, NULL, 0, "<Branch>", NULL,},
487 {"/File/_Merge...", NULL, GTK_MENU_FUNC(file_merge_cmd_cb), 0, NULL, NULL,},
488 {"/File/_Close", "<control>W", GTK_MENU_FUNC(file_close_cmd_cb),
489 0, "<StockItem>", GTK_STOCK_CLOSE,},
490 {"/File/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
491 {"/File/_Save", "<control>S", GTK_MENU_FUNC(file_save_cmd_cb),
492 0, "<StockItem>", GTK_STOCK_SAVE,},
493 {"/File/Save _As...", "<shift><control>S", GTK_MENU_FUNC(file_save_as_cmd_cb),
494 0, "<StockItem>", GTK_STOCK_SAVE_AS,},
495 {"/File/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
496 {"/File/File Set", NULL, NULL, 0, "<Branch>", NULL,},
497 {"/File/File Set/List Files", NULL, GTK_MENU_FUNC(fileset_cb), 0, "<StockItem>", WIRESHARK_STOCK_FILE_SET_LIST,},
498 {"/File/File Set/Next File", NULL, GTK_MENU_FUNC(fileset_next_cb), 0, "<StockItem>", WIRESHARK_STOCK_FILE_SET_NEXT,},
499 {"/File/File Set/Previous File", NULL, GTK_MENU_FUNC(fileset_previous_cb), 0, "<StockItem>", WIRESHARK_STOCK_FILE_SET_PREVIOUS,},
500 {"/File/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
501 {"/File/_Export", NULL, NULL, 0, "<Branch>", NULL,},
503 {"/File/Export/File...", NULL, GTK_MENU_FUNC(export_text_cmd_cb),
506 {"/File/Export/as \"Plain _Text\" file...", NULL, GTK_MENU_FUNC(export_text_cmd_cb),
508 {"/File/Export/as \"_PostScript\" file...", NULL, GTK_MENU_FUNC(export_ps_cmd_cb),
510 {"/File/Export/as \"_CSV\" (Comma Separated Values packet summary) file...",
511 NULL, GTK_MENU_FUNC(export_csv_cmd_cb), 0, NULL, NULL,},
512 {"/File/Export/as \"C _Arrays\" (packet bytes) file...", NULL, GTK_MENU_FUNC(export_carrays_cmd_cb),
514 {"/File/Export/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
515 {"/File/Export/as XML - \"P_SML\" (packet summary) file...", NULL, GTK_MENU_FUNC(export_psml_cmd_cb),
517 {"/File/Export/as XML - \"P_DML\" (packet details) file...", NULL, GTK_MENU_FUNC(export_pdml_cmd_cb),
519 {"/File/Export/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
521 {"/File/Export/Selected Packet _Bytes...", "<control>H", GTK_MENU_FUNC(savehex_cb),
523 {"/File/Export/_Objects/_HTTP", NULL, GTK_MENU_FUNC(eo_http_cb), 0, NULL, NULL,},
524 {"/File/Export/_Objects/_DICOM", NULL, GTK_MENU_FUNC(eo_dicom_cb), 0, NULL, NULL,},
525 {"/File/Export/_Objects/_SMB", NULL, GTK_MENU_FUNC(eo_smb_cb), 0, NULL, NULL,},
526 {"/File/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
527 {"/File/_Print...", "<control>P", GTK_MENU_FUNC(file_print_cmd_cb),
528 0, "<StockItem>", GTK_STOCK_PRINT,},
529 {"/File/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
530 {"/File/_Quit", "<control>Q", GTK_MENU_FUNC(file_quit_cmd_cb),
531 0, "<StockItem>", GTK_STOCK_QUIT,},
532 {"/_Edit", NULL, NULL, 0, "<Branch>", NULL,},
533 {"/Edit/Copy", NULL, NULL, 0, "<Branch>", NULL,},
534 {"/Edit/Copy/Description", "<shift><control>D", GTK_MENU_FUNC(copy_selected_plist_cb), COPY_SELECTED_DESCRIPTION, NULL, NULL,},
535 {"/Edit/Copy/Fieldname", "<shift><control>F", GTK_MENU_FUNC(copy_selected_plist_cb), COPY_SELECTED_FIELDNAME, NULL, NULL,},
536 {"/Edit/Copy/Value", "<shift><control>V", GTK_MENU_FUNC(copy_selected_plist_cb), COPY_SELECTED_VALUE, NULL, NULL,},
537 {"/Edit/Copy/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
538 {"/Edit/Copy/As Filter", "<shift><control>C", GTK_MENU_FUNC(match_selected_ptree_cb),
539 MATCH_SELECTED_REPLACE|MATCH_SELECTED_COPY_ONLY, NULL, NULL,},
542 * Un-#if this when we actually implement Cut/Copy/Paste for the
543 * packet list and packet detail windows.
545 * Note: when we implement Cut/Copy/Paste in those windows, we
546 * will almost certainly want to allow multiple packets to be
547 * selected in the packet list pane and multiple packet detail
548 * items to be selected in the packet detail pane, so that
549 * the user can, for example, copy the summaries of multiple
550 * packets to the clipboard from the packet list pane and multiple
551 * packet detail items - perhaps *all* packet detail items - from
552 * the packet detail pane. Given that, we'll also want to
553 * implement Select All.
555 * If multiple packets are selected, we would probably display nothing
556 * in the packet detail pane, just as we do if no packet is selected,
557 * and any menu items etc. that would pertain only to a single packet
560 * If multiple packet detail items are selected, we would probably
561 * disable all items that pertain only to a single packet detail
562 * item, such as some items in the status bar.
564 * XXX - the actions for these will be different depending on what
565 * widget we're in; ^C should copy from the filter text widget if
566 * we're in that widget, the packet list if we're in that widget
567 * (presumably copying the summaries of selected packets to the
568 * clipboard, e.g. the text copy would be the text of the columns),
569 * the packet detail if we're in that widget (presumably copying
570 * the contents of selected protocol tree items to the clipboard,
571 * e.g. the text copy would be the text displayed for those items),
574 * Given that those menu items should also affect text widgets
575 * such as the filter box, we would again want Select All, and,
576 * at least for the filter box, we would also want Undo and Redo.
577 * We would only want Cut, Paste, Undo, and Redo for the packet
578 * list and packet detail panes if we support modifying them.
580 {"/Edit/_Undo", "<control>Z", NULL,
581 0, "<StockItem>", GTK_STOCK_UNDO,},
582 {"/Edit/_Redo", "<shift><control>Z", NULL,
583 0, "<StockItem>", GTK_STOCK_REDO,},
584 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
585 {"/Edit/Cu_t", "<control>X", NULL,
586 0, "<StockItem>", GTK_STOCK_CUT,},
587 {"/Edit/_Copy", "<control>C", NULL,
588 0, "<StockItem>", GTK_STOCK_COPY,},
589 {"/Edit/_Paste", "<control>V", NULL,
590 0, "<StockItem>", GTK_STOCK_PASTE,},
591 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
592 {"/Edit/Select _All", "<control>A", NULL, 0,
593 #ifdef GTK_STOCK_SELECT_ALL /* first appeared in 2.10 */
594 "<StockItem>", GTK_STOCK_SELECT_ALL,
597 #endif /* GTK_STOCK_SELECT_ALL */
600 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
601 {"/Edit/_Find Packet...", "<control>F", GTK_MENU_FUNC(find_frame_cb), 0, "<StockItem>", GTK_STOCK_FIND,},
602 {"/Edit/Find Ne_xt", "<control>N", GTK_MENU_FUNC(find_next_cb), 0, NULL, NULL,},
603 {"/Edit/Find Pre_vious", "<control>B", GTK_MENU_FUNC(find_previous_cb), 0, NULL, NULL,},
604 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
605 #ifdef NEW_PACKET_LIST
606 {"/Edit/_Mark Packet (toggle)", "<control>M", GTK_MENU_FUNC(new_packet_list_mark_frame_cb),0, NULL, NULL,},
607 {"/Edit/Mark All Displayed Packets (toggle)", "<shift><control>M", GTK_MENU_FUNC(new_packet_list_mark_all_displayed_frames_cb), 0, NULL, NULL,},
608 {"/Edit/Unmark All Packets", "<alt><control>M", GTK_MENU_FUNC(new_packet_list_unmark_all_frames_cb), 0, NULL, NULL,},
609 {"/Edit/Find Next Mark", "<shift><control>N", GTK_MENU_FUNC(find_next_mark_cb), 0, NULL, NULL,},
610 {"/Edit/Find Previous Mark", "<shift><control>B", GTK_MENU_FUNC(find_prev_mark_cb), 0, NULL, NULL,},
611 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
612 {"/Edit/_Ignore Packet (toggle)", "<control>D", GTK_MENU_FUNC(new_packet_list_ignore_frame_cb), 0, NULL, NULL,},
614 * XXX - this next one overrides /Edit/Copy/Description
616 {"/Edit/Ignore All Displayed Packets (toggle)","<shift><control>D", GTK_MENU_FUNC(new_packet_list_ignore_all_displayed_frames_cb), 0, NULL, NULL,},
617 {"/Edit/U_n-Ignore All Packets", "<alt><control>D", GTK_MENU_FUNC(new_packet_list_unignore_all_frames_cb), 0, NULL, NULL,},
618 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
619 {"/Edit/Set Time Reference (toggle)", "<control>T", GTK_MENU_FUNC(reftime_frame_cb), REFTIME_TOGGLE, "<StockItem>", WIRESHARK_STOCK_TIME,},
620 {"/Edit/Un-Time Reference All Packets", "<alt><control>T", GTK_MENU_FUNC(new_packet_list_untime_reference_all_frames_cb), 0, NULL, NULL,},
621 {"/Edit/Find Next Time Reference", "<alt><control>N", GTK_MENU_FUNC(reftime_frame_cb), REFTIME_FIND_NEXT, NULL, NULL,},
622 {"/Edit/Find Previous Time Reference", "<alt><control>B", GTK_MENU_FUNC(reftime_frame_cb), REFTIME_FIND_PREV, NULL, NULL,},
623 #else /* NEW_PACKET_LIST */
625 * XXX - this should be changed to match the list used with the new
626 * packet list, assuming we don't just drop the old packet list
629 {"/Edit/_Mark Packet (toggle)", "<control>M", GTK_MENU_FUNC(packet_list_mark_frame_cb),
631 {"/Edit/Find Next Mark", "<shift><control>N", GTK_MENU_FUNC(find_next_mark_cb),
633 {"/Edit/Find Previous Mark", "<shift><control>B", GTK_MENU_FUNC(find_prev_mark_cb),
635 {"/Edit/Mark _All Displayed Packets (toggle)", "<shift><control>M", GTK_MENU_FUNC(packet_list_mark_all_frames_cb), 0, NULL, NULL,},
636 {"/Edit/_Unmark All Packets", "<alt><control>M", GTK_MENU_FUNC(packet_list_unmark_all_frames_cb), 0, NULL, NULL,},
637 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
638 {"/Edit/_Ignore Packet (toggle)", "<control>D", GTK_MENU_FUNC(packet_list_ignore_frame_cb),
640 {"/Edit/Ignore All Displayed Packets (toggle)", "<shift><control>D", GTK_MENU_FUNC(packet_list_ignore_all_frames_cb),
642 {"/Edit/U_n-Ignore All Packets", "<alt><control>D", GTK_MENU_FUNC(packet_list_unignore_all_frames_cb),
644 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
645 {"/Edit/Set Time Reference (toggle)", "<control>T", GTK_MENU_FUNC(reftime_frame_cb),
646 REFTIME_TOGGLE, "<StockItem>", WIRESHARK_STOCK_TIME,},
647 {"/Edit/Find Next Time Reference", "<alt><shift><control>N", GTK_MENU_FUNC(reftime_frame_cb), REFTIME_FIND_NEXT, NULL, NULL,},
648 {"/Edit/Find Previous Time Reference", "<alt><shift><control>B", GTK_MENU_FUNC(reftime_frame_cb), REFTIME_FIND_PREV, NULL, NULL,},
649 #endif /* NEW_PACKET_LIST */
650 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
651 {"/Edit/_Configuration Profiles...", "<shift><control>A", GTK_MENU_FUNC(profile_dialog_cb), 0, NULL, NULL,},
652 {"/Edit/_Preferences...", "<shift><control>P", GTK_MENU_FUNC(prefs_page_cb),
653 PREFS_PAGE_USER_INTERFACE, "<StockItem>", GTK_STOCK_PREFERENCES,},
654 {"/_View", NULL, NULL, 0, "<Branch>", NULL,},
655 {"/View/_Main Toolbar", NULL, GTK_MENU_FUNC(show_hide_cb), SHOW_HIDE_MAIN_TOOLBAR, "<CheckItem>", NULL,},
656 {"/View/_Filter Toolbar", NULL, GTK_MENU_FUNC(show_hide_cb), SHOW_HIDE_FILTER_TOOLBAR, "<CheckItem>", NULL,},
658 {"/View/_Wireless Toolbar", NULL, GTK_MENU_FUNC(show_hide_cb), SHOW_HIDE_AIRPCAP_TOOLBAR, "<CheckItem>", NULL,},
660 {"/View/_Statusbar", NULL, GTK_MENU_FUNC(show_hide_cb), SHOW_HIDE_STATUSBAR, "<CheckItem>", NULL,},
661 {"/View/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
662 {"/View/Packet _List", NULL, GTK_MENU_FUNC(show_hide_cb), SHOW_HIDE_PACKET_LIST, "<CheckItem>", NULL,},
663 {"/View/Packet _Details", NULL, GTK_MENU_FUNC(show_hide_cb), SHOW_HIDE_TREE_VIEW, "<CheckItem>", NULL,},
664 {"/View/Packet _Bytes", NULL, GTK_MENU_FUNC(show_hide_cb), SHOW_HIDE_BYTE_VIEW, "<CheckItem>", NULL,},
665 {"/View/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
666 {"/View/_Time Display Format", NULL, NULL, 0, "<Branch>", NULL,},
667 {"/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),
668 TS_ABSOLUTE_WITH_DATE, "<RadioItem>", NULL,},
669 {"/View/Time Display Format/Time of Day: 01:02:03.123456", "<alt><control>2", GTK_MENU_FUNC(timestamp_format_cb),
670 TS_ABSOLUTE, "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456", NULL,},
671 {"/View/Time Display Format/Seconds Since Epoch (1970-01-01): 1234567890.123456", "<alt><control>3", GTK_MENU_FUNC(timestamp_format_cb),
672 TS_EPOCH, "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456", NULL,},
673 {"/View/Time Display Format/Seconds Since Beginning of Capture: 123.123456", "<alt><control>4", GTK_MENU_FUNC(timestamp_format_cb),
674 TS_RELATIVE, "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456", NULL,},
675 {"/View/Time Display Format/Seconds Since Previous Captured Packet: 1.123456", "<alt><control>5", GTK_MENU_FUNC(timestamp_format_cb),
676 TS_DELTA, "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456", NULL,},
677 {"/View/Time Display Format/Seconds Since Previous Displayed Packet: 1.123456", "<alt><control>6", GTK_MENU_FUNC(timestamp_format_cb),
678 TS_DELTA_DIS, "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456", NULL,},
679 {"/View/Time Display Format/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
680 {"/View/Time Display Format/Automatic (File Format Precision)", NULL, GTK_MENU_FUNC(timestamp_precision_cb),
681 TS_PREC_AUTO, "<RadioItem>", NULL,},
682 {"/View/Time Display Format/Seconds: 0", NULL, GTK_MENU_FUNC(timestamp_precision_cb),
683 TS_PREC_FIXED_SEC, "/View/Time Display Format/Automatic (File Format Precision)", NULL,},
684 {"/View/Time Display Format/Deciseconds: 0.1", NULL, GTK_MENU_FUNC(timestamp_precision_cb),
685 TS_PREC_FIXED_DSEC, "/View/Time Display Format/Automatic (File Format Precision)", NULL,},
686 {"/View/Time Display Format/Centiseconds: 0.12", NULL, GTK_MENU_FUNC(timestamp_precision_cb),
687 TS_PREC_FIXED_CSEC, "/View/Time Display Format/Automatic (File Format Precision)", NULL,},
688 {"/View/Time Display Format/Milliseconds: 0.123", NULL, GTK_MENU_FUNC(timestamp_precision_cb),
689 TS_PREC_FIXED_MSEC, "/View/Time Display Format/Automatic (File Format Precision)", NULL,},
690 {"/View/Time Display Format/Microseconds: 0.123456", NULL, GTK_MENU_FUNC(timestamp_precision_cb),
691 TS_PREC_FIXED_USEC, "/View/Time Display Format/Automatic (File Format Precision)", NULL,},
692 {"/View/Time Display Format/Nanoseconds: 0.123456789", NULL, GTK_MENU_FUNC(timestamp_precision_cb),
693 TS_PREC_FIXED_NSEC, "/View/Time Display Format/Automatic (File Format Precision)", NULL,},
694 {"/View/Time Display Format/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
695 {"/View/Time Display Format/Display Seconds with hours and minutes", "<alt><control>0", GTK_MENU_FUNC(timestamp_seconds_time_cb), 0, "<CheckItem>", NULL,},
696 {"/View/Name Resol_ution", NULL, NULL, 0, "<Branch>", NULL,},
697 {"/View/Name Resolution/_Resolve Name", NULL, GTK_MENU_FUNC(resolve_name_cb), 0, NULL, NULL,},
698 {"/View/Name Resolution/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
699 {"/View/Name Resolution/Enable for _MAC Layer", NULL, GTK_MENU_FUNC(name_resolution_cb), RESOLV_MAC, "<CheckItem>", NULL,},
700 {"/View/Name Resolution/Enable for _Network Layer", NULL, GTK_MENU_FUNC(name_resolution_cb), RESOLV_NETWORK, "<CheckItem>", NULL,},
701 {"/View/Name Resolution/Enable for _Transport Layer", NULL, GTK_MENU_FUNC(name_resolution_cb), RESOLV_TRANSPORT, "<CheckItem>", NULL,},
702 {"/View/Colorize Packet List", NULL, colorize_cb, 0, "<CheckItem>", NULL,},
704 {"/View/Auto Scroll in Li_ve Capture", NULL, GTK_MENU_FUNC(auto_scroll_live_cb), 0, "<CheckItem>", NULL,},
706 {"/View/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
707 {"/View/_Zoom In", "<control>plus", GTK_MENU_FUNC(view_zoom_in_cb),
708 0, "<StockItem>", GTK_STOCK_ZOOM_IN,},
709 {"/View/Zoom _Out", "<control>minus", GTK_MENU_FUNC(view_zoom_out_cb),
710 0, "<StockItem>", GTK_STOCK_ZOOM_OUT,},
711 {"/View/_Normal Size", "<control>equal", GTK_MENU_FUNC(view_zoom_100_cb),
712 0, "<StockItem>", GTK_STOCK_ZOOM_100,},
713 #ifdef NEW_PACKET_LIST
714 {"/View/Resize All Columns", "<shift><control>R", GTK_MENU_FUNC(new_packet_list_resize_columns_cb),
715 0, "<StockItem>", WIRESHARK_STOCK_RESIZE_COLUMNS,},
716 {"/View/Displayed Columns", NULL, NULL, 0, NULL, NULL,},
718 {"/View/Resize All Columns", "<shift><control>R", GTK_MENU_FUNC(packet_list_resize_columns_cb),
719 0, "<StockItem>", WIRESHARK_STOCK_RESIZE_COLUMNS,},
720 #endif /* NEW_PACKET_LIST */
721 {"/View/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
722 {"/View/E_xpand Subtrees", "<shift>Right", GTK_MENU_FUNC(expand_tree_cb), 0, NULL, NULL,},
723 {"/View/_Expand All", "<control>Right", GTK_MENU_FUNC(expand_all_cb),
725 {"/View/Collapse _All", "<control>Left", GTK_MENU_FUNC(collapse_all_cb),
727 {"/View/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
728 {"/View/Colorize Conversation", NULL, NULL, 0, "<Branch>",NULL,},
729 {"/View/Colorize Conversation/Color 1", "<control>1",
730 GTK_MENU_FUNC(colorize_conversation_cb), 1*256, "<StockItem>", WIRESHARK_STOCK_COLOR1,},
731 {"/View/Colorize Conversation/Color 2", "<control>2",
732 GTK_MENU_FUNC(colorize_conversation_cb), 2*256, "<StockItem>", WIRESHARK_STOCK_COLOR2,},
733 {"/View/Colorize Conversation/Color 3", "<control>3",
734 GTK_MENU_FUNC(colorize_conversation_cb), 3*256, "<StockItem>", WIRESHARK_STOCK_COLOR3,},
735 {"/View/Colorize Conversation/Color 4", "<control>4",
736 GTK_MENU_FUNC(colorize_conversation_cb), 4*256, "<StockItem>", WIRESHARK_STOCK_COLOR4,},
737 {"/View/Colorize Conversation/Color 5", "<control>5",
738 GTK_MENU_FUNC(colorize_conversation_cb), 5*256, "<StockItem>", WIRESHARK_STOCK_COLOR5,},
739 {"/View/Colorize Conversation/Color 6", "<control>6",
740 GTK_MENU_FUNC(colorize_conversation_cb), 6*256, "<StockItem>", WIRESHARK_STOCK_COLOR6,},
741 {"/View/Colorize Conversation/Color 7", "<control>7",
742 GTK_MENU_FUNC(colorize_conversation_cb), 7*256, "<StockItem>", WIRESHARK_STOCK_COLOR7,},
743 {"/View/Colorize Conversation/Color 8", "<control>8",
744 GTK_MENU_FUNC(colorize_conversation_cb), 8*256, "<StockItem>", WIRESHARK_STOCK_COLOR8,},
745 {"/View/Colorize Conversation/Color 9", "<control>9",
746 GTK_MENU_FUNC(colorize_conversation_cb), 9*256, "<StockItem>", WIRESHARK_STOCK_COLOR9,},
747 {"/View/Colorize Conversation/Color 10", "<control>0",
748 GTK_MENU_FUNC(colorize_conversation_cb), 10*256, "<StockItem>", WIRESHARK_STOCK_COLOR0,},
749 {"/View/Colorize Conversation/<separator>", NULL,
750 NULL, 0, "<Separator>",NULL,},
751 {"/View/Colorize Conversation/New Coloring Rule...", NULL,
752 GTK_MENU_FUNC(colorize_conversation_cb), 0, "<StockItem>", GTK_STOCK_SELECT_COLOR,},
753 {"/View/Reset Coloring 1-10", "<control>space",
754 GTK_MENU_FUNC(colorize_conversation_cb), 255*256, NULL, NULL,},
755 {"/View/_Coloring Rules...", NULL, color_display_cb,
756 0, "<StockItem>", GTK_STOCK_SELECT_COLOR,},
757 {"/View/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
760 {"/View/Show Packet in New _Window", NULL,
761 GTK_MENU_FUNC(new_window_cb), 0, NULL, NULL,},
762 {"/View/_Reload", "<control>R", GTK_MENU_FUNC(file_reload_cmd_cb),
763 0, "<StockItem>", GTK_STOCK_REFRESH,},
764 {"/_Go", NULL, NULL, 0, "<Branch>", NULL,},
765 {"/Go/_Back", "<alt>Left",
766 GTK_MENU_FUNC(history_back_cb), 0, "<StockItem>", GTK_STOCK_GO_BACK,},
767 {"/Go/_Forward", "<alt>Right",
768 GTK_MENU_FUNC(history_forward_cb), 0, "<StockItem>", GTK_STOCK_GO_FORWARD,},
769 {"/Go/_Go to Packet...", "<control>G",
770 GTK_MENU_FUNC(goto_frame_cb), 0, "<StockItem>", GTK_STOCK_JUMP_TO,},
771 {"/Go/Go to _Corresponding Packet", NULL, GTK_MENU_FUNC(goto_framenum_cb),
773 {"/Go/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
774 {"/Go/Previous Packet", "<control>Up",
775 GTK_MENU_FUNC(goto_previous_frame_cb), 0, "<StockItem>", GTK_STOCK_GO_UP,},
776 {"/Go/Next Packet", "<control>Down",
777 GTK_MENU_FUNC(goto_next_frame_cb), 0, "<StockItem>", GTK_STOCK_GO_DOWN,},
778 {"/Go/F_irst Packet", "<control>Home",
779 GTK_MENU_FUNC(goto_top_frame_cb), 0, "<StockItem>", GTK_STOCK_GOTO_TOP,},
780 {"/Go/_Last Packet", "<control>End",
781 GTK_MENU_FUNC(goto_bottom_frame_cb), 0, "<StockItem>", GTK_STOCK_GOTO_BOTTOM,},
783 {"/_Capture", NULL, NULL, 0, "<Branch>", NULL,},
784 {"/Capture/_Interfaces...", "<control>I",
785 GTK_MENU_FUNC(capture_if_cb), 0, "<StockItem>", WIRESHARK_STOCK_CAPTURE_INTERFACES,},
786 {"/Capture/_Options...", "<control>K",
787 GTK_MENU_FUNC(capture_prep_cb), 0, "<StockItem>", WIRESHARK_STOCK_CAPTURE_OPTIONS,},
788 {"/Capture/_Start", "<control>E",
789 GTK_MENU_FUNC(capture_start_cb), 0, "<StockItem>", WIRESHARK_STOCK_CAPTURE_START,},
790 {"/Capture/S_top", "<control>E", GTK_MENU_FUNC(capture_stop_cb),
791 0, "<StockItem>", WIRESHARK_STOCK_CAPTURE_STOP,},
792 {"/Capture/_Restart", "<control>R", GTK_MENU_FUNC(capture_restart_cb),
793 0, "<StockItem>", WIRESHARK_STOCK_CAPTURE_RESTART,},
794 {"/Capture/Capture _Filters...", NULL, GTK_MENU_FUNC(cfilter_dialog_cb),
795 0, "<StockItem>", WIRESHARK_STOCK_CAPTURE_FILTER,},
796 #endif /* HAVE_LIBPCAP */
797 {"/_Analyze", NULL, NULL, 0, "<Branch>", NULL,},
798 {"/Analyze/_Display Filters...", NULL, GTK_MENU_FUNC(dfilter_dialog_cb),
799 0, "<StockItem>", WIRESHARK_STOCK_DISPLAY_FILTER,},
800 {"/Analyze/Display Filter _Macros...", NULL, GTK_MENU_FUNC(macros_dialog_cb), 0, NULL, NULL,},
801 {"/Analyze/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
802 {"/Analyze/Apply as Column", NULL, GTK_MENU_FUNC(apply_as_custom_column_cb), 0, NULL, NULL},
803 {"/Analyze/Appl_y as Filter", NULL, NULL, 0, "<Branch>", NULL,},
804 {"/Analyze/Apply as Filter/_Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
805 MATCH_SELECTED_REPLACE|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
806 {"/Analyze/Apply as Filter/_Not Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
807 MATCH_SELECTED_NOT|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
808 {"/Analyze/Apply as Filter/... _and Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
809 MATCH_SELECTED_AND|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
810 {"/Analyze/Apply as Filter/... _or Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
811 MATCH_SELECTED_OR|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
812 {"/Analyze/Apply as Filter/... a_nd not Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
813 MATCH_SELECTED_AND_NOT|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
814 {"/Analyze/Apply as Filter/... o_r not Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
815 MATCH_SELECTED_OR_NOT|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
816 {"/Analyze/_Prepare a Filter", NULL, NULL, 0, "<Branch>", NULL,},
817 {"/Analyze/Prepare a Filter/_Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
818 MATCH_SELECTED_REPLACE, NULL, NULL,},
819 {"/Analyze/Prepare a Filter/_Not Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
820 MATCH_SELECTED_NOT, NULL, NULL,},
821 {"/Analyze/Prepare a Filter/... _and Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
822 MATCH_SELECTED_AND, NULL, NULL,},
823 {"/Analyze/Prepare a Filter/... _or Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
824 MATCH_SELECTED_OR, NULL, NULL,},
825 {"/Analyze/Prepare a Filter/... a_nd not Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
826 MATCH_SELECTED_AND_NOT, NULL, NULL,},
827 {"/Analyze/Prepare a Filter/... o_r not Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
828 MATCH_SELECTED_OR_NOT, NULL, NULL,},
829 {"/Analyze/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
830 {"/Analyze/_Enabled Protocols...", "<shift><control>E", GTK_MENU_FUNC(proto_cb),
831 0, "<StockItem>", WIRESHARK_STOCK_CHECKBOX,},
832 {"/Analyze/Decode _As...", NULL, GTK_MENU_FUNC(decode_as_cb),
833 0, "<StockItem>", WIRESHARK_STOCK_DECODE_AS,},
834 {"/Analyze/_User Specified Decodes...", NULL,
835 GTK_MENU_FUNC(decode_show_cb), 0, "<StockItem>", WIRESHARK_STOCK_DECODE_AS,},
836 {"/Analyze/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
837 {"/Analyze/_Follow TCP Stream", NULL,
838 GTK_MENU_FUNC(follow_tcp_stream_cb), 0, NULL, NULL,},
839 {"/Analyze/_Follow UDP Stream", NULL,
840 GTK_MENU_FUNC(follow_udp_stream_cb), 0, NULL, NULL,},
841 {"/Analyze/_Follow SSL Stream", NULL,
842 GTK_MENU_FUNC(follow_ssl_stream_cb), 0, NULL, NULL,},
843 {"/_Statistics", NULL, NULL, 0, "<Branch>", NULL,},
844 {"/Statistics/_Summary", NULL, GTK_MENU_FUNC(summary_open_cb), 0, "<StockItem>", GTK_STOCK_PROPERTIES,},
845 {"/Statistics/_Protocol Hierarchy", NULL,
846 GTK_MENU_FUNC(proto_hier_stats_cb), 0, NULL, NULL,},
847 {"/Statistics/Conversations", NULL,
848 GTK_MENU_FUNC(init_conversation_notebook_cb), 0, "<StockItem>", WIRESHARK_STOCK_CONVERSATIONS,},
849 {"/Statistics/Endpoints", NULL,
850 GTK_MENU_FUNC(init_hostlist_notebook_cb), 0, "<StockItem>", WIRESHARK_STOCK_ENDPOINTS,},
851 {"/Telephon_y", NULL, NULL, 0, "<Branch>", NULL,},
852 {"/_Tools", NULL, NULL, 0, "<Branch>", NULL,},
853 {"/Tools/Firewall ACL Rules", NULL,
854 firewall_rule_cb, 0, NULL, NULL,},
855 {"/WS internal", NULL, NULL, 0, "<Branch>", NULL,},
856 {"/WS internal/Dissector tables", NULL, GTK_MENU_FUNC(dissector_tables_dlg_cb),
858 {"/_Help", NULL, NULL, 0, "<Branch>", NULL,},
859 {"/Help/_Contents", "F1", GTK_MENU_FUNC(topic_menu_cb), HELP_CONTENT, "<StockItem>", GTK_STOCK_HELP,},
860 {"/Help/FAQ's", NULL, GTK_MENU_FUNC(topic_menu_cb), ONLINEPAGE_FAQ, NULL, NULL,},
861 {"/Help/Manual Pages", NULL, NULL, 0, "<Branch>", NULL,},
862 {"/Help/Manual Pages/Wireshark", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_WIRESHARK, NULL, NULL,},
863 {"/Help/Manual Pages/Wireshark Filter", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_WIRESHARK_FILTER, NULL, NULL,},
864 {"/Help/Manual Pages/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
865 {"/Help/Manual Pages/TShark", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_TSHARK, NULL, NULL,},
866 {"/Help/Manual Pages/RawShark", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_RAWSHARK, NULL, NULL,},
867 {"/Help/Manual Pages/Dumpcap", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_DUMPCAP, NULL, NULL,},
868 {"/Help/Manual Pages/Mergecap", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_MERGECAP, NULL, NULL,},
869 {"/Help/Manual Pages/Editcap", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_EDITCAP, NULL, NULL,},
870 {"/Help/Manual Pages/Text2pcap", NULL, GTK_MENU_FUNC(topic_menu_cb), LOCALPAGE_MAN_TEXT2PCAP, NULL, NULL,},
871 {"/Help/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
872 {"/Help/Website", NULL, GTK_MENU_FUNC(topic_menu_cb), ONLINEPAGE_HOME, "<StockItem>", GTK_STOCK_HOME,},
873 {"/Help/Wiki", NULL, GTK_MENU_FUNC(topic_menu_cb), ONLINEPAGE_WIKI, "<StockItem>", WIRESHARK_STOCK_WIKI,},
874 {"/Help/Downloads", NULL, GTK_MENU_FUNC(topic_menu_cb), ONLINEPAGE_DOWNLOAD, NULL, NULL,},
875 {"/Help/Sample Captures", NULL, GTK_MENU_FUNC(topic_menu_cb), ONLINEPAGE_SAMPLE_FILES, NULL, NULL,},
876 {"/Help/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
877 {"/Help/_Supported Protocols (slow!)", NULL, GTK_MENU_FUNC(supported_cb), 0, NULL, NULL,},
878 {"/Help/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
879 {"/Help/_About Wireshark", NULL, GTK_MENU_FUNC(about_wireshark_cb),
880 0, "<StockItem>", WIRESHARK_STOCK_ABOUT}
884 /* Prepare for use of GTKUImanager */
885 GtkUIManager *ui_manager_main_menubar = NULL;
888 copy_description_cb(GtkWidget *widget, gpointer user_data)
890 copy_selected_plist_cb( widget , user_data, COPY_SELECTED_DESCRIPTION);
894 copy_fieldname_cb(GtkWidget *widget, gpointer user_data)
896 copy_selected_plist_cb( widget , user_data, COPY_SELECTED_FIELDNAME);
900 copy_value_cb(GtkWidget *widget, gpointer user_data)
902 copy_selected_plist_cb( widget , user_data, COPY_SELECTED_VALUE);
906 copy_as_filter_cb(GtkWidget *widget, gpointer user_data)
908 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_REPLACE|MATCH_SELECTED_COPY_ONLY);
912 set_reftime_cb(GtkWidget *widget, gpointer user_data)
914 reftime_frame_cb( widget , user_data, REFTIME_TOGGLE);
918 find_next_ref_time_cb(GtkWidget *widget, gpointer user_data)
920 reftime_frame_cb( widget , user_data, REFTIME_FIND_NEXT);
924 find_previous_ref_time_cb(GtkWidget *widget, gpointer user_data)
926 reftime_frame_cb( widget , user_data, REFTIME_FIND_PREV);
930 prefs_cb(GtkWidget *widget, gpointer user_data)
932 prefs_page_cb( widget , user_data, PREFS_PAGE_USER_INTERFACE);
936 main_toolbar_show_hide_cb(GtkAction *action, gpointer user_data)
938 /* XXXX fixme show_hide_cb SHOW_HIDE_MAIN_TOOLBAR*/
942 filter_toolbar_show_hide_cb(GtkAction * action, gpointer user_data)
944 /* XXXX fixme SHOW_HIDE_FILTER_TOOLBAR */
949 wireless_toolbar_show_hide_cb(GtkAction *action, gpointer user_data)
951 /* XXXX fixme SHOW_HIDE_AIRPCAP_TOOLBAR*/
956 status_bar_show_hide_cb(GtkAction *action, gpointer user_data)
958 /* XXXX fixme SHOW_HIDE_STATUSBAR*/
961 packet_list_show_hide_cb(GtkAction *action, gpointer user_data)
963 /* XXXX fixme SHOW_HIDE_PACKET_LIST*/
966 packet_details_show_hide_cb(GtkAction *action, gpointer user_data)
968 /* XXXX fixme SHOW_HIDE_TREE_VIEW*/
971 packet_bytes_show_hide_cb(GtkAction *action, gpointer user_data)
973 /* XXXX fixme SHOW_HIDE_BYTE_VIEW*/
977 timestamp_format_new_cb (GtkRadioAction *action, GtkRadioAction *current, gpointer user_data)
981 value = gtk_radio_action_get_current_value (action);
985 timestamp_precision_new_cb (GtkRadioAction *action, GtkRadioAction *current, gpointer user_data)
989 value = gtk_radio_action_get_current_value (action);
993 view_menu_en_for_MAC_cb(GtkAction *action, gpointer user_data)
997 name_resolution_cb( widget , user_data, RESOLV_MAC);
1000 state = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
1004 static const char *ui_desc_menubar =
1006 " <menubar name ='Menubar'>\n"
1007 " <menu name= 'FileMenu' action='/File'>\n"
1008 " <menuitem name='Open' action='/File/Open'/>\n"
1009 " <menuitem name='OpenRecent' action='/File/OpenRecent'/>\n"
1010 " <menuitem name='Merge' action='/File/Merge'/>\n"
1011 " <menuitem name='Close' action='/File/Close'/>\n"
1013 " <menuitem name='Save' action='/File/Save'/>\n"
1014 " <menuitem name='SaveAs' action='/File/SaveAs'/>\n"
1016 " <menu name= 'Set' action='/File/Set'>\n"
1017 " <menuitem name='ListFiles' action='/File/Set/ListFiles'/>\n"
1018 " <menuitem name='NextFile' action='/File/Set/NextFile'/>\n"
1019 " <menuitem name='PreviousFile' action='/File/Set/PreviousFile'/>\n"
1022 " <menu name= 'Export' action='/File/Export'>\n"
1024 " <menuitem name='File' action='/File/Export/File'/>\n"
1026 " <menu name= 'File' action='/File/Export/File'>\n"
1027 " <menuitem name='AsTxt' action='/File/Export/File/Text'/>\n"
1028 " <menuitem name='AsPostScript' action='/File/Export/File/PostScript'/>\n"
1029 " <menuitem name='AsCSV' action='/File/Export/File/CSV'/>\n"
1030 " <menuitem name='AsCArrays' action='/File/Export/File/CArrays'/>\n"
1032 " <menuitem name='AsPSML' action='/File/Export/File/PSML'/>\n"
1033 " <menuitem name='AsPDML' action='/File/Export/File/PDML'/>\n"
1037 " <menuitem name='SelectedPacketBytes' action='/File/Export/SelectedPacketBytes'/>\n"
1038 " <menu name= 'Objects' action='/File/Export/Objects'>\n"
1039 " <menuitem name='HTTP' action='/File/Export/Objects/HTTP'/>\n"
1040 " <menuitem name='DICOM' action='/File/Export/Objects/DICOM'/>\n"
1041 " <menuitem name='SMB' action='/File/Export/Objects/SMB'/>\n"
1045 " <menuitem name='Print' action='/File/Print'/>\n"
1047 " <menuitem name='Quit' action='/File/Quit'/>\n"
1049 " <menu name= 'EditMenu' action='/Edit'>\n"
1050 " <menu name= 'Copy' action='/Edit/Copy'>\n"
1051 " <menuitem name='Description' action='/Edit/Copy/Description'/>\n"
1052 " <menuitem name='Fieldname' action='/Edit/Copy/Fieldname'/>\n"
1053 " <menuitem name='Value' action='/Edit/Copy/Value'/>\n"
1055 " <menuitem name='AsFilter' action='/Edit/Copy/AsFilter'/>\n"
1057 " <menuitem name='FindPacket' action='/Edit/FindPacket'/>\n"
1058 " <menuitem name='FindNext' action='/Edit/FindNext'/>\n"
1059 " <menuitem name='FindPrevious' action='/Edit/FindPrevious'/>\n"
1061 #ifdef NEW_PACKET_LIST
1062 " <menuitem name='MarkPacket' action='/Edit/MarkPacket'/>\n"
1063 " <menuitem name='MarkAllDisplayedPackets' action='/Edit/MarkAllDisplayedPackets'/>\n"
1064 " <menuitem name='UnmarkAllPackets' action='/Edit/UnmarkAllPackets'/>\n"
1065 " <menuitem name='FindNextMark' action='/Edit/FindNextMark'/>\n"
1066 " <menuitem name='FindPreviousMark' action='/Edit/FindPreviousMark'/>\n"
1068 " <menuitem name='IgnorePacket' action='/Edit/IgnorePacket'/>\n"
1069 " <menuitem name='IgnoreAllDisplayedPackets' action='/Edit/IgnoreAllDisplayedPackets'/>\n"
1070 " <menuitem name='Un-IgnoreAllPackets' action='/Edit/Un-IgnoreAllPackets'/>\n"
1072 " <menuitem name='SetTimeReference' action='/Edit/SetTimeReference'/>\n"
1073 " <menuitem name='Un-TimeReferenceAllPackets' action='/Edit/Un-TimeReferenceAllPackets'/>\n"
1074 " <menuitem name='FindNextTimeReference' action='/Edit/FindNextTimeReference'/>\n"
1075 " <menuitem name='FindPreviousTimeReference' action='/Edit/FindPreviousTimeReference'/>\n"
1077 #else /* NEW_PACKET_LIST */
1080 " <menuitem name='ConfigurationProfiles' action='/Edit/ConfigurationProfiles'/>\n"
1081 " <menuitem name='Preferences' action='/Edit/Preferences'/>\n"
1083 " <menu name= 'ViewMenu' action='/View'>\n"
1084 " <menuitem name='MainToolbar' action='/View/MainToolbar'/>\n"
1085 " <menuitem name='FilterToolbar' action='/View/FilterToolbar'/>\n"
1087 " <menuitem name='WirelessToolbar' action='/View/WirelessToolbar'/>\n"
1089 " <menuitem name='Statusbar' action='/View/Statusbar'/>\n"
1091 " <menuitem name='PacketList' action='/View/PacketList'/>\n"
1092 " <menuitem name='PacketDetails' action='/View/PacketDetails'/>\n"
1093 " <menuitem name='PacketBytes' action='/View/PacketBytes'/>\n"
1095 " <menu name= 'TimeDisplayFormat' action='/View/TimeDisplayFormat'>\n"
1096 " <menuitem name='DateandTimeofDay' action='/View/TimeDisplayFormat/DateandTimeofDay'/>\n"
1097 " <menuitem name='TimeofDay' action='/View/TimeDisplayFormat/TimeofDay'/>\n"
1098 " <menuitem name='SecondsSinceEpoch' action='/View/TimeDisplayFormat/SecondsSinceEpoch'/>\n"
1099 " <menuitem name='SecondsSinceBeginningofCapture' action='/View/TimeDisplayFormat/SecondsSinceBeginningofCapture'/>\n"
1100 " <menuitem name='SecondsSincePreviousCapturedPacket' action='/View/TimeDisplayFormat/SecondsSincePreviousCapturedPacket'/>\n"
1101 " <menuitem name='SecondsSincePreviousDisplayedPacket' action='/View/TimeDisplayFormat/SecondsSincePreviousDisplayedPacket'/>\n"
1103 " <menuitem name='FileFormatPrecision-Automatic' action='/View/TimeDisplayFormat/FileFormatPrecision-Automatic'/>\n"
1104 " <menuitem name='FileFormatPrecision-Seconds' action='/View/TimeDisplayFormat/FileFormatPrecision-Seconds'/>\n"
1105 " <menuitem name='FileFormatPrecision-Deciseconds' action='/View/TimeDisplayFormat/FileFormatPrecision-Deciseconds'/>\n"
1106 " <menuitem name='FileFormatPrecision-Centiseconds' action='/View/TimeDisplayFormat/FileFormatPrecision-Centiseconds'/>\n"
1107 " <menuitem name='FileFormatPrecision-Milliseconds' action='/View/TimeDisplayFormat/FileFormatPrecision-Milliseconds'/>\n"
1108 " <menuitem name='FileFormatPrecision-Microseconds' action='/View/TimeDisplayFormat/FileFormatPrecision-Microseconds'/>\n"
1109 " <menuitem name='FileFormatPrecision-Nanoseconds' action='/View/TimeDisplayFormat/FileFormatPrecision-Nanoseconds'/>\n"
1111 " <menuitem name='DisplaySecondsWithHoursAndMinutes' action='/View/TimeDisplayFormat/DisplaySecondsWithHoursAndMinutes'/>\n"
1113 " <menu name= 'NameResolutionMenu' action='/View/NameResolution'>\n"
1114 " <menuitem name='ResolveName' action='/View/NameResolution/ResolveName'/>\n"
1125 * const gchar *name;
1126 * const gchar *stock_id;
1127 * const gchar *label;
1128 * const gchar *accelerator;
1129 * const gchar *tooltip;
1130 * GCallback callback;
1132 * const gchar *name; The name of the action.
1133 * const gchar *stock_id; The stock id for the action, or the name of an icon from the icon theme.
1134 * const gchar *label; The label for the action. This field should typically be marked for translation,
1135 * see gtk_action_group_set_translation_domain().
1136 * If label is NULL, the label of the stock item with id stock_id is used.
1137 * const gchar *accelerator; The accelerator for the action, in the format understood by gtk_accelerator_parse().
1138 * const gchar *tooltip; The tooltip for the action. This field should typically be marked for translation,
1139 * see gtk_action_group_set_translation_domain().
1140 * GCallback callback; The function to call when the action is activated.
1143 static const GtkActionEntry main_menu_bar_entries[] = {
1145 { "/File", NULL, "_File", NULL, NULL, NULL },
1146 { "/Edit", NULL, "_Edit", NULL, NULL, NULL },
1147 { "/View", NULL, "_View", NULL, NULL, NULL },
1149 { "/File/Open", GTK_STOCK_OPEN, "_Open...", "<control>O", "Open a file", G_CALLBACK(file_open_cmd_cb) },
1150 { "/File/OpenRecent", NULL, "Open _Recent", NULL, NULL, NULL },
1151 { "/File/Merge", NULL, "_Merge...", NULL, NULL, G_CALLBACK(file_merge_cmd_cb) },
1152 { "/File/Close", GTK_STOCK_CLOSE, "_Close", "<control>W", NULL, G_CALLBACK(file_close_cmd_cb) },
1154 { "/File/Save", GTK_STOCK_SAVE, "_Save", "<control>S", NULL, G_CALLBACK(file_save_cmd_cb) },
1155 { "/File/SaveAs", GTK_STOCK_SAVE_AS, "Save _As...", "<shift><control>S", NULL, G_CALLBACK(file_save_as_cmd_cb) },
1157 { "/File/Set", NULL, "File Set", NULL, NULL, NULL },
1158 { "/File/Export", NULL, "Export", NULL, NULL, NULL },
1159 { "/File/Print", GTK_STOCK_PRINT, "_Print...", "<control>P", NULL, G_CALLBACK(file_print_cmd_cb) },
1160 { "/File/Quit", GTK_STOCK_QUIT, "_Quit", "<control>Q", NULL, G_CALLBACK(file_quit_cmd_cb) },
1162 { "/File/Set/ListFiles", WIRESHARK_STOCK_FILE_SET_LIST, "List Files", NULL, NULL, G_CALLBACK(fileset_cb) },
1163 { "/File/Set/NextFile", WIRESHARK_STOCK_FILE_SET_NEXT, "Next File", NULL, NULL, G_CALLBACK(fileset_next_cb) },
1164 { "/File/Set/PreviousFile",WIRESHARK_STOCK_FILE_SET_PREVIOUS, "Previous File", NULL, NULL, G_CALLBACK(fileset_previous_cb) },
1167 { "/File/Export/File", NULL, "File...", NULL, NULL, G_CALLBACK(export_text_cmd_cb) },
1169 { "/File/Export/File", NULL, "File...", NULL, NULL, NULL },
1170 { "/File/Export/File/Text", NULL, "as \"Plain _Text\" file...", NULL, NULL, G_CALLBACK(export_text_cmd_cb) },
1171 { "/File/Export/File/PostScript", NULL, "as \"_PostScript\" file...", NULL, NULL, G_CALLBACK(export_ps_cmd_cb) },
1172 { "/File/Export/File/CSV", NULL, "as \"_CSV\" (Comma Separated Values packet summary) file...",
1173 NULL, NULL, G_CALLBACK(export_csv_cmd_cb) },
1174 { "/File/Export/File/CArrays", NULL, "as \"C _Arrays\" (packet bytes) file...",
1175 NULL, NULL, G_CALLBACK(export_carrays_cmd_cb) },
1176 { "/File/Export/File/PSML", NULL, "as XML - \"P_SML\" (packet summary) file...",
1177 NULL, NULL, G_CALLBACK(export_psml_cmd_cb) },
1178 { "/File/Export/File/PDML", NULL, "as XML - \"P_DML\" (packet details) file...",
1179 NULL, NULL, G_CALLBACK(export_pdml_cmd_cb) },
1181 { "/File/Export/SelectedPacketBytes", NULL, "Selected Packet _Bytes...", "<control>H", NULL, G_CALLBACK(savehex_cb) },
1182 { "/File/Export/Objects", NULL, "Objects", NULL, NULL, NULL },
1183 { "/File/Export/Objects/HTTP", NULL, "_HTTP", NULL, NULL, G_CALLBACK(eo_http_cb) },
1184 { "/File/Export/Objects/DICOM", NULL, "_DICOM", NULL, NULL, G_CALLBACK(eo_dicom_cb) },
1185 { "/File/Export/Objects/SMB", NULL, "_SMB", NULL, NULL, G_CALLBACK(eo_smb_cb) },
1188 { "/Edit/Copy", NULL, "Copy", NULL, NULL, NULL },
1190 { "/Edit/Copy/Description", NULL, "Description", "<shift><control>D", NULL, G_CALLBACK(copy_description_cb) },
1191 { "/Edit/Copy/Fieldname", NULL, "Fieldname", "<shift><control>F", NULL, G_CALLBACK(copy_fieldname_cb) },
1192 { "/Edit/Copy/Value", NULL, "Value", "<shift><control>V", NULL, G_CALLBACK(copy_value_cb) },
1193 { "/Edit/Copy/AsFilter", NULL, "As Filter", "<shift><control>C", NULL, G_CALLBACK(copy_as_filter_cb) },
1197 * Un-#if this when we actually implement Cut/Copy/Paste for the
1198 * packet list and packet detail windows.
1200 * Note: when we implement Cut/Copy/Paste in those windows, we
1201 * will almost certainly want to allow multiple packets to be
1202 * selected in the packet list pane and multiple packet detail
1203 * items to be selected in the packet detail pane, so that
1204 * the user can, for example, copy the summaries of multiple
1205 * packets to the clipboard from the packet list pane and multiple
1206 * packet detail items - perhaps *all* packet detail items - from
1207 * the packet detail pane. Given that, we'll also want to
1208 * implement Select All.
1210 * If multiple packets are selected, we would probably display nothing
1211 * in the packet detail pane, just as we do if no packet is selected,
1212 * and any menu items etc. that would pertain only to a single packet
1213 * would be disabled.
1215 * If multiple packet detail items are selected, we would probably
1216 * disable all items that pertain only to a single packet detail
1217 * item, such as some items in the status bar.
1219 * XXX - the actions for these will be different depending on what
1220 * widget we're in; ^C should copy from the filter text widget if
1221 * we're in that widget, the packet list if we're in that widget
1222 * (presumably copying the summaries of selected packets to the
1223 * clipboard, e.g. the text copy would be the text of the columns),
1224 * the packet detail if we're in that widget (presumably copying
1225 * the contents of selected protocol tree items to the clipboard,
1226 * e.g. the text copy would be the text displayed for those items),
1229 * Given that those menu items should also affect text widgets
1230 * such as the filter box, we would again want Select All, and,
1231 * at least for the filter box, we would also want Undo and Redo.
1232 * We would only want Cut, Paste, Undo, and Redo for the packet
1233 * list and packet detail panes if we support modifying them.
1235 {"/Edit/_Undo", "<control>Z", NULL,
1236 0, "<StockItem>", GTK_STOCK_UNDO,},
1237 {"/Edit/_Redo", "<shift><control>Z", NULL,
1238 0, "<StockItem>", GTK_STOCK_REDO,},
1239 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1240 {"/Edit/Cu_t", "<control>X", NULL,
1241 0, "<StockItem>", GTK_STOCK_CUT,},
1242 {"/Edit/_Copy", "<control>C", NULL,
1243 0, "<StockItem>", GTK_STOCK_COPY,},
1244 {"/Edit/_Paste", "<control>V", NULL,
1245 0, "<StockItem>", GTK_STOCK_PASTE,},
1246 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1247 {"/Edit/Select _All", "<control>A", NULL, 0,
1248 #ifdef GTK_STOCK_SELECT_ALL /* first appeared in 2.10 */
1249 "<StockItem>", GTK_STOCK_SELECT_ALL,
1252 #endif /* GTK_STOCK_SELECT_ALL */
1254 { "/Edit/FindPacket", GTK_STOCK_FIND, "_Find Packet...", "<control>F", NULL, G_CALLBACK(find_frame_cb) },
1255 { "/Edit/FindNext", NULL, "Find Ne_xt", "<control>N", NULL, G_CALLBACK(find_next_cb) },
1256 { "/Edit/FindPrevious", NULL, "Find Pre_vious", "<control>B", NULL, G_CALLBACK(find_previous_cb) },
1258 #ifdef NEW_PACKET_LIST
1259 { "/Edit/MarkPacket", NULL, "_Mark Packet (toggle)", "<control>M", NULL, G_CALLBACK(new_packet_list_mark_frame_cb) },
1260 { "/Edit/FindNextMark", NULL, "Find Next Mark", "<shift><control>N", NULL, G_CALLBACK(find_next_mark_cb) },
1261 { "/Edit/FindPreviousMark", NULL, "Find Next Mark", "<shift><control>B", NULL, G_CALLBACK(find_prev_mark_cb) },
1262 { "/Edit/MarkAllDisplayedPackets", NULL, "Mark All Displayed Packets (toggle)", "<control>A", NULL, G_CALLBACK(new_packet_list_mark_all_displayed_frames_cb) },
1263 { "/Edit/UnmarkAllPackets", NULL, "_Unmark All Packets", "<control>D", NULL, G_CALLBACK(new_packet_list_unmark_all_frames_cb) },
1265 { "/Edit/IgnorePacket", NULL, "_Ignore Packet (toggle)", "<control>X", NULL, G_CALLBACK(new_packet_list_ignore_frame_cb) },
1267 * XXX - this next one overrides /Edit/Copy/Description
1269 { "/Edit/IgnoreAllDisplayedPackets", NULL, "_Ignore All Displayed Packets (toggle)","<alt><shift><control>X", NULL, G_CALLBACK(new_packet_list_ignore_all_displayed_frames_cb) },
1270 { "/Edit/Un-IgnoreAllPackets", NULL, "U_n-Ignore All Packets", "<shift><control>X", NULL, G_CALLBACK(new_packet_list_unignore_all_frames_cb) },
1271 { "/Edit/SetTimeReference", WIRESHARK_STOCK_TIME, "Set Time Reference (toggle)", "<control>T", NULL, G_CALLBACK(set_reftime_cb) },
1272 { "/Edit/Un-TimeReferenceAllPackets",NULL, "Un-Time Reference All Packets", "<alt><control>T", NULL, G_CALLBACK(new_packet_list_untime_reference_all_frames_cb) },
1273 { "/Edit/FindNextTimeReference", NULL, "Find Next Time Reference", "<alt><control>N", NULL, G_CALLBACK(find_next_ref_time_cb) },
1274 { "/Edit/FindPreviousTimeReference", NULL, "Find Previous Time Reference", "<alt><control>B", NULL, G_CALLBACK(find_previous_ref_time_cb) },
1276 #else /* NEW_PACKET_LIST */
1278 #endif /* NEW_PACKET_LIST */
1279 { "/Edit/ConfigurationProfiles", NULL, "_Configuration Profiles...", "<shift><control>A", NULL, G_CALLBACK(profile_dialog_cb) },
1280 { "/Edit/Preferences", GTK_STOCK_PREFERENCES, "_Preferences...", "<shift><control>P", NULL, G_CALLBACK(prefs_cb) },
1283 { "/View/TimeDisplayFormat", NULL, "_Time Display Format", NULL, NULL, NULL },
1285 { "/View/NameResolution", NULL, "Name Resol_ution", NULL, NULL, NULL },
1286 { "/View/NameResolution/ResolveName", NULL, "_Resolve Name", NULL, NULL, G_CALLBACK(view_menu_en_for_MAC_cb) },
1289 static const GtkToggleActionEntry main_menu_bar_toggle_action_entries[] =
1291 /* name, stock id, label, accel, tooltip, callback, is_active */
1292 {"/View/MainToolbar", NULL, "_Main Toolbar", NULL, NULL, G_CALLBACK(main_toolbar_show_hide_cb), TRUE},
1293 {"/View/FilterToolbar", NULL, "_FilterToolbar", NULL, NULL, G_CALLBACK(filter_toolbar_show_hide_cb), TRUE},
1295 {"/View/WirelessToolbar", NULL, "_WirelessToolbar", NULL, NULL, G_CALLBACK(wireless_toolbar_show_hide_cb), TRUE},
1297 {"/View/Statusbar", NULL, "_Statusbar", NULL, NULL, G_CALLBACK(status_bar_show_hide_cb), TRUE},
1298 {"/View/PacketList", NULL, "Packet _List", NULL, NULL, G_CALLBACK(packet_list_show_hide_cb), TRUE},
1299 {"/View/PacketDetails", NULL, "Packet _Details", NULL, NULL, G_CALLBACK(packet_details_show_hide_cb), TRUE},
1300 {"/View/PacketBytes", NULL, "Packet _Bytes", NULL, NULL, G_CALLBACK(packet_bytes_show_hide_cb), TRUE},
1301 {"/View/TimeDisplayFormat/DisplaySecondsWithHoursAndMinutes", NULL, "Display Seconds with hours and minutes", NULL, NULL, G_CALLBACK(timestamp_seconds_time_cb), FALSE},
1302 {"/View/NameResolution/EnableforMACLayer", NULL, "Enable for _MAC Layer", NULL, NULL, G_CALLBACK(view_menu_en_for_MAC_cb) },
1306 static const GtkRadioActionEntry main_menu_bar_radio_view_time_entries [] =
1308 /* name, stock id, label, accel, tooltip, value */
1309 { "/View/TimeDisplayFormat/DateandTimeofDay", NULL, "Date and Time of Day: 1970-01-01 01:02:03.123456", "<alt><control>1", NULL, TS_ABSOLUTE_WITH_DATE },
1310 { "/View/TimeDisplayFormat/TimeofDay", NULL, "Time of Day: 01:02:03.123456", "<alt><control>2", NULL, TS_ABSOLUTE },
1311 { "/View/TimeDisplayFormat/SecondsSinceEpoch", NULL, "Seconds Since Epoch (1970-01-01): 1234567890.123456", "<alt><control>3", NULL, TS_EPOCH },
1312 { "/View/TimeDisplayFormat/SecondsSinceBeginningofCapture", NULL, "Seconds Since Beginning of Capture: 123.123456", "<alt><control>4", NULL, TS_RELATIVE },
1313 { "/View/TimeDisplayFormat/SecondsSincePreviousCapturedPacket", NULL, "Seconds Since Previous Captured Packet: 1.123456", "<alt><control>5", NULL, TS_DELTA },
1314 { "/View/TimeDisplayFormat/SecondsSincePreviousDisplayedPacket",NULL, "Seconds Since Previous Displayed Packet: 1.123456", "<alt><control>6", NULL, TS_DELTA_DIS },
1317 static const GtkRadioActionEntry main_menu_bar_radio_view_time_fileformat_prec_entries [] =
1319 /* name, stock id, label, accel, tooltip, value */
1320 { "/View/TimeDisplayFormat/FileFormatPrecision-Automatic", NULL, "Automatic (File Format Precision)", NULL, NULL, TS_PREC_AUTO },
1321 { "/View/TimeDisplayFormat/FileFormatPrecision-Seconds", NULL, "Seconds: 0", NULL, NULL, TS_PREC_FIXED_SEC },
1322 { "/View/TimeDisplayFormat/FileFormatPrecision-Deciseconds", NULL, "Deciseconds: 0.1", NULL, NULL, TS_PREC_FIXED_DSEC },
1323 { "/View/TimeDisplayFormat/FileFormatPrecision-Centiseconds", NULL, "Centiseconds: 0.12", NULL, NULL, TS_PREC_FIXED_CSEC },
1324 { "/View/TimeDisplayFormat/FileFormatPrecision-Milliseconds", NULL, "Milliseconds: 0.123", NULL, NULL, TS_PREC_FIXED_MSEC },
1325 { "/View/TimeDisplayFormat/FileFormatPrecision-Microseconds", NULL, "Microseconds: 0.123456", NULL, NULL, TS_PREC_FIXED_USEC },
1326 { "/View/TimeDisplayFormat/FileFormatPrecision-Nanoseconds", NULL, "Nanoseconds: 0.123456789", NULL, NULL, TS_PREC_FIXED_NSEC },
1328 #endif /* 0 Prepare for use of GTKUImanager*/
1330 /* calculate the number of menu_items */
1331 static int nmenu_items = sizeof(menu_items) / sizeof(menu_items[0]);
1332 #ifndef MENUS_USE_UIMANAGER
1333 /* packet list heading popup */
1334 static GtkItemFactoryEntry packet_list_heading_items[] =
1336 #ifdef NEW_PACKET_LIST
1337 {"/Sort Ascending", NULL, GTK_MENU_FUNC(new_packet_list_column_menu_cb), COLUMN_SELECTED_SORT_ASCENDING, "<StockItem>", GTK_STOCK_SORT_ASCENDING,},
1338 {"/Sort Descending", NULL, GTK_MENU_FUNC(new_packet_list_column_menu_cb), COLUMN_SELECTED_SORT_DESCENDING, "<StockItem>", GTK_STOCK_SORT_DESCENDING,},
1339 {"/No Sorting", NULL, GTK_MENU_FUNC(new_packet_list_column_menu_cb), COLUMN_SELECTED_SORT_NONE, NULL, NULL,},
1341 {"/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1343 {"/Show Resolved", NULL, GTK_MENU_FUNC(new_packet_list_column_menu_cb), COLUMN_SELECTED_TOGGLE_RESOLVED, "<CheckItem>", NULL,},
1345 {"/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1347 {"/Align Left", NULL, GTK_MENU_FUNC(new_packet_list_column_menu_cb), COLUMN_SELECTED_ALIGN_LEFT, "<StockItem>", GTK_STOCK_JUSTIFY_LEFT,},
1348 {"/Align Center", NULL, GTK_MENU_FUNC(new_packet_list_column_menu_cb), COLUMN_SELECTED_ALIGN_CENTER, "<StockItem>", GTK_STOCK_JUSTIFY_CENTER,},
1349 {"/Align Right", NULL, GTK_MENU_FUNC(new_packet_list_column_menu_cb), COLUMN_SELECTED_ALIGN_RIGHT, "<StockItem>", GTK_STOCK_JUSTIFY_RIGHT,},
1351 {"/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1353 {"/Column Preferences...", NULL, GTK_MENU_FUNC(prefs_page_cb), PREFS_PAGE_COLUMNS, "<StockItem>", GTK_STOCK_PREFERENCES,},
1354 {"/Resize Column", NULL, GTK_MENU_FUNC(new_packet_list_column_menu_cb), COLUMN_SELECTED_RESIZE, "<StockItem>", WIRESHARK_STOCK_RESIZE_COLUMNS,},
1355 {"/Rename Column Title...", NULL, GTK_MENU_FUNC(new_packet_list_column_menu_cb), COLUMN_SELECTED_RENAME, "<StockItem>", GTK_STOCK_BOLD,},
1357 {"/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1359 {"/Displayed Columns", NULL, NULL, 0, NULL, NULL,},
1360 {"/Hide Column", NULL, GTK_MENU_FUNC(new_packet_list_column_menu_cb), COLUMN_SELECTED_HIDE, NULL, NULL,},
1361 {"/Remove Column", NULL, GTK_MENU_FUNC(new_packet_list_column_menu_cb), COLUMN_SELECTED_REMOVE, "<StockItem>", GTK_STOCK_DELETE,}
1363 {"/Sort Ascending", NULL, GTK_MENU_FUNC(packet_list_column_menu_cb), COLUMN_SELECTED_SORT_ASCENDING, "<StockItem>", GTK_STOCK_SORT_ASCENDING,},
1364 {"/Sort Descending", NULL, GTK_MENU_FUNC(packet_list_column_menu_cb), COLUMN_SELECTED_SORT_DESCENDING, "<StockItem>", GTK_STOCK_SORT_DESCENDING,},
1365 {"/No Sorting", NULL, GTK_MENU_FUNC(packet_list_column_menu_cb), COLUMN_SELECTED_SORT_NONE, NULL, NULL,},
1367 {"/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1369 {"/Align Left", NULL, GTK_MENU_FUNC(packet_list_column_menu_cb), COLUMN_SELECTED_ALIGN_LEFT, "<StockItem>", GTK_STOCK_JUSTIFY_LEFT,},
1370 {"/Align Center", NULL, GTK_MENU_FUNC(packet_list_column_menu_cb), COLUMN_SELECTED_ALIGN_CENTER, "<StockItem>", GTK_STOCK_JUSTIFY_CENTER,},
1371 {"/Align Right", NULL, GTK_MENU_FUNC(packet_list_column_menu_cb), COLUMN_SELECTED_ALIGN_RIGHT, "<StockItem>", GTK_STOCK_JUSTIFY_RIGHT,},
1373 {"/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1375 {"/Column Preferences...", NULL, GTK_MENU_FUNC(prefs_page_cb), PREFS_PAGE_COLUMNS, "<StockItem>", GTK_STOCK_PREFERENCES,},
1376 {"/Resize Column", NULL, GTK_MENU_FUNC(packet_list_column_menu_cb), COLUMN_SELECTED_RESIZE, "<StockItem>", WIRESHARK_STOCK_RESIZE_COLUMNS,},
1377 {"/Rename Column Title...", NULL, GTK_MENU_FUNC(packet_list_column_menu_cb), COLUMN_SELECTED_RENAME, "<StockItem>", GTK_STOCK_BOLD,},
1379 {"/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1381 {"/Remove Column", NULL, GTK_MENU_FUNC(packet_list_column_menu_cb), COLUMN_SELECTED_REMOVE, "<StockItem>", GTK_STOCK_DELETE,}
1385 /* packet list popup */
1386 static GtkItemFactoryEntry packet_list_menu_items[] =
1388 #ifdef NEW_PACKET_LIST
1389 {"/Mark Packet (toggle)", NULL, GTK_MENU_FUNC(new_packet_list_mark_frame_cb), 0, NULL, NULL,},
1390 {"/Ignore Packet (toggle)", NULL, GTK_MENU_FUNC(new_packet_list_ignore_frame_cb), 0, NULL, NULL,},
1392 {"/Mark Packet (toggle)", NULL, GTK_MENU_FUNC(packet_list_mark_frame_cb), 0, NULL, NULL,},
1393 {"/Ignore Packet (toggle)", NULL, GTK_MENU_FUNC(packet_list_ignore_frame_cb), 0, NULL, NULL,},
1394 #endif /* NEW_PACKET_LIST */
1395 {"/Set Time Reference (toggle)", NULL, GTK_MENU_FUNC(reftime_frame_cb), REFTIME_TOGGLE, "<StockItem>", WIRESHARK_STOCK_TIME,},
1397 {"/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1398 {"/Manually Resolve Address", NULL, GTK_MENU_FUNC(manual_addr_resolv_dlg), 0, NULL, NULL,},
1399 {"/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1401 {"/Apply as Filter", NULL, NULL, 0, "<Branch>", NULL,},
1402 {"/Apply as Filter/_Selected", NULL, GTK_MENU_FUNC(match_selected_plist_cb),
1403 MATCH_SELECTED_REPLACE|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
1404 {"/Apply as Filter/_Not Selected", NULL, GTK_MENU_FUNC(match_selected_plist_cb),
1405 MATCH_SELECTED_NOT|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
1406 {"/Apply as Filter/... _and Selected", NULL, GTK_MENU_FUNC(match_selected_plist_cb),
1407 MATCH_SELECTED_AND|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
1408 {"/Apply as Filter/... _or Selected", NULL, GTK_MENU_FUNC(match_selected_plist_cb),
1409 MATCH_SELECTED_OR|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
1410 {"/Apply as Filter/... a_nd not Selected", NULL, GTK_MENU_FUNC(match_selected_plist_cb),
1411 MATCH_SELECTED_AND_NOT|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
1412 {"/Apply as Filter/... o_r not Selected", NULL, GTK_MENU_FUNC(match_selected_plist_cb),
1413 MATCH_SELECTED_OR_NOT|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
1414 {"/Prepare a Filter", NULL, NULL, 0, "<Branch>", NULL,},
1415 {"/Prepare a Filter/_Selected", NULL, GTK_MENU_FUNC(match_selected_plist_cb),
1416 MATCH_SELECTED_REPLACE, NULL, NULL,},
1417 {"/Prepare a Filter/_Not Selected", NULL, GTK_MENU_FUNC(match_selected_plist_cb),
1418 MATCH_SELECTED_NOT, NULL, NULL,},
1419 {"/Prepare a Filter/... _and Selected", NULL, GTK_MENU_FUNC(match_selected_plist_cb),
1420 MATCH_SELECTED_AND, NULL, NULL,},
1421 {"/Prepare a Filter/... _or Selected", NULL, GTK_MENU_FUNC(match_selected_plist_cb),
1422 MATCH_SELECTED_OR, NULL, NULL,},
1423 {"/Prepare a Filter/... a_nd not Selected", NULL, GTK_MENU_FUNC(match_selected_plist_cb),
1424 MATCH_SELECTED_AND_NOT, NULL, NULL,},
1425 {"/Prepare a Filter/... o_r not Selected", NULL, GTK_MENU_FUNC(match_selected_plist_cb),
1426 MATCH_SELECTED_OR_NOT, NULL, NULL,},
1427 {"/Conversation Filter", NULL, NULL, 0, "<Branch>",NULL,},
1428 {"/Conversation Filter/Ethernet", NULL, GTK_MENU_FUNC(conversation_cb),
1429 CONV_ETHER, NULL, NULL,},
1430 {"/Conversation Filter/IP", NULL, GTK_MENU_FUNC(conversation_cb),
1431 CONV_IP, NULL, NULL,},
1432 {"/Conversation Filter/TCP", NULL, GTK_MENU_FUNC(conversation_cb),
1433 CONV_TCP, NULL, NULL,},
1434 {"/Conversation Filter/UDP", NULL, GTK_MENU_FUNC(conversation_cb),
1435 CONV_UDP, NULL, NULL,},
1436 {"/Conversation Filter/PN-CBA Server", NULL, GTK_MENU_FUNC(conversation_cb),
1437 CONV_CBA, NULL, NULL,},
1439 {"/Colorize Conversation", NULL, NULL, 0, "<Branch>",NULL,},
1440 {"/Colorize Conversation/Ethernet", NULL, NULL, 0, "<Branch>",NULL,},
1441 {"/Colorize Conversation/Ethernet/Color 1", NULL,
1442 GTK_MENU_FUNC(colorize_conversation_cb), CONV_ETHER+1*256, "<StockItem>", WIRESHARK_STOCK_COLOR1,},
1443 {"/Colorize Conversation/Ethernet/Color 2", NULL,
1444 GTK_MENU_FUNC(colorize_conversation_cb), CONV_ETHER+2*256, "<StockItem>", WIRESHARK_STOCK_COLOR2,},
1445 {"/Colorize Conversation/Ethernet/Color 3", NULL,
1446 GTK_MENU_FUNC(colorize_conversation_cb), CONV_ETHER+3*256, "<StockItem>", WIRESHARK_STOCK_COLOR3,},
1447 {"/Colorize Conversation/Ethernet/Color 4", NULL,
1448 GTK_MENU_FUNC(colorize_conversation_cb), CONV_ETHER+4*256, "<StockItem>", WIRESHARK_STOCK_COLOR4,},
1449 {"/Colorize Conversation/Ethernet/Color 5", NULL,
1450 GTK_MENU_FUNC(colorize_conversation_cb), CONV_ETHER+5*256, "<StockItem>", WIRESHARK_STOCK_COLOR5,},
1451 {"/Colorize Conversation/Ethernet/Color 6", NULL,
1452 GTK_MENU_FUNC(colorize_conversation_cb), CONV_ETHER+6*256, "<StockItem>", WIRESHARK_STOCK_COLOR6,},
1453 {"/Colorize Conversation/Ethernet/Color 7", NULL,
1454 GTK_MENU_FUNC(colorize_conversation_cb), CONV_ETHER+7*256, "<StockItem>", WIRESHARK_STOCK_COLOR7,},
1455 {"/Colorize Conversation/Ethernet/Color 8", NULL,
1456 GTK_MENU_FUNC(colorize_conversation_cb), CONV_ETHER+8*256, "<StockItem>", WIRESHARK_STOCK_COLOR8,},
1457 {"/Colorize Conversation/Ethernet/Color 9", NULL,
1458 GTK_MENU_FUNC(colorize_conversation_cb), CONV_ETHER+9*256, "<StockItem>", WIRESHARK_STOCK_COLOR9,},
1459 {"/Colorize Conversation/Ethernet/Color 10", NULL,
1460 GTK_MENU_FUNC(colorize_conversation_cb), CONV_ETHER+10*256, "<StockItem>", WIRESHARK_STOCK_COLOR0,},
1461 {"/Colorize Conversation/Ethernet/<separator>", NULL,
1462 NULL, 0, "<Separator>",NULL,},
1463 {"/Colorize Conversation/Ethernet/New Coloring Rule...", NULL,
1464 GTK_MENU_FUNC(colorize_conversation_cb), CONV_ETHER, "<StockItem>", GTK_STOCK_SELECT_COLOR,},
1465 {"/Colorize Conversation/IP", NULL, NULL, 0, "<Branch>",NULL,},
1466 {"/Colorize Conversation/IP/Color 1", NULL,
1467 GTK_MENU_FUNC(colorize_conversation_cb), CONV_IP+1*256, "<StockItem>", WIRESHARK_STOCK_COLOR1,},
1468 {"/Colorize Conversation/IP/Color 2", NULL,
1469 GTK_MENU_FUNC(colorize_conversation_cb), CONV_IP+2*256, "<StockItem>", WIRESHARK_STOCK_COLOR2,},
1470 {"/Colorize Conversation/IP/Color 3", NULL,
1471 GTK_MENU_FUNC(colorize_conversation_cb), CONV_IP+3*256, "<StockItem>", WIRESHARK_STOCK_COLOR3,},
1472 {"/Colorize Conversation/IP/Color 4", NULL,
1473 GTK_MENU_FUNC(colorize_conversation_cb), CONV_IP+4*256, "<StockItem>", WIRESHARK_STOCK_COLOR4,},
1474 {"/Colorize Conversation/IP/Color 5", NULL,
1475 GTK_MENU_FUNC(colorize_conversation_cb), CONV_IP+5*256, "<StockItem>", WIRESHARK_STOCK_COLOR5,},
1476 {"/Colorize Conversation/IP/Color 6", NULL,
1477 GTK_MENU_FUNC(colorize_conversation_cb), CONV_IP+6*256, "<StockItem>", WIRESHARK_STOCK_COLOR6,},
1478 {"/Colorize Conversation/IP/Color 7", NULL,
1479 GTK_MENU_FUNC(colorize_conversation_cb), CONV_IP+7*256, "<StockItem>", WIRESHARK_STOCK_COLOR7,},
1480 {"/Colorize Conversation/IP/Color 8", NULL,
1481 GTK_MENU_FUNC(colorize_conversation_cb), CONV_IP+8*256, "<StockItem>", WIRESHARK_STOCK_COLOR8,},
1482 {"/Colorize Conversation/IP/Color 9", NULL,
1483 GTK_MENU_FUNC(colorize_conversation_cb), CONV_IP+9*256, "<StockItem>", WIRESHARK_STOCK_COLOR9,},
1484 {"/Colorize Conversation/IP/Color 10", NULL,
1485 GTK_MENU_FUNC(colorize_conversation_cb), CONV_IP+10*256, "<StockItem>", WIRESHARK_STOCK_COLOR0,},
1486 {"/Colorize Conversation/IP/<separator>", NULL,
1487 NULL, 0, "<Separator>",NULL,},
1488 {"/Colorize Conversation/IP/New Coloring Rule...", NULL,
1489 GTK_MENU_FUNC(colorize_conversation_cb), CONV_IP, "<StockItem>", GTK_STOCK_SELECT_COLOR,},
1490 {"/Colorize Conversation/TCP", NULL, NULL, 0, "<Branch>",NULL,},
1491 {"/Colorize Conversation/TCP/Color 1", NULL,
1492 GTK_MENU_FUNC(colorize_conversation_cb), CONV_TCP+1*256, "<StockItem>", WIRESHARK_STOCK_COLOR1,},
1493 {"/Colorize Conversation/TCP/Color 2", NULL,
1494 GTK_MENU_FUNC(colorize_conversation_cb), CONV_TCP+2*256, "<StockItem>", WIRESHARK_STOCK_COLOR2,},
1495 {"/Colorize Conversation/TCP/Color 3", NULL,
1496 GTK_MENU_FUNC(colorize_conversation_cb), CONV_TCP+3*256, "<StockItem>", WIRESHARK_STOCK_COLOR3,},
1497 {"/Colorize Conversation/TCP/Color 4", NULL,
1498 GTK_MENU_FUNC(colorize_conversation_cb), CONV_TCP+4*256, "<StockItem>", WIRESHARK_STOCK_COLOR4,},
1499 {"/Colorize Conversation/TCP/Color 5", NULL,
1500 GTK_MENU_FUNC(colorize_conversation_cb), CONV_TCP+5*256, "<StockItem>", WIRESHARK_STOCK_COLOR5,},
1501 {"/Colorize Conversation/TCP/Color 6", NULL,
1502 GTK_MENU_FUNC(colorize_conversation_cb), CONV_TCP+6*256, "<StockItem>", WIRESHARK_STOCK_COLOR6,},
1503 {"/Colorize Conversation/TCP/Color 7", NULL,
1504 GTK_MENU_FUNC(colorize_conversation_cb), CONV_TCP+7*256, "<StockItem>", WIRESHARK_STOCK_COLOR7,},
1505 {"/Colorize Conversation/TCP/Color 8", NULL,
1506 GTK_MENU_FUNC(colorize_conversation_cb), CONV_TCP+8*256, "<StockItem>", WIRESHARK_STOCK_COLOR8,},
1507 {"/Colorize Conversation/TCP/Color 9", NULL,
1508 GTK_MENU_FUNC(colorize_conversation_cb), CONV_TCP+9*256, "<StockItem>", WIRESHARK_STOCK_COLOR9,},
1509 {"/Colorize Conversation/TCP/Color 10", NULL,
1510 GTK_MENU_FUNC(colorize_conversation_cb), CONV_TCP+10*256, "<StockItem>", WIRESHARK_STOCK_COLOR0,},
1511 {"/Colorize Conversation/TCP/<separator>", NULL,
1512 NULL, 0, "<Separator>",NULL,},
1513 {"/Colorize Conversation/TCP/New Coloring Rule...", NULL,
1514 GTK_MENU_FUNC(colorize_conversation_cb), CONV_TCP, "<StockItem>", GTK_STOCK_SELECT_COLOR,},
1515 {"/Colorize Conversation/UDP", NULL, NULL, 0, "<Branch>",NULL,},
1516 {"/Colorize Conversation/UDP/Color 1", NULL,
1517 GTK_MENU_FUNC(colorize_conversation_cb), CONV_UDP+1*256, "<StockItem>", WIRESHARK_STOCK_COLOR1,},
1518 {"/Colorize Conversation/UDP/Color 2", NULL,
1519 GTK_MENU_FUNC(colorize_conversation_cb), CONV_UDP+2*256, "<StockItem>", WIRESHARK_STOCK_COLOR2,},
1520 {"/Colorize Conversation/UDP/Color 3", NULL,
1521 GTK_MENU_FUNC(colorize_conversation_cb), CONV_UDP+3*256, "<StockItem>", WIRESHARK_STOCK_COLOR3,},
1522 {"/Colorize Conversation/UDP/Color 4", NULL,
1523 GTK_MENU_FUNC(colorize_conversation_cb), CONV_UDP+4*256, "<StockItem>", WIRESHARK_STOCK_COLOR4,},
1524 {"/Colorize Conversation/UDP/Color 5", NULL,
1525 GTK_MENU_FUNC(colorize_conversation_cb), CONV_UDP+5*256, "<StockItem>", WIRESHARK_STOCK_COLOR5,},
1526 {"/Colorize Conversation/UDP/Color 6", NULL,
1527 GTK_MENU_FUNC(colorize_conversation_cb), CONV_UDP+6*256, "<StockItem>", WIRESHARK_STOCK_COLOR6,},
1528 {"/Colorize Conversation/UDP/Color 7", NULL,
1529 GTK_MENU_FUNC(colorize_conversation_cb), CONV_UDP+7*256, "<StockItem>", WIRESHARK_STOCK_COLOR7,},
1530 {"/Colorize Conversation/UDP/Color 8", NULL,
1531 GTK_MENU_FUNC(colorize_conversation_cb), CONV_UDP+8*256, "<StockItem>", WIRESHARK_STOCK_COLOR8,},
1532 {"/Colorize Conversation/UDP/Color 9", NULL,
1533 GTK_MENU_FUNC(colorize_conversation_cb), CONV_UDP+9*256, "<StockItem>", WIRESHARK_STOCK_COLOR9,},
1534 {"/Colorize Conversation/UDP/Color 10", NULL,
1535 GTK_MENU_FUNC(colorize_conversation_cb), CONV_UDP+10*256, "<StockItem>", WIRESHARK_STOCK_COLOR0,},
1536 {"/Colorize Conversation/UDP/<separator>", NULL,
1537 NULL, 0, "<Separator>",NULL,},
1538 {"/Colorize Conversation/UDP/New Coloring Rule...", NULL,
1539 GTK_MENU_FUNC(colorize_conversation_cb), CONV_UDP, "<StockItem>", GTK_STOCK_SELECT_COLOR,},
1540 {"/Colorize Conversation/PN-CBA Server", NULL, NULL, 0, "<Branch>",NULL,},
1541 {"/Colorize Conversation/PN-CBA Server/Color 1", NULL,
1542 GTK_MENU_FUNC(colorize_conversation_cb), CONV_CBA+1*256, "<StockItem>", WIRESHARK_STOCK_COLOR1,},
1543 {"/Colorize Conversation/PN-CBA Server/Color 2", NULL,
1544 GTK_MENU_FUNC(colorize_conversation_cb), CONV_CBA+2*256, "<StockItem>", WIRESHARK_STOCK_COLOR2,},
1545 {"/Colorize Conversation/PN-CBA Server/Color 3", NULL,
1546 GTK_MENU_FUNC(colorize_conversation_cb), CONV_CBA+3*256, "<StockItem>", WIRESHARK_STOCK_COLOR3,},
1547 {"/Colorize Conversation/PN-CBA Server/Color 4", NULL,
1548 GTK_MENU_FUNC(colorize_conversation_cb), CONV_CBA+4*256, "<StockItem>", WIRESHARK_STOCK_COLOR4,},
1549 {"/Colorize Conversation/PN-CBA Server/Color 5", NULL,
1550 GTK_MENU_FUNC(colorize_conversation_cb), CONV_CBA+5*256, "<StockItem>", WIRESHARK_STOCK_COLOR5,},
1551 {"/Colorize Conversation/PN-CBA Server/Color 6", NULL,
1552 GTK_MENU_FUNC(colorize_conversation_cb), CONV_CBA+6*256, "<StockItem>", WIRESHARK_STOCK_COLOR6,},
1553 {"/Colorize Conversation/PN-CBA Server/Color 7", NULL,
1554 GTK_MENU_FUNC(colorize_conversation_cb), CONV_CBA+7*256, "<StockItem>", WIRESHARK_STOCK_COLOR7,},
1555 {"/Colorize Conversation/PN-CBA Server/Color 8", NULL,
1556 GTK_MENU_FUNC(colorize_conversation_cb), CONV_CBA+8*256, "<StockItem>", WIRESHARK_STOCK_COLOR8,},
1557 {"/Colorize Conversation/PN-CBA Server/Color 9", NULL,
1558 GTK_MENU_FUNC(colorize_conversation_cb), CONV_CBA+9*256, "<StockItem>", WIRESHARK_STOCK_COLOR9,},
1559 {"/Colorize Conversation/PN-CBA Server/Color 10", NULL,
1560 GTK_MENU_FUNC(colorize_conversation_cb), CONV_CBA+10*256, "<StockItem>", WIRESHARK_STOCK_COLOR0,},
1561 {"/Colorize Conversation/PN-CBA Server/<separator>", NULL,
1562 NULL, 0, "<Separator>",NULL,},
1563 {"/Colorize Conversation/PN-CBA Server/New Coloring Rule...", NULL,
1564 GTK_MENU_FUNC(colorize_conversation_cb), CONV_CBA, "<StockItem>", GTK_STOCK_SELECT_COLOR,},
1566 {"/SCTP", NULL, NULL, 0, "<Branch>",NULL,},
1567 {"/SCTP/Analyse this Association", NULL, GTK_MENU_FUNC(sctp_analyse_start),
1569 {"/SCTP/Prepare Filter for this Association", NULL, (sctp_set_assoc_filter),
1572 {"/Follow TCP Stream", NULL, (follow_tcp_stream_cb),
1574 {"/Follow UDP Stream", NULL, (follow_udp_stream_cb),
1576 {"/Follow SSL Stream", NULL, (follow_ssl_stream_cb),
1579 {"/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1580 {"/Copy", NULL, NULL, 0, "<Branch>", NULL,},
1581 #ifdef NEW_PACKET_LIST
1582 {"/Copy/Summary (Text)", NULL, GTK_MENU_FUNC(new_packet_list_copy_summary_cb), CS_TEXT, NULL, NULL,},
1583 {"/Copy/Summary (CSV)", NULL, GTK_MENU_FUNC(new_packet_list_copy_summary_cb), CS_CSV, NULL, NULL,},
1584 {"/Copy/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1586 {"/Copy/Summary (Text)", NULL, GTK_MENU_FUNC(packet_list_copy_summary_cb), CS_TEXT, NULL, NULL,},
1587 {"/Copy/Summary (CSV)", NULL, GTK_MENU_FUNC(packet_list_copy_summary_cb), CS_CSV, NULL, NULL,},
1588 {"/Copy/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1589 #endif /* NEW_PACKET_LIST */
1590 {"/Copy/As Filter", NULL, GTK_MENU_FUNC(match_selected_plist_cb),
1591 MATCH_SELECTED_REPLACE|MATCH_SELECTED_COPY_ONLY, NULL, NULL,},
1592 {"/Copy/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1593 {"/Copy/Bytes (Offset Hex Text)", NULL, GTK_MENU_FUNC(copy_hex_cb), CD_ALLINFO, NULL, NULL,},
1594 {"/Copy/Bytes (Offset Hex)", NULL, GTK_MENU_FUNC(copy_hex_cb), CD_HEXCOLUMNS, NULL, NULL,},
1595 {"/Copy/Bytes (Printable Text Only)", NULL, GTK_MENU_FUNC(copy_hex_cb), CD_TEXTONLY, NULL, NULL,},
1596 {"/Copy/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1597 {"/Copy/Bytes (Hex Stream)", NULL, GTK_MENU_FUNC(copy_hex_cb), CD_HEX, NULL, NULL,},
1598 {"/Copy/Bytes (Binary Stream)", NULL, GTK_MENU_FUNC(copy_hex_cb), CD_BINARY, NULL, NULL,},
1600 {"/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1602 {"/Decode As...", NULL, GTK_MENU_FUNC(decode_as_cb), 0, "<StockItem>", WIRESHARK_STOCK_DECODE_AS,},
1603 {"/Print...", NULL, GTK_MENU_FUNC(file_print_selected_cmd_cb), 0, "<StockItem>", GTK_STOCK_PRINT,},
1604 {"/Show Packet in New Window", NULL, GTK_MENU_FUNC(new_window_cb),
1608 static GtkItemFactoryEntry tree_view_menu_items[] =
1611 {"/Expand Subtrees", NULL, GTK_MENU_FUNC(expand_tree_cb), 0, NULL, NULL,},
1612 {"/Expand All", NULL, GTK_MENU_FUNC(expand_all_cb), 0, NULL, NULL,},
1613 {"/Collapse All", NULL, GTK_MENU_FUNC(collapse_all_cb), 0, NULL, NULL,},
1615 {"/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1617 {"/Apply as Column", NULL, GTK_MENU_FUNC(apply_as_custom_column_cb), 0, NULL, NULL},
1619 {"/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1621 {"/Apply as Filter", NULL, NULL, 0, "<Branch>", NULL,},
1622 {"/Apply as Filter/_Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
1623 MATCH_SELECTED_REPLACE|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
1624 {"/Apply as Filter/_Not Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
1625 MATCH_SELECTED_NOT|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
1626 {"/Apply as Filter/... _and Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
1627 MATCH_SELECTED_AND|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
1628 {"/Apply as Filter/... _or Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
1629 MATCH_SELECTED_OR|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
1630 {"/Apply as Filter/... a_nd not Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
1631 MATCH_SELECTED_AND_NOT|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
1632 {"/Apply as Filter/... o_r not Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
1633 MATCH_SELECTED_OR_NOT|MATCH_SELECTED_APPLY_NOW, NULL, NULL,},
1635 {"/Prepare a Filter", NULL, NULL, 0, "<Branch>", NULL,},
1636 {"/Prepare a Filter/_Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
1637 MATCH_SELECTED_REPLACE, NULL, NULL,},
1638 {"/Prepare a Filter/_Not Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
1639 MATCH_SELECTED_NOT, NULL, NULL,},
1640 {"/Prepare a Filter/... _and Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
1641 MATCH_SELECTED_AND, NULL, NULL,},
1642 {"/Prepare a Filter/... _or Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
1643 MATCH_SELECTED_OR, NULL, NULL,},
1644 {"/Prepare a Filter/... a_nd not Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
1645 MATCH_SELECTED_AND_NOT, NULL, NULL,},
1646 {"/Prepare a Filter/... o_r not Selected", NULL, GTK_MENU_FUNC(match_selected_ptree_cb),
1647 MATCH_SELECTED_OR_NOT, NULL, NULL,},
1649 {"/Colorize with Filter", NULL, NULL, 0, "<Branch>", NULL,},
1650 {"/Colorize with Filter/Color 1", NULL, GTK_MENU_FUNC(colorize_selected_ptree_cb), 1, "<StockItem>", WIRESHARK_STOCK_COLOR1,},
1651 {"/Colorize with Filter/Color 2", NULL, GTK_MENU_FUNC(colorize_selected_ptree_cb), 2, "<StockItem>", WIRESHARK_STOCK_COLOR2,},
1652 {"/Colorize with Filter/Color 3", NULL, GTK_MENU_FUNC(colorize_selected_ptree_cb), 3, "<StockItem>", WIRESHARK_STOCK_COLOR3,},
1653 {"/Colorize with Filter/Color 4", NULL, GTK_MENU_FUNC(colorize_selected_ptree_cb), 4, "<StockItem>", WIRESHARK_STOCK_COLOR4,},
1654 {"/Colorize with Filter/Color 5", NULL, GTK_MENU_FUNC(colorize_selected_ptree_cb), 5, "<StockItem>", WIRESHARK_STOCK_COLOR5,},
1655 {"/Colorize with Filter/Color 6", NULL, GTK_MENU_FUNC(colorize_selected_ptree_cb), 6, "<StockItem>", WIRESHARK_STOCK_COLOR6,},
1656 {"/Colorize with Filter/Color 7", NULL, GTK_MENU_FUNC(colorize_selected_ptree_cb), 7, "<StockItem>", WIRESHARK_STOCK_COLOR7,},
1657 {"/Colorize with Filter/Color 8", NULL, GTK_MENU_FUNC(colorize_selected_ptree_cb), 8, "<StockItem>", WIRESHARK_STOCK_COLOR8,},
1658 {"/Colorize with Filter/Color 9", NULL, GTK_MENU_FUNC(colorize_selected_ptree_cb), 9, "<StockItem>", WIRESHARK_STOCK_COLOR9,},
1659 {"/Colorize with Filter/Color 10", NULL, GTK_MENU_FUNC(colorize_selected_ptree_cb), 10, "<StockItem>", WIRESHARK_STOCK_COLOR0,},
1660 {"/Colorize with Filter/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1661 {"/Colorize with Filter/New Coloring Rule...", NULL, GTK_MENU_FUNC(colorize_selected_ptree_cb), 0, "<StockItem>", GTK_STOCK_SELECT_COLOR,},
1663 {"/Follow TCP Stream", NULL, GTK_MENU_FUNC(follow_tcp_stream_cb),
1665 {"/Follow UDP Stream", NULL, GTK_MENU_FUNC(follow_udp_stream_cb),
1667 {"/Follow SSL Stream", NULL, GTK_MENU_FUNC(follow_ssl_stream_cb),
1670 {"/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1672 {"/Copy", NULL, NULL, 0, "<Branch>", NULL,},
1673 {"/Copy/Description", NULL, GTK_MENU_FUNC(copy_selected_plist_cb), COPY_SELECTED_DESCRIPTION, NULL, NULL,},
1674 {"/Copy/Fieldname", NULL, GTK_MENU_FUNC(copy_selected_plist_cb), COPY_SELECTED_FIELDNAME, NULL, NULL,},
1675 {"/Copy/Value", NULL, GTK_MENU_FUNC(copy_selected_plist_cb), COPY_SELECTED_VALUE, NULL, NULL,},
1676 {"/Copy/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1677 {"/Copy/As Filter", NULL, GTK_MENU_FUNC(match_selected_ptree_cb), MATCH_SELECTED_REPLACE|MATCH_SELECTED_COPY_ONLY, NULL, NULL,},
1678 {"/Copy/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1679 {"/Copy/Bytes (Offset Hex Text)", NULL, GTK_MENU_FUNC(copy_hex_cb), CD_ALLINFO | CD_FLAGS_SELECTEDONLY, NULL, NULL,},
1680 {"/Copy/Bytes (Offset Hex)", NULL, GTK_MENU_FUNC(copy_hex_cb), CD_HEXCOLUMNS | CD_FLAGS_SELECTEDONLY, NULL, NULL,},
1681 {"/Copy/Bytes (Printable Text Only)", NULL, GTK_MENU_FUNC(copy_hex_cb), CD_TEXTONLY | CD_FLAGS_SELECTEDONLY, NULL, NULL,},
1682 {"/Copy/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1683 {"/Copy/Bytes (Hex Stream)", NULL, GTK_MENU_FUNC(copy_hex_cb), CD_HEX | CD_FLAGS_SELECTEDONLY, NULL, NULL,},
1684 {"/Copy/Bytes (Binary Stream)", NULL, GTK_MENU_FUNC(copy_hex_cb), CD_BINARY | CD_FLAGS_SELECTEDONLY, NULL, NULL,},
1686 {"/Export Selected Packet Bytes...", NULL, GTK_MENU_FUNC(savehex_cb),
1689 {"/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1691 {"/Wiki Protocol Page", NULL, GTK_MENU_FUNC(selected_ptree_info_cb),
1692 0, "<StockItem>", WIRESHARK_STOCK_WIKI,},
1693 {"/Filter Field Reference", NULL, GTK_MENU_FUNC(selected_ptree_ref_cb),
1694 0, "<StockItem>", WIRESHARK_STOCK_INTERNET,},
1695 #if GLIB_CHECK_VERSION(2,14,0) /* GRegex */
1696 {"/Protocol Help", NULL, NULL, 0, "<Branch>", NULL,},
1697 #endif /* GLIB_CHECK_VERSION(2,14,0) */
1698 {"/Protocol Preferences", NULL, NULL, 0, NULL, NULL,},
1699 {"/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1700 {"/Decode As...", NULL, GTK_MENU_FUNC(decode_as_cb), 0, "<StockItem>", WIRESHARK_STOCK_DECODE_AS,},
1701 {"/Disable Protocol...", NULL, GTK_MENU_FUNC(proto_disable_cb), 0, "<StockItem>", WIRESHARK_STOCK_CHECKBOX,},
1702 {"/_Resolve Name", NULL, GTK_MENU_FUNC(resolve_name_cb), 0, NULL, NULL,},
1703 {"/_Go to Corresponding Packet", NULL, GTK_MENU_FUNC(goto_framenum_cb), 0, NULL, NULL,}
1706 static GtkItemFactoryEntry bytes_menu_items[] =
1708 {"/Hex View", NULL, GTK_MENU_FUNC(select_bytes_view), BYTES_HEX, "<RadioItem>", NULL,},
1709 {"/Bits View", NULL, GTK_MENU_FUNC(select_bytes_view), BYTES_BITS, "/Hex View", NULL,}
1713 static int initialize = TRUE;
1714 static GtkItemFactory *main_menu_factory = NULL;
1715 #ifdef MENUS_USE_UIMANAGER
1716 static GtkUIManager *ui_manager_packet_list_heading = NULL;
1717 static GtkUIManager *ui_manager_packet_list_menu = NULL;
1718 static GtkUIManager *ui_manager_tree_view_menu = NULL;
1719 static GtkUIManager *ui_manager_bytes_menu = NULL;
1721 static GtkItemFactory *packet_list_heading_factory = NULL;
1722 static GtkItemFactory *packet_list_menu_factory = NULL;
1723 static GtkItemFactory *tree_view_menu_factory = NULL;
1724 static GtkItemFactory *bytes_menu_factory = NULL;
1726 static GSList *popup_menu_list = NULL;
1728 static GtkAccelGroup *grp;
1730 #ifdef MENUS_USE_UIMANAGER
1733 select_bytes_view_cb (GtkRadioAction *action, GtkRadioAction *current _U_, gpointer user_data _U_)
1737 value = gtk_radio_action_get_current_value (action);
1739 select_bytes_view( NULL, NULL, value);
1743 sort_ascending_cb(GtkWidget *widget, gpointer user_data)
1745 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_SORT_ASCENDING);
1749 sort_descending_cb(GtkWidget *widget, gpointer user_data)
1751 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_SORT_DESCENDING);
1755 no_sorting_cb(GtkWidget *widget, gpointer user_data)
1757 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_SORT_NONE);
1761 packet_list_heading_show_resolved_cb(GtkAction *action _U_, gpointer user_data)
1763 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/ShowResolved")
1765 new_packet_list_column_menu_cb( widget , NULL, COLUMN_SELECTED_TOGGLE_RESOLVED);
1769 packet_list_heading_align_left_cb(GtkWidget *widget, gpointer user_data)
1771 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_ALIGN_LEFT);
1775 packet_list_heading_align_center_cb(GtkWidget *widget, gpointer user_data)
1777 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_ALIGN_CENTER);
1781 packet_list_heading_align_right_cb(GtkWidget *widget, gpointer user_data)
1783 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_ALIGN_RIGHT);
1787 packet_list_heading_col_pref_cb(GtkWidget *widget, gpointer user_data)
1789 prefs_page_cb( widget , user_data, PREFS_PAGE_COLUMNS);
1793 packet_list_heading_resize_col_cb(GtkWidget *widget, gpointer user_data)
1795 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_RESIZE);
1799 packet_list_heading_rename_col_cb(GtkWidget *widget, gpointer user_data)
1801 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_RENAME);
1805 packet_list_heading_activate_all_columns(GtkWidget *widget _U_, gpointer user_data _U_)
1807 new_packet_list_set_all_columns_visible ();
1811 packet_list_heading_hide_col_cb(GtkWidget *widget, gpointer user_data)
1813 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_HIDE);
1817 packet_list_heading_remove_col_cb(GtkWidget *widget, gpointer user_data)
1819 new_packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_REMOVE);
1823 packet_list_menu_set_ref_time_cb(GtkWidget *widget, gpointer user_data)
1825 reftime_frame_cb( widget , user_data, REFTIME_TOGGLE);
1830 packet_list_menu_apply_selected_cb(GtkWidget *widget, gpointer user_data)
1832 match_selected_plist_cb( widget , user_data, MATCH_SELECTED_REPLACE|MATCH_SELECTED_APPLY_NOW);
1836 packet_list_menu_apply_not_selected_cb(GtkWidget *widget, gpointer user_data)
1838 match_selected_plist_cb( widget , user_data, MATCH_SELECTED_NOT|MATCH_SELECTED_APPLY_NOW);
1842 packet_list_menu_apply_and_selected_cb(GtkWidget *widget, gpointer user_data)
1844 match_selected_plist_cb( widget , user_data, MATCH_SELECTED_AND|MATCH_SELECTED_APPLY_NOW);
1848 packet_list_menu_apply_or_selected_cb(GtkWidget *widget, gpointer user_data)
1850 match_selected_plist_cb( widget , user_data, MATCH_SELECTED_OR|MATCH_SELECTED_APPLY_NOW);
1854 packet_list_menu_apply_and_not_selected_cb(GtkWidget *widget, gpointer user_data)
1856 match_selected_plist_cb( widget , user_data, MATCH_SELECTED_AND_NOT|MATCH_SELECTED_APPLY_NOW);
1860 packet_list_menu_apply_or_not_selected_cb(GtkWidget *widget, gpointer user_data)
1862 match_selected_plist_cb( widget , user_data,MATCH_SELECTED_OR_NOT|MATCH_SELECTED_APPLY_NOW);
1864 /* Prepare a filter */
1866 packet_list_menu_prepare_selected_cb(GtkWidget *widget, gpointer user_data)
1868 match_selected_plist_cb( widget , user_data, MATCH_SELECTED_REPLACE);
1872 packet_list_menu_prepare_not_selected_cb(GtkWidget *widget, gpointer user_data)
1874 match_selected_plist_cb( widget , user_data, MATCH_SELECTED_NOT);
1878 packet_list_menu_prepare_and_selected_cb(GtkWidget *widget, gpointer user_data)
1880 match_selected_plist_cb( widget , user_data, MATCH_SELECTED_AND);
1884 packet_list_menu_prepare_or_selected_cb(GtkWidget *widget, gpointer user_data)
1886 match_selected_plist_cb( widget , user_data, MATCH_SELECTED_OR);
1890 packet_list_menu_prepare_and_not_selected_cb(GtkWidget *widget, gpointer user_data)
1892 match_selected_plist_cb( widget , user_data, MATCH_SELECTED_AND_NOT);
1896 packet_list_menu_prepare_or_not_selected_cb(GtkWidget *widget, gpointer user_data)
1898 match_selected_plist_cb( widget , user_data, MATCH_SELECTED_OR_NOT);
1902 packet_list_menu_conversation_ethernet_cb(GtkWidget *widget, gpointer user_data)
1904 conversation_cb( widget , user_data, CONV_ETHER);
1908 packet_list_menu_conversation_ip_cb(GtkWidget *widget, gpointer user_data)
1910 conversation_cb( widget , user_data, CONV_IP);
1914 packet_list_menu_conversation_tcp_cb(GtkWidget *widget, gpointer user_data)
1916 conversation_cb( widget , user_data, CONV_TCP);
1920 packet_list_menu_conversation_udp_cb(GtkWidget *widget, gpointer user_data)
1922 conversation_cb( widget , user_data, CONV_UDP);
1926 packet_list_menu_conversation_pn_cba_cb(GtkWidget *widget, gpointer user_data)
1928 conversation_cb( widget , user_data, CONV_CBA);
1932 packet_list_menu_color_conv_ethernet_color1_cb(GtkWidget *widget, gpointer user_data)
1934 colorize_conversation_cb( widget , user_data, CONV_ETHER+1*256);
1939 packet_list_menu_color_conv_ethernet_color2_cb(GtkWidget *widget, gpointer user_data)
1941 colorize_conversation_cb( widget , user_data, CONV_ETHER+1*256);
1945 packet_list_menu_color_conv_ethernet_color3_cb(GtkWidget *widget, gpointer user_data)
1947 colorize_conversation_cb( widget , user_data, CONV_ETHER+3*256);
1951 packet_list_menu_color_conv_ethernet_color4_cb(GtkWidget *widget, gpointer user_data)
1953 colorize_conversation_cb( widget , user_data, CONV_ETHER+4*256);
1957 packet_list_menu_color_conv_ethernet_color5_cb(GtkWidget *widget, gpointer user_data)
1959 colorize_conversation_cb( widget , user_data, CONV_ETHER+5*256);
1963 packet_list_menu_color_conv_ethernet_color6_cb(GtkWidget *widget, gpointer user_data)
1965 colorize_conversation_cb( widget , user_data, CONV_ETHER+6*256);
1969 packet_list_menu_color_conv_ethernet_color7_cb(GtkWidget *widget, gpointer user_data)
1971 colorize_conversation_cb( widget , user_data, CONV_ETHER+7*256);
1975 packet_list_menu_color_conv_ethernet_color8_cb(GtkWidget *widget, gpointer user_data)
1977 colorize_conversation_cb( widget , user_data, CONV_ETHER+8*256);
1981 packet_list_menu_color_conv_ethernet_color9_cb(GtkWidget *widget, gpointer user_data)
1983 colorize_conversation_cb( widget , user_data, CONV_ETHER+9*256);
1987 packet_list_menu_color_conv_ethernet_color10_cb(GtkWidget *widget, gpointer user_data)
1989 colorize_conversation_cb( widget , user_data, CONV_ETHER+10*256);
1994 packet_list_menu_color_conv_ethernet_new_rule_cb(GtkWidget *widget, gpointer user_data)
1996 colorize_conversation_cb( widget , user_data, CONV_ETHER);
2003 packet_list_menu_color_conv_ip_color1_cb(GtkWidget *widget, gpointer user_data)
2005 colorize_conversation_cb( widget , user_data, CONV_IP+1*256);
2010 packet_list_menu_color_conv_ip_color2_cb(GtkWidget *widget, gpointer user_data)
2012 colorize_conversation_cb( widget , user_data, CONV_IP+1*256);
2016 packet_list_menu_color_conv_ip_color3_cb(GtkWidget *widget, gpointer user_data)
2018 colorize_conversation_cb( widget , user_data, CONV_IP+3*256);
2022 packet_list_menu_color_conv_ip_color4_cb(GtkWidget *widget, gpointer user_data)
2024 colorize_conversation_cb( widget , user_data, CONV_IP+4*256);
2028 packet_list_menu_color_conv_ip_color5_cb(GtkWidget *widget, gpointer user_data)
2030 colorize_conversation_cb( widget , user_data, CONV_IP+5*256);
2034 packet_list_menu_color_conv_ip_color6_cb(GtkWidget *widget, gpointer user_data)
2036 colorize_conversation_cb( widget , user_data, CONV_IP+6*256);
2040 packet_list_menu_color_conv_ip_color7_cb(GtkWidget *widget, gpointer user_data)
2042 colorize_conversation_cb( widget , user_data, CONV_IP+7*256);
2046 packet_list_menu_color_conv_ip_color8_cb(GtkWidget *widget, gpointer user_data)
2048 colorize_conversation_cb( widget , user_data, CONV_IP+8*256);
2052 packet_list_menu_color_conv_ip_color9_cb(GtkWidget *widget, gpointer user_data)
2054 colorize_conversation_cb( widget , user_data, CONV_IP+9*256);
2058 packet_list_menu_color_conv_ip_color10_cb(GtkWidget *widget, gpointer user_data)
2060 colorize_conversation_cb( widget , user_data, CONV_IP+10*256);
2065 packet_list_menu_color_conv_ip_new_rule_cb(GtkWidget *widget, gpointer user_data)
2067 colorize_conversation_cb( widget , user_data, CONV_TCP);
2073 packet_list_menu_color_conv_tcp_color1_cb(GtkWidget *widget, gpointer user_data)
2075 colorize_conversation_cb( widget , user_data, CONV_TCP+1*256);
2080 packet_list_menu_color_conv_tcp_color2_cb(GtkWidget *widget, gpointer user_data)
2082 colorize_conversation_cb( widget , user_data, CONV_TCP+1*256);
2086 packet_list_menu_color_conv_tcp_color3_cb(GtkWidget *widget, gpointer user_data)
2088 colorize_conversation_cb( widget , user_data, CONV_TCP+3*256);
2092 packet_list_menu_color_conv_tcp_color4_cb(GtkWidget *widget, gpointer user_data)
2094 colorize_conversation_cb( widget , user_data, CONV_TCP+4*256);
2098 packet_list_menu_color_conv_tcp_color5_cb(GtkWidget *widget, gpointer user_data)
2100 colorize_conversation_cb( widget , user_data, CONV_TCP+5*256);
2104 packet_list_menu_color_conv_tcp_color6_cb(GtkWidget *widget, gpointer user_data)
2106 colorize_conversation_cb( widget , user_data, CONV_TCP+6*256);
2110 packet_list_menu_color_conv_tcp_color7_cb(GtkWidget *widget, gpointer user_data)
2112 colorize_conversation_cb( widget , user_data, CONV_TCP+7*256);
2116 packet_list_menu_color_conv_tcp_color8_cb(GtkWidget *widget, gpointer user_data)
2118 colorize_conversation_cb( widget , user_data, CONV_TCP+8*256);
2122 packet_list_menu_color_conv_tcp_color9_cb(GtkWidget *widget, gpointer user_data)
2124 colorize_conversation_cb( widget , user_data, CONV_TCP+9*256);
2128 packet_list_menu_color_conv_tcp_color10_cb(GtkWidget *widget, gpointer user_data)
2130 colorize_conversation_cb( widget , user_data, CONV_TCP+10*256);
2135 packet_list_menu_color_conv_tcp_new_rule_cb(GtkWidget *widget, gpointer user_data)
2137 colorize_conversation_cb( widget , user_data, CONV_TCP);
2143 packet_list_menu_color_conv_udp_color1_cb(GtkWidget *widget, gpointer user_data)
2145 colorize_conversation_cb( widget , user_data, CONV_UDP+1*256);
2150 packet_list_menu_color_conv_udp_color2_cb(GtkWidget *widget, gpointer user_data)
2152 colorize_conversation_cb( widget , user_data, CONV_UDP+1*256);
2156 packet_list_menu_color_conv_udp_color3_cb(GtkWidget *widget, gpointer user_data)
2158 colorize_conversation_cb( widget , user_data, CONV_UDP+3*256);
2162 packet_list_menu_color_conv_udp_color4_cb(GtkWidget *widget, gpointer user_data)
2164 colorize_conversation_cb( widget , user_data, CONV_UDP+4*256);
2168 packet_list_menu_color_conv_udp_color5_cb(GtkWidget *widget, gpointer user_data)
2170 colorize_conversation_cb( widget , user_data, CONV_UDP+5*256);
2174 packet_list_menu_color_conv_udp_color6_cb(GtkWidget *widget, gpointer user_data)
2176 colorize_conversation_cb( widget , user_data, CONV_UDP+6*256);
2180 packet_list_menu_color_conv_udp_color7_cb(GtkWidget *widget, gpointer user_data)
2182 colorize_conversation_cb( widget , user_data, CONV_UDP+7*256);
2186 packet_list_menu_color_conv_udp_color8_cb(GtkWidget *widget, gpointer user_data)
2188 colorize_conversation_cb( widget , user_data, CONV_UDP+8*256);
2192 packet_list_menu_color_conv_udp_color9_cb(GtkWidget *widget, gpointer user_data)
2194 colorize_conversation_cb( widget , user_data, CONV_UDP+9*256);
2198 packet_list_menu_color_conv_udp_color10_cb(GtkWidget *widget, gpointer user_data)
2200 colorize_conversation_cb( widget , user_data, CONV_UDP+10*256);
2205 packet_list_menu_color_conv_udp_new_rule_cb(GtkWidget *widget, gpointer user_data)
2207 colorize_conversation_cb( widget , user_data, CONV_UDP);
2214 packet_list_menu_color_conv_cba_color1_cb(GtkWidget *widget, gpointer user_data)
2216 colorize_conversation_cb( widget , user_data, CONV_CBA+1*256);
2221 packet_list_menu_color_conv_cba_color2_cb(GtkWidget *widget, gpointer user_data)
2223 colorize_conversation_cb( widget , user_data, CONV_CBA+1*256);
2227 packet_list_menu_color_conv_cba_color3_cb(GtkWidget *widget, gpointer user_data)
2229 colorize_conversation_cb( widget , user_data, CONV_CBA+3*256);
2233 packet_list_menu_color_conv_cba_color4_cb(GtkWidget *widget, gpointer user_data)
2235 colorize_conversation_cb( widget , user_data, CONV_CBA+4*256);
2239 packet_list_menu_color_conv_cba_color5_cb(GtkWidget *widget, gpointer user_data)
2241 colorize_conversation_cb( widget , user_data, CONV_CBA+5*256);
2245 packet_list_menu_color_conv_cba_color6_cb(GtkWidget *widget, gpointer user_data)
2247 colorize_conversation_cb( widget , user_data, CONV_CBA+6*256);
2251 packet_list_menu_color_conv_cba_color7_cb(GtkWidget *widget, gpointer user_data)
2253 colorize_conversation_cb( widget , user_data, CONV_CBA+7*256);
2257 packet_list_menu_color_conv_cba_color8_cb(GtkWidget *widget, gpointer user_data)
2259 colorize_conversation_cb( widget , user_data, CONV_CBA+8*256);
2263 packet_list_menu_color_conv_cba_color9_cb(GtkWidget *widget, gpointer user_data)
2265 colorize_conversation_cb( widget , user_data, CONV_CBA+9*256);
2269 packet_list_menu_color_conv_cba_color10_cb(GtkWidget *widget, gpointer user_data)
2271 colorize_conversation_cb( widget , user_data, CONV_CBA+10*256);
2276 packet_list_menu_color_conv_cba_new_rule_cb(GtkWidget *widget, gpointer user_data)
2278 colorize_conversation_cb( widget , user_data, CONV_CBA);
2283 packet_list_menu_copy_sum_txt(GtkWidget *widget, gpointer user_data)
2285 copy_hex_cb( widget , user_data, CS_TEXT);
2290 packet_list_menu_copy_sum_csv(GtkWidget *widget, gpointer user_data)
2292 copy_hex_cb( widget , user_data, CS_CSV);
2297 packet_list_menu_copy_as_flt(GtkWidget *widget, gpointer user_data)
2299 copy_hex_cb( widget , user_data, MATCH_SELECTED_REPLACE|MATCH_SELECTED_COPY_ONLY);
2304 packet_list_menu_copy_bytes_oht_cb(GtkWidget *widget, gpointer user_data)
2306 copy_hex_cb( widget , user_data, CD_ALLINFO | CD_FLAGS_SELECTEDONLY);
2311 packet_list_menu_copy_bytes_oh_cb(GtkWidget *widget, gpointer user_data)
2313 copy_hex_cb( widget , user_data, CD_HEXCOLUMNS | CD_FLAGS_SELECTEDONLY);
2318 packet_list_menu_copy_bytes_text_cb(GtkWidget *widget, gpointer user_data)
2320 copy_hex_cb( widget , user_data, CD_TEXTONLY | CD_FLAGS_SELECTEDONLY);
2325 packet_list_menu_copy_bytes_hex_strm_cb(GtkWidget *widget, gpointer user_data)
2327 copy_hex_cb( widget , user_data, CD_HEX | CD_FLAGS_SELECTEDONLY);
2332 packet_list_menu_copy_bytes_bin_strm_cb(GtkWidget *widget, gpointer user_data)
2334 copy_hex_cb( widget , user_data, CD_BINARY | CD_FLAGS_SELECTEDONLY);
2342 tree_view_menu_apply_selected_cb(GtkWidget *widget, gpointer user_data)
2344 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_REPLACE|MATCH_SELECTED_APPLY_NOW);
2348 tree_view_menu_apply_not_selected_cb(GtkWidget *widget, gpointer user_data)
2350 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_NOT|MATCH_SELECTED_APPLY_NOW);
2354 tree_view_menu_apply_and_selected_cb(GtkWidget *widget, gpointer user_data)
2356 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_AND|MATCH_SELECTED_APPLY_NOW);
2360 tree_view_menu_apply_or_selected_cb(GtkWidget *widget, gpointer user_data)
2362 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_OR|MATCH_SELECTED_APPLY_NOW);
2366 tree_view_menu_apply_and_not_selected_cb(GtkWidget *widget, gpointer user_data)
2368 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_AND_NOT|MATCH_SELECTED_APPLY_NOW);
2372 tree_view_menu_apply_or_not_selected_cb(GtkWidget *widget, gpointer user_data)
2374 match_selected_ptree_cb( widget , user_data,MATCH_SELECTED_OR_NOT|MATCH_SELECTED_APPLY_NOW);
2376 /* Prepare a filter */
2378 tree_view_menu_prepare_selected_cb(GtkWidget *widget, gpointer user_data)
2380 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_REPLACE);
2384 tree_view_menu_prepare_not_selected_cb(GtkWidget *widget, gpointer user_data)
2386 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_NOT);
2390 tree_view_menu_prepare_and_selected_cb(GtkWidget *widget, gpointer user_data)
2392 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_AND);
2396 tree_view_menu_prepare_or_selected_cb(GtkWidget *widget, gpointer user_data)
2398 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_OR);
2402 tree_view_menu_prepare_and_not_selected_cb(GtkWidget *widget, gpointer user_data)
2404 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_AND_NOT);
2408 tree_view_menu_prepare_or_not_selected_cb(GtkWidget *widget, gpointer user_data)
2410 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_OR_NOT);
2415 tree_view_menu_color_with_flt_color1_cb(GtkWidget *widget, gpointer user_data)
2417 colorize_selected_ptree_cb( widget , user_data, 1);
2422 tree_view_menu_color_with_flt_color2_cb(GtkWidget *widget, gpointer user_data)
2424 colorize_selected_ptree_cb( widget , user_data, 2);
2428 tree_view_menu_color_with_flt_color3_cb(GtkWidget *widget, gpointer user_data)
2430 colorize_selected_ptree_cb( widget , user_data, 3);
2434 tree_view_menu_color_with_flt_color4_cb(GtkWidget *widget, gpointer user_data)
2436 colorize_selected_ptree_cb( widget , user_data, 4);
2440 tree_view_menu_color_with_flt_color5_cb(GtkWidget *widget, gpointer user_data)
2442 colorize_selected_ptree_cb( widget , user_data, 5);
2446 tree_view_menu_color_with_flt_color6_cb(GtkWidget *widget, gpointer user_data)
2448 colorize_selected_ptree_cb( widget , user_data, 6);
2452 tree_view_menu_color_with_flt_color7_cb(GtkWidget *widget, gpointer user_data)
2454 colorize_selected_ptree_cb( widget , user_data, 7);
2458 tree_view_menu_color_with_flt_color8_cb(GtkWidget *widget, gpointer user_data)
2460 colorize_selected_ptree_cb( widget , user_data, 8);
2464 tree_view_menu_color_with_flt_color9_cb(GtkWidget *widget, gpointer user_data)
2466 colorize_selected_ptree_cb( widget , user_data, 9);
2470 tree_view_menu_color_with_flt_color10_cb(GtkWidget *widget, gpointer user_data)
2472 colorize_selected_ptree_cb( widget , user_data, 10);
2477 tree_view_menu_color_with_flt_new_rule_cb(GtkWidget *widget, gpointer user_data)
2479 colorize_selected_ptree_cb( widget , user_data, 0);
2484 tree_view_menu_copy_desc(GtkWidget *widget, gpointer user_data)
2486 copy_selected_plist_cb( widget , user_data, COPY_SELECTED_DESCRIPTION);
2491 tree_view_menu_copy_field(GtkWidget *widget, gpointer user_data)
2493 copy_selected_plist_cb( widget , user_data, COPY_SELECTED_FIELDNAME);
2498 tree_view_menu_copy_value(GtkWidget *widget, gpointer user_data)
2500 copy_selected_plist_cb( widget , user_data, COPY_SELECTED_VALUE);
2505 tree_view_menu_copy_as_flt(GtkWidget *widget, gpointer user_data)
2507 match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_REPLACE|MATCH_SELECTED_COPY_ONLY);
2511 static const char *ui_desc_packet_list_heading_menu_popup =
2513 " <popup name='PacketListHeadingPopup' action='PopupAction'>\n"
2514 " <menuitem name='SortAscending' action='/Sort Ascending'/>\n"
2515 " <menuitem name='SortDescending' action='/Sort Descending'/>\n"
2516 " <menuitem name='NoSorting' action='/No Sorting'/>\n"
2518 " <menuitem name='ShowResolved' action='/Show Resolved'/>\n"
2520 " <menuitem name='AlignLeft' action='/Align Left'/>\n"
2521 " <menuitem name='AlignCenter' action='/Align Center'/>\n"
2522 " <menuitem name='AlignRight' action='/Align Right'/>\n"
2524 " <menuitem name='ColumnPreferences' action='/Column Preferences'/>\n"
2525 " <menuitem name='ResizeColumn' action='/Resize Column'/>\n"
2526 " <menuitem name='RenameColumnTitle' action='/Rename Column Title'/>\n"
2528 " <menu name='DisplayedColumns' action='/Displayed Columns'>\n"
2529 " <menuitem name='Display All' action='/Displayed Columns/Display All'/>\n"
2531 " <menuitem name='HideColumn' action='/Hide Column'/>\n"
2532 " <menuitem name='RemoveColumn' action='/Remove Column'/>\n"
2536 static const GtkActionEntry packet_list_heading_menu_popup_action_entries[] = {
2537 { "/Sort Ascending", GTK_STOCK_SORT_ASCENDING, "Sort Ascending", NULL, NULL, G_CALLBACK(sort_ascending_cb) },
2538 { "/Sort Descending", GTK_STOCK_SORT_DESCENDING, "Sort Descending", NULL, NULL, G_CALLBACK(sort_descending_cb) },
2539 { "/No Sorting", NULL, "No Sorting", NULL, NULL, G_CALLBACK(no_sorting_cb) },
2540 { "/Align Left", GTK_STOCK_JUSTIFY_LEFT, "Align Left", NULL, NULL, G_CALLBACK(packet_list_heading_align_left_cb) },
2541 { "/Align Center", GTK_STOCK_JUSTIFY_CENTER, "Align Center", NULL, NULL, G_CALLBACK(packet_list_heading_align_center_cb) },
2542 { "/Align Right", GTK_STOCK_JUSTIFY_RIGHT, "Align Right", NULL, NULL, G_CALLBACK(packet_list_heading_align_right_cb) },
2543 { "/Column Preferences", GTK_STOCK_PREFERENCES, "Column Preferences...", NULL, NULL, G_CALLBACK(packet_list_heading_col_pref_cb) },
2544 { "/Resize Column", WIRESHARK_STOCK_RESIZE_COLUMNS, "Resize Column", NULL, NULL, G_CALLBACK(packet_list_heading_resize_col_cb) },
2545 { "/Rename Column Title", GTK_STOCK_BOLD, "Rename Column Title...", NULL, NULL, G_CALLBACK(packet_list_heading_rename_col_cb) },
2546 { "/Displayed Columns", NULL, "Displayed Columns", NULL, NULL, NULL },
2547 { "/Displayed Columns/Display All", NULL, "Display All", NULL, NULL, G_CALLBACK(packet_list_heading_activate_all_columns) },
2548 { "/Hide Column", NULL, "Hide Column", NULL, NULL, G_CALLBACK(packet_list_heading_hide_col_cb) },
2549 { "/Remove Column", GTK_STOCK_DELETE, "Remove Column", NULL, NULL, G_CALLBACK(packet_list_heading_remove_col_cb) },
2552 static const GtkToggleActionEntry packet_list_heading_menu_toggle_action_entries[] =
2554 /* name, stock id, label, accel, tooltip, callback, is_active */
2555 {"/Show Resolved", NULL, "Show Resolved", NULL, NULL, G_CALLBACK(packet_list_heading_show_resolved_cb), FALSE},
2558 static const char *ui_desc_packet_list_menu_popup =
2560 " <popup name='PacketListMenuPopup' action='PopupAction'>\n"
2561 " <menuitem name='MarkPacket' action='/MarkPacket'/>\n"
2562 " <menuitem name='IgnorePacket' action='/IgnorePacket'/>\n"
2563 " <menuitem name='SetTimeReference' action='/Set Time Reference'/>\n"
2564 " <menuitem name='ManuallyResolveAddress' action='/ManuallyResolveAddress'/>\n"
2566 " <menu name= 'ApplyAsFilter' action='/Apply as Filter'>\n"
2567 " <menuitem name='Selected' action='/Apply as Filter/Selected'/>\n"
2568 " <menuitem name='NotSelected' action='/Apply as Filter/Not Selected'/>\n"
2569 " <menuitem name='AndSelected' action='/Apply as Filter/AndSelected'/>\n"
2570 " <menuitem name='OrSelected' action='/Apply as Filter/OrSelected'/>\n"
2571 " <menuitem name='AndNotSelected' action='/Apply as Filter/AndNotSelected'/>\n"
2572 " <menuitem name='OrNotSelected' action='/Apply as Filter/OrNotSelected'/>\n"
2574 " <menu name= 'PrepareaFilter' action='/Prepare a Filter'>\n"
2575 " <menuitem name='Selected' action='/Prepare a Filter/Selected'/>\n"
2576 " <menuitem name='NotSelected' action='/Prepare a Filter/Not Selected'/>\n"
2577 " <menuitem name='AndSelected' action='/Prepare a Filter/AndSelected'/>\n"
2578 " <menuitem name='OrSelected' action='/Prepare a Filter/OrSelected'/>\n"
2579 " <menuitem name='AndNotSelected' action='/Prepare a Filter/AndNotSelected'/>\n"
2580 " <menuitem name='OrNotSelected' action='/Prepare a Filter/OrNotSelected'/>\n"
2582 " <menu name= 'ConversationFilter' action='/Conversation Filter'>\n"
2583 " <menuitem name='Ethernet' action='/Conversation Filter/Ethernet'/>\n"
2584 " <menuitem name='IP' action='/Conversation Filter/IP'/>\n"
2585 " <menuitem name='TCP' action='/Conversation Filter/TCP'/>\n"
2586 " <menuitem name='UDP' action='/Conversation Filter/UDP'/>\n"
2587 " <menuitem name='PN-CBA' action='/Conversation Filter/PN-CBA'/>\n"
2589 " <menu name= 'ColorizeConversation' action='/Colorize Conversation'>\n"
2590 " <menu name= 'Ethernet' action='/Colorize Conversation/Ethernet'>\n"
2591 " <menuitem name='Color1' action='/Colorize Conversation/Ethernet/Color 1'/>\n"
2592 " <menuitem name='Color2' action='/Colorize Conversation/Ethernet/Color 2'/>\n"
2593 " <menuitem name='Color3' action='/Colorize Conversation/Ethernet/Color 3'/>\n"
2594 " <menuitem name='Color4' action='/Colorize Conversation/Ethernet/Color 4'/>\n"
2595 " <menuitem name='Color5' action='/Colorize Conversation/Ethernet/Color 5'/>\n"
2596 " <menuitem name='Color6' action='/Colorize Conversation/Ethernet/Color 6'/>\n"
2597 " <menuitem name='Color7' action='/Colorize Conversation/Ethernet/Color 7'/>\n"
2598 " <menuitem name='Color8' action='/Colorize Conversation/Ethernet/Color 8'/>\n"
2599 " <menuitem name='Color9' action='/Colorize Conversation/Ethernet/Color 9'/>\n"
2600 " <menuitem name='Color10' action='/Colorize Conversation/Ethernet/Color 10'/>\n"
2601 " <menuitem name='NewColoringRule' action='/Colorize Conversation/Ethernet/New Coloring Rule'/>\n"
2603 " <menu name= 'IP' action='/Colorize Conversation/IP'>\n"
2604 " <menuitem name='Color1' action='/Colorize Conversation/IP/Color 1'/>\n"
2605 " <menuitem name='Color2' action='/Colorize Conversation/IP/Color 2'/>\n"
2606 " <menuitem name='Color3' action='/Colorize Conversation/IP/Color 3'/>\n"
2607 " <menuitem name='Color4' action='/Colorize Conversation/IP/Color 4'/>\n"
2608 " <menuitem name='Color5' action='/Colorize Conversation/IP/Color 5'/>\n"
2609 " <menuitem name='Color6' action='/Colorize Conversation/IP/Color 6'/>\n"
2610 " <menuitem name='Color7' action='/Colorize Conversation/IP/Color 7'/>\n"
2611 " <menuitem name='Color8' action='/Colorize Conversation/IP/Color 8'/>\n"
2612 " <menuitem name='Color9' action='/Colorize Conversation/IP/Color 9'/>\n"
2613 " <menuitem name='Color10' action='/Colorize Conversation/IP/Color 10'/>\n"
2614 " <menuitem name='NewColoringRule' action='/Colorize Conversation/IP/New Coloring Rule'/>\n"
2616 " <menu name= 'TCP' action='/Colorize Conversation/TCP'>\n"
2617 " <menuitem name='Color1' action='/Colorize Conversation/TCP/Color 1'/>\n"
2618 " <menuitem name='Color2' action='/Colorize Conversation/TCP/Color 2'/>\n"
2619 " <menuitem name='Color3' action='/Colorize Conversation/TCP/Color 3'/>\n"
2620 " <menuitem name='Color4' action='/Colorize Conversation/TCP/Color 4'/>\n"
2621 " <menuitem name='Color5' action='/Colorize Conversation/TCP/Color 5'/>\n"
2622 " <menuitem name='Color6' action='/Colorize Conversation/TCP/Color 6'/>\n"
2623 " <menuitem name='Color7' action='/Colorize Conversation/TCP/Color 7'/>\n"
2624 " <menuitem name='Color8' action='/Colorize Conversation/TCP/Color 8'/>\n"
2625 " <menuitem name='Color9' action='/Colorize Conversation/TCP/Color 9'/>\n"
2626 " <menuitem name='Color10' action='/Colorize Conversation/TCP/Color 10'/>\n"
2627 " <menuitem name='NewColoringRule' action='/Colorize Conversation/TCP/New Coloring Rule'/>\n"
2629 " <menu name= 'UDP' action='/Colorize Conversation/UDP'>\n"
2630 " <menuitem name='Color1' action='/Colorize Conversation/UDP/Color 1'/>\n"
2631 " <menuitem name='Color2' action='/Colorize Conversation/UDP/Color 2'/>\n"
2632 " <menuitem name='Color3' action='/Colorize Conversation/UDP/Color 3'/>\n"
2633 " <menuitem name='Color4' action='/Colorize Conversation/UDP/Color 4'/>\n"
2634 " <menuitem name='Color5' action='/Colorize Conversation/UDP/Color 5'/>\n"
2635 " <menuitem name='Color6' action='/Colorize Conversation/UDP/Color 6'/>\n"
2636 " <menuitem name='Color7' action='/Colorize Conversation/UDP/Color 7'/>\n"
2637 " <menuitem name='Color8' action='/Colorize Conversation/UDP/Color 8'/>\n"
2638 " <menuitem name='Color9' action='/Colorize Conversation/UDP/Color 9'/>\n"
2639 " <menuitem name='Color10' action='/Colorize Conversation/UDP/Color 10'/>\n"
2640 " <menuitem name='NewColoringRule' action='/Colorize Conversation/UDP/New Coloring Rule'/>\n"
2642 " <menu name= 'PN-CBA' action='/Colorize Conversation/PN-CBA'>\n"
2643 " <menuitem name='Color1' action='/Colorize Conversation/PN-CBA/Color 1'/>\n"
2644 " <menuitem name='Color2' action='/Colorize Conversation/PN-CBA/Color 2'/>\n"
2645 " <menuitem name='Color3' action='/Colorize Conversation/PN-CBA/Color 3'/>\n"
2646 " <menuitem name='Color4' action='/Colorize Conversation/PN-CBA/Color 4'/>\n"
2647 " <menuitem name='Color5' action='/Colorize Conversation/PN-CBA/Color 5'/>\n"
2648 " <menuitem name='Color6' action='/Colorize Conversation/PN-CBA/Color 6'/>\n"
2649 " <menuitem name='Color7' action='/Colorize Conversation/PN-CBA/Color 7'/>\n"
2650 " <menuitem name='Color8' action='/Colorize Conversation/PN-CBA/Color 8'/>\n"
2651 " <menuitem name='Color9' action='/Colorize Conversation/PN-CBA/Color 9'/>\n"
2652 " <menuitem name='Color10' action='/Colorize Conversation/PN-CBA/Color 10'/>\n"
2653 " <menuitem name='NewColoringRule' action='/Colorize Conversation/PN-CBA/New Coloring Rule'/>\n"
2656 " <menu name= 'SCTP' action='/SCTP'>\n"
2657 " <menuitem name='AnalysethisAssociation' action='/SCTP/Analyse this Association'/>\n"
2658 " <menuitem name='PrepareFilterforthisAssociation' action='/SCTP/Prepare Filter for this Association'/>\n"
2660 " <menuitem name='FollowTCPStream' action='/Follow TCP Stream'/>\n"
2661 " <menuitem name='FollowUDPStream' action='/Follow UDP Stream'/>\n"
2662 " <menuitem name='FollowSSLStream' action='/Follow SSL Stream'/>\n"
2664 " <menu name= 'Copy' action='/Copy'>\n"
2665 " <menuitem name='SummaryTxt' action='/Copy/SummaryTxt'/>\n"
2666 " <menuitem name='SummaryCSV' action='/Copy/SummaryCSV'/>\n"
2667 " <menuitem name='AsFilter' action='/Copy/AsFilter'/>\n"
2669 " <menu name= 'Bytes' action='/Copy/Bytes'>\n"
2670 " <menuitem name='OffsetHexText' action='/Copy/Bytes/OffsetHexText'/>\n"
2671 " <menuitem name='OffsetHex' action='/Copy/Bytes/OffsetHex'/>\n"
2672 " <menuitem name='PrintableTextOnly' action='/Copy/Bytes/PrintableTextOnly'/>\n"
2674 " <menuitem name='HexStream' action='/Copy/Bytes/HexStream'/>\n"
2675 " <menuitem name='BinaryStream' action='/Copy/Bytes/BinaryStream'/>\n"
2679 " <menuitem name='DecodeAs' action='/DecodeAs'/>\n"
2680 " <menuitem name='Print' action='/Print'/>\n"
2681 " <menuitem name='ShowPacketinNewWindow' action='/ShowPacketinNewWindow'/>\n"
2685 static const GtkActionEntry packet_list_menu_popup_action_entries[] = {
2686 { "/MarkPacket", NULL, "Mark Packet (toggle)", NULL, NULL, G_CALLBACK(new_packet_list_mark_frame_cb) },
2687 { "/IgnorePacket", NULL, "Ignore Packet (toggle)", NULL, NULL, G_CALLBACK(new_packet_list_ignore_frame_cb) },
2688 { "/Set Time Reference", WIRESHARK_STOCK_TIME, "Set Time Reference (toggle)", NULL, NULL, G_CALLBACK(packet_list_menu_set_ref_time_cb) },
2689 { "/ManuallyResolveAddress", NULL, "Manually Resolve Address", NULL, NULL, G_CALLBACK(manual_addr_resolv_dlg) },
2690 { "/Apply as Filter", NULL, "Apply as Filter", NULL, NULL, NULL },
2692 { "/Apply as Filter/Selected", NULL, "_Selected" , NULL, NULL, G_CALLBACK(packet_list_menu_apply_selected_cb) },
2693 { "/Apply as Filter/Not Selected", NULL, "_Not Selected", NULL, NULL, G_CALLBACK(packet_list_menu_apply_not_selected_cb) },
2694 { "/Apply as Filter/AndSelected", NULL, "... _and Selected", NULL, NULL, G_CALLBACK(packet_list_menu_apply_and_selected_cb) },
2695 { "/Apply as Filter/OrSelected", NULL, "... _or Selected", NULL, NULL, G_CALLBACK(packet_list_menu_apply_or_selected_cb) },
2696 { "/Apply as Filter/AndNotSelected", NULL, "... a_nd not Selected", NULL, NULL, G_CALLBACK(packet_list_menu_apply_and_not_selected_cb) },
2697 { "/Apply as Filter/OrNotSelected", NULL, "... o_r not Selected", NULL, NULL, G_CALLBACK(packet_list_menu_apply_or_not_selected_cb) },
2699 { "/Prepare a Filter", NULL, "Prepare a Filter", NULL, NULL, NULL },
2700 { "/Prepare a Filter/Selected", NULL, "_Selected" , NULL, NULL, G_CALLBACK(packet_list_menu_prepare_selected_cb) },
2701 { "/Prepare a Filter/Not Selected", NULL, "_Not Selected", NULL, NULL, G_CALLBACK(packet_list_menu_prepare_not_selected_cb) },
2702 { "/Prepare a Filter/AndSelected", NULL, "... _and Selected", NULL, NULL, G_CALLBACK(packet_list_menu_prepare_and_selected_cb) },
2703 { "/Prepare a Filter/OrSelected", NULL, "... _or Selected", NULL, NULL, G_CALLBACK(packet_list_menu_prepare_or_selected_cb) },
2704 { "/Prepare a Filter/AndNotSelected", NULL, "... a_nd not Selected", NULL, NULL, G_CALLBACK(packet_list_menu_prepare_and_not_selected_cb) },
2705 { "/Prepare a Filter/OrNotSelected", NULL, "... o_r not Selected", NULL, NULL, G_CALLBACK(packet_list_menu_prepare_or_not_selected_cb) },
2707 { "/Conversation Filter", NULL, "Conversation Filter", NULL, NULL, NULL },
2708 { "/Conversation Filter/Ethernet", NULL, "Ethernet", NULL, NULL, G_CALLBACK(packet_list_menu_conversation_ethernet_cb) },
2709 { "/Conversation Filter/IP", NULL, "IP", NULL, NULL, G_CALLBACK(packet_list_menu_conversation_ip_cb) },
2710 { "/Conversation Filter/TCP", NULL, "TCP", NULL, NULL, G_CALLBACK(packet_list_menu_conversation_tcp_cb) },
2711 { "/Conversation Filter/UDP", NULL, "UDP", NULL, NULL, G_CALLBACK(packet_list_menu_conversation_udp_cb) },
2712 { "/Conversation Filter/PN-CBA", NULL, "PN-CBA", NULL, NULL, G_CALLBACK(packet_list_menu_conversation_pn_cba_cb) },
2714 { "/Colorize Conversation", NULL, "Colorize Conversation", NULL, NULL, NULL },
2716 { "/Colorize Conversation/Ethernet", NULL, "Ethernet", NULL, NULL, NULL },
2718 { "/Colorize Conversation/Ethernet/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color1_cb) },
2719 { "/Colorize Conversation/Ethernet/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color2_cb) },
2720 { "/Colorize Conversation/Ethernet/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color3_cb) },
2721 { "/Colorize Conversation/Ethernet/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color4_cb) },
2722 { "/Colorize Conversation/Ethernet/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color5_cb) },
2723 { "/Colorize Conversation/Ethernet/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color6_cb) },
2724 { "/Colorize Conversation/Ethernet/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color7_cb) },
2725 { "/Colorize Conversation/Ethernet/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color8_cb) },
2726 { "/Colorize Conversation/Ethernet/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color9_cb) },
2727 { "/Colorize Conversation/Ethernet/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color10_cb) },
2728 { "/Colorize Conversation/Ethernet/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_new_rule_cb) },
2730 { "/Colorize Conversation/IP", NULL, "IP", NULL, NULL, NULL },
2732 { "/Colorize Conversation/IP/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color1_cb) },
2733 { "/Colorize Conversation/IP/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color2_cb) },
2734 { "/Colorize Conversation/IP/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color3_cb) },
2735 { "/Colorize Conversation/IP/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color4_cb) },
2736 { "/Colorize Conversation/IP/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color5_cb) },
2737 { "/Colorize Conversation/IP/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color6_cb) },
2738 { "/Colorize Conversation/IP/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color7_cb) },
2739 { "/Colorize Conversation/IP/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color8_cb) },
2740 { "/Colorize Conversation/IP/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color9_cb) },
2741 { "/Colorize Conversation/IP/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color10_cb) },
2742 { "/Colorize Conversation/IP/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_new_rule_cb) },
2744 { "/Colorize Conversation/TCP", NULL, "TCP", NULL, NULL, NULL },
2746 { "/Colorize Conversation/TCP/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color1_cb) },
2747 { "/Colorize Conversation/TCP/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color2_cb) },
2748 { "/Colorize Conversation/TCP/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color3_cb) },
2749 { "/Colorize Conversation/TCP/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color4_cb) },
2750 { "/Colorize Conversation/TCP/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color5_cb) },
2751 { "/Colorize Conversation/TCP/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color6_cb) },
2752 { "/Colorize Conversation/TCP/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color7_cb) },
2753 { "/Colorize Conversation/TCP/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color8_cb) },
2754 { "/Colorize Conversation/TCP/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color9_cb) },
2755 { "/Colorize Conversation/TCP/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color10_cb) },
2756 { "/Colorize Conversation/TCP/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_new_rule_cb) },
2758 { "/Colorize Conversation/UDP", NULL, "UDP", NULL, NULL, NULL },
2760 { "/Colorize Conversation/UDP/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color1_cb) },
2761 { "/Colorize Conversation/UDP/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color2_cb) },
2762 { "/Colorize Conversation/UDP/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color3_cb) },
2763 { "/Colorize Conversation/UDP/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color4_cb) },
2764 { "/Colorize Conversation/UDP/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color5_cb) },
2765 { "/Colorize Conversation/UDP/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color6_cb) },
2766 { "/Colorize Conversation/UDP/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color7_cb) },
2767 { "/Colorize Conversation/UDP/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color8_cb) },
2768 { "/Colorize Conversation/UDP/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color9_cb) },
2769 { "/Colorize Conversation/UDP/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color10_cb) },
2770 { "/Colorize Conversation/UDP/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_new_rule_cb) },
2772 { "/Colorize Conversation/PN-CBA", NULL, "PN-CBA Server", NULL, NULL, NULL },
2774 { "/Colorize Conversation/PN-CBA/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color1_cb) },
2775 { "/Colorize Conversation/PN-CBA/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color2_cb) },
2776 { "/Colorize Conversation/PN-CBA/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color3_cb) },
2777 { "/Colorize Conversation/PN-CBA/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color4_cb) },
2778 { "/Colorize Conversation/PN-CBA/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color5_cb) },
2779 { "/Colorize Conversation/PN-CBA/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color6_cb) },
2780 { "/Colorize Conversation/PN-CBA/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color7_cb) },
2781 { "/Colorize Conversation/PN-CBA/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color8_cb) },
2782 { "/Colorize Conversation/PN-CBA/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color9_cb) },
2783 { "/Colorize Conversation/PN-CBA/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color10_cb) },
2784 { "/Colorize Conversation/PN-CBA/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_new_rule_cb) },
2786 { "/SCTP", NULL, "SCTP", NULL, NULL, NULL },
2787 { "/SCTP/Analyse this Association", NULL, "Analyse this Association", NULL, NULL, G_CALLBACK(sctp_analyse_start) },
2788 { "/SCTP/Prepare Filter for this Association", NULL, "Prepare Filter for this Association", NULL, NULL, G_CALLBACK(sctp_set_assoc_filter) },
2791 { "/Follow TCP Stream", NULL, "Follow TCP Stream", NULL, NULL, G_CALLBACK(follow_tcp_stream_cb) },
2792 { "/Follow UDP Stream", NULL, "Follow UDP Stream", NULL, NULL, G_CALLBACK(follow_udp_stream_cb) },
2793 { "/Follow SSL Stream", NULL, "Follow SSL Stream", NULL, NULL, G_CALLBACK(follow_ssl_stream_cb) },
2795 { "/Copy", NULL, "Copy", NULL, NULL, NULL },
2796 { "/Copy/SummaryTxt", NULL, "Summary (Text)", NULL, NULL, G_CALLBACK(packet_list_menu_copy_sum_txt) },
2797 { "/Copy/SummaryCSV", NULL, "Summary (CSV)", NULL, NULL, G_CALLBACK(packet_list_menu_copy_sum_csv) },
2798 { "/Copy/AsFilter", NULL, "As Filter", NULL, NULL, G_CALLBACK(packet_list_menu_copy_as_flt) },
2801 { "/Copy/Bytes", NULL, "Bytes", NULL, NULL, NULL },
2802 { "/Copy/Bytes/OffsetHexText", NULL, "Offset Hex Text", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_oht_cb) },
2803 { "/Copy/Bytes/OffsetHex", NULL, "Offset Hex", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_oh_cb) },
2804 { "/Copy/Bytes/PrintableTextOnly", NULL, "Printable Text Only", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_text_cb) },
2806 { "/Copy/Bytes/HexStream", NULL, "Hex Stream", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_hex_strm_cb) },
2807 { "/Copy/Bytes/BinaryStream", NULL, "Binary Stream", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_bin_strm_cb) },
2809 { "/DecodeAs", WIRESHARK_STOCK_DECODE_AS, "Decode As...", NULL, NULL, G_CALLBACK(decode_as_cb) },
2810 { "/Print", GTK_STOCK_PRINT, "Print...", NULL, NULL, G_CALLBACK(file_print_selected_cmd_cb) },
2811 { "/ShowPacketinNewWindow", NULL, "Show Packet in New Window", NULL, NULL, G_CALLBACK(new_window_cb) },
2815 static const char *ui_desc_tree_view_menu_popup =
2817 " <popup name='TreeViewPopup' action='PopupAction'>\n"
2818 " <menuitem name='ExpandSubtrees' action='/ExpandSubtrees'/>\n"
2819 " <menuitem name='ExpandAll' action='/ExpandAll'/>\n"
2820 " <menuitem name='CollapseAll' action='/CollapseAll'/>\n"
2822 " <menuitem name='ApplyasColumn' action='/Apply as Column'/>\n"
2824 " <menu name= 'ApplyAsFilter' action='/Apply as Filter'>\n"
2825 " <menuitem name='Selected' action='/Apply as Filter/Selected'/>\n"
2826 " <menuitem name='NotSelected' action='/Apply as Filter/Not Selected'/>\n"
2827 " <menuitem name='AndSelected' action='/Apply as Filter/AndSelected'/>\n"
2828 " <menuitem name='OrSelected' action='/Apply as Filter/OrSelected'/>\n"
2829 " <menuitem name='AndNotSelected' action='/Apply as Filter/AndNotSelected'/>\n"
2830 " <menuitem name='OrNotSelected' action='/Apply as Filter/OrNotSelected'/>\n"
2832 " <menu name= 'PrepareaFilter' action='/Prepare a Filter'>\n"
2833 " <menuitem name='Selected' action='/Prepare a Filter/Selected'/>\n"
2834 " <menuitem name='NotSelected' action='/Prepare a Filter/Not Selected'/>\n"
2835 " <menuitem name='AndSelected' action='/Prepare a Filter/AndSelected'/>\n"
2836 " <menuitem name='OrSelected' action='/Prepare a Filter/OrSelected'/>\n"
2837 " <menuitem name='AndNotSelected' action='/Prepare a Filter/AndNotSelected'/>\n"
2838 " <menuitem name='OrNotSelected' action='/Prepare a Filter/OrNotSelected'/>\n"
2840 " <menu name= 'ColorizewithFilter' action='/Colorize with Filter'>\n"
2841 " <menuitem name='Color1' action='/Colorize with Filter/Color 1'/>\n"
2842 " <menuitem name='Color2' action='/Colorize with Filter/Color 2'/>\n"
2843 " <menuitem name='Color3' action='/Colorize with Filter/Color 3'/>\n"
2844 " <menuitem name='Color4' action='/Colorize with Filter/Color 4'/>\n"
2845 " <menuitem name='Color5' action='/Colorize with Filter/Color 5'/>\n"
2846 " <menuitem name='Color6' action='/Colorize with Filter/Color 6'/>\n"
2847 " <menuitem name='Color7' action='/Colorize with Filter/Color 7'/>\n"
2848 " <menuitem name='Color8' action='/Colorize with Filter/Color 8'/>\n"
2849 " <menuitem name='Color9' action='/Colorize with Filter/Color 9'/>\n"
2850 " <menuitem name='Color10' action='/Colorize with Filter/Color 10'/>\n"
2851 " <menuitem name='NewColoringRule' action='/Colorize with Filter/New Coloring Rule'/>\n"
2853 " <menuitem name='FollowTCPStream' action='/Follow TCP Stream'/>\n"
2854 " <menuitem name='FollowUDPStream' action='/Follow UDP Stream'/>\n"
2855 " <menuitem name='FollowSSLStream' action='/Follow SSL Stream'/>\n"
2857 " <menu name= 'Copy' action='/Copy'>\n"
2858 " <menuitem name='Description' action='/Copy/Description'/>\n"
2859 " <menuitem name='Fieldname' action='/Copy/Fieldname'/>\n"
2860 " <menuitem name='Value' action='/Copy/Value'/>\n"
2862 " <menuitem name='AsFilter' action='/Copy/AsFilter'/>\n"
2864 " <menu name= 'Bytes' action='/Copy/Bytes'>\n"
2865 " <menuitem name='OffsetHexText' action='/Copy/Bytes/OffsetHexText'/>\n"
2866 " <menuitem name='OffsetHex' action='/Copy/Bytes/OffsetHex'/>\n"
2867 " <menuitem name='PrintableTextOnly' action='/Copy/Bytes/PrintableTextOnly'/>\n"
2869 " <menuitem name='HexStream' action='/Copy/Bytes/HexStream'/>\n"
2870 " <menuitem name='BinaryStream' action='/Copy/Bytes/BinaryStream'/>\n"
2873 " <menuitem name='ExportSelectedPacketBytes' action='/ExportSelectedPacketBytes'/>\n"
2875 " <menuitem name='WikiProtocolPage' action='/WikiProtocolPage'/>\n"
2876 " <menuitem name='FilterFieldReference' action='/FilterFieldReference'/>\n"
2877 #if GLIB_CHECK_VERSION(2,14,0) /* GRegex */
2878 " <menuitem name='ProtocolHelp' action='/ProtocolHelp'/>\n"
2879 #endif /* GLIB_CHECK_VERSION(2,14,0) */
2880 " <menuitem name='ProtocolPreferences' action='/ProtocolPreferences'/>\n"
2882 " <menuitem name='DecodeAs' action='/DecodeAs'/>\n"
2883 " <menuitem name='DisableProtocol' action='/DisableProtocol'/>\n"
2884 " <menuitem name='ResolveName' action='/ResolveName'/>\n"
2885 " <menuitem name='GotoCorrespondingPacket' action='/GotoCorrespondingPacket'/>\n"
2889 static const GtkActionEntry tree_view_menu_popup_action_entries[] = {
2890 { "/ExpandSubtrees", NULL, "Expand Subtrees", NULL, NULL, G_CALLBACK(expand_tree_cb) },
2891 { "/ExpandAll", NULL, "Expand All", NULL, NULL, G_CALLBACK(expand_all_cb) },
2892 { "/CollapseAll", NULL, "Collapse All", NULL, NULL, G_CALLBACK(collapse_all_cb) },
2893 { "/Apply as Column", NULL, "Apply as Column", NULL, NULL, G_CALLBACK(apply_as_custom_column_cb) },
2894 { "/Apply as Filter", NULL, "Apply as Filter", NULL, NULL, NULL },
2896 { "/Apply as Filter/Selected", NULL, "_Selected" , NULL, NULL, G_CALLBACK(tree_view_menu_apply_selected_cb) },
2897 { "/Apply as Filter/Not Selected", NULL, "_Not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_not_selected_cb) },
2898 { "/Apply as Filter/AndSelected", NULL, "... _and Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_and_selected_cb) },
2899 { "/Apply as Filter/OrSelected", NULL, "... _or Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_or_selected_cb) },
2900 { "/Apply as Filter/AndNotSelected", NULL, "... a_nd not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_and_not_selected_cb) },
2901 { "/Apply as Filter/OrNotSelected", NULL, "... o_r not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_apply_or_not_selected_cb) },
2903 { "/Prepare a Filter", NULL, "Prepare a Filter", NULL, NULL, NULL },
2904 { "/Prepare a Filter/Selected", NULL, "_Selected" , NULL, NULL, G_CALLBACK(tree_view_menu_prepare_selected_cb) },
2905 { "/Prepare a Filter/Not Selected", NULL, "_Not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_not_selected_cb) },
2906 { "/Prepare a Filter/AndSelected", NULL, "... _and Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_and_selected_cb) },
2907 { "/Prepare a Filter/OrSelected", NULL, "... _or Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_or_selected_cb) },
2908 { "/Prepare a Filter/AndNotSelected", NULL, "... a_nd not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_and_not_selected_cb) },
2909 { "/Prepare a Filter/OrNotSelected", NULL, "... o_r not Selected", NULL, NULL, G_CALLBACK(tree_view_menu_prepare_or_not_selected_cb) },
2911 { "/Colorize with Filter", NULL, "Colorize with Filter", NULL, NULL, NULL },
2912 { "/Colorize with Filter/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color1_cb) },
2913 { "/Colorize with Filter/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color2_cb) },
2914 { "/Colorize with Filter/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color3_cb) },
2915 { "/Colorize with Filter/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color4_cb) },
2916 { "/Colorize with Filter/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color5_cb) },
2917 { "/Colorize with Filter/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color6_cb) },
2918 { "/Colorize with Filter/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color7_cb) },
2919 { "/Colorize with Filter/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color8_cb) },
2920 { "/Colorize with Filter/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color9_cb) },
2921 { "/Colorize with Filter/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color10_cb) },
2922 { "/Colorize with Filter/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_new_rule_cb) },
2924 { "/Follow TCP Stream", NULL, "Follow TCP Stream", NULL, NULL, G_CALLBACK(follow_tcp_stream_cb) },
2925 { "/Follow UDP Stream", NULL, "Follow UDP Stream", NULL, NULL, G_CALLBACK(follow_udp_stream_cb) },
2926 { "/Follow SSL Stream", NULL, "Follow SSL Stream", NULL, NULL, G_CALLBACK(follow_ssl_stream_cb) },
2928 { "/Copy", NULL, "Copy", NULL, NULL, NULL },
2929 { "/Copy/Description", NULL, "Description", NULL, NULL, G_CALLBACK(tree_view_menu_copy_desc) },
2930 { "/Copy/Fieldname", NULL, "Fieldname", NULL, NULL, G_CALLBACK(tree_view_menu_copy_field) },
2931 { "/Copy/Value", NULL, "Value", NULL, NULL, G_CALLBACK(tree_view_menu_copy_value) },
2933 { "/Copy/AsFilter", NULL, "As Filter", NULL, NULL, G_CALLBACK(tree_view_menu_copy_as_flt) },
2935 { "/Copy/Bytes", NULL, "Bytes", NULL, NULL, NULL },
2936 { "/Copy/Bytes/OffsetHexText", NULL, "Offset Hex Text", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_oht_cb) },
2937 { "/Copy/Bytes/OffsetHex", NULL, "Offset Hex", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_oh_cb) },
2938 { "/Copy/Bytes/PrintableTextOnly", NULL, "Printable Text Only", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_text_cb) },
2940 { "/Copy/Bytes/HexStream", NULL, "Hex Stream", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_hex_strm_cb) },
2941 { "/Copy/Bytes/BinaryStream", NULL, "Binary Stream", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_bin_strm_cb) },
2943 { "/ExportSelectedPacketBytes", NULL, "Export Selected Packet Bytes...", NULL, NULL, G_CALLBACK(savehex_cb) },
2945 { "/WikiProtocolPage", WIRESHARK_STOCK_WIKI, "Wiki Protocol Page", NULL, NULL, G_CALLBACK(selected_ptree_info_cb) },
2946 { "/FilterFieldReference", WIRESHARK_STOCK_INTERNET, "Filter Field Reference", NULL, NULL, G_CALLBACK(selected_ptree_ref_cb) },
2947 #if GLIB_CHECK_VERSION(2,14,0) /* GRegex */
2948 { "/ProtocolHelp", NULL, "Protocol Help", NULL, NULL, NULL },
2949 #endif /* GLIB_CHECK_VERSION(2,14,0) */
2950 { "/ProtocolPreferences", NULL, "Protocol Preferences", NULL, NULL, NULL },
2951 { "/DecodeAs", WIRESHARK_STOCK_DECODE_AS, "Decode As...", NULL, NULL, G_CALLBACK(decode_as_cb) },
2952 { "/DisableProtocol", WIRESHARK_STOCK_CHECKBOX, "Disable Protocol...", NULL, NULL, G_CALLBACK(proto_disable_cb) },
2953 { "/ResolveName", NULL, "_Resolve Name", NULL, NULL, G_CALLBACK(resolve_name_cb) },
2954 { "/GotoCorrespondingPacket", NULL, "_Go to Corresponding Packet", NULL, NULL, G_CALLBACK(goto_framenum_cb) },
2957 static const char *ui_desc_bytes_menu_popup =
2959 " <popup name='BytesMenuPopup' action='PopupAction'>\n"
2960 " <menuitem name='HexView' action='/HexView'/>\n"
2961 " <menuitem name='BitsView' action='/BitsView'/>\n"
2964 static const GtkRadioActionEntry bytes_menu_radio_action_entries [] =
2966 /* name, stock id, label, accel, tooltip, value */
2967 { "/HexView", NULL, "Hex View", NULL, NULL, BYTES_HEX },
2968 { "/BitsView", NULL, "Bits View", NULL, NULL, BYTES_BITS },
2971 static const char *ui_desc_conv_filter_popup =
2973 " <popup name='ConversationFilterPopup' action='PopupAction'>\n"
2974 " <menu name= 'ApplyAsFilter' action='/Apply as Filter'>\n"
2982 main_menu_new(GtkAccelGroup ** table) {
2984 #ifdef HAVE_IGE_MAC_INTEGRATION
2985 GtkWidget *quit_item, *about_item, *preferences_item;
2986 IgeMacMenuGroup *group;
2988 #ifdef HAVE_GTKOSXAPPLICATION
2989 GtkOSXApplication *theApp;
2991 GtkOSXApplicationMenuGroup *group;
2992 GtkWidget * dock_menu;
2995 grp = gtk_accel_group_new();
3000 menubar = main_menu_factory->widget;
3002 #ifdef HAVE_IGE_MAC_INTEGRATION
3003 if(prefs.gui_macosx_style) {
3004 ige_mac_menu_set_menu_bar(GTK_MENU_SHELL(menubar));
3005 ige_mac_menu_set_global_key_handler_enabled(TRUE);
3007 /* Create menu items to populate the application menu with. We have to
3008 * do this because we are still using the old GtkItemFactory API for
3010 group = ige_mac_menu_add_app_menu_group();
3011 about_item = gtk_menu_item_new_with_label("About");
3012 g_signal_connect(about_item, "activate", G_CALLBACK(about_wireshark_cb),
3014 ige_mac_menu_add_app_menu_item(group, GTK_MENU_ITEM(about_item), NULL);
3016 group = ige_mac_menu_add_app_menu_group();
3017 preferences_item = gtk_menu_item_new_with_label("Preferences");
3018 g_signal_connect(preferences_item, "activate", G_CALLBACK(prefs_cb),
3020 ige_mac_menu_add_app_menu_item(group, GTK_MENU_ITEM(preferences_item),
3024 /* The quit item in the application menu shows up whenever ige mac
3025 * integration is enabled, even if the OS X UI style in Wireshark isn't
3027 quit_item = gtk_menu_item_new_with_label("Quit");
3028 g_signal_connect(quit_item, "activate", G_CALLBACK(file_quit_cmd_cb), NULL);
3029 ige_mac_menu_set_quit_menu_item(GTK_MENU_ITEM(quit_item));
3032 #ifdef HAVE_GTKOSXAPPLICATION
3033 theApp = g_object_new(GTK_TYPE_OSX_APPLICATION, NULL);
3035 if(prefs.gui_macosx_style) {
3036 gtk_osxapplication_set_menu_bar(theApp, GTK_MENU_SHELL(menubar));
3037 gtk_osxapplication_set_use_quartz_accelerators(theApp, TRUE);
3039 group = gtk_osxapplication_add_app_menu_group (theApp);
3040 item = gtk_item_factory_get_item(main_menu_factory,"/Help/About Wireshark");
3041 gtk_osxapplication_add_app_menu_item(theApp, group,GTK_MENU_ITEM (item));
3043 group = gtk_osxapplication_add_app_menu_group (theApp);
3044 item = gtk_item_factory_get_item(main_menu_factory,"/Edit/Preferences...");
3045 gtk_osxapplication_add_app_menu_item(theApp, group,GTK_MENU_ITEM (item));
3047 group = gtk_osxapplication_add_app_menu_group (theApp);
3048 item = gtk_item_factory_get_item(main_menu_factory,"/Help");
3049 gtk_osxapplication_set_help_menu(theApp,GTK_MENU_ITEM(item));
3051 /* Quit item is not needed */
3052 gtk_item_factory_delete_item(main_menu_factory,"/File/Quit");
3055 /* generate dock menu */
3056 dock_menu = gtk_menu_new();
3058 item = gtk_menu_item_new_with_label("Start");
3059 g_signal_connect(item, "activate", G_CALLBACK (capture_start_cb), NULL);
3060 gtk_menu_shell_append(GTK_MENU_SHELL(dock_menu), item);
3062 item = gtk_menu_item_new_with_label("Stop");
3063 g_signal_connect(item, "activate", G_CALLBACK (capture_stop_cb), NULL);
3064 gtk_menu_shell_append(GTK_MENU_SHELL(dock_menu), item);
3066 item = gtk_menu_item_new_with_label("Restart");
3067 g_signal_connect(item, "activate", G_CALLBACK (capture_restart_cb), NULL);
3068 gtk_menu_shell_append(GTK_MENU_SHELL(dock_menu), item);
3070 gtk_osxapplication_set_dock_menu(theApp, GTK_MENU_SHELL(dock_menu));
3080 void menu_dissector_filter_cb( GtkWidget *widget _U_,
3081 gpointer callback_data,
3082 guint callback_action _U_)
3084 dissector_filter_t *filter_entry = callback_data;
3085 GtkWidget *filter_te;
3088 filter_te = g_object_get_data(G_OBJECT(popup_menu_object), E_DFILTER_TE_KEY);
3090 /* XXX - this gets the packet_info of the last dissected packet, */
3091 /* which is not necessarily the last selected packet */
3092 /* e.g. "Update list of packets in real time" won't work correct */
3093 buf = filter_entry->build_filter_string(&cfile.edt->pi);
3095 gtk_entry_set_text(GTK_ENTRY(filter_te), buf);
3097 /* Run the display filter so it goes in effect - even if it's the
3098 same as the previous display filter. */
3099 main_filter_packets(&cfile, buf, TRUE);
3101 g_free( (void *) buf);
3104 gboolean menu_dissector_filter_spe_cb(frame_data *fd _U_, epan_dissect_t *edt, gpointer callback_data) {
3105 dissector_filter_t *filter_entry = callback_data;
3107 /* XXX - this gets the packet_info of the last dissected packet, */
3108 /* which is not necessarily the last selected packet */
3109 /* e.g. "Update list of packets in real time" won't work correct */
3110 return (edt != NULL) ? filter_entry->is_filter_valid(&edt->pi) : FALSE;
3113 void menu_dissector_filter(void) {
3114 GList *list_entry = dissector_filter_list;
3115 dissector_filter_t *filter_entry;
3117 while(list_entry != NULL) {
3118 filter_entry = list_entry->data;
3120 register_stat_menu_item(filter_entry->name, REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER,
3121 menu_dissector_filter_cb,
3122 menu_dissector_filter_spe_cb,
3123 NULL /* selected_tree_row_enabled */,
3126 list_entry = g_list_next(list_entry);
3133 #ifdef MENUS_USE_UIMANAGER
3134 GtkActionGroup *packet_list_heading_action_group, *packet_list_action_group,
3135 *packet_list_details_action_group, *packet_list_byte_menu_action_group;
3136 GError *error = NULL;
3142 popup_menu_object = gtk_menu_new();
3144 /* packet list heading pop-up menu */
3145 #ifdef MENUS_USE_UIMANAGER
3146 packet_list_heading_action_group = gtk_action_group_new ("PacketListHeadingPopUpMenuActionGroup");
3148 gtk_action_group_add_actions (packet_list_heading_action_group, /* the action group */
3149 packet_list_heading_menu_popup_action_entries, /* an array of action descriptions */
3150 G_N_ELEMENTS(packet_list_heading_menu_popup_action_entries), /* the number of entries */
3151 popup_menu_object); /* data to pass to the action callbacks */
3153 gtk_action_group_add_toggle_actions(packet_list_heading_action_group, /* the action group */
3154 packet_list_heading_menu_toggle_action_entries, /* an array of action descriptions */
3155 G_N_ELEMENTS(packet_list_heading_menu_toggle_action_entries), /* the number of entries */
3156 NULL); /* data to pass to the action callbacks */
3158 ui_manager_packet_list_heading = gtk_ui_manager_new ();
3159 gtk_ui_manager_insert_action_group (ui_manager_packet_list_heading,
3160 packet_list_heading_action_group,
3161 0); /* the position at which the group will be inserted. */
3163 gtk_ui_manager_add_ui_from_string (ui_manager_packet_list_heading,ui_desc_packet_list_heading_menu_popup, -1, &error);
3166 fprintf (stderr, "Warning: building Packet List Heading Pop-Up failed: %s\n",
3168 g_error_free (error);
3172 g_object_set_data(G_OBJECT(popup_menu_object), PM_PACKET_LIST_COL_KEY,
3173 gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup"));
3175 popup_menu_list = g_slist_append((GSList *)popup_menu_list, ui_manager_packet_list_heading);
3178 packet_list_heading_factory = gtk_item_factory_new(GTK_TYPE_MENU, "<main>", NULL);
3179 gtk_item_factory_create_items_ac(packet_list_heading_factory, sizeof(packet_list_heading_items)/sizeof(packet_list_heading_items[0]), packet_list_heading_items, popup_menu_object, 2);
3180 g_object_set_data(G_OBJECT(popup_menu_object), PM_PACKET_LIST_COL_KEY,
3181 packet_list_heading_factory->widget);
3182 popup_menu_list = g_slist_append((GSList *)popup_menu_list, packet_list_heading_factory);
3184 #endif /* MENUS_USE_UIMANAGER */
3186 /* packet list pop-up menu */
3187 #ifdef MENUS_USE_UIMANAGER
3188 packet_list_action_group = gtk_action_group_new ("PacketListPopUpMenuActionGroup");
3190 gtk_action_group_add_actions (packet_list_action_group, /* the action group */
3191 packet_list_menu_popup_action_entries, /* an array of action descriptions */
3192 G_N_ELEMENTS(packet_list_menu_popup_action_entries), /* the number of entries */
3193 popup_menu_object); /* data to pass to the action callbacks */
3195 ui_manager_packet_list_menu = gtk_ui_manager_new ();
3197 gtk_ui_manager_insert_action_group (ui_manager_packet_list_menu,
3198 packet_list_action_group,
3199 0); /* the position at which the group will be inserted. */
3201 gtk_ui_manager_add_ui_from_string (ui_manager_packet_list_menu, ui_desc_packet_list_menu_popup, -1, &error);
3204 fprintf (stderr, "Warning: building Packet List Pop-Up menu failed: %s\n",
3206 g_error_free (error);
3210 g_object_set_data(G_OBJECT(popup_menu_object), PM_PACKET_LIST_KEY,
3211 gtk_ui_manager_get_widget(ui_manager_packet_list_menu, "/PacketListMenuPopup"));
3213 popup_menu_list = g_slist_append((GSList *)popup_menu_list, ui_manager_packet_list_menu);
3216 packet_list_menu_factory = gtk_item_factory_new(GTK_TYPE_MENU, "<main>", NULL);
3217 gtk_item_factory_create_items_ac(packet_list_menu_factory, sizeof(packet_list_menu_items)/sizeof(packet_list_menu_items[0]), packet_list_menu_items, popup_menu_object, 2);
3218 g_object_set_data(G_OBJECT(popup_menu_object), PM_PACKET_LIST_KEY,
3219 packet_list_menu_factory->widget);
3220 popup_menu_list = g_slist_append((GSList *)popup_menu_list, packet_list_menu_factory);
3221 #endif /* MENUS_USE_UIMANAGER */
3223 /* packet detail pop-up menu */
3224 #ifdef MENUS_USE_UIMANAGER
3225 packet_list_details_action_group = gtk_action_group_new ("PacketListDetailsMenuPopUpActionGroup");
3227 gtk_action_group_add_actions (packet_list_details_action_group, /* the action group */
3228 tree_view_menu_popup_action_entries, /* an array of action descriptions */
3229 G_N_ELEMENTS(tree_view_menu_popup_action_entries), /* the number of entries */
3230 popup_menu_object); /* data to pass to the action callbacks */
3232 ui_manager_tree_view_menu = gtk_ui_manager_new ();
3234 gtk_ui_manager_insert_action_group (ui_manager_tree_view_menu,
3235 packet_list_details_action_group,
3236 0); /* the position at which the group will be inserted. */
3238 gtk_ui_manager_add_ui_from_string (ui_manager_tree_view_menu, ui_desc_tree_view_menu_popup, -1, &error);
3241 fprintf (stderr, "Warning: building TreeWiew Pop-Up menu failed: %s\n",
3243 g_error_free (error);
3247 g_object_set_data(G_OBJECT(popup_menu_object), PM_TREE_VIEW_KEY,
3248 gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup"));
3250 popup_menu_list = g_slist_append((GSList *)popup_menu_list, ui_manager_tree_view_menu);
3253 tree_view_menu_factory = gtk_item_factory_new(GTK_TYPE_MENU, "<main>", NULL);
3254 gtk_item_factory_create_items_ac(tree_view_menu_factory, sizeof(tree_view_menu_items)/sizeof(tree_view_menu_items[0]), tree_view_menu_items, popup_menu_object, 2);
3255 g_object_set_data(G_OBJECT(popup_menu_object), PM_TREE_VIEW_KEY,
3256 tree_view_menu_factory->widget);
3257 popup_menu_list = g_slist_append((GSList *)popup_menu_list, tree_view_menu_factory);
3258 #endif /* MENUS_USE_UIMANAGER */
3261 * Hex dump pop-up menu.
3262 * We provide our own empty menu to suppress the default pop-up menu
3265 #ifdef MENUS_USE_UIMANAGER
3266 packet_list_byte_menu_action_group = gtk_action_group_new ("PacketListDetailsMenuPopUpActionGroup");
3269 gtk_action_group_add_radio_actions (packet_list_byte_menu_action_group, /* the action group */
3270 bytes_menu_radio_action_entries, /* an array of radio action descriptions */
3271 G_N_ELEMENTS(bytes_menu_radio_action_entries), /* the number of entries */
3272 recent.gui_bytes_view, /* the value of the action to activate initially, or -1 if no action should be activated */
3273 G_CALLBACK(select_bytes_view_cb), /* the callback to connect to the changed signal */
3274 popup_menu_object); /* data to pass to the action callbacks */
3276 ui_manager_bytes_menu = gtk_ui_manager_new ();
3278 gtk_ui_manager_insert_action_group (ui_manager_bytes_menu,
3279 packet_list_byte_menu_action_group,
3280 0); /* the position at which the group will be inserted. */
3282 gtk_ui_manager_add_ui_from_string (ui_manager_bytes_menu, ui_desc_bytes_menu_popup, -1, &error);
3285 fprintf (stderr, "Warning: building Bytes Pop-Up menu failed: %s\n",
3287 g_error_free (error);
3291 g_object_set_data(G_OBJECT(popup_menu_object), PM_BYTES_VIEW_KEY,
3292 gtk_ui_manager_get_widget(ui_manager_bytes_menu, "/BytesMenuPopup"));
3294 popup_menu_list = g_slist_append((GSList *)popup_menu_list, ui_manager_bytes_menu);
3297 bytes_menu_factory = gtk_item_factory_new(GTK_TYPE_MENU, "<main>", NULL);
3298 gtk_item_factory_create_items_ac(bytes_menu_factory, sizeof(bytes_menu_items)/sizeof(bytes_menu_items[0]), bytes_menu_items, popup_menu_object, 2);
3299 g_object_set_data(G_OBJECT(popup_menu_object), PM_BYTES_VIEW_KEY,
3300 bytes_menu_factory->widget);
3301 popup_menu_list = g_slist_append((GSList *)popup_menu_list, bytes_menu_factory);
3302 #endif /* MENUS_USE_UIMANAGER */
3305 main_menu_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", grp);
3306 gtk_item_factory_create_items_ac(main_menu_factory, nmenu_items, menu_items, NULL, 2);
3308 menu_dissector_filter();
3309 merge_all_tap_menus(tap_menu_tree_root);
3311 /* Initialize enabled/disabled state of menu items */
3312 set_menus_for_capture_file(NULL);
3314 /* Un-#if this when we actually implement Cut/Copy/Paste.
3315 Then make sure you enable them when they can be done. */
3316 set_menu_sensitivity_old(main_menu_factory, "/Edit/Cut", FALSE);
3317 set_menu_sensitivity_old(main_menu_factory, "/Edit/Copy", FALSE);
3318 set_menu_sensitivity_old(main_menu_factory, "/Edit/Paste", FALSE);
3321 set_menus_for_captured_packets(FALSE);
3322 set_menus_for_selected_packet(&cfile);
3323 set_menus_for_selected_tree_row(&cfile);
3324 set_menus_for_capture_in_progress(FALSE);
3325 set_menus_for_file_set(/* dialog */TRUE, /* previous file */ FALSE, /* next_file */ FALSE);
3327 /* Init with an empty recent files list */
3328 clear_menu_recent_capture_file_cmd_cb(NULL, NULL);
3330 /* Protocol help links */
3331 #ifdef MENUS_USE_UIMANAGER
3332 proto_help_menu_init(gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup"));
3335 proto_help_menu_init(tree_view_menu_factory->widget);
3341 static gint tap_menu_item_add_compare(gconstpointer a, gconstpointer b)
3344 ((const menu_item_t *) a)->name,
3345 ((const menu_item_t *) b)->name);
3349 /* add a menuitem below the current node */
3350 static GList * tap_menu_item_add(
3353 const char *stock_id,
3354 GtkItemFactoryCallback callback,
3355 gboolean (*selected_packet_enabled)(frame_data *, epan_dissect_t *, gpointer callback_data),
3356 gboolean (*selected_tree_row_enabled)(field_info *, gpointer callback_data),
3357 gpointer callback_data,
3364 child = g_malloc(sizeof (menu_item_t));
3366 child->group = group;
3367 child->stock_id = stock_id;
3368 child->callback = callback;
3369 child->selected_packet_enabled = selected_packet_enabled;
3370 child->selected_tree_row_enabled = selected_tree_row_enabled;
3371 child->callback_data = callback_data;
3372 child->enabled = FALSE;
3373 child->children = NULL;
3375 /* insert the new child node into the parent */
3376 curr = curnode->data;
3377 curr->children = g_list_insert_sorted(curr->children, child, tap_menu_item_add_compare);
3379 /* return the new node */
3380 /* XXX: improve this */
3381 return g_list_find(curr->children, child);
3385 * Add a new menu item for a tap.
3386 * This must be called after we've created the main menu, so it can't
3387 * be called from the routine that registers taps - we have to introduce
3388 * another per-tap registration routine.
3390 * "callback" gets called when the menu item is selected; it should do
3391 * the work of creating the tap window.
3393 * "selected_packet_enabled" gets called by "set_menus_for_selected_packet()";
3394 * it's passed a Boolean that's TRUE if a packet is selected and FALSE
3395 * otherwise, and should return TRUE if the tap will work now (which
3396 * might depend on whether a packet is selected and, if one is, on the
3397 * packet) and FALSE if not.
3399 * "selected_tree_row_enabled" gets called by
3400 * "set_menus_for_selected_tree_row()"; it's passed a Boolean that's TRUE if
3401 * a protocol tree row is selected and FALSE otherwise, and should return
3402 * TRUE if the tap will work now (which might depend on whether a tree row
3403 * is selected and, if one is, on the tree row) and FALSE if not.
3406 register_stat_menu_item_stock(
3408 register_stat_group_t group,
3409 const char *stock_id,
3410 GtkItemFactoryCallback callback,
3411 gboolean (*selected_packet_enabled)(frame_data *, epan_dissect_t *, gpointer callback_data),
3412 gboolean (*selected_tree_row_enabled)(field_info *, gpointer callback_data),
3413 gpointer callback_data)
3415 /*static const char toolspath[] = "/Statistics/";*/
3416 const char *toolspath;
3425 * The menu path must be relative.
3427 g_assert(*name != '/');
3430 case(REGISTER_STAT_GROUP_GENERIC): toolspath = "/Statistics/"; break;
3431 case(REGISTER_STAT_GROUP_CONVERSATION_LIST): toolspath = "/Statistics/_Conversation List/"; break;
3432 case(REGISTER_STAT_GROUP_ENDPOINT_LIST): toolspath = "/Statistics/_Endpoint List/"; break;
3433 case(REGISTER_STAT_GROUP_RESPONSE_TIME): toolspath = "/Statistics/Service _Response Time/"; break;
3434 case(REGISTER_STAT_GROUP_UNSORTED): toolspath = "/Statistics/"; break;
3435 case(REGISTER_ANALYZE_GROUP_UNSORTED): toolspath = "/Analyze/"; break;
3436 case(REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER): toolspath = "/Analyze/Conversation Filter/"; break;
3437 case(REGISTER_STAT_GROUP_TELEPHONY): toolspath = "/Telephony/"; break;
3438 case(REGISTER_TOOLS_GROUP_UNSORTED): toolspath = "/Tools/"; break;
3440 g_assert(!"no such menu group");
3444 /* add the (empty) root node, if not already done */
3445 if(tap_menu_tree_root == NULL) {
3446 child = g_malloc0(sizeof (menu_item_t));
3447 tap_menu_tree_root = g_list_append(NULL, child);
3451 * Create any submenus required.
3453 curnode = tap_menu_tree_root;
3455 while ((p = strchr(p, '/')) != NULL) {
3457 * OK, everything between "name" and "p" is
3458 * a menu relative subtree into which the menu item
3461 * Construct the absolute path name of that subtree.
3463 menupathlen = strlen(toolspath) + 1 + (p - name);
3464 menupath = g_malloc(menupathlen);
3465 g_strlcpy(menupath, toolspath, menupathlen);
3466 g_strlcat(menupath, name, menupathlen);
3469 * Does there exist an entry with that path at this
3470 * level of the Analyze menu tree?
3472 child = curnode->data;
3473 for (childnode = child->children; childnode != NULL; childnode = childnode->next) {
3474 child = childnode->data;
3475 if (strcmp(child->name, menupath) == 0)
3478 if (childnode == NULL) {
3480 * No. Create such an item as a subtree, and
3481 * add it to the Tools menu tree.
3483 childnode = tap_menu_item_add(
3484 menupath, group, "", NULL, NULL ,NULL, NULL, curnode);
3487 * Yes. We don't need this "menupath" any longer.
3491 curnode = childnode;
3494 * Skip over the '/' we found.
3500 * Construct the main menu path for the menu item.
3502 menupathlen = strlen(toolspath) + 1 + strlen(name);
3503 menupath = g_malloc(menupathlen);
3504 g_strlcpy(menupath, toolspath, menupathlen);
3505 g_strlcat(menupath, name, menupathlen);
3508 * Construct an item factory entry for the item, and add it to
3512 menupath, group, stock_id, callback,
3513 selected_packet_enabled, selected_tree_row_enabled,
3514 callback_data, curnode);
3518 * Add a new menu item for a stat.
3519 * This must be called after we've created the main menu, so it can't
3520 * be called from the routine that registers stats - we have to introduce
3521 * another per-stat registration routine.
3523 * @param name the menu label
3525 * @param group the menu group this stat should be registered to
3527 * @param callback gets called when the menu item is selected; it should do
3528 * the work of creating the stat window.
3530 * @param selected_packet_enabled gets called by set_menus_for_selected_packet();
3531 * it's passed a pointer to the "frame_data" structure for the current frame,
3532 * if any, and to the "epan_dissect_t" structure for that frame, if any, and
3533 * should return TRUE if the stat will work now (which might depend on whether
3534 * a frame is selected and, if one is, on the frame) and FALSE if not.
3536 * @param selected_tree_row_enabled gets called by
3537 * set_menus_for_selected_tree_row(); it's passed a pointer to the
3538 * "field_info" structure for the currently selected field, if any,
3539 * and should return TRUE if the stat will work now (which might depend on
3540 * whether a tree row is selected and, if one is, on the tree row) and
3543 * @param callback_data data for callback function
3546 register_stat_menu_item(
3548 register_stat_group_t group,
3549 GtkItemFactoryCallback callback,
3550 gboolean (*selected_packet_enabled)(frame_data *, epan_dissect_t *, gpointer callback_data),
3551 gboolean (*selected_tree_row_enabled)(field_info *, gpointer callback_data),
3552 gpointer callback_data)
3554 register_stat_menu_item_stock(
3559 selected_packet_enabled,
3560 selected_tree_row_enabled,
3564 static guint merge_tap_menus_layered(GList *node, gint group) {
3565 GtkItemFactoryEntry *entry;
3568 menu_item_t *node_data = node->data;
3571 * Is this a leaf node or an interior node?
3573 if (node_data->children == NULL) {
3579 * The root node doesn't correspond to a menu tree item; it
3580 * has a null name pointer.
3582 if (node_data->name != NULL && group == node_data->group) {
3583 entry = g_malloc0(sizeof (GtkItemFactoryEntry));
3584 entry->path = node_data->name;
3585 entry->callback = node_data->callback;
3587 case(REGISTER_STAT_GROUP_UNSORTED):
3589 case(REGISTER_STAT_GROUP_GENERIC):
3591 case(REGISTER_STAT_GROUP_CONVERSATION_LIST):
3592 entry->item_type = "<StockItem>";
3593 entry->extra_data = WIRESHARK_STOCK_CONVERSATIONS;
3595 case(REGISTER_STAT_GROUP_ENDPOINT_LIST):
3596 entry->item_type = "<StockItem>";
3597 entry->extra_data = WIRESHARK_STOCK_ENDPOINTS;
3599 case(REGISTER_STAT_GROUP_RESPONSE_TIME):
3600 entry->item_type = "<StockItem>";
3601 entry->extra_data = WIRESHARK_STOCK_TIME;
3603 case(REGISTER_STAT_GROUP_TELEPHONY):
3605 case(REGISTER_ANALYZE_GROUP_UNSORTED):
3607 case(REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER):
3609 case(REGISTER_TOOLS_GROUP_UNSORTED):
3612 g_assert_not_reached();
3614 if(node_data->stock_id!= NULL) {
3615 entry->item_type = "<StockItem>";
3616 entry->extra_data = node_data->stock_id;
3618 gtk_item_factory_create_item(main_menu_factory, entry, node_data->callback_data, /* callback_type */ 2);
3619 set_menu_sensitivity_old(main_menu_factory, node_data->name, FALSE); /* no capture file yet */
3625 * It's an interior node; call
3626 * "merge_tap_menus_layered()" on all its children
3630 * The root node doesn't correspond to a menu tree item; it
3631 * has a null name pointer.
3633 if (node_data->name != NULL && group == node_data->group) {
3634 entry = g_malloc0(sizeof (GtkItemFactoryEntry));
3635 entry->path = node_data->name;
3636 entry->item_type = "<Branch>";
3637 gtk_item_factory_create_item(main_menu_factory, entry,
3639 set_menu_sensitivity_old(main_menu_factory, node_data->name,
3640 FALSE); /* no children yet */
3645 for (child = node_data->children; child != NULL; child =
3647 added += merge_tap_menus_layered(child, group);
3655 void merge_all_tap_menus(GList *node) {
3656 GtkItemFactoryEntry *sep_entry;
3658 sep_entry = g_malloc0(sizeof (GtkItemFactoryEntry));
3659 sep_entry->item_type = "<Separator>";
3660 sep_entry->path = "/Statistics/";
3663 * merge only the menu items of the specific group,
3664 * and then append a seperator
3666 if (merge_tap_menus_layered(node, REGISTER_STAT_GROUP_GENERIC)) {
3667 gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);
3669 if (merge_tap_menus_layered(node, REGISTER_STAT_GROUP_CONVERSATION_LIST)) {
3670 /*gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);*/
3672 if (merge_tap_menus_layered(node, REGISTER_STAT_GROUP_ENDPOINT_LIST)) {
3673 /*gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);*/
3675 if (merge_tap_menus_layered(node, REGISTER_STAT_GROUP_RESPONSE_TIME)) {
3676 gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);
3678 if (merge_tap_menus_layered(node, REGISTER_STAT_GROUP_TELEPHONY)) {
3679 /*gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);*/
3681 if (merge_tap_menus_layered(node, REGISTER_STAT_GROUP_UNSORTED)) {
3682 /*gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);*/
3684 if (merge_tap_menus_layered(node, REGISTER_ANALYZE_GROUP_UNSORTED)) {
3685 sep_entry->path = "/Analyze/";
3686 /*gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);*/
3688 if (merge_tap_menus_layered(node, REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER)) {
3689 sep_entry->path = "/Analyze/Conversation Filter/";
3690 /*gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);*/
3692 if (merge_tap_menus_layered(node, REGISTER_TOOLS_GROUP_UNSORTED)) {
3693 /*gtk_item_factory_create_item(main_menu_factory, sep_entry, NULL, 2);*/
3699 #ifdef MENUS_USE_UIMANAGER
3701 * Enable/disable menu sensitivity.
3704 set_menu_sensitivity(GtkUIManager *ui_manager, const gchar *path, gint val)
3708 action = gtk_ui_manager_get_action(ui_manager, path);
3710 fprintf (stderr, "Warning: couldn't find action path= %s\n",
3714 #if GLIB_CHECK_VERSION(2,6,0)
3715 gtk_action_set_sensitive (action,
3716 val); /* TRUE to make the action sensitive */
3718 g_object_set (G_OBJECT (action), "sensitive", val, NULL);
3721 #endif /* MENUS_USE_UIMANAGER */
3724 * Enable/disable menu sensitivity.
3727 set_menu_sensitivity_old(GtkItemFactory *ifactory, const gchar *path, gint val)
3730 GtkWidget *menu_item;
3735 /* the underscore character regularly confuses things, as it will prevent finding
3736 * the menu_item, so it has to be removed first */
3737 dup = g_strdup(path);
3748 if (ifactory == NULL) {
3750 * Do it for all pop-up menus.
3752 for (menu_list = popup_menu_list; menu_list != NULL;
3753 menu_list = g_slist_next(menu_list))
3754 set_menu_sensitivity_old(menu_list->data, dup, val);
3757 * Do it for that particular menu.
3759 if ((menu_item = gtk_item_factory_get_widget(ifactory, dup)) != NULL) {
3760 if (GTK_IS_MENU(menu_item)) {
3762 * "dup" refers to a submenu; "gtk_item_factory_get_widget()"
3763 * gets the menu, not the item that, when selected, pops up
3766 * We have to change the latter item's sensitivity, so that
3767 * it shows up normally if sensitive and grayed-out if
3770 menu_item = gtk_menu_get_attach_widget(GTK_MENU(menu_item));
3772 gtk_widget_set_sensitive(menu_item, val);
3774 #ifndef NEW_PACKET_LIST
3775 /* be sure this menu item *is* existing */
3776 g_assert_not_reached();
3785 #ifdef MENUS_USE_UIMANAGER
3787 set_menu_object_data_meat(GtkUIManager *ui_manager, const gchar *path, const gchar *key, gpointer data)
3789 GtkWidget *menu = NULL;
3791 if ((menu = gtk_ui_manager_get_widget(ui_manager, path)) != NULL)
3792 g_object_set_data(G_OBJECT(menu), key, data);
3797 set_menu_object_data_meat_old(GtkItemFactory *ifactory, const gchar *path, const gchar *key, gpointer data)
3799 GtkWidget *menu = NULL;
3801 if ((menu = gtk_item_factory_get_widget(ifactory, path)) != NULL)
3802 g_object_set_data(G_OBJECT(menu), key, data);
3806 set_menu_object_data (const gchar *path, const gchar *key, gpointer data) {
3807 GSList *menu_list = popup_menu_list;
3808 gchar *shortpath = strrchr(path, '/');
3810 set_menu_object_data_meat_old(main_menu_factory, path, key, data);
3811 while (menu_list != NULL) {
3812 #ifdef MENUS_USE_UIMANAGER
3813 set_menu_object_data_meat(menu_list->data, shortpath, key, data);
3814 set_menu_object_data_meat(menu_list->data, path, key, data);
3816 set_menu_object_data_meat_old(menu_list->data, shortpath, key, data);
3817 set_menu_object_data_meat_old(menu_list->data, path, key, data);
3819 menu_list = g_slist_next(menu_list);
3824 /* Recently used capture files submenu:
3825 * Submenu containing the recently used capture files.
3826 * The capture filenames are always kept with the absolute path, to be independant
3827 * of the current path.
3828 * They are only stored inside the labels of the submenu (no separate list). */
3830 #define MENU_RECENT_FILES_PATH "/File/Open Recent"
3831 #define MENU_RECENT_FILES_KEY "Recent File Name"
3836 update_menu_recent_capture_file1(GtkWidget *widget, gpointer cnt) {
3837 gchar *widget_cf_name;
3839 widget_cf_name = g_object_get_data(G_OBJECT(widget), MENU_RECENT_FILES_KEY);
3841 /* if this menu item is a file, count it */
3842 if (widget_cf_name) {
3844 main_welcome_add_recent_capture_files(widget_cf_name);
3850 /* update the menu */
3852 update_menu_recent_capture_file(GtkWidget *submenu_recent_files) {
3856 main_welcome_reset_recent_capture_files();
3858 gtk_container_foreach(GTK_CONTAINER(submenu_recent_files),
3859 update_menu_recent_capture_file1, &cnt);
3861 /* make parent menu item sensitive only, if we have any valid files in the list */
3862 set_menu_sensitivity_old(main_menu_factory, MENU_RECENT_FILES_PATH, cnt);
3867 /* remove the capture filename from the "Recent Files" menu */
3869 remove_menu_recent_capture_filename(gchar *cf_name) {
3870 GtkWidget *submenu_recent_files;
3872 GList* child_list_item;
3873 GtkWidget *menu_item_child;
3874 const gchar *menu_item_cf_name;
3876 /* get the submenu container item */
3877 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH);
3879 /* find the corresponding menu item to be removed */
3880 child_list = gtk_container_get_children(GTK_CONTAINER(submenu_recent_files));
3881 child_list_item = child_list;
3882 while(child_list_item) {
3883 menu_item_child = (GTK_BIN(child_list_item->data))->child;
3884 if (menu_item_child != NULL) { /* Note: there are two "extra" items on the end of the child_list: */
3885 /* - a separator (with no menu_item_child and thus no text label) */
3886 /* - a 2nd item with a menu_child with text label "Clear" */
3887 /* [See add_menu_recent_capture_file_absolute() ] */
3888 /* 'if (menu_item_child != NULL)' skips the separator item; */
3889 /* An absolute filename in cf_name will never match "Clear". */
3890 menu_item_cf_name = gtk_label_get_text(GTK_LABEL(menu_item_child));
3891 if(strcmp(menu_item_cf_name, cf_name) == 0) {
3892 /* XXX: is this all we need to do, to free the menu item and its label?
3893 The reference count of widget will go to 0, so it'll be freed;
3894 will that free the label? */
3895 gtk_container_remove(GTK_CONTAINER(submenu_recent_files), child_list_item->data);
3898 child_list_item = g_list_next(child_list_item);
3900 g_list_free(child_list);
3902 update_menu_recent_capture_file(submenu_recent_files);
3906 /* remove the capture filename from the "Recent Files" menu */
3908 remove_menu_recent_capture_file(GtkWidget *widget, gpointer unused _U_) {
3909 GtkWidget *submenu_recent_files;
3910 gchar *widget_cf_name;
3913 widget_cf_name = g_object_get_data(G_OBJECT(widget), MENU_RECENT_FILES_KEY);
3914 g_free(widget_cf_name);
3916 /* get the submenu container item */
3917 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH);
3919 /* XXX: is this all we need to do, to free the menu item and its label?
3920 The reference count of widget will go to 0, so it'll be freed;
3921 will that free the label? */
3922 gtk_container_remove(GTK_CONTAINER(submenu_recent_files), widget);
3926 /* callback, if the user pushed the <Clear> menu item */
3928 clear_menu_recent_capture_file_cmd_cb(GtkWidget *w _U_, gpointer unused _U_) {
3929 GtkWidget *submenu_recent_files;
3932 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH);
3934 gtk_container_foreach(GTK_CONTAINER(submenu_recent_files),
3935 remove_menu_recent_capture_file, NULL);
3937 update_menu_recent_capture_file(submenu_recent_files);
3941 /* Open a file by it's name
3942 (Beware: will not ask to close existing capture file!) */
3944 menu_open_filename(gchar *cf_name)
3946 GtkWidget *submenu_recent_files;
3949 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH);
3951 /* open and read the capture file (this will close an existing file) */
3952 if (cf_open(&cfile, cf_name, FALSE, &err) == CF_OK) {
3953 cf_read(&cfile, FALSE);
3955 /* the capture file apparently no longer exists; remove menu item */
3956 /* XXX: ask user to remove item, it's maybe only a temporary problem */
3957 remove_menu_recent_capture_filename(cf_name);
3960 update_menu_recent_capture_file(submenu_recent_files);
3964 /* callback, if the user pushed a recent file submenu item */
3966 menu_open_recent_file_cmd(GtkWidget *w)
3968 GtkWidget *submenu_recent_files;
3969 GtkWidget *menu_item_child;
3970 const gchar *cf_name;
3973 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH);
3975 /* get capture filename from the menu item label */
3976 menu_item_child = (GTK_BIN(w))->child;
3977 cf_name = gtk_label_get_text(GTK_LABEL(menu_item_child));
3979 /* open and read the capture file (this will close an existing file) */
3980 if (cf_open(&cfile, cf_name, FALSE, &err) == CF_OK) {
3981 cf_read(&cfile, FALSE);
3983 /* the capture file apparently no longer exists; remove menu item */
3984 /* XXX: ask user to remove item, it's maybe only a temporary problem */
3985 remove_menu_recent_capture_file(w, NULL);
3988 update_menu_recent_capture_file(submenu_recent_files);
3991 static void menu_open_recent_file_answered_cb(gpointer dialog _U_, gint btn, gpointer data)
3995 /* save file first */
3996 file_save_as_cmd(after_save_open_recent_file, data);
4000 menu_open_recent_file_cmd(data);
4002 case(ESD_BTN_CANCEL):
4005 g_assert_not_reached();
4010 menu_open_recent_file_cmd_cb(GtkWidget *widget, gpointer data _U_) {
4014 if((cfile.state != FILE_CLOSED) && !cfile.user_saved && prefs.gui_ask_unsaved) {
4015 /* user didn't saved his current file, ask him */
4016 dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_YES_NO_CANCEL,
4017 "%sSave capture file before opening a new one?%s\n\n"
4018 "If you open a new capture file without saving, your current capture data will be discarded.",
4019 simple_dialog_primary_start(), simple_dialog_primary_end());
4020 simple_dialog_set_cb(dialog, menu_open_recent_file_answered_cb, widget);
4022 /* unchanged file */
4023 menu_open_recent_file_cmd(widget);
4027 /* add the capture filename (with an absolute path) to the "Recent Files" menu */
4029 add_menu_recent_capture_file_absolute(gchar *cf_name) {
4030 GtkWidget *submenu_recent_files;
4031 GList *menu_item_list;
4033 gchar *widget_cf_name;
4034 gchar *normalized_cf_name;
4035 GtkWidget *menu_item;
4040 normalized_cf_name = g_strdup(cf_name);
4042 /* replace all slashes by backslashes */
4043 g_strdelimit(normalized_cf_name, "/", '\\');
4046 /* get the submenu container item */
4047 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH);
4049 /* convert container to a GList */
4050 menu_item_list = gtk_container_get_children(GTK_CONTAINER(submenu_recent_files));
4052 /* iterate through list items of menu_item_list,
4053 * removing special items, a maybe duplicate entry and every item above count_max */
4055 for (li = g_list_first(menu_item_list); li; li = li->next, cnt++) {
4056 /* get capture filename */
4057 menu_item = GTK_WIDGET(li->data);
4058 widget_cf_name = g_object_get_data(G_OBJECT(menu_item), MENU_RECENT_FILES_KEY);
4060 /* if this element string is one of our special items (seperator, ...) or
4061 * already in the list or
4062 * this element is above maximum count (too old), remove it */
4063 if (!widget_cf_name ||
4065 /* do a case insensitive compare on win32 */
4066 g_ascii_strncasecmp(widget_cf_name, normalized_cf_name, 1000) == 0 ||
4068 /* do a case sensitive compare on unix */
4069 strncmp(widget_cf_name, normalized_cf_name, 1000) == 0 ||
4071 cnt >= prefs.gui_recent_files_count_max) {
4072 remove_menu_recent_capture_file(li->data, NULL);
4077 g_list_free(menu_item_list);
4079 /* add new item at latest position */
4080 menu_item = gtk_menu_item_new_with_label(normalized_cf_name);
4081 g_object_set_data(G_OBJECT(menu_item), MENU_RECENT_FILES_KEY, normalized_cf_name);
4082 gtk_menu_shell_prepend (GTK_MENU_SHELL(submenu_recent_files), menu_item);
4083 g_signal_connect_swapped(GTK_OBJECT(menu_item), "activate",
4084 G_CALLBACK(menu_open_recent_file_cmd_cb), (GtkObject *) menu_item);
4085 gtk_widget_show (menu_item);
4087 /* add seperator at last position */
4088 menu_item = gtk_menu_item_new();
4089 gtk_menu_shell_append (GTK_MENU_SHELL(submenu_recent_files), menu_item);
4090 gtk_widget_show (menu_item);
4092 /* add new "clear list" item at last position */
4093 menu_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_CLEAR, NULL);
4094 gtk_menu_shell_append (GTK_MENU_SHELL(submenu_recent_files), menu_item);
4095 g_signal_connect_swapped(GTK_OBJECT(menu_item), "activate",
4096 G_CALLBACK(clear_menu_recent_capture_file_cmd_cb), (GtkObject *) menu_item);
4097 gtk_widget_show (menu_item);
4099 update_menu_recent_capture_file(submenu_recent_files);
4103 /* add the capture filename to the "Recent Files" menu */
4104 /* (will change nothing, if this filename is already in the menu) */
4106 * XXX - We might want to call SHAddToRecentDocs under Windows 7:
4107 * http://stackoverflow.com/questions/437212/how-do-you-register-a-most-recently-used-list-with-windows-in-preparation-for-win
4110 add_menu_recent_capture_file(gchar *cf_name) {
4115 /* if this filename is an absolute path, we can use it directly */
4116 if (g_path_is_absolute(cf_name)) {
4117 add_menu_recent_capture_file_absolute(cf_name);
4121 /* this filename is not an absolute path, prepend the current dir */
4122 curr = g_get_current_dir();
4123 absolute = g_strdup_printf("%s%s%s", curr, G_DIR_SEPARATOR_S, cf_name);
4124 add_menu_recent_capture_file_absolute(absolute);
4130 /* write all capture filenames of the menu to the user's recent file */
4132 menu_recent_file_write_all(FILE *rf) {
4133 GtkWidget *submenu_recent_files;
4139 submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH);
4141 /* we have to iterate backwards through the children's list,
4142 * so we get the latest item last in the file.
4143 * (don't use gtk_container_foreach() here, it will return the wrong iteration order) */
4144 children = gtk_container_get_children(GTK_CONTAINER(submenu_recent_files));
4145 child = g_list_last(children);
4146 while(child != NULL) {
4147 /* get capture filename from the menu item label */
4148 cf_name = g_object_get_data(G_OBJECT(child->data), MENU_RECENT_FILES_KEY);
4151 fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", u3_contract_device_path(cf_name));
4153 fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", cf_name);
4156 child = g_list_previous(child);
4159 g_list_free(children);
4164 show_hide_cb(GtkWidget *w, gpointer data _U_, gint action)
4167 /* save current setting in recent */
4169 case(SHOW_HIDE_MAIN_TOOLBAR):
4170 recent.main_toolbar_show = GTK_CHECK_MENU_ITEM(w)->active;
4172 case(SHOW_HIDE_FILTER_TOOLBAR):
4173 recent.filter_toolbar_show = GTK_CHECK_MENU_ITEM(w)->active;
4176 case(SHOW_HIDE_AIRPCAP_TOOLBAR):
4177 recent.airpcap_toolbar_show = GTK_CHECK_MENU_ITEM(w)->active;
4180 case(SHOW_HIDE_STATUSBAR):
4181 recent.statusbar_show = GTK_CHECK_MENU_ITEM(w)->active;
4183 case(SHOW_HIDE_PACKET_LIST):
4184 recent.packet_list_show = GTK_CHECK_MENU_ITEM(w)->active;
4186 case(SHOW_HIDE_TREE_VIEW):
4187 recent.tree_view_show = GTK_CHECK_MENU_ITEM(w)->active;
4189 case(SHOW_HIDE_BYTE_VIEW):
4190 recent.byte_view_show = GTK_CHECK_MENU_ITEM(w)->active;
4193 g_assert_not_reached();
4196 main_widgets_show_or_hide();
4201 timestamp_format_cb(GtkWidget *w _U_, gpointer d _U_, gint action)
4203 if (recent.gui_time_format != action) {
4204 timestamp_set_type(action);
4205 recent.gui_time_format = action;
4206 #ifdef NEW_PACKET_LIST
4207 /* This call adjusts column width */
4208 cf_timestamp_auto_precision(&cfile);
4209 new_packet_list_queue_draw();
4211 cf_change_time_formats(&cfile);
4218 timestamp_precision_cb(GtkWidget *w _U_, gpointer d _U_, gint action)
4220 if (recent.gui_time_precision != action) {
4221 /* the actual precision will be set in cf_change_time_formats() below */
4222 if (action == TS_PREC_AUTO) {
4223 timestamp_set_precision(TS_PREC_AUTO_SEC);
4225 timestamp_set_precision(action);
4227 recent.gui_time_precision = action;
4228 #ifdef NEW_PACKET_LIST
4229 /* This call adjusts column width */
4230 cf_timestamp_auto_precision(&cfile);
4231 new_packet_list_queue_draw();
4233 cf_change_time_formats(&cfile);
4239 timestamp_seconds_time_cb(GtkWidget *w, gpointer d _U_, gint action _U_)
4241 if (GTK_CHECK_MENU_ITEM(w)->active) {
4242 recent.gui_seconds_format = TS_SECONDS_HOUR_MIN_SEC;
4244 recent.gui_seconds_format = TS_SECONDS_DEFAULT;
4246 timestamp_set_seconds_type (recent.gui_seconds_format);
4248 #ifdef NEW_PACKET_LIST
4249 /* This call adjusts column width */
4250 cf_timestamp_auto_precision(&cfile);
4251 new_packet_list_queue_draw();
4253 cf_change_time_formats(&cfile);
4258 menu_name_resolution_changed(void)
4260 GtkWidget *menu = NULL;
4262 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Name Resolution/Enable for MAC Layer");
4263 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), g_resolv_flags & RESOLV_MAC);
4265 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Name Resolution/Enable for Network Layer");
4266 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), g_resolv_flags & RESOLV_NETWORK);
4268 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Name Resolution/Enable for Transport Layer");
4269 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), g_resolv_flags & RESOLV_TRANSPORT);
4273 name_resolution_cb(GtkWidget *w, gpointer d _U_, gint action)
4275 if (GTK_CHECK_MENU_ITEM(w)->active) {
4276 g_resolv_flags |= action;
4278 g_resolv_flags &= ~action;
4284 menu_auto_scroll_live_changed(gboolean auto_scroll_live_in) {
4288 /* tell menu about it */
4289 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Auto Scroll in Live Capture");
4290 if( ((gboolean) GTK_CHECK_MENU_ITEM(menu)->active) != auto_scroll_live_in) {
4291 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), auto_scroll_live_in);
4294 /* tell toolbar about it */
4295 toolbar_auto_scroll_live_changed(auto_scroll_live_in);
4297 /* change auto scroll */
4298 if(auto_scroll_live_in != auto_scroll_live) {
4299 auto_scroll_live = auto_scroll_live_in;
4304 auto_scroll_live_cb(GtkWidget *w _U_, gpointer d _U_)
4306 menu_auto_scroll_live_changed(GTK_CHECK_MENU_ITEM(w)->active);
4312 menu_colorize_changed(gboolean packet_list_colorize) {
4316 /* tell menu about it */
4317 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Colorize Packet List");
4318 if( ((gboolean) GTK_CHECK_MENU_ITEM(menu)->active) != packet_list_colorize) {
4319 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), packet_list_colorize);
4322 /* tell toolbar about it */
4323 toolbar_colorize_changed(packet_list_colorize);
4325 /* change colorization */
4326 if(packet_list_colorize != recent.packet_list_colorize) {
4327 recent.packet_list_colorize = packet_list_colorize;
4328 color_filters_enable(packet_list_colorize);
4329 #ifdef NEW_PACKET_LIST
4330 new_packet_list_colorize_packets();
4332 cf_colorize_packets(&cfile);
4338 colorize_cb(GtkWidget *w, gpointer d _U_)
4340 menu_colorize_changed(GTK_CHECK_MENU_ITEM(w)->active);
4344 /* the recent file read has finished, update the menu corresponding */
4346 menu_recent_read_finished(void) {
4347 GtkWidget *menu = NULL;
4349 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Main Toolbar");
4350 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.main_toolbar_show);
4352 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Filter Toolbar");
4353 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.filter_toolbar_show);
4356 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Wireless Toolbar");
4357 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.airpcap_toolbar_show);
4360 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Statusbar");
4361 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.statusbar_show);
4363 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Packet List");
4364 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.packet_list_show);
4366 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Packet Details");
4367 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.tree_view_show);
4369 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Packet Bytes");
4370 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.byte_view_show);
4372 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Colorize Packet List");
4373 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.packet_list_colorize);
4375 menu_name_resolution_changed();
4378 menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Auto Scroll in Live Capture");
4379 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), auto_scroll_live);
4382 main_widgets_rearrange();
4384 /* don't change the time format, if we had a command line value */
4385 if (timestamp_get_type() != TS_NOT_SET) {
4386 recent.gui_time_format = timestamp_get_type();
4389 switch(recent.gui_time_format) {
4390 case(TS_ABSOLUTE_WITH_DATE):
4391 menu = gtk_item_factory_get_widget(main_menu_factory,
4392 "/View/Time Display Format/Date and Time of Day: 1970-01-01 01:02:03.123456");
4395 menu = gtk_item_factory_get_widget(main_menu_factory,
4396 "/View/Time Display Format/Time of Day: 01:02:03.123456");
4399 menu = gtk_item_factory_get_widget(main_menu_factory,
4400 "/View/Time Display Format/Seconds Since Beginning of Capture: 123.123456");
4403 menu = gtk_item_factory_get_widget(main_menu_factory,
4404 "/View/Time Display Format/Seconds Since Previous Captured Packet: 1.123456");
4407 menu = gtk_item_factory_get_widget(main_menu_factory,
4408 "/View/Time Display Format/Seconds Since Previous Displayed Packet: 1.123456");
4411 menu = gtk_item_factory_get_widget(main_menu_factory,
4412 "/View/Time Display Format/Seconds Since Epoch (1970-01-01): 1234567890.123456");
4415 g_assert_not_reached();
4418 /* set_active will not trigger the callback when activating an active item! */
4419 recent.gui_time_format = -1;
4420 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), FALSE);
4421 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
4423 switch(recent.gui_time_precision) {
4425 menu = gtk_item_factory_get_widget(main_menu_factory,
4426 "/View/Time Display Format/Automatic (File Format Precision)");
4428 case(TS_PREC_FIXED_SEC):
4429 menu = gtk_item_factory_get_widget(main_menu_factory,
4430 "/View/Time Display Format/Seconds: 0");
4432 case(TS_PREC_FIXED_DSEC):
4433 menu = gtk_item_factory_get_widget(main_menu_factory,
4434 "/View/Time Display Format/Deciseconds: 0.1");
4436 case(TS_PREC_FIXED_CSEC):
4437 menu = gtk_item_factory_get_widget(main_menu_factory,
4438 "/View/Time Display Format/Centiseconds: 0.12");
4440 case(TS_PREC_FIXED_MSEC):
4441 menu = gtk_item_factory_get_widget(main_menu_factory,
4442 "/View/Time Display Format/Milliseconds: 0.123");
4444 case(TS_PREC_FIXED_USEC):
4445 menu = gtk_item_factory_get_widget(main_menu_factory,
4446 "/View/Time Display Format/Microseconds: 0.123456");
4448 case(TS_PREC_FIXED_NSEC):
4449 menu = gtk_item_factory_get_widget(main_menu_factory,
4450 "/View/Time Display Format/Nanoseconds: 0.123456789");
4453 g_assert_not_reached();
4456 /* set_active will not trigger the callback when activating an active item! */
4457 recent.gui_time_precision = -1;
4458 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), FALSE);
4459 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
4461 /* don't change the seconds format, if we had a command line value */
4462 if (timestamp_get_seconds_type() != TS_SECONDS_NOT_SET) {
4463 recent.gui_seconds_format = timestamp_get_seconds_type();
4466 menu = gtk_item_factory_get_widget(main_menu_factory,
4467 "/View/Time Display Format/Display Seconds with hours and minutes");
4468 switch (recent.gui_seconds_format) {
4469 case TS_SECONDS_DEFAULT:
4470 recent.gui_seconds_format = -1;
4471 /* set_active will not trigger the callback when deactivating an inactive item! */
4472 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
4473 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), FALSE);
4475 case TS_SECONDS_HOUR_MIN_SEC:
4476 recent.gui_seconds_format = -1;
4477 /* set_active will not trigger the callback when activating an active item! */
4478 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), FALSE);
4479 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
4482 g_assert_not_reached();
4485 menu_colorize_changed(recent.packet_list_colorize);
4486 #ifdef MENUS_USE_UIMANAGER
4487 /* We set active at creation of the menu */
4489 switch (recent.gui_bytes_view) {
4491 menu = gtk_item_factory_get_widget(bytes_menu_factory, "/Hex View");
4494 menu = gtk_item_factory_get_widget(bytes_menu_factory, "/Bits View");
4497 g_assert_not_reached();
4499 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
4505 popup_menu_handler(GtkWidget *widget, GdkEvent *event, gpointer data)
4507 GtkWidget *menu = (GtkWidget *)data;
4508 GdkEventButton *event_button = NULL;
4511 if(widget == NULL || event == NULL || data == NULL) {
4516 * If we ever want to make the menu differ based on what row
4517 * and/or column we're above, we'd use "eth_clist_get_selection_info()"
4518 * to find the row and column number for the coordinates; a CTree is,
4519 * I guess, like a CList with one column(?) and the expander widget
4522 /* Check if we are on packet_list object */
4523 if (widget == g_object_get_data(G_OBJECT(popup_menu_object), E_MPACKET_LIST_KEY) &&
4524 ((GdkEventButton *)event)->button != 1) {
4525 #ifdef NEW_PACKET_LIST
4527 if (new_packet_list_get_event_row_column((GdkEventButton *)event, &physical_row, &row, &column)) {
4529 if (packet_list_get_event_row_column(widget, (GdkEventButton *)event, &row, &column)) {
4531 g_object_set_data(G_OBJECT(popup_menu_object), E_MPACKET_LIST_ROW_KEY,
4532 #ifdef NEW_PACKET_LIST
4533 GINT_TO_POINTER(row));
4535 GINT_TO_POINTER(row));
4537 g_object_set_data(G_OBJECT(popup_menu_object), E_MPACKET_LIST_COL_KEY,
4538 GINT_TO_POINTER(column));
4539 #ifdef NEW_PACKET_LIST
4540 new_packet_list_set_selected_row(row);
4542 packet_list_set_selected_row(row);
4547 /* Check if we are on tree_view object */
4548 if (widget == tree_view_gbl) {
4549 tree_view_select(widget, (GdkEventButton *) event);
4552 /* context menu handler */
4553 if(event->type == GDK_BUTTON_PRESS) {
4554 event_button = (GdkEventButton *) event;
4556 /* To quote the "Gdk Event Structures" doc:
4557 * "Normally button 1 is the left mouse button, 2 is the middle button, and 3 is the right button" */
4558 if(event_button->button == 3) {
4559 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
4560 event_button->button,
4561 event_button->time);
4562 g_signal_stop_emission_by_name(widget, "button_press_event");
4567 /* Check if we are on byte_view object */
4568 if(widget == get_notebook_bv_ptr(byte_nb_ptr_gbl)) {
4569 byte_view_select(widget, (GdkEventButton *) event);
4572 /* GDK_2BUTTON_PRESS is a doubleclick -> expand/collapse tree row */
4573 /* GTK version 1 seems to be doing this automatically */
4574 if (widget == tree_view_gbl && event->type == GDK_2BUTTON_PRESS) {
4577 if (gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(widget),
4578 (gint) (((GdkEventButton *)event)->x),
4579 (gint) (((GdkEventButton *)event)->y),
4580 &path, NULL, NULL, NULL))
4582 if (gtk_tree_view_row_expanded(GTK_TREE_VIEW(widget), path))
4583 gtk_tree_view_collapse_row(GTK_TREE_VIEW(widget), path);
4585 gtk_tree_view_expand_row(GTK_TREE_VIEW(widget), path,
4587 gtk_tree_path_free(path);
4593 /* Enable or disable menu items based on whether you have a capture file
4594 you've finished reading and, if you have one, whether it's been saved
4595 and whether it could be saved except by copying the raw packet data. */
4597 set_menus_for_capture_file(capture_file *cf)
4600 /* We have no capture file */
4601 set_menu_sensitivity_old(main_menu_factory, "/File/Merge...", FALSE);
4602 set_menu_sensitivity_old(main_menu_factory, "/File/Close", FALSE);
4603 set_menu_sensitivity_old(main_menu_factory, "/File/Save", FALSE);
4604 set_menu_sensitivity_old(main_menu_factory, "/File/Save As...", FALSE);
4605 set_menu_sensitivity_old(main_menu_factory, "/File/Export", FALSE);
4606 set_menu_sensitivity_old(main_menu_factory, "/View/Reload", FALSE);
4607 set_toolbar_for_capture_file(FALSE);
4608 set_toolbar_for_unsaved_capture_file(FALSE);
4610 set_menu_sensitivity_old(main_menu_factory, "/File/Merge...", TRUE);
4611 set_menu_sensitivity_old(main_menu_factory, "/File/Close", TRUE);
4612 set_menu_sensitivity_old(main_menu_factory, "/File/Save", !cf->user_saved);
4614 * "Save As..." works only if we can write the file out in at least
4615 * one format (so we can save the whole file or just a subset) or
4616 * if we have an unsaved capture (so writing the whole file out
4617 * with a raw data copy makes sense).
4619 set_menu_sensitivity_old(main_menu_factory, "/File/Save As...",
4620 cf_can_save_as(cf) || !cf->user_saved);
4621 set_menu_sensitivity_old(main_menu_factory, "/File/Export", TRUE);
4622 set_menu_sensitivity_old(main_menu_factory, "/View/Reload", TRUE);
4623 set_toolbar_for_unsaved_capture_file(!cf->user_saved);
4624 set_toolbar_for_capture_file(TRUE);
4628 /* Enable or disable menu items based on whether there's a capture in
4631 set_menus_for_capture_in_progress(gboolean capture_in_progress)
4633 set_menu_sensitivity_old(main_menu_factory, "/File/Open...",
4634 !capture_in_progress);
4635 set_menu_sensitivity_old(main_menu_factory, "/File/Open Recent",
4636 !capture_in_progress);
4637 set_menu_sensitivity_old(main_menu_factory, "/File/Export",
4638 capture_in_progress);
4640 set_menu_sensitivity_old(main_menu_factory, "/Capture/Options...",
4641 !capture_in_progress);
4642 set_menu_sensitivity_old(main_menu_factory, "/Capture/Start",
4643 !capture_in_progress);
4644 set_menu_sensitivity_old(main_menu_factory, "/Capture/Stop",
4645 capture_in_progress);
4646 set_menu_sensitivity_old(main_menu_factory, "/Capture/Restart",
4647 capture_in_progress);
4648 set_toolbar_for_capture_in_progress(capture_in_progress);
4650 set_capture_if_dialog_for_capture_in_progress(capture_in_progress);
4651 #endif /* HAVE_LIBPCAP */
4654 /* Enable or disable menu items based on whether you have some captured
4657 walk_menu_tree_for_captured_packets(GList *node,
4658 gboolean have_captured_packets)
4660 gboolean is_enabled;
4662 menu_item_t *node_data = node->data;
4665 * Is this a leaf node or an interior node?
4667 if (node_data->children == NULL) {
4671 * If it has no "selected_packet_enabled()" or
4672 * "selected_tree_row_enabled()" routines, we enable
4673 * it. This allows tap windows to be popped up even
4674 * if you have no capture file; this is done to let
4675 * the user pop up multiple tap windows before reading
4676 * in a capture file, so that they can be processed in
4677 * parallel while the capture file is being read rather
4678 * than one at at time as you pop up the windows, and to
4679 * let the user pop up tap windows before starting an
4680 * "Update list of packets in real time" capture, so that
4681 * the statistics can be displayed while the capture is
4684 * If it has either of those routines, we disable it for
4685 * now - as long as, when a capture is first available,
4686 * we don't get called after a packet or tree row is
4687 * selected, that's OK.
4688 * XXX - that should be done better.
4690 if (node_data->selected_packet_enabled == NULL &&
4691 node_data->selected_tree_row_enabled == NULL)
4692 node_data->enabled = TRUE;
4694 node_data->enabled = FALSE;
4697 * It's an interior node; call
4698 * "walk_menu_tree_for_captured_packets()" on all its
4699 * children and, if any of them are enabled, enable
4700 * this node, otherwise disable it.
4702 * XXX - should we just leave all interior nodes enabled?
4703 * Which is a better UI choice?
4706 for (child = node_data->children; child != NULL; child =
4708 if (walk_menu_tree_for_captured_packets(child,
4709 have_captured_packets))
4712 node_data->enabled = is_enabled;
4716 * The root node doesn't correspond to a menu tree item; it
4717 * has a null name pointer.
4719 if (node_data->name != NULL) {
4720 set_menu_sensitivity_old(main_menu_factory, node_data->name,
4721 node_data->enabled);
4723 return node_data->enabled;
4727 set_menus_for_captured_packets(gboolean have_captured_packets)
4729 set_menu_sensitivity_old(main_menu_factory, "/File/Print...",
4730 have_captured_packets);
4731 #ifdef MENUS_USE_UIMANAGER
4732 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/Print",
4733 have_captured_packets);
4736 set_menu_sensitivity_old(packet_list_menu_factory, "/Print...",
4737 have_captured_packets);
4739 set_menu_sensitivity_old(main_menu_factory, "/Edit/Find Packet...",
4740 have_captured_packets);
4741 set_menu_sensitivity_old(main_menu_factory, "/Edit/Find Next",
4742 have_captured_packets);
4743 set_menu_sensitivity_old(main_menu_factory, "/Edit/Find Previous",
4744 have_captured_packets);
4745 set_menu_sensitivity_old(main_menu_factory, "/View/Zoom In",
4746 have_captured_packets);
4747 set_menu_sensitivity_old(main_menu_factory, "/View/Zoom Out",
4748 have_captured_packets);
4749 set_menu_sensitivity_old(main_menu_factory, "/View/Normal Size",
4750 have_captured_packets);
4751 set_menu_sensitivity_old(main_menu_factory, "/Go/Go to Packet...",
4752 have_captured_packets);
4753 set_menu_sensitivity_old(main_menu_factory, "/Go/Previous Packet",
4754 have_captured_packets);
4755 set_menu_sensitivity_old(main_menu_factory, "/Go/Next Packet",
4756 have_captured_packets);
4757 set_menu_sensitivity_old(main_menu_factory, "/Go/First Packet",
4758 have_captured_packets);
4759 set_menu_sensitivity_old(main_menu_factory, "/Go/Last Packet",
4760 have_captured_packets);
4761 set_menu_sensitivity_old(main_menu_factory, "/Statistics/Summary",
4762 have_captured_packets);
4763 set_menu_sensitivity_old(main_menu_factory, "/Statistics/Protocol Hierarchy",
4764 have_captured_packets);
4766 walk_menu_tree_for_captured_packets(tap_menu_tree_root,
4767 have_captured_packets);
4768 set_toolbar_for_captured_packets(have_captured_packets);
4771 /* Enable or disable menu items based on whether a packet is selected and,
4772 if so, on the properties of the packet. */
4774 walk_menu_tree_for_selected_packet(GList *node, frame_data *fd,
4775 epan_dissect_t *edt)
4777 gboolean is_enabled;
4779 menu_item_t *node_data = node->data;
4782 * Is this a leaf node or an interior node?
4784 if (node_data->children == NULL) {
4788 * If it has no "selected_packet_enabled()" routine,
4789 * leave its enabled/disabled status alone - it
4790 * doesn't depend on whether we have a packet selected
4791 * or not or on the selected packet.
4793 * If it has a "selected_packet_enabled()" routine,
4794 * call it and set the item's enabled/disabled status
4795 * based on its return value.
4797 if (node_data->selected_packet_enabled != NULL)
4798 node_data->enabled = node_data->selected_packet_enabled(fd, edt, node_data->callback_data);
4801 * It's an interior node; call
4802 * "walk_menu_tree_for_selected_packet()" on all its
4803 * children and, if any of them are enabled, enable
4804 * this node, otherwise disable it.
4806 * XXX - should we just leave all interior nodes enabled?
4807 * Which is a better UI choice?
4810 for (child = node_data->children; child != NULL; child =
4812 if (walk_menu_tree_for_selected_packet(child, fd, edt))
4815 node_data->enabled = is_enabled;
4819 * The root node doesn't correspond to a menu tree item; it
4820 * has a null name pointer.
4822 if (node_data->name != NULL) {
4823 set_menu_sensitivity_old(main_menu_factory, node_data->name,
4824 node_data->enabled);
4826 return node_data->enabled;
4830 packet_is_ssl(epan_dissect_t* edt)
4836 if (!edt || !edt->tree)
4838 ssl_id = proto_get_id_by_filter_name("ssl");
4841 array = proto_find_finfo(edt->tree, ssl_id);
4842 is_ssl = (array->len > 0) ? TRUE : FALSE;
4843 g_ptr_array_free(array, TRUE);
4848 set_menus_for_selected_packet(capture_file *cf)
4850 /* Making the menu context-sensitive allows for easier selection of the
4851 desired item and has the added benefit, with large captures, of
4852 avoiding needless looping through huge lists for marked, ignored,
4853 or time-referenced packets. */
4854 gboolean is_ssl = packet_is_ssl(cf->edt);
4855 gboolean frame_selected = cf->current_frame != NULL;
4856 /* A frame is selected */
4857 gboolean have_marked = frame_selected && cf->marked_count > 0;
4858 /* We have marked frames. (XXX - why check frame_selected?) */
4859 gboolean another_is_marked = have_marked &&
4860 !(cf->marked_count == 1 && cf->current_frame->flags.marked);
4861 /* We have a marked frame other than the current frame (i.e.,
4862 we have at least one marked frame, and either there's more
4863 than one marked frame or the current frame isn't marked). */
4864 gboolean have_time_ref = cf->ref_time_count > 0;
4865 gboolean another_is_time_ref = frame_selected && have_time_ref &&
4866 !(cf->ref_time_count == 1 && cf->current_frame->flags.ref_time);
4867 /* We have a time reference frame other than the current frame (i.e.,
4868 we have at least one time reference frame, and either there's more
4869 than one time reference frame or the current frame isn't a
4870 time reference frame). (XXX - why check frame_selected?) */
4872 set_menu_sensitivity_old(main_menu_factory, "/Edit/Mark Packet (toggle)",
4874 #ifdef MENUS_USE_UIMANAGER
4875 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/MarkPacket",
4878 set_menu_sensitivity_old(packet_list_menu_factory, "/Mark Packet (toggle)",
4881 set_menu_sensitivity_old(main_menu_factory, "/Edit/Mark All Displayed Packets (toggle)",
4882 cf->displayed_count > 0);
4883 /* Unlike un-ignore, do not allow unmark of all frames when no frames are displayed */
4884 set_menu_sensitivity_old(main_menu_factory, "/Edit/Unmark All Packets",
4886 set_menu_sensitivity_old(main_menu_factory, "/Edit/Find Next Mark",
4888 set_menu_sensitivity_old(main_menu_factory, "/Edit/Find Previous Mark",
4891 set_menu_sensitivity_old(main_menu_factory, "/Edit/Ignore Packet (toggle)",
4893 #ifdef MENUS_USE_UIMANAGER
4894 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/IgnorePacket",
4897 set_menu_sensitivity_old(packet_list_menu_factory, "/Ignore Packet (toggle)",
4900 set_menu_sensitivity_old(main_menu_factory, "/Edit/Ignore All Displayed Packets (toggle)",
4901 cf->displayed_count > 0 && cf->displayed_count != cf->count);
4902 /* Allow un-ignore of all frames even with no frames currently displayed */
4903 set_menu_sensitivity_old(main_menu_factory, "/Edit/Un-Ignore All Packets",
4904 cf->ignored_count > 0);
4906 set_menu_sensitivity_old(main_menu_factory, "/Edit/Set Time Reference (toggle)",
4908 #ifdef NEW_PACKET_LIST
4909 set_menu_sensitivity_old(main_menu_factory, "/Edit/Un-Time Reference All Packets",
4912 #ifdef MENUS_USE_UIMANAGER
4913 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/SetTimeReference",
4916 set_menu_sensitivity_old(packet_list_menu_factory, "/Set Time Reference (toggle)",
4919 set_menu_sensitivity_old(main_menu_factory, "/Edit/Find Next Time Reference",
4920 another_is_time_ref);
4921 set_menu_sensitivity_old(main_menu_factory, "/Edit/Find Previous Time Reference",
4922 another_is_time_ref);
4924 set_menu_sensitivity_old(main_menu_factory, "/View/Resize All Columns",
4926 set_menu_sensitivity_old(main_menu_factory, "/View/Collapse All",
4928 #ifdef MENUS_USE_UIMANAGER
4929 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/CollapseAll",
4932 set_menu_sensitivity_old(tree_view_menu_factory, "/Collapse All",
4935 set_menu_sensitivity_old(main_menu_factory, "/View/Expand All",
4937 #ifdef MENUS_USE_UIMANAGER
4938 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ExpandAll",
4941 set_menu_sensitivity_old(tree_view_menu_factory, "/Expand All",
4944 set_menu_sensitivity_old(main_menu_factory, "/View/Colorize Conversation",
4946 set_menu_sensitivity_old(main_menu_factory, "/View/Reset Coloring 1-10",
4947 tmp_color_filters_used());
4948 set_menu_sensitivity_old(main_menu_factory, "/View/Show Packet in New Window",
4951 #ifdef MENUS_USE_UIMANAGER
4952 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ShowPacketinNewWindow",
4954 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ManuallyResolveAddress",
4955 frame_selected ? ((cf->edt->pi.ethertype == ETHERTYPE_IP)||(cf->edt->pi.ethertype == ETHERTYPE_IPv6)) : FALSE);
4956 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/SCTP",
4957 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_SCTP) : FALSE);
4958 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/FollowTCPStream",
4959 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
4960 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FollowTCPStream",
4961 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
4962 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/FollowUDPStream",
4963 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
4964 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/FollowSSLStream",
4965 frame_selected ? is_ssl : FALSE);
4966 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FollowSSLStream",
4967 frame_selected ? is_ssl : FALSE);
4968 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter",
4970 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/Ethernet",
4971 frame_selected ? (cf->edt->pi.dl_src.type == AT_ETHER) : FALSE);
4972 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/IP",
4973 frame_selected ? ((cf->edt->pi.ethertype == ETHERTYPE_IP)||(cf->edt->pi.ethertype == ETHERTYPE_IPv6)) : FALSE);
4974 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/TCP",
4975 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
4976 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/UDP",
4977 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
4978 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FollowUDPStream",
4979 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
4980 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/PN-CBA",
4981 frame_selected ? (cf->edt->pi.profinet_type != 0 && cf->edt->pi.profinet_type < 10) : FALSE);
4982 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation",
4984 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/Ethernet",
4985 frame_selected ? (cf->edt->pi.dl_src.type == AT_ETHER) : FALSE);
4986 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/IP",
4987 frame_selected ? ((cf->edt->pi.ethertype == ETHERTYPE_IP)||(cf->edt->pi.ethertype == ETHERTYPE_IPv6)) : FALSE);
4988 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/TCP",
4989 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
4990 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/UDP",
4991 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
4992 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/PN-CBA",
4993 frame_selected ? (cf->edt->pi.profinet_type != 0 && cf->edt->pi.profinet_type < 10) : FALSE);
4994 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/DecodeAs",
4995 frame_selected && decode_as_ok());
4996 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/DecodeAs",
4997 frame_selected && decode_as_ok());
4998 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/Copy",
5000 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ApplyAsFilter",
5002 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/PrepareaFilter",
5004 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ResolveName",
5005 frame_selected && (g_resolv_flags & RESOLV_ALL_ADDRS) != RESOLV_ALL_ADDRS);
5007 set_menu_sensitivity_old(packet_list_menu_factory, "/Show Packet in New Window",
5009 set_menu_sensitivity_old(packet_list_menu_factory, "/Manually Resolve Address",
5010 frame_selected ? ((cf->edt->pi.ethertype == ETHERTYPE_IP)||(cf->edt->pi.ethertype == ETHERTYPE_IPv6)) : FALSE);
5011 set_menu_sensitivity_old(packet_list_menu_factory, "/SCTP",
5012 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_SCTP) : FALSE);
5013 set_menu_sensitivity_old(packet_list_menu_factory, "/Follow TCP Stream",
5014 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
5015 set_menu_sensitivity_old(tree_view_menu_factory, "/Follow TCP Stream",
5016 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
5017 set_menu_sensitivity_old(packet_list_menu_factory, "/Follow UDP Stream",
5018 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
5019 set_menu_sensitivity_old(tree_view_menu_factory, "/Follow UDP Stream",
5020 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
5021 set_menu_sensitivity_old(packet_list_menu_factory, "/Follow SSL Stream",
5022 frame_selected ? is_ssl : FALSE);
5023 set_menu_sensitivity_old(tree_view_menu_factory, "/Follow SSL Stream",
5024 frame_selected ? is_ssl : FALSE);
5025 set_menu_sensitivity_old(packet_list_menu_factory, "/Conversation Filter",
5027 set_menu_sensitivity_old(packet_list_menu_factory, "/Conversation Filter/Ethernet",
5028 frame_selected ? (cf->edt->pi.dl_src.type == AT_ETHER) : FALSE);
5029 set_menu_sensitivity_old(packet_list_menu_factory, "/Conversation Filter/IP",
5030 frame_selected ? ((cf->edt->pi.ethertype == ETHERTYPE_IP)||(cf->edt->pi.ethertype == ETHERTYPE_IPv6)) : FALSE);
5031 set_menu_sensitivity_old(packet_list_menu_factory, "/Conversation Filter/TCP",
5032 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
5033 set_menu_sensitivity_old(packet_list_menu_factory, "/Conversation Filter/UDP",
5034 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
5035 set_menu_sensitivity_old(packet_list_menu_factory, "/Conversation Filter/PN-CBA Server",
5036 frame_selected ? (cf->edt->pi.profinet_type != 0 && cf->edt->pi.profinet_type < 10) : FALSE);
5037 set_menu_sensitivity_old(packet_list_menu_factory, "/Colorize Conversation",
5039 set_menu_sensitivity_old(packet_list_menu_factory, "/Colorize Conversation/Ethernet",
5040 frame_selected ? (cf->edt->pi.dl_src.type == AT_ETHER) : FALSE);
5041 set_menu_sensitivity_old(packet_list_menu_factory, "/Colorize Conversation/IP",
5042 frame_selected ? ((cf->edt->pi.ethertype == ETHERTYPE_IP)||(cf->edt->pi.ethertype == ETHERTYPE_IPv6)) : FALSE);
5043 set_menu_sensitivity_old(packet_list_menu_factory, "/Colorize Conversation/TCP",
5044 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
5045 set_menu_sensitivity_old(packet_list_menu_factory, "/Colorize Conversation/UDP",
5046 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
5047 set_menu_sensitivity_old(packet_list_menu_factory, "/Colorize Conversation/PN-CBA Server",
5048 frame_selected ? (cf->edt->pi.profinet_type != 0 && cf->edt->pi.profinet_type < 10) : FALSE);
5049 set_menu_sensitivity_old(packet_list_menu_factory, "/Decode As...",
5050 frame_selected && decode_as_ok());
5051 set_menu_sensitivity_old(tree_view_menu_factory, "/Decode As...",
5052 frame_selected && decode_as_ok());
5053 set_menu_sensitivity_old(packet_list_menu_factory, "/Copy",
5055 set_menu_sensitivity_old(packet_list_menu_factory, "/Apply as Filter",
5057 set_menu_sensitivity_old(packet_list_menu_factory, "/Prepare a Filter",
5059 set_menu_sensitivity_old(tree_view_menu_factory, "/Resolve Name",
5060 frame_selected && (g_resolv_flags & RESOLV_ALL_ADDRS) != RESOLV_ALL_ADDRS);
5062 set_menu_sensitivity_old(main_menu_factory, "/Analyze/Follow TCP Stream",
5063 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
5064 set_menu_sensitivity_old(main_menu_factory, "/Analyze/Follow UDP Stream",
5065 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
5066 set_menu_sensitivity_old(main_menu_factory, "/Analyze/Follow SSL Stream",
5067 frame_selected ? is_ssl : FALSE);
5068 set_menu_sensitivity_old(main_menu_factory, "/Analyze/Decode As...",
5069 frame_selected && decode_as_ok());
5070 set_menu_sensitivity_old(main_menu_factory, "/View/Name Resolution/Resolve Name",
5071 frame_selected && (g_resolv_flags & RESOLV_ALL_ADDRS) != RESOLV_ALL_ADDRS);
5072 set_menu_sensitivity_old(main_menu_factory, "/Tools/Firewall ACL Rules",
5075 walk_menu_tree_for_selected_packet(tap_menu_tree_root, cf->current_frame,
5079 /* Enable or disable menu items based on whether a tree row is selected
5080 and, if so, on the properties of the tree row. */
5082 walk_menu_tree_for_selected_tree_row(GList *node, field_info *fi)
5084 gboolean is_enabled;
5086 menu_item_t *node_data = node->data;
5089 * Is this a leaf node or an interior node?
5091 if (node_data->children == NULL) {
5095 * If it has no "selected_tree_row_enabled()" routine,
5096 * leave its enabled/disabled status alone - it
5097 * doesn't depend on whether we have a tree row selected
5098 * or not or on the selected tree row.
5100 * If it has a "selected_tree_row_enabled()" routine,
5101 * call it and set the item's enabled/disabled status
5102 * based on its return value.
5104 if (node_data->selected_tree_row_enabled != NULL)
5105 node_data->enabled = node_data->selected_tree_row_enabled(fi, node_data->callback_data);
5108 * It's an interior node; call
5109 * "walk_menu_tree_for_selected_tree_row()" on all its
5110 * children and, if any of them are enabled, enable
5111 * this node, otherwise disable it.
5113 * XXX - should we just leave all interior nodes enabled?
5114 * Which is a better UI choice?
5117 for (child = node_data->children; child != NULL; child =
5119 if (walk_menu_tree_for_selected_tree_row(child, fi))
5122 node_data->enabled = is_enabled;
5126 * The root node doesn't correspond to a menu tree item; it
5127 * has a null name pointer.
5129 if (node_data->name != NULL) {
5130 set_menu_sensitivity_old(main_menu_factory, node_data->name,
5131 node_data->enabled);
5133 return node_data->enabled;
5137 menu_prefs_toggle_bool (GtkWidget *w, gpointer data)
5139 gboolean *value = data;
5140 module_t *module = g_object_get_data (G_OBJECT(w), "module");
5142 module->prefs_changed = TRUE;
5145 prefs_apply (module);
5146 if (!prefs.gui_use_pref_save) {
5149 redissect_packets();
5153 menu_prefs_change_enum (GtkWidget *w, gpointer data)
5156 module_t *module = g_object_get_data (G_OBJECT(w), "module");
5157 gint new_value = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(w), "enumval"));
5159 if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM(w)))
5162 if (*value != new_value) {
5163 module->prefs_changed = TRUE;
5166 prefs_apply (module);
5167 if (!prefs.gui_use_pref_save) {
5170 redissect_packets();
5175 menu_prefs_reset(void)
5177 #ifdef MENUS_USE_UIMANAGER
5178 g_free (g_object_get_data(G_OBJECT(ui_manager_tree_view_menu), "menu_abbrev"));
5179 g_object_set_data(G_OBJECT(ui_manager_tree_view_menu), "menu_abbrev", NULL);
5181 g_free (g_object_get_data(G_OBJECT(tree_view_menu_factory), "menu_abbrev"));
5182 g_object_set_data(G_OBJECT(tree_view_menu_factory), "menu_abbrev", NULL);
5187 menu_prefs_change_ok (GtkWidget *w, gpointer parent_w)
5189 GtkWidget *entry = g_object_get_data (G_OBJECT(w), "entry");
5190 module_t *module = g_object_get_data (G_OBJECT(w), "module");
5191 pref_t *pref = g_object_get_data (G_OBJECT(w), "pref");
5192 const gchar *new_value = gtk_entry_get_text(GTK_ENTRY(entry));
5197 switch (pref->type) {
5199 uval = strtoul(new_value, &p, pref->info.base);
5200 if (p == new_value || *p != '\0') {
5201 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
5202 "The value \"%s\" isn't a valid number.",
5206 if (*pref->varp.uint != uval) {
5207 module->prefs_changed = TRUE;
5208 *pref->varp.uint = uval;
5212 if (strcmp (*pref->varp.string, new_value) != 0) {
5213 module->prefs_changed = TRUE;
5214 g_free((void*)*pref->varp.string);
5215 *pref->varp.string = g_strdup(new_value);
5219 if (range_convert_str(&newrange, new_value, pref->info.max_value) != CVT_NO_ERROR) {
5220 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
5221 "The value \"%s\" isn't a valid range.",
5225 if (!ranges_are_equal(*pref->varp.range, newrange)) {
5226 module->prefs_changed = TRUE;
5227 g_free(*pref->varp.range);
5228 *pref->varp.range = newrange;
5234 g_assert_not_reached();
5238 if (module->prefs_changed) {
5239 /* Ensure we reload the sub menu */
5241 prefs_apply (module);
5242 if (!prefs.gui_use_pref_save) {
5245 redissect_packets();
5248 window_destroy(GTK_WIDGET(parent_w));
5252 menu_prefs_change_cancel (GtkWidget *w _U_, gpointer parent_w)
5254 window_destroy(GTK_WIDGET(parent_w));
5258 menu_prefs_edit_dlg (GtkWidget *w, gpointer data)
5260 pref_t *pref = data;
5261 module_t *module = g_object_get_data (G_OBJECT(w), "module");
5262 gchar *value = NULL;
5264 GtkWidget *win, *main_tb, *main_vb, *bbox, *cancel_bt, *ok_bt;
5265 GtkWidget *entry, *label;
5266 GtkTooltips *tooltips;
5268 switch (pref->type) {
5270 switch (pref->info.base) {
5272 value = g_strdup_printf("%o", *pref->varp.uint);
5275 value = g_strdup_printf("%u", *pref->varp.uint);
5278 value = g_strdup_printf("%x", *pref->varp.uint);
5281 g_assert_not_reached();
5286 value = g_strdup(*pref->varp.string);
5289 value = g_strdup(range_convert_range (*pref->varp.range));
5292 g_assert_not_reached();
5296 tooltips = gtk_tooltips_new();
5298 win = dlg_window_new(module->description);
5300 gtk_window_set_resizable(GTK_WINDOW(win),FALSE);
5301 gtk_window_resize(GTK_WINDOW(win), 400, 100);
5303 main_vb = gtk_vbox_new(FALSE, 5);
5304 gtk_container_add(GTK_CONTAINER(win), main_vb);
5305 gtk_container_set_border_width(GTK_CONTAINER(main_vb), 6);
5307 main_tb = gtk_table_new(2, 2, FALSE);
5308 gtk_box_pack_start(GTK_BOX(main_vb), main_tb, FALSE, FALSE, 0);
5309 gtk_table_set_col_spacings(GTK_TABLE(main_tb), 10);
5311 label = gtk_label_new(ep_strdup_printf("%s:", pref->title));
5312 gtk_table_attach_defaults(GTK_TABLE(main_tb), label, 0, 1, 1, 2);
5313 gtk_misc_set_alignment(GTK_MISC(label), 1.0f, 0.5f);
5314 if (pref->description)
5315 gtk_tooltips_set_tip(tooltips, label, pref->description, NULL);
5317 entry = gtk_entry_new();
5318 gtk_table_attach_defaults(GTK_TABLE(main_tb), entry, 1, 2, 1, 2);
5319 gtk_entry_set_text(GTK_ENTRY(entry), value);
5320 if (pref->description)
5321 gtk_tooltips_set_tip(tooltips, entry, pref->description, NULL);
5323 bbox = dlg_button_row_new(GTK_STOCK_CANCEL,GTK_STOCK_OK, NULL);
5324 gtk_box_pack_end(GTK_BOX(main_vb), bbox, FALSE, FALSE, 0);
5326 ok_bt = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_OK);
5327 g_object_set_data (G_OBJECT(ok_bt), "module", module);
5328 g_object_set_data (G_OBJECT(ok_bt), "entry", entry);
5329 g_object_set_data (G_OBJECT(ok_bt), "pref", pref);
5330 g_signal_connect(ok_bt, "clicked", G_CALLBACK(menu_prefs_change_ok), win);
5332 dlg_set_activate(entry, ok_bt);
5334 cancel_bt = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_CANCEL);
5335 g_signal_connect(cancel_bt, "clicked", G_CALLBACK(menu_prefs_change_cancel), win);
5336 window_set_cancel_button(win, cancel_bt, NULL);
5338 gtk_widget_grab_default(ok_bt);
5339 gtk_widget_show_all(win);
5344 add_protocol_prefs_menu (pref_t *pref, gpointer data)
5346 GtkWidget *menu_preferences;
5347 GtkWidget *menu_item, *menu_sub_item, *sub_menu;
5348 GSList *group = NULL;
5349 module_t *module = data;
5350 const enum_val_t *enum_valp;
5351 gchar *label = NULL;
5353 switch (pref->type) {
5355 switch (pref->info.base) {
5357 label = g_strdup_printf ("%s: %o", pref->title, *pref->varp.uint);
5360 label = g_strdup_printf ("%s: %u", pref->title, *pref->varp.uint);
5363 label = g_strdup_printf ("%s: %x", pref->title, *pref->varp.uint);
5366 g_assert_not_reached();
5369 menu_item = gtk_menu_item_new_with_label(label);
5370 g_object_set_data (G_OBJECT(menu_item), "module", module);
5371 g_signal_connect(menu_item, "activate", G_CALLBACK(menu_prefs_edit_dlg), pref);
5375 menu_item = gtk_check_menu_item_new_with_label(pref->title);
5376 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menu_item), *pref->varp.boolp);
5377 g_object_set_data (G_OBJECT(menu_item), "module", module);
5378 g_signal_connect(menu_item, "activate", G_CALLBACK(menu_prefs_toggle_bool), pref->varp.boolp);
5381 menu_item = gtk_menu_item_new_with_label(pref->title);
5382 sub_menu = gtk_menu_new();
5383 gtk_menu_item_set_submenu (GTK_MENU_ITEM(menu_item), sub_menu);
5384 enum_valp = pref->info.enum_info.enumvals;
5385 while (enum_valp->name != NULL) {
5386 menu_sub_item = gtk_radio_menu_item_new_with_label(group, enum_valp->description);
5387 group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_sub_item));
5388 if (enum_valp->value == *pref->varp.enump) {
5389 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menu_sub_item), TRUE);
5391 g_object_set_data (G_OBJECT(menu_sub_item), "module", module);
5392 g_object_set_data (G_OBJECT(menu_sub_item), "enumval", GINT_TO_POINTER(enum_valp->value));
5393 g_signal_connect(menu_sub_item, "activate", G_CALLBACK(menu_prefs_change_enum), pref->varp.enump);
5394 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_sub_item);
5395 gtk_widget_show (menu_sub_item);
5400 label = g_strdup_printf ("%s: %s", pref->title, *pref->varp.string);
5401 menu_item = gtk_menu_item_new_with_label(label);
5402 g_object_set_data (G_OBJECT(menu_item), "module", module);
5403 g_signal_connect(menu_item, "activate", G_CALLBACK(menu_prefs_edit_dlg), pref);
5407 label = g_strdup_printf ("%s: %s", pref->title, range_convert_range (*pref->varp.range));
5408 menu_item = gtk_menu_item_new_with_label(label);
5409 g_object_set_data (G_OBJECT(menu_item), "module", module);
5410 g_signal_connect(menu_item, "activate", G_CALLBACK(menu_prefs_edit_dlg), pref);
5414 label = g_strdup_printf ("%s...", pref->title);
5415 menu_item = gtk_menu_item_new_with_label(label);
5416 g_signal_connect (menu_item, "activate", G_CALLBACK(uat_window_cb), pref->varp.uat);
5419 case PREF_STATIC_TEXT:
5422 /* Nothing to add */
5426 #ifdef MENUS_USE_UIMANAGER
5427 menu_preferences = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/ProtocolPreferences");
5429 menu_preferences = gtk_item_factory_get_widget(tree_view_menu_factory, "/Protocol Preferences");
5431 sub_menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM(menu_preferences));
5432 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
5433 gtk_widget_show (menu_item);
5439 rebuild_protocol_prefs_menu (module_t *prefs_module_p, gboolean preferences)
5441 GtkWidget *menu_preferences, *menu_item;
5442 GtkWidget *sub_menu;
5445 #ifdef MENUS_USE_UIMANAGER
5446 menu_preferences = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/ProtocolPreferences");
5448 menu_preferences = gtk_item_factory_get_widget(tree_view_menu_factory, "/Protocol Preferences");
5451 sub_menu = gtk_menu_new();
5452 gtk_menu_item_set_submenu (GTK_MENU_ITEM(menu_preferences), sub_menu);
5454 label = g_strdup_printf ("%s Preferences...", prefs_module_p->description);
5455 menu_item = gtk_image_menu_item_new_with_label (label);
5456 gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM(menu_item),
5457 gtk_image_new_from_stock(GTK_STOCK_PREFERENCES, GTK_ICON_SIZE_MENU));
5458 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
5459 g_signal_connect_swapped(GTK_OBJECT(menu_item), "activate",
5460 G_CALLBACK(properties_cb), (GtkObject *) menu_item);
5461 gtk_widget_show (menu_item);
5464 menu_item = gtk_menu_item_new();
5465 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
5466 gtk_widget_show (menu_item);
5468 prefs_pref_foreach(prefs_module_p, add_protocol_prefs_menu, prefs_module_p);
5470 /* No preferences, remove sub menu */
5471 gtk_menu_item_set_submenu (GTK_MENU_ITEM(menu_preferences), NULL);
5476 #ifdef NEW_PACKET_LIST
5478 menu_visible_column_toggle (GtkWidget *w _U_, gpointer data)
5480 new_packet_list_toggle_visible_column (GPOINTER_TO_INT(data));
5483 #ifndef MENUS_USE_UIMANAGER
5485 menu_activate_all_columns (GtkWidget *w _U_, gpointer data _U_)
5487 new_packet_list_set_all_columns_visible ();
5492 rebuild_visible_columns_menu (void)
5494 GtkWidget *menu_columns[2], *menu_item;
5495 GtkWidget *sub_menu;
5499 gint i, col_id, cur_fmt;
5501 menu_columns[0] = gtk_item_factory_get_widget(main_menu_factory, "/View/Displayed Columns");
5502 #ifdef MENUS_USE_UIMANAGER
5503 menu_columns[1] = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/DisplayedColumns");
5505 menu_columns[1] = gtk_item_factory_get_widget(packet_list_heading_factory, "/Displayed Columns");
5508 if(! menu_columns[1]){
5509 fprintf (stderr, "Warning: couldn't find menu_columns[1] path=/PacketListHeadingPopup/DisplayedColumns");
5512 for (i = 0; i < 2; i++) {
5513 sub_menu = gtk_menu_new();
5514 gtk_menu_item_set_submenu (GTK_MENU_ITEM(menu_columns[i]), sub_menu);
5516 clp = g_list_first (prefs.col_list);
5519 cfmt = (fmt_data *) clp->data;
5520 cur_fmt = get_column_format_from_str(cfmt->fmt);
5521 if (cur_fmt == COL_CUSTOM) {
5522 title = g_strdup_printf ("%s (%s)", cfmt->title, cfmt->custom_field);
5524 title = g_strdup_printf ("%s (%s)", cfmt->title, col_format_desc (cur_fmt));
5526 menu_item = gtk_check_menu_item_new_with_label(title);
5528 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menu_item), cfmt->visible);
5529 g_signal_connect(menu_item, "activate", G_CALLBACK(menu_visible_column_toggle), GINT_TO_POINTER(col_id));
5530 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
5531 gtk_widget_show (menu_item);
5532 clp = g_list_next (clp);
5536 menu_item = gtk_menu_item_new();
5537 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
5538 gtk_widget_show (menu_item);
5540 menu_item = gtk_menu_item_new_with_label ("Display All");
5541 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
5542 #ifdef MENUS_USE_UIMANAGER
5543 g_signal_connect(menu_item, "activate", G_CALLBACK(packet_list_heading_activate_all_columns), NULL);
5545 g_signal_connect(menu_item, "activate", G_CALLBACK(menu_activate_all_columns), NULL);
5547 gtk_widget_show (menu_item);
5553 menus_set_column_resolved (gboolean resolved, gboolean can_resolve)
5557 #ifdef MENUS_USE_UIMANAGER
5558 menu = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/ShowResolved");
5560 fprintf (stderr, "Warning: couldn't find menu path=/PacketListHeadingPopup/ShowResolved");
5562 g_object_set_data(G_OBJECT(menu), "skip-update", (void *)1);
5563 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), resolved && can_resolve);
5564 set_menu_sensitivity(ui_manager_packet_list_heading, "/PacketListHeadingPopup/ShowResolved", can_resolve);
5565 g_object_set_data(G_OBJECT(menu), "skip-update", NULL);
5567 menu = gtk_item_factory_get_widget(packet_list_heading_factory, "/Show Resolved");
5568 g_object_set_data(G_OBJECT(menu), "skip-update", (void *)1);
5569 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), resolved && can_resolve);
5570 set_menu_sensitivity_old(packet_list_heading_factory, "/Show Resolved", can_resolve);
5571 g_object_set_data(G_OBJECT(menu), "skip-update", NULL);
5577 menus_set_column_align_default (gboolean right_justify)
5579 GtkWidget *submenu, *menu_item_child;
5580 GList *child_list, *child_list_item;
5581 const gchar *menu_item_name;
5582 size_t menu_item_len;
5584 /* get the submenu container item */
5585 #ifdef MENUS_USE_UIMANAGER
5586 submenu = gtk_ui_manager_get_widget (ui_manager_packet_list_heading, "/PacketListHeadingPopup");
5588 fprintf (stderr, "Warning: couldn't find submenu path=/PacketListHeadingPopup");
5591 submenu = packet_list_heading_factory->widget;
5594 /* find the corresponding menu items to update */
5595 child_list = gtk_container_get_children(GTK_CONTAINER(submenu));
5596 child_list_item = child_list;
5597 while(child_list_item) {
5598 menu_item_child = (GTK_BIN(child_list_item->data))->child;
5599 if (menu_item_child != NULL) {
5600 menu_item_name = gtk_label_get_text(GTK_LABEL(menu_item_child));
5601 menu_item_len = strlen (menu_item_name);
5602 if(strncmp(menu_item_name, "Align Left", 10) == 0) {
5603 if (!right_justify && menu_item_len == 10) {
5604 gtk_label_set_text(GTK_LABEL(menu_item_child), "Align Left\t(default)");
5605 } else if (right_justify && menu_item_len > 10) {
5606 gtk_label_set_text(GTK_LABEL(menu_item_child), "Align Left");
5608 } else if (strncmp (menu_item_name, "Align Right", 11) == 0) {
5609 if (right_justify && menu_item_len == 11) {
5610 gtk_label_set_text(GTK_LABEL(menu_item_child), "Align Right\t(default)");
5611 } else if (!right_justify && menu_item_len > 11) {
5612 gtk_label_set_text(GTK_LABEL(menu_item_child), "Align Right");
5616 child_list_item = g_list_next(child_list_item);
5618 g_list_free(child_list);
5622 set_menus_for_selected_tree_row(capture_file *cf)
5624 gboolean properties;
5627 if (cf->finfo_selected != NULL) {
5628 header_field_info *hfinfo = cf->finfo_selected->hfinfo;
5632 if (hfinfo->parent == -1) {
5633 abbrev = hfinfo->abbrev;
5634 id = (hfinfo->type == FT_PROTOCOL) ? proto_get_id((protocol_t *)hfinfo->strings) : -1;
5636 abbrev = proto_registrar_get_abbrev(hfinfo->parent);
5637 id = hfinfo->parent;
5639 properties = prefs_is_registered_protocol(abbrev);
5640 #ifdef MENUS_USE_UIMANAGER
5641 set_menu_sensitivity(ui_manager_tree_view_menu,
5642 "/TreeViewPopup/GotoCorrespondingPacket", hfinfo->type == FT_FRAMENUM);
5643 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/Copy",
5645 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/Copy/AsFilter",
5646 proto_can_match_selected(cf->finfo_selected, cf->edt));
5647 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyasColumn",
5648 hfinfo->type != FT_NONE);
5649 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter",
5650 proto_can_match_selected(cf->finfo_selected, cf->edt));
5651 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter",
5652 proto_can_match_selected(cf->finfo_selected, cf->edt));
5653 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ColorizewithFilter",
5654 proto_can_match_selected(cf->finfo_selected, cf->edt));
5655 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ProtocolPreferences",
5657 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/DisableProtocol",
5658 (id == -1) ? FALSE : proto_can_toggle_protocol(id));
5659 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ExpandSubtrees", cf->finfo_selected->tree_type != -1);
5660 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/WikiProtocolPage",
5661 (id == -1) ? FALSE : TRUE);
5662 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FilterFieldReference",
5663 (id == -1) ? FALSE : TRUE);
5665 set_menu_sensitivity_old(tree_view_menu_factory,
5666 "/Go to Corresponding Packet", hfinfo->type == FT_FRAMENUM);
5667 set_menu_sensitivity_old(tree_view_menu_factory, "/Copy",
5669 set_menu_sensitivity_old(tree_view_menu_factory, "/Copy/As Filter",
5670 proto_can_match_selected(cf->finfo_selected, cf->edt));
5671 set_menu_sensitivity_old(tree_view_menu_factory, "/Apply as Column",
5672 hfinfo->type != FT_NONE);
5673 set_menu_sensitivity_old(tree_view_menu_factory, "/Apply as Filter",
5674 proto_can_match_selected(cf->finfo_selected, cf->edt));
5675 set_menu_sensitivity_old(tree_view_menu_factory, "/Prepare a Filter",
5676 proto_can_match_selected(cf->finfo_selected, cf->edt));
5677 set_menu_sensitivity_old(tree_view_menu_factory, "/Colorize with Filter",
5678 proto_can_match_selected(cf->finfo_selected, cf->edt));
5679 set_menu_sensitivity_old(tree_view_menu_factory, "/Protocol Preferences",
5681 set_menu_sensitivity_old(tree_view_menu_factory, "/Disable Protocol...",
5682 (id == -1) ? FALSE : proto_can_toggle_protocol(id));
5683 set_menu_sensitivity_old(tree_view_menu_factory, "/Expand Subtrees", cf->finfo_selected->tree_type != -1);
5684 set_menu_sensitivity_old(tree_view_menu_factory, "/Wiki Protocol Page",
5685 (id == -1) ? FALSE : TRUE);
5686 set_menu_sensitivity_old(tree_view_menu_factory, "/Filter Field Reference",
5687 (id == -1) ? FALSE : TRUE);
5689 set_menu_sensitivity_old(main_menu_factory,
5690 "/File/Export/Selected Packet Bytes...", TRUE);
5691 set_menu_sensitivity_old(main_menu_factory,
5692 "/Go/Go to Corresponding Packet", hfinfo->type == FT_FRAMENUM);
5693 set_menu_sensitivity_old(main_menu_factory, "/Edit/Copy/Description",
5694 proto_can_match_selected(cf->finfo_selected, cf->edt));
5695 set_menu_sensitivity_old(main_menu_factory, "/Edit/Copy/Fieldname",
5696 proto_can_match_selected(cf->finfo_selected, cf->edt));
5697 set_menu_sensitivity_old(main_menu_factory, "/Edit/Copy/Value",
5698 proto_can_match_selected(cf->finfo_selected, cf->edt));
5699 set_menu_sensitivity_old(main_menu_factory, "/Edit/Copy/As Filter",
5700 proto_can_match_selected(cf->finfo_selected, cf->edt));
5701 set_menu_sensitivity_old(main_menu_factory, "/Analyze/Apply as Column",
5702 hfinfo->type != FT_NONE);
5703 set_menu_sensitivity_old(main_menu_factory, "/Analyze/Apply as Filter",
5704 proto_can_match_selected(cf->finfo_selected, cf->edt));
5705 set_menu_sensitivity_old(main_menu_factory, "/Analyze/Prepare a Filter",
5706 proto_can_match_selected(cf->finfo_selected, cf->edt));
5707 set_menu_sensitivity_old(main_menu_factory, "/View/Expand Subtrees", cf->finfo_selected->tree_type != -1);
5709 #ifdef MENUS_USE_UIMANAGER
5710 prev_abbrev = g_object_get_data(G_OBJECT(ui_manager_tree_view_menu), "menu_abbrev");
5712 prev_abbrev = g_object_get_data(G_OBJECT(tree_view_menu_factory), "menu_abbrev");
5714 if (!prev_abbrev || (strcmp (prev_abbrev, abbrev) != 0)) {
5715 /* No previous protocol or protocol changed - update Protocol Preferences menu */
5716 module_t *prefs_module_p = prefs_find_module(abbrev);
5717 rebuild_protocol_prefs_menu (prefs_module_p, properties);
5719 #ifdef MENUS_USE_UIMANAGER
5720 g_object_set_data(G_OBJECT(ui_manager_tree_view_menu), "menu_abbrev", g_strdup(abbrev));
5722 g_object_set_data(G_OBJECT(tree_view_menu_factory), "menu_abbrev", g_strdup(abbrev));
5724 g_free (prev_abbrev);
5727 #ifdef MENUS_USE_UIMANAGER
5728 set_menu_sensitivity(ui_manager_tree_view_menu,
5729 "/TreeViewPopup/GotoCorrespondingPacket", FALSE);
5730 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/Copy", FALSE);
5731 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyasColumn", FALSE);
5732 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter", FALSE);
5733 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter", FALSE);
5734 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ColorizewithFilter", FALSE);
5735 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ProtocolPreferences",
5737 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/DisableProtocol", FALSE);
5738 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ExpandSubtrees", FALSE);
5739 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/WikiProtocolPage",
5741 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FilterFieldReference",
5744 set_menu_sensitivity_old(tree_view_menu_factory,
5745 "/Go to Corresponding Packet", FALSE);
5746 set_menu_sensitivity_old(tree_view_menu_factory, "/Copy", FALSE);
5747 set_menu_sensitivity_old(tree_view_menu_factory, "/Apply as Column", FALSE);
5748 set_menu_sensitivity_old(tree_view_menu_factory, "/Apply as Filter", FALSE);
5749 set_menu_sensitivity_old(tree_view_menu_factory, "/Prepare a Filter", FALSE);
5750 set_menu_sensitivity_old(tree_view_menu_factory, "/Colorize with Filter", FALSE);
5751 set_menu_sensitivity_old(tree_view_menu_factory, "/Protocol Preferences",
5753 set_menu_sensitivity_old(tree_view_menu_factory, "/Disable Protocol...", FALSE);
5754 set_menu_sensitivity_old(tree_view_menu_factory, "/Expand Subtrees", FALSE);
5755 set_menu_sensitivity_old(tree_view_menu_factory, "/Wiki Protocol Page",
5757 set_menu_sensitivity_old(tree_view_menu_factory, "/Filter Field Reference",
5760 set_menu_sensitivity_old(main_menu_factory,
5761 "/File/Export/Selected Packet Bytes...", FALSE);
5762 set_menu_sensitivity_old(main_menu_factory,
5763 "/Go/Go to Corresponding Packet", FALSE);
5764 set_menu_sensitivity_old(main_menu_factory, "/Edit/Copy/Description", FALSE);
5765 set_menu_sensitivity_old(main_menu_factory, "/Edit/Copy/Fieldname", FALSE);
5766 set_menu_sensitivity_old(main_menu_factory, "/Edit/Copy/Value", FALSE);
5767 set_menu_sensitivity_old(main_menu_factory, "/Edit/Copy/As Filter", FALSE);
5768 set_menu_sensitivity_old(main_menu_factory, "/Analyze/Apply as Column", FALSE);
5769 set_menu_sensitivity_old(main_menu_factory, "/Analyze/Apply as Filter", FALSE);
5770 set_menu_sensitivity_old(main_menu_factory, "/Analyze/Prepare a Filter", FALSE);
5771 set_menu_sensitivity_old(main_menu_factory, "/View/Expand Subtrees", FALSE);
5774 walk_menu_tree_for_selected_tree_row(tap_menu_tree_root, cf->finfo_selected);
5777 void set_menus_for_packet_history(gboolean back_history, gboolean forward_history) {
5779 set_menu_sensitivity_old(main_menu_factory, "/Go/Back", back_history);
5780 set_menu_sensitivity_old(main_menu_factory, "/Go/Forward", forward_history);
5782 set_toolbar_for_packet_history(back_history, forward_history);
5786 void set_menus_for_file_set(gboolean file_set, gboolean previous_file, gboolean next_file) {
5788 set_menu_sensitivity_old(main_menu_factory, "/File/File Set/List Files", file_set);
5789 set_menu_sensitivity_old(main_menu_factory, "/File/File Set/Previous File", previous_file);
5790 set_menu_sensitivity_old(main_menu_factory, "/File/File Set/Next File", next_file);
5799 * indent-tabs-mode: nil
5802 * ex: set shiftwidth=4 tabstop=8 expandtab
5803 * :indentSize=4:tabSize=8:noTabs=true: