add parameter dcerpc_info to PIDL_dissect_ipv?address()
[wireshark-wip.git] / ui / gtk / main_menubar.c
blob52b4128f687d0b8e45fec4017d475fa5fbc51855
1 /* main_menubar.c
2 * Menu routines
4 * $Id$
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 #include "config.h"
26 #include <gtk/gtk.h>
28 #include <stdio.h>
29 #include <string.h>
31 #include <wsutil/u3.h>
33 #include <epan/packet.h>
34 #include <epan/addr_resolv.h>
35 #include <epan/prefs.h>
36 #include <epan/prefs-int.h>
37 #include <epan/tap.h>
38 #include <epan/timestamp.h>
39 #include <epan/etypes.h>
40 #include <epan/ipproto.h>
41 #include <epan/dissector_filters.h>
42 #include <epan/strutil.h>
43 #include <epan/plugins.h>
44 #include <epan/epan_dissect.h>
45 #include <epan/column.h>
46 #include <epan/stats_tree_priv.h>
47 #include <epan/filesystem.h>
48 #include <epan/print.h>
50 #include "cfile.h"
51 #include "globals.h"
52 #include "color_filters.h"
53 #include "stat_menu.h"
55 #include "ui/iface_lists.h"
56 #include "ui/main_statusbar.h"
57 #include "ui/preference_utils.h"
58 #include "ui/recent.h"
59 #include "ui/recent_utils.h"
60 #include "ui/simple_dialog.h"
61 #include "ui/software_update.h"
62 #include "ui/ui_util.h"
63 #include "ui/utf8_entities.h"
65 #include "ui/gtk/about_dlg.h"
66 #include "ui/gtk/capture_dlg.h"
67 #include "ui/gtk/capture_if_dlg.h"
68 #include "ui/gtk/color_dlg.h"
69 #include "ui/gtk/export_object_dlg.h"
70 #include "ui/gtk/filter_dlg.h"
71 #include "ui/gtk/profile_dlg.h"
72 #include "ui/gtk/dlg_utils.h"
73 #include "ui/gtk/capture_file_dlg.h"
74 #include "ui/gtk/fileset_dlg.h"
75 #include "ui/gtk/file_import_dlg.h"
76 #include "ui/gtk/find_dlg.h"
77 #include "ui/gtk/goto_dlg.h"
78 #include "ui/gtk/summary_dlg.h"
79 #include "ui/gtk/prefs_dlg.h"
80 #include "ui/gtk/packet_win.h"
81 #include "ui/gtk/follow_tcp.h"
82 #include "ui/gtk/follow_udp.h"
83 #include "ui/gtk/follow_ssl.h"
84 #include "ui/gtk/decode_as_dlg.h"
85 #include "ui/gtk/help_dlg.h"
86 #include "ui/gtk/supported_protos_dlg.h"
87 #include "ui/gtk/proto_dlg.h"
88 #include "ui/gtk/proto_hier_stats_dlg.h"
89 #include "ui/gtk/keys.h"
90 #include "ui/gtk/stock_icons.h"
91 #include "ui/gtk/gtkglobals.h"
92 #include "ui/gtk/packet_panes.h"
93 #include "ui/gtk/conversations_table.h"
94 #include "ui/gtk/hostlist_table.h"
95 #include "ui/gtk/packet_history.h"
96 #include "ui/tap-sctp-analysis.h"
97 #include "ui/gtk/sctp_stat_gtk.h"
98 #include "ui/gtk/firewall_dlg.h"
99 #include "ui/gtk/macros_dlg.h"
100 #include "epan/dissectors/packet-ssl-utils.h"
101 #include "ui/gtk/export_sslkeys.h"
102 #include "ui/gtk/gui_stat_menu.h"
103 #include "ui/gtk/main.h"
104 #include "ui/gtk/menus.h"
105 #include "ui/gtk/main_menubar_private.h"
106 #include "ui/gtk/main_toolbar.h"
107 #include "ui/gtk/main_welcome.h"
108 #include "ui/gtk/uat_gui.h"
109 #include "ui/gtk/gui_utils.h"
110 #include "ui/gtk/manual_addr_resolv.h"
111 #include "ui/gtk/proto_help.h"
112 #include "ui/gtk/dissector_tables_dlg.h"
113 #include "ui/gtk/expert_comp_dlg.h"
114 #include "ui/gtk/time_shift_dlg.h"
115 #include "ui/gtk/edit_packet_comment_dlg.h"
116 #include "ui/gtk/addr_resolution_dlg.h"
117 #include "ui/gtk/export_pdu_dlg.h"
118 #include "ui/gtk/conversation_hastables_dlg.h"
120 #include "ui/gtk/packet_list.h"
122 #ifdef HAVE_LIBPCAP
123 #include "capture_opts.h"
124 #include "ui/capture_globals.h"
125 #endif
126 #ifdef HAVE_IGE_MAC_INTEGRATION
127 #include <ige-mac-menu.h>
128 #endif
130 #ifdef HAVE_GTKOSXAPPLICATION
131 #include <gtkmacintegration/gtkosxapplication.h>
132 #endif
134 static int initialize = TRUE;
135 GtkActionGroup *main_menu_bar_action_group;
136 static GtkUIManager *ui_manager_main_menubar = NULL;
137 static GtkUIManager *ui_manager_packet_list_heading = NULL;
138 static GtkUIManager *ui_manager_packet_list_menu = NULL;
139 static GtkUIManager *ui_manager_tree_view_menu = NULL;
140 static GtkUIManager *ui_manager_bytes_menu = NULL;
141 static GtkUIManager *ui_manager_statusbar_profiles_menu = NULL;
142 static GSList *popup_menu_list = NULL;
144 static GtkAccelGroup *grp;
146 static GList *merge_menu_items_list = NULL;
147 static GList *build_menubar_items_callback_list = NULL;
149 GtkWidget *popup_menu_object;
151 static void menu_open_recent_file_cmd_cb(GtkAction *action, gpointer data _U_ );
152 static void add_recent_items (guint merge_id, GtkUIManager *ui_manager);
153 static void add_tap_plugins (guint merge_id, GtkUIManager *ui_manager);
155 static void menus_init(void);
156 static void merge_menu_items(GList *node);
157 static void ws_menubar_build_external_menus(void);
158 static void set_menu_sensitivity (GtkUIManager *ui_manager, const gchar *, gint);
159 static void menu_name_resolution_update_cb(GtkAction *action, gpointer data);
160 static void name_resolution_cb(GtkWidget *w, gpointer d, gboolean* res_flag);
161 static void colorize_cb(GtkWidget *w, gpointer d);
162 static void rebuild_protocol_prefs_menu (module_t *prefs_module_p, gboolean preferences,
163 GtkUIManager *ui_menu, const char *path);
166 /* As a general GUI guideline, we try to follow the Gnome Human Interface Guidelines, which can be found at:
167 http://developer.gnome.org/projects/gup/hig/1.0/index.html
169 Please note: there are some differences between the Gnome HIG menu suggestions and our implementation:
171 File/Open Recent: the Gnome HIG suggests putting the list of recently used files as elements into the File menuitem.
172 As this is ok for only a few items, this will become unhandy for 10 or even more list entries.
173 For this reason, we use a submenu for this.
175 File/Close: the Gnome HIG suggests putting this item just above the Quit item.
176 This results in unintuitive behaviour as both Close and Quit items are very near together.
177 By putting the Close item near the open item(s), it better suggests that it will close the
178 currently opened/captured file only.
181 typedef enum {
182 CONV_ETHER = 1,
183 CONV_IP,
184 CONV_TCP,
185 CONV_UDP,
186 CONV_CBA
187 } conv_values_e;
189 static char *
190 build_conversation_filter(int action, gboolean show_dialog)
192 packet_info *pi = &cfile.edt->pi;
193 char *buf;
195 switch(action) {
196 case(CONV_CBA):
197 if (pi->profinet_type == 0) {
198 if (show_dialog) {
199 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
200 "Error filtering conversation. Please make\n"
201 "sure you have a PROFINET CBA packet selected.");
203 return NULL;
206 if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4
207 && pi->ipproto == IP_PROTO_TCP ) {
208 /* IPv4 */
209 switch(pi->profinet_type) {
210 case(1):
211 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)",
212 ip_to_str( (const guint8 *)pi->net_dst.data),
213 ip_to_str( (const guint8 *)pi->net_src.data),
214 ip_to_str( (const guint8 *)pi->net_src.data),
215 ip_to_str( (const guint8 *)pi->net_dst.data));
216 break;
217 case(2):
218 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)",
219 ip_to_str( (const guint8 *)pi->net_src.data),
220 ip_to_str( (const guint8 *)pi->net_dst.data),
221 ip_to_str( (const guint8 *)pi->net_dst.data),
222 ip_to_str( (const guint8 *)pi->net_src.data));
223 break;
224 case(3):
225 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)",
226 ip_to_str( (const guint8 *)pi->net_dst.data),
227 ip_to_str( (const guint8 *)pi->net_src.data),
228 ip_to_str( (const guint8 *)pi->net_src.data),
229 ip_to_str( (const guint8 *)pi->net_dst.data));
230 break;
231 case(4):
232 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)",
233 ip_to_str( (const guint8 *)pi->net_src.data),
234 ip_to_str( (const guint8 *)pi->net_dst.data),
235 ip_to_str( (const guint8 *)pi->net_dst.data),
236 ip_to_str( (const guint8 *)pi->net_src.data));
237 break;
238 default:
239 return NULL;
241 } else {
242 return NULL;
244 break;
245 case(CONV_TCP):
246 if (pi->ipproto != IP_PROTO_TCP) {
247 if (show_dialog) {
248 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
249 "Error filtering conversation. Please make\n"
250 "sure you have a TCP packet selected.");
252 return NULL;
255 if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4 ) {
256 /* TCP over IPv4 */
257 buf = g_strdup_printf("(ip.addr eq %s and ip.addr eq %s) and (tcp.port eq %d and tcp.port eq %d)",
258 ip_to_str( (const guint8 *)pi->net_src.data),
259 ip_to_str( (const guint8 *)pi->net_dst.data),
260 pi->srcport, pi->destport );
261 } else if( pi->net_src.type == AT_IPv6 && pi->net_dst.type == AT_IPv6 ) {
262 /* TCP over IPv6 */
263 buf = g_strdup_printf("(ipv6.addr eq %s and ipv6.addr eq %s) and (tcp.port eq %d and tcp.port eq %d)",
264 ip6_to_str((const struct e_in6_addr *)pi->net_src.data),
265 ip6_to_str((const struct e_in6_addr *)pi->net_dst.data),
266 pi->srcport, pi->destport );
267 } else {
268 return NULL;
270 break;
271 case(CONV_UDP):
272 if (pi->ipproto != IP_PROTO_UDP) {
273 if (show_dialog) {
274 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
275 "Error filtering conversation. Please make\n"
276 "sure you have a UDP packet selected.");
278 return NULL;
281 if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4 ) {
282 /* UDP over IPv4 */
283 buf = g_strdup_printf("(ip.addr eq %s and ip.addr eq %s) and (udp.port eq %d and udp.port eq %d)",
284 ip_to_str( (const guint8 *)pi->net_src.data),
285 ip_to_str( (const guint8 *)pi->net_dst.data),
286 pi->srcport, pi->destport );
287 } else if( pi->net_src.type == AT_IPv6 && pi->net_dst.type == AT_IPv6 ) {
288 /* UDP over IPv6 */
289 buf = g_strdup_printf("(ipv6.addr eq %s and ipv6.addr eq %s) and (udp.port eq %d and udp.port eq %d)",
290 ip6_to_str((const struct e_in6_addr *)pi->net_src.data),
291 ip6_to_str((const struct e_in6_addr *)pi->net_dst.data),
292 pi->srcport, pi->destport );
293 } else {
294 return NULL;
296 break;
297 case(CONV_IP):
298 if ((pi->ethertype != ETHERTYPE_IP) && (pi->ethertype != ETHERTYPE_IPv6)) {
299 if (show_dialog) {
300 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
301 "Error filtering conversation. Please make\n"
302 "sure you have a IP packet selected.");
304 return NULL;
307 if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4 ) {
308 /* IPv4 */
309 buf = g_strdup_printf("ip.addr eq %s and ip.addr eq %s",
310 ip_to_str( (const guint8 *)pi->net_src.data),
311 ip_to_str( (const guint8 *)pi->net_dst.data));
312 } else if( pi->net_src.type == AT_IPv6 && pi->net_dst.type == AT_IPv6 ) {
313 /* IPv6 */
314 buf = g_strdup_printf("ipv6.addr eq %s and ipv6.addr eq %s",
315 ip6_to_str((const struct e_in6_addr *)pi->net_src.data),
316 ip6_to_str((const struct e_in6_addr *)pi->net_dst.data));
317 } else {
318 return NULL;
320 break;
321 case(CONV_ETHER):
322 /* XXX - is this the right way to check for Ethernet? */
323 /* check for the data link address type */
324 /* (ethertype will be 0 when used as length field) */
325 if (pi->dl_src.type != AT_ETHER) {
326 if (show_dialog) {
327 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
328 "Error filtering conversation. Please make\n"
329 "sure you have a Ethernet packet selected.");
331 return NULL;
334 if( pi->dl_src.type == AT_ETHER && pi->dl_dst.type == AT_ETHER ) {
335 /* Ethernet */
336 buf = g_strdup_printf("eth.addr eq %s and eth.addr eq %s",
337 ether_to_str( (const guint8 *)pi->dl_src.data),
338 ether_to_str( (const guint8 *)pi->dl_dst.data));
339 } else {
340 return NULL;
342 break;
343 default:
344 return NULL;
347 return buf;
350 static void
351 new_window_cb(GtkWidget *widget)
353 new_packet_window(widget, FALSE, FALSE);
356 static void
357 new_window_cb_ref(GtkWidget *widget)
359 new_packet_window(widget, TRUE, FALSE);
362 #ifdef WANT_PACKET_EDITOR
363 static void
364 edit_window_cb(GtkWidget *widget _U_)
366 new_packet_window(widget, FALSE, TRUE);
368 #endif
370 static void
371 conversation_cb(GtkAction *a _U_, gpointer data _U_, int action)
373 gchar *filter;
374 GtkWidget *filter_te;
376 if (cfile.current_frame) {
377 /* create a filter-string based on the selected packet and action */
378 filter = build_conversation_filter(action, TRUE);
380 /* Run the display filter so it goes in effect - even if it's the
381 same as the previous display filter. */
382 filter_te = gtk_bin_get_child(GTK_BIN(g_object_get_data(G_OBJECT(top_level), E_DFILTER_CM_KEY)));
384 gtk_entry_set_text(GTK_ENTRY(filter_te), filter);
385 main_filter_packets(&cfile, filter, TRUE);
387 g_free(filter);
391 static void
392 colorize_conversation_cb(GtkAction *action _U_, gpointer data _U_, int action_num)
394 gchar *filter = NULL;
396 if( (action_num>>8) == 255 ) {
397 color_filters_reset_tmp();
398 packet_list_colorize_packets();
399 } else if (cfile.current_frame) {
400 if( (action_num&0xff) == 0 ) {
401 /* colorize_conversation_cb was called from the window-menu
402 * or through an accelerator key. Try to build a conversation
403 * filter in the order TCP, UDP, IP, Ethernet and apply the
404 * coloring */
405 filter = build_conversation_filter(CONV_TCP,FALSE);
406 if( filter == NULL )
407 filter = build_conversation_filter(CONV_UDP,FALSE);
408 if( filter == NULL )
409 filter = build_conversation_filter(CONV_IP,FALSE);
410 if( filter == NULL )
411 filter = build_conversation_filter(CONV_ETHER,FALSE);
412 if( filter == NULL ) {
413 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Unable to build conversation filter.");
414 return;
416 } else {
417 /* create a filter-string based on the selected packet and action_num */
418 filter = build_conversation_filter(action_num&0xff, TRUE);
421 if( (action_num>>8) == 0) {
422 /* Open the "new coloring filter" dialog with the filter */
423 color_display_with_filter(filter);
424 } else {
425 /* Set one of the temporary coloring filters */
426 color_filters_set_tmp((guint8)(action_num>>8),filter,FALSE);
427 packet_list_colorize_packets();
430 g_free(filter);
434 static void
435 goto_conversation_frame(gboolean dir)
437 gchar *filter;
438 dfilter_t *dfcode = NULL;
439 gboolean found_packet = FALSE;
441 filter = build_conversation_filter(CONV_TCP,FALSE);
442 if( filter == NULL )
443 filter = build_conversation_filter(CONV_UDP,FALSE);
444 if( filter == NULL )
445 filter = build_conversation_filter(CONV_IP,FALSE);
446 if( filter == NULL ) {
447 statusbar_push_temporary_msg("Unable to build conversation filter.");
448 g_free(filter);
449 return;
452 if (!dfilter_compile(filter, &dfcode)) {
453 /* The attempt failed; report an error. */
454 statusbar_push_temporary_msg("Error compiling filter for this conversation.");
455 g_free(filter);
456 return;
459 found_packet = cf_find_packet_dfilter(&cfile, dfcode, dir?SD_BACKWARD:SD_FORWARD);
461 if (!found_packet) {
462 /* We didn't find a packet */
463 statusbar_push_temporary_msg("No previous/next packet in conversation.");
466 dfilter_free(dfcode);
467 g_free(filter);
470 static void
471 goto_next_frame_conversation_cb(GtkAction *action _U_, gpointer user_data _U_)
473 goto_conversation_frame(FALSE);
476 static void
477 goto_previous_frame_conversation_cb(GtkAction *action _U_, gpointer user_data _U_)
479 goto_conversation_frame(TRUE);
484 static void
485 copy_description_cb(GtkAction *action _U_, gpointer user_data)
487 copy_selected_plist_cb( NULL /* widget _U_ */ , user_data, COPY_SELECTED_DESCRIPTION);
490 static void
491 copy_fieldname_cb(GtkAction *action _U_, gpointer user_data)
493 copy_selected_plist_cb( NULL /* widget _U_ */ , user_data, COPY_SELECTED_FIELDNAME);
496 static void
497 copy_value_cb(GtkAction *action _U_, gpointer user_data)
499 copy_selected_plist_cb( NULL /* widget _U_ */ , user_data, COPY_SELECTED_VALUE);
502 static void
503 copy_as_filter_cb(GtkAction *action _U_, gpointer user_data _U_)
505 /* match_selected_ptree_cb needs the popup_menu_object to get the right object E_DFILTER_TE_KEY */
506 match_selected_ptree_cb( popup_menu_object, (MATCH_SELECTED_E)(MATCH_SELECTED_REPLACE|MATCH_SELECTED_COPY_ONLY));
509 static void
510 set_reftime_cb(GtkAction *action _U_, gpointer user_data)
512 reftime_frame_cb( NULL /* widget _U_ */ , user_data, REFTIME_TOGGLE);
515 static void
516 find_next_ref_time_cb(GtkAction *action _U_, gpointer user_data)
518 reftime_frame_cb( NULL /* widget _U_ */ , user_data, REFTIME_FIND_NEXT);
521 static void
522 find_previous_ref_time_cb(GtkAction *action _U_, gpointer user_data)
524 reftime_frame_cb( NULL /* widget _U_ */ , user_data, REFTIME_FIND_PREV);
527 static void
528 menus_prefs_cb(GtkAction *action _U_, gpointer user_data)
530 prefs_page_cb( NULL /* widget _U_ */ , user_data, PREFS_PAGE_USER_INTERFACE);
533 static void
534 main_toolbar_show_hide_cb(GtkAction *action _U_, gpointer user_data _U_)
536 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/MainToolbar");
538 recent.main_toolbar_show = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
539 main_widgets_show_or_hide();
543 static void
544 filter_toolbar_show_hide_cb(GtkAction * action _U_, gpointer user_data _U_)
546 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/FilterToolbar");
548 recent.filter_toolbar_show = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
549 main_widgets_show_or_hide();
552 static void
553 wireless_toolbar_show_hide_cb(GtkAction *action _U_, gpointer user_data _U_)
555 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/WirelessToolbar");
557 if(widget) {
558 recent.wireless_toolbar_show = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
559 } else {
560 recent.wireless_toolbar_show = FALSE;
562 main_widgets_show_or_hide();
565 static void
566 status_bar_show_hide_cb(GtkAction *action _U_, gpointer user_data _U_)
568 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/StatusBar");
570 recent.statusbar_show = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
571 main_widgets_show_or_hide();
573 static void
574 packet_list_show_hide_cb(GtkAction *action _U_, gpointer user_data _U_)
576 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/PacketList");
578 recent.packet_list_show = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
579 main_widgets_show_or_hide();
581 static void
582 packet_details_show_hide_cb(GtkAction *action _U_, gpointer user_data _U_)
584 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/PacketDetails");
586 recent.tree_view_show = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
587 main_widgets_show_or_hide();
589 static void
590 packet_bytes_show_hide_cb(GtkAction *action _U_, gpointer user_data _U_)
592 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/PacketBytes");
594 recent.byte_view_show = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
595 main_widgets_show_or_hide();
598 static void
599 timestamp_seconds_time_cb(GtkAction *action _U_, gpointer user_data _U_)
601 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/TimeDisplayFormat/DisplaySecondsWithHoursAndMinutes");
603 if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) {
604 recent.gui_seconds_format = TS_SECONDS_HOUR_MIN_SEC;
605 } else {
606 recent.gui_seconds_format = TS_SECONDS_DEFAULT;
608 timestamp_set_seconds_type (recent.gui_seconds_format);
610 /* This call adjusts column width */
611 cf_timestamp_auto_precision(&cfile);
612 packet_list_queue_draw();
615 static void
616 timestamp_format_new_cb (GtkRadioAction *action, GtkRadioAction *current _U_, gpointer user_data _U_)
618 ts_type value;
620 value = (ts_type) gtk_radio_action_get_current_value (action);
621 if (recent.gui_time_format != value) {
622 timestamp_set_type(value);
623 recent.gui_time_format = value;
624 /* This call adjusts column width */
625 cf_timestamp_auto_precision(&cfile);
626 packet_list_queue_draw();
631 static void
632 timestamp_precision_new_cb (GtkRadioAction *action, GtkRadioAction *current _U_, gpointer user_data _U_)
634 gint value;
636 value = gtk_radio_action_get_current_value (action);
637 if (recent.gui_time_precision != value) {
638 /* the actual precision will be set in packet_list_queue_draw() below */
639 if (value == TS_PREC_AUTO) {
640 timestamp_set_precision(TS_PREC_AUTO_SEC);
641 } else {
642 timestamp_set_precision(value);
644 recent.gui_time_precision = value;
645 /* This call adjusts column width */
646 cf_timestamp_auto_precision(&cfile);
647 packet_list_queue_draw();
651 static void
652 view_menu_en_for_MAC_cb(GtkAction *action _U_, gpointer user_data)
654 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/EnableforMACLayer");
656 if (!widget){
657 g_warning("view_menu_en_for_MAC_cb: No widget found");
658 }else{
659 name_resolution_cb( widget , user_data, &gbl_resolv_flags.mac_name);
663 static void
664 view_menu_en_for_network_cb(GtkAction *action _U_, gpointer user_data)
666 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/EnableforNetworkLayer");
668 if (!widget){
669 g_warning("view_menu_en_for_network_cb: No widget found");
670 }else{
671 name_resolution_cb( widget , user_data, &gbl_resolv_flags.network_name);
675 static void
676 view_menu_en_for_transport_cb(GtkAction *action _U_, gpointer user_data)
678 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/EnableforTransportLayer");
680 if (!widget){
681 g_warning("view_menu_en_for_transport_cb: No widget found");
682 }else{
683 name_resolution_cb( widget , user_data, &gbl_resolv_flags.transport_name);
687 static void
688 view_menu_en_use_external_resolver_cb(GtkAction *action _U_, gpointer user_data)
690 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/UseExternalNetworkNameResolver");
692 if (!widget){
693 g_warning("view_menu_en_use_external_resolver_cb: No widget found");
694 }else{
695 name_resolution_cb( widget , user_data, &gbl_resolv_flags.use_external_net_name_resolver);
699 static void
700 view_menu_colorize_pkt_lst_cb(GtkAction *action _U_, gpointer user_data)
702 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/ColorizePacketList");
704 if (!widget){
705 g_warning("view_menu_colorize_pkt_lst_cb: No widget found");
706 }else{
707 colorize_cb( widget , user_data);
712 #ifdef HAVE_LIBPCAP
713 static void
714 view_menu_auto_scroll_live_cb(GtkAction *action _U_, gpointer user_data _U_)
716 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/AutoScrollinLiveCapture");
718 if (!widget){
719 g_warning("view_menu_auto_scroll_live_cb: No widget found");
720 }else{
721 main_auto_scroll_live_changed(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)));
724 #endif
726 static void
727 view_menu_color_conv_color1_cb(GtkAction *action, gpointer user_data)
729 colorize_conversation_cb(action, user_data, 1*256);
732 static void
733 view_menu_color_conv_color2_cb(GtkAction *action, gpointer user_data)
735 colorize_conversation_cb(action, user_data, 2*256);
738 static void
739 view_menu_color_conv_color3_cb(GtkAction *action, gpointer user_data)
741 colorize_conversation_cb(action, user_data, 3*256);
744 static void
745 view_menu_color_conv_color4_cb(GtkAction *action, gpointer user_data)
747 colorize_conversation_cb(action, user_data, 4*256);
750 static void
751 view_menu_color_conv_color5_cb(GtkAction *action, gpointer user_data)
753 colorize_conversation_cb(action, user_data, 5*256);
756 static void
757 view_menu_color_conv_color6_cb(GtkAction *action, gpointer user_data)
759 colorize_conversation_cb(action, user_data, 6*256);
762 static void
763 view_menu_color_conv_color7_cb(GtkAction *action, gpointer user_data)
765 colorize_conversation_cb(action, user_data, 7*256);
768 static void
769 view_menu_color_conv_color8_cb(GtkAction *action, gpointer user_data)
771 colorize_conversation_cb(action, user_data, 8*256);
774 static void
775 view_menu_color_conv_color9_cb(GtkAction *action, gpointer user_data)
777 colorize_conversation_cb(action, user_data, 9*256);
780 static void
781 view_menu_color_conv_color10_cb(GtkAction *action, gpointer user_data)
783 colorize_conversation_cb(action, user_data, 10*256);
786 static void
787 view_menu_color_conv_new_rule_cb(GtkAction *action, gpointer user_data)
789 colorize_conversation_cb(action, user_data, 0);
792 static void
793 view_menu_reset_coloring_cb(GtkAction *action, gpointer user_data)
795 colorize_conversation_cb(action, user_data, 255*256);
799 * TODO Move this menu to capture_if_dlg.c ?
801 #ifdef HAVE_LIBPCAP
802 static void
803 capture_if_action_cb(GtkAction *action _U_, gpointer user_data)
805 capture_if_cb(NULL /* GtkWidget *w _U_ */, user_data);
808 static void
809 capture_prep_action_cb(GtkAction *action _U_, gpointer user_data)
811 capture_prep_cb(NULL /* GtkWidget *w _U_ */, user_data);
814 static void
815 capture_start_action_cb(GtkAction *action _U_, gpointer user_data)
817 capture_start_cb(NULL /* GtkWidget *w _U_ */, user_data);
820 static void
821 capture_stop_action_cb(GtkAction *action _U_, gpointer user_data)
823 capture_stop_cb(NULL /* GtkWidget *w _U_ */, user_data);
826 static void
827 capture_restart_action_cb(GtkAction *action _U_, gpointer user_data)
829 capture_restart_cb(NULL /* GtkWidget *w _U_ */, user_data);
832 static void
833 capture_filters_action_cb(GtkAction *action _U_, gpointer user_data _U_)
835 cfilter_dialog_cb(NULL /* GtkWidget *w _U_ */);
838 static void
839 refresh_interfaces_action_cb(GtkAction *action _U_, gpointer user_data _U_)
841 refresh_local_interface_lists();
843 #endif /* HAVE_LIBPCAP */
845 static void
846 help_menu_cont_cb(GtkAction *action _U_, gpointer user_data _U_)
848 topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(HELP_CONTENT));
851 static void
852 help_menu_faq_cb(GtkAction *action _U_, gpointer user_data _U_)
854 topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(ONLINEPAGE_FAQ));
857 static void
858 help_menu_ask_cb(GtkAction *action _U_, gpointer user_data _U_)
860 topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(ONLINEPAGE_ASK));
863 static void
864 help_menu_wireshark_cb(GtkAction *action _U_, gpointer user_data _U_)
866 topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_WIRESHARK));
869 static void
870 help_menu_wireshark_flt_cb(GtkAction *action _U_, gpointer user_data _U_)
872 topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_WIRESHARK_FILTER));
875 static void
876 help_menu_Capinfos_cb(GtkAction *action _U_, gpointer user_data _U_)
878 topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_CAPINFOS));
881 static void
882 help_menu_Dumpcap_cb(GtkAction *action _U_, gpointer user_data _U_)
884 topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_DUMPCAP));
887 static void
888 help_menu_Editcap_cb(GtkAction *action _U_, gpointer user_data _U_)
890 topic_menu_cb(NULL/* widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_EDITCAP));
893 static void
894 help_menu_Mergecap_cb(GtkAction *action _U_, gpointer user_data _U_)
896 topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_MERGECAP));
899 static void
900 help_menu_RawShark_cb(GtkAction *action _U_, gpointer user_data _U_)
902 topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_RAWSHARK));
905 static void
906 help_menu_Reorder_cb(GtkAction *action _U_, gpointer user_data _U_)
908 topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_REORDERCAP));
911 static void
912 help_menu_Text2pcap_cb(GtkAction *action _U_, gpointer user_data _U_)
914 topic_menu_cb(NULL/* widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_TEXT2PCAP));
917 static void
918 help_menu_TShark_cb(GtkAction *action _U_, gpointer user_data _U_)
920 topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_TSHARK));
923 static void
924 help_menu_Website_cb(GtkAction *action _U_, gpointer user_data _U_)
926 topic_menu_cb(NULL/* widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(ONLINEPAGE_HOME));
929 static void
930 help_menu_Wiki_cb(GtkAction *action _U_, gpointer user_data _U_)
932 topic_menu_cb(NULL/* widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(ONLINEPAGE_WIKI));
935 static void
936 help_menu_Downloads_cb(GtkAction *action _U_, gpointer user_data _U_)
938 topic_menu_cb(NULL/* widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(ONLINEPAGE_DOWNLOAD));
941 static void
942 help_menu_SampleCaptures_cb(GtkAction *action _U_, gpointer user_data _U_)
944 topic_menu_cb( NULL/* widget_U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(ONLINEPAGE_SAMPLE_FILES));
947 #ifdef HAVE_SOFTWARE_UPDATE
948 static void
949 check_for_updates_cb(GtkAction *action _U_, gpointer user_data _U_)
951 software_update_check();
953 #endif /* HAVE_SOFTWARE_UPDATE */
955 static const char *ui_desc_menubar =
956 "<ui>\n"
957 " <menubar name ='Menubar'>\n"
958 " <menu name= 'FileMenu' action='/File'>\n"
959 " <menuitem name='Open' action='/File/Open'/>\n"
960 " <menu name='OpenRecent' action='/File/OpenRecent'>\n"
961 " <placeholder name='RecentFiles'/>\n"
962 " </menu>\n"
963 " <menuitem name='Merge' action='/File/Merge'/>\n"
964 " <menuitem name='ImportFromHexDump' action='/File/ImportFromHexDump'/>\n"
965 " <menuitem name='Close' action='/File/Close'/>\n"
966 " <separator/>\n"
967 " <menuitem name='Save' action='/File/Save'/>\n"
968 " <menuitem name='SaveAs' action='/File/SaveAs'/>\n"
969 " <separator/>\n"
970 " <menu name= 'Set' action='/File/Set'>\n"
971 " <menuitem name='ListFiles' action='/File/Set/ListFiles'/>\n"
972 " <menuitem name='NextFile' action='/File/Set/NextFile'/>\n"
973 " <menuitem name='PreviousFile' action='/File/Set/PreviousFile'/>\n"
974 " </menu>\n"
975 " <separator/>\n"
976 " <menuitem name='ExportSpecifiedPackets' action='/File/ExportSpecifiedPackets'/>\n"
977 " <menu name= 'ExportPacketDissections' action='/File/ExportPacketDissections'>\n"
978 " <menuitem name='AsTxt' action='/File/ExportPacketDissections/Text'/>\n"
979 " <menuitem name='AsPostScript' action='/File/ExportPacketDissections/PostScript'/>\n"
980 " <menuitem name='AsCSV' action='/File/ExportPacketDissections/CSV'/>\n"
981 " <menuitem name='AsCArrays' action='/File/ExportPacketDissections/CArrays'/>\n"
982 " <separator/>\n"
983 " <menuitem name='AsPSML' action='/File/ExportPacketDissections/PSML'/>\n"
984 " <menuitem name='AsPDML' action='/File/ExportPacketDissections/PDML'/>\n"
985 " <separator/>\n"
986 " </menu>\n"
987 " <menuitem name='ExportSelectedPacketBytes' action='/File/ExportSelectedPacketBytes'/>\n"
988 " <menuitem name='ExportPDUs' action='/File/ExportPDUs'/>\n"
989 " <menuitem name='ExportSSLSessionKeys' action='/File/ExportSSLSessionKeys'/>\n"
990 " <menu name= 'ExportObjects' action='/File/ExportObjects'>\n"
991 " <menuitem name='HTTP' action='/File/ExportObjects/HTTP'/>\n"
992 " <menuitem name='DICOM' action='/File/ExportObjects/DICOM'/>\n"
993 " <menuitem name='SMB' action='/File/ExportObjects/SMB'/>\n"
994 " </menu>\n"
995 " <separator/>\n"
996 " <menuitem name='Print' action='/File/Print'/>\n"
997 " <separator/>\n"
998 " <menuitem name='Quit' action='/File/Quit'/>\n"
999 " </menu>\n"
1000 " <menu name= 'EditMenu' action='/Edit'>\n"
1001 " <menu name= 'Copy' action='/Edit/Copy'>\n"
1002 " <menuitem name='Description' action='/Edit/Copy/Description'/>\n"
1003 " <menuitem name='Fieldname' action='/Edit/Copy/Fieldname'/>\n"
1004 " <menuitem name='Value' action='/Edit/Copy/Value'/>\n"
1005 " <separator/>\n"
1006 " <menuitem name='AsFilter' action='/Edit/Copy/AsFilter'/>\n"
1007 " </menu>\n"
1008 " <menuitem name='FindPacket' action='/Edit/FindPacket'/>\n"
1009 " <menuitem name='FindNext' action='/Edit/FindNext'/>\n"
1010 " <menuitem name='FindPrevious' action='/Edit/FindPrevious'/>\n"
1011 " <separator/>\n"
1012 " <menuitem name='MarkPacket' action='/Edit/MarkPacket'/>\n"
1013 " <menuitem name='MarkAllDisplayedPackets' action='/Edit/MarkAllDisplayedPackets'/>\n"
1014 " <menuitem name='UnmarkAllDisplayedPackets' action='/Edit/UnmarkAllDisplayedPackets'/>\n"
1015 " <menuitem name='FindNextMark' action='/Edit/FindNextMark'/>\n"
1016 " <menuitem name='FindPreviousMark' action='/Edit/FindPreviousMark'/>\n"
1017 " <separator/>\n"
1018 " <menuitem name='IgnorePacket' action='/Edit/IgnorePacket'/>\n"
1019 " <menuitem name='IgnoreAllDisplayedPackets' action='/Edit/IgnoreAllDisplayedPackets'/>\n"
1020 " <menuitem name='Un-IgnoreAllPackets' action='/Edit/Un-IgnoreAllPackets'/>\n"
1021 " <separator/>\n"
1022 " <menuitem name='SetTimeReference' action='/Edit/SetTimeReference'/>\n"
1023 " <menuitem name='Un-TimeReferenceAllPackets' action='/Edit/Un-TimeReferenceAllPackets'/>\n"
1024 " <menuitem name='FindNextTimeReference' action='/Edit/FindNextTimeReference'/>\n"
1025 " <menuitem name='FindPreviousTimeReference' action='/Edit/FindPreviousTimeReference'/>\n"
1026 " <separator/>\n"
1027 " <menuitem name='TimeShift' action='/Edit/TimeShift'/>\n"
1028 " <separator/>\n"
1029 #ifdef WANT_PACKET_EDITOR
1030 " <menuitem name='EditPacket' action='/Edit/EditPacket'/>\n"
1031 #endif
1032 " <menuitem name='AddEditPktComment' action='/Edit/AddEditPktComment'/>\n"
1033 " <separator/>\n"
1034 " <menuitem name='ConfigurationProfiles' action='/Edit/ConfigurationProfiles'/>\n"
1035 " <menuitem name='Preferences' action='/Edit/Preferences'/>\n"
1036 " </menu>\n"
1037 " <menu name= 'ViewMenu' action='/View'>\n"
1038 " <menuitem name='MainToolbar' action='/View/MainToolbar'/>\n"
1039 " <menuitem name='FilterToolbar' action='/View/FilterToolbar'/>\n"
1040 " <menuitem name='WirelessToolbar' action='/View/WirelessToolbar'/>\n"
1041 " <menuitem name='StatusBar' action='/View/StatusBar'/>\n"
1042 " <separator/>\n"
1043 " <menuitem name='PacketList' action='/View/PacketList'/>\n"
1044 " <menuitem name='PacketDetails' action='/View/PacketDetails'/>\n"
1045 " <menuitem name='PacketBytes' action='/View/PacketBytes'/>\n"
1046 " <separator/>\n"
1047 " <menu name= 'TimeDisplayFormat' action='/View/TimeDisplayFormat'>\n"
1048 " <menuitem name='DateYMDandTimeofDay' action='/View/TimeDisplayFormat/DateYMDandTimeofDay'/>\n"
1049 " <menuitem name='DateYDOYandTimeofDay' action='/View/TimeDisplayFormat/DateYDOYandTimeofDay'/>\n"
1050 " <menuitem name='TimeofDay' action='/View/TimeDisplayFormat/TimeofDay'/>\n"
1051 " <menuitem name='SecondsSinceEpoch' action='/View/TimeDisplayFormat/SecondsSinceEpoch'/>\n"
1052 " <menuitem name='SecondsSinceBeginningofCapture' action='/View/TimeDisplayFormat/SecondsSinceBeginningofCapture'/>\n"
1053 " <menuitem name='SecondsSincePreviousCapturedPacket' action='/View/TimeDisplayFormat/SecondsSincePreviousCapturedPacket'/>\n"
1054 " <menuitem name='SecondsSincePreviousDisplayedPacket' action='/View/TimeDisplayFormat/SecondsSincePreviousDisplayedPacket'/>\n"
1055 " <menuitem name='UTCDateYMDandTimeofDay' action='/View/TimeDisplayFormat/UTCDateYMDandTimeofDay'/>\n"
1056 " <menuitem name='UTCDateYDOYandTimeofDay' action='/View/TimeDisplayFormat/UTCDateYDOYandTimeofDay'/>\n"
1057 " <menuitem name='UTCTimeofDay' action='/View/TimeDisplayFormat/UTCTimeofDay'/>\n"
1058 " <separator/>\n"
1059 " <menuitem name='FileFormatPrecision-Automatic' action='/View/TimeDisplayFormat/FileFormatPrecision-Automatic'/>\n"
1060 " <menuitem name='FileFormatPrecision-Seconds' action='/View/TimeDisplayFormat/FileFormatPrecision-Seconds'/>\n"
1061 " <menuitem name='FileFormatPrecision-Deciseconds' action='/View/TimeDisplayFormat/FileFormatPrecision-Deciseconds'/>\n"
1062 " <menuitem name='FileFormatPrecision-Centiseconds' action='/View/TimeDisplayFormat/FileFormatPrecision-Centiseconds'/>\n"
1063 " <menuitem name='FileFormatPrecision-Milliseconds' action='/View/TimeDisplayFormat/FileFormatPrecision-Milliseconds'/>\n"
1064 " <menuitem name='FileFormatPrecision-Microseconds' action='/View/TimeDisplayFormat/FileFormatPrecision-Microseconds'/>\n"
1065 " <menuitem name='FileFormatPrecision-Nanoseconds' action='/View/TimeDisplayFormat/FileFormatPrecision-Nanoseconds'/>\n"
1066 " <separator/>\n"
1067 " <menuitem name='DisplaySecondsWithHoursAndMinutes' action='/View/TimeDisplayFormat/DisplaySecondsWithHoursAndMinutes'/>\n"
1068 " </menu>\n"
1069 " <menu name= 'NameResolution' action='/View/NameResolution'>\n"
1070 " <menuitem name='ResolveName' action='/View/NameResolution/ResolveName'/>\n"
1071 " <menuitem name='ManuallyResolveName' action='/View/NameResolution/ManuallyResolveName'/>\n"
1072 " <separator/>\n"
1073 " <menuitem name='EnableforMACLayer' action='/View/NameResolution/EnableforMACLayer'/>\n"
1074 " <menuitem name='EnableforTransportLayer' action='/View/NameResolution/EnableforTransportLayer'/>\n"
1075 " <menuitem name='EnableforNetworkLayer' action='/View/NameResolution/EnableforNetworkLayer'/>\n"
1076 " <menuitem name='UseExternalNetworkNameResolver' action='/View/NameResolution/UseExternalNetworkNameResolver'/>\n"
1077 " </menu>\n"
1078 " <menuitem name='ColorizePacketList' action='/View/ColorizePacketList'/>\n"
1079 #ifdef HAVE_LIBPCAP
1080 " <menuitem name='AutoScrollinLiveCapture' action='/View/AutoScrollinLiveCapture'/>\n"
1081 #endif
1082 " <separator/>\n"
1083 " <menuitem name='ZoomIn' action='/View/ZoomIn'/>\n"
1084 " <menuitem name='ZoomOut' action='/View/ZoomOut'/>\n"
1085 " <menuitem name='NormalSize' action='/View/NormalSize'/>\n"
1086 " <separator/>\n"
1087 " <menuitem name='ResizeAllColumns' action='/View/ResizeAllColumns'/>\n"
1088 " <menuitem name='DisplayedColumns' action='/View/DisplayedColumns'/>\n"
1089 " <separator/>\n"
1090 " <menuitem name='ExpandSubtrees' action='/View/ExpandSubtrees'/>\n"
1091 " <menuitem name='CollapseSubtrees' action='/View/CollapseSubtrees'/>\n"
1092 " <menuitem name='ExpandAll' action='/View/ExpandAll'/>\n"
1093 " <menuitem name='CollapseAll' action='/View/CollapseAll'/>\n"
1094 " <separator/>\n"
1095 " <menu name= 'ColorizeConversation' action='/View/ColorizeConversation'>\n"
1096 " <menuitem name='Color1' action='/View/ColorizeConversation/Color 1'/>\n"
1097 " <menuitem name='Color2' action='/View/ColorizeConversation/Color 2'/>\n"
1098 " <menuitem name='Color3' action='/View/ColorizeConversation/Color 3'/>\n"
1099 " <menuitem name='Color4' action='/View/ColorizeConversation/Color 4'/>\n"
1100 " <menuitem name='Color5' action='/View/ColorizeConversation/Color 5'/>\n"
1101 " <menuitem name='Color6' action='/View/ColorizeConversation/Color 6'/>\n"
1102 " <menuitem name='Color7' action='/View/ColorizeConversation/Color 7'/>\n"
1103 " <menuitem name='Color8' action='/View/ColorizeConversation/Color 8'/>\n"
1104 " <menuitem name='Color9' action='/View/ColorizeConversation/Color 9'/>\n"
1105 " <menuitem name='Color10' action='/View/ColorizeConversation/Color 10'/>\n"
1106 " <menuitem name='NewColoringRule' action='/View/ColorizeConversation/NewColoringRule'/>\n"
1107 " </menu>\n"
1108 " <separator/>\n"
1109 " <menuitem name='ResetColoring1-10' action='/View/ResetColoring1-10'/>\n"
1110 " <menuitem name='ColoringRules' action='/View/ColoringRules'/>\n"
1111 " <separator/>\n"
1112 " <menuitem name='ShowPacketinNewWindow' action='/View/ShowPacketinNewWindow'/>\n"
1113 " <menuitem name='Reload' action='/View/Reload'/>\n"
1114 " </menu>\n"
1115 " <menu name= 'GoMenu' action='/Go'>\n"
1116 " <menuitem name='Back' action='/Go/Back'/>\n"
1117 " <menuitem name='Forward' action='/Go/Forward'/>\n"
1118 " <menuitem name='Goto' action='/Go/Goto'/>\n"
1119 " <menuitem name='GotoCorrespondingPacket' action='/Go/GotoCorrespondingPacket'/>\n"
1120 " <separator/>\n"
1121 " <menuitem name='PreviousPacket' action='/Go/PreviousPacket'/>\n"
1122 " <menuitem name='NextPacket' action='/Go/NextPacket'/>\n"
1123 " <menuitem name='FirstPacket' action='/Go/FirstPacket'/>\n"
1124 " <menuitem name='LastPacket' action='/Go/LastPacket'/>\n"
1125 " <menuitem name='PreviousPacketInConversation' action='/Go/PreviousPacketInConversation'/>\n"
1126 " <menuitem name='NextPacketInConversation' action='/Go/NextPacketInConversation'/>\n"
1127 " </menu>\n"
1128 #ifdef HAVE_LIBPCAP
1129 " <menu name= 'CaptureMenu' action='/Capture'>\n"
1130 " <menuitem name='Interfaces' action='/Capture/Interfaces'/>\n"
1131 " <menuitem name='Options' action='/Capture/Options'/>\n"
1132 " <menuitem name='Start' action='/Capture/Start'/>\n"
1133 " <menuitem name='Stop' action='/Capture/Stop'/>\n"
1134 " <menuitem name='Restart' action='/Capture/Restart'/>\n"
1135 " <menuitem name='CaptureFilters' action='/Capture/CaptureFilters'/>\n"
1136 " <menuitem name='RefreshInterfaces' action='/Capture/RefreshInterfaces'/>\n"
1137 " </menu>\n"
1138 #endif
1139 " <menu name= 'AnalyzeMenu' action='/Analyze'>\n"
1140 " <menuitem name='DisplayFilters' action='/Analyze/DisplayFilters'/>\n"
1141 " <menuitem name='DisplayFilterMacros' action='/Analyze/DisplayFilterMacros'/>\n"
1142 " <separator/>\n"
1143 " <menuitem name='ApplyasColumn' action='/Analyze/ApplyasColumn'/>\n"
1144 " <menu name= 'ApplyAsFilter' action='/ApplyasFilter'>\n"
1145 " <menuitem name='Selected' action='/ApplyasFilter/Selected'/>\n"
1146 " <menuitem name='NotSelected' action='/ApplyasFilter/Not Selected'/>\n"
1147 " <menuitem name='AndSelected' action='/ApplyasFilter/AndSelected'/>\n"
1148 " <menuitem name='OrSelected' action='/ApplyasFilter/OrSelected'/>\n"
1149 " <menuitem name='AndNotSelected' action='/ApplyasFilter/AndNotSelected'/>\n"
1150 " <menuitem name='OrNotSelected' action='/ApplyasFilter/OrNotSelected'/>\n"
1151 " </menu>\n"
1152 " <menu name= 'PrepareaFilter' action='/PrepareaFilter'>\n"
1153 " <menuitem name='Selected' action='/PrepareaFilter/Selected'/>\n"
1154 " <menuitem name='NotSelected' action='/PrepareaFilter/Not Selected'/>\n"
1155 " <menuitem name='AndSelected' action='/PrepareaFilter/AndSelected'/>\n"
1156 " <menuitem name='OrSelected' action='/PrepareaFilter/OrSelected'/>\n"
1157 " <menuitem name='AndNotSelected' action='/PrepareaFilter/AndNotSelected'/>\n"
1158 " <menuitem name='OrNotSelected' action='/PrepareaFilter/OrNotSelected'/>\n"
1159 " </menu>\n"
1160 " <separator/>\n"
1161 " <menuitem name='EnabledProtocols' action='/Analyze/EnabledProtocols'/>\n"
1162 " <menuitem name='DecodeAs' action='/Analyze/DecodeAs'/>\n"
1163 " <menuitem name='UserSpecifiedDecodes' action='/Analyze/UserSpecifiedDecodes'/>\n"
1164 " <separator/>\n"
1165 " <menuitem name='FollowTCPStream' action='/Analyze/FollowTCPStream'/>\n"
1166 " <menuitem name='FollowUDPStream' action='/Analyze/FollowUDPStream'/>\n"
1167 " <menuitem name='FollowSSLStream' action='/Analyze/FollowSSLStream'/>\n"
1168 " <menuitem name='ExpertInfo' action='/Analyze/ExpertInfo'/>\n"
1169 " <menu name= 'ConversationFilterMenu' action='/Analyze/ConversationFilter'>\n"
1170 " <placeholder name='Filters'/>\n"
1171 " </menu>\n"
1172 " </menu>\n"
1173 " <menu name= 'StatisticsMenu' action='/Statistics'>\n"
1174 " <menuitem name='Summary' action='/Statistics/Summary'/>\n"
1175 " <menuitem name='ShowCommentsSummary' action='/Statistics/CommentsSummary'/>\n"
1176 " <menuitem name='ShowAddreRes' action='/Statistics/ShowAddreRes'/>\n"
1177 " <menuitem name='ProtocolHierarchy' action='/Statistics/ProtocolHierarchy'/>\n"
1178 " <menuitem name='Conversations' action='/Statistics/Conversations'/>\n"
1179 " <menuitem name='Endpoints' action='/Statistics/Endpoints'/>\n"
1180 " <menuitem name='PacketLengths' action='/Statistics/plen'/>\n"
1181 " <menuitem name='IOGraphs' action='/Statistics/IOGraphs'/>\n"
1182 " <separator/>\n"
1183 " <menu name= 'ConversationListMenu' action='/Statistics/ConversationList'>\n"
1184 " <menuitem name='Ethernet' action='/Statistics/ConversationList/Ethernet'/>\n"
1185 " <menuitem name='FibreChannel' action='/Statistics/ConversationList/FibreChannel'/>\n"
1186 " <menuitem name='FDDI' action='/Statistics/ConversationList/FDDI'/>\n"
1187 " <menuitem name='IP' action='/Statistics/ConversationList/IP'/>\n"
1188 " <menuitem name='IPv6' action='/Statistics/ConversationList/IPv6'/>\n"
1189 " <menuitem name='IPX' action='/Statistics/ConversationList/IPX'/>\n"
1190 " <menuitem name='JXTA' action='/Statistics/ConversationList/JXTA'/>\n"
1191 " <menuitem name='NCP' action='/Statistics/ConversationList/NCP'/>\n"
1192 " <menuitem name='RSVP' action='/Statistics/ConversationList/RSVP'/>\n"
1193 " <menuitem name='SCTP' action='/Statistics/ConversationList/SCTP'/>\n"
1194 " <menuitem name='TCPIP' action='/Statistics/ConversationList/TCPIP'/>\n"
1195 " <menuitem name='TR' action='/Statistics/ConversationList/TR'/>\n"
1196 " <menuitem name='UDPIP' action='/Statistics/ConversationList/UDPIP'/>\n"
1197 " <menuitem name='USB' action='/Statistics/ConversationList/USB'/>\n"
1198 " <menuitem name='WLAN' action='/Statistics/ConversationList/WLAN'/>\n"
1199 " </menu>\n"
1200 " <menu name= 'EndpointListMenu' action='/Statistics/EndpointList'>\n"
1201 " <menuitem name='Ethernet' action='/Statistics/EndpointList/Ethernet'/>\n"
1202 " <menuitem name='FibreChannel' action='/Statistics/EndpointList/FibreChannel'/>\n"
1203 " <menuitem name='FDDI' action='/Statistics/EndpointList/FDDI'/>\n"
1204 " <menuitem name='IP' action='/Statistics/EndpointList/IP'/>\n"
1205 " <menuitem name='IPv6' action='/Statistics/EndpointList/IPv6'/>\n"
1206 " <menuitem name='IPX' action='/Statistics/EndpointList/IPX'/>\n"
1207 " <menuitem name='JXTA' action='/Statistics/EndpointList/JXTA'/>\n"
1208 " <menuitem name='NCP' action='/Statistics/EndpointList/NCP'/>\n"
1209 " <menuitem name='RSVP' action='/Statistics/EndpointList/RSVP'/>\n"
1210 " <menuitem name='SCTP' action='/Statistics/EndpointList/SCTP'/>\n"
1211 " <menuitem name='TCPIP' action='/Statistics/EndpointList/TCPIP'/>\n"
1212 " <menuitem name='TR' action='/Statistics/EndpointList/TR'/>\n"
1213 " <menuitem name='UDPIP' action='/Statistics/EndpointList/UDPIP'/>\n"
1214 " <menuitem name='USB' action='/Statistics/EndpointList/USB'/>\n"
1215 " <menuitem name='WLAN' action='/Statistics/EndpointList/WLAN'/>\n"
1216 " </menu>\n"
1217 " <menu name='ServiceResponseTimeMenu' action='/Statistics/ServiceResponseTime'>\n"
1218 " <menuitem name='DCE-RPC' action='/Statistics/ServiceResponseTime/DCE-RPC'/>\n"
1219 " <menuitem name='ONC-RPC' action='/Statistics/ServiceResponseTime/ONC-RPC'/>\n"
1220 " </menu>\n"
1221 " <separator/>\n"
1222 " <menuitem name='ANCP' action='/Statistics/ancp'/>\n"
1223 " <menu name= 'BACnetMenu' action='/Statistics/BACnet'>\n"
1224 " <menuitem name='bacapp_instanceid' action='/Statistics/BACnet/bacapp_instanceid'/>\n"
1225 " <menuitem name='bacapp_ip' action='/Statistics/BACnet/bacapp_ip'/>\n"
1226 " <menuitem name='bacapp_objectid' action='/Statistics/BACnet/bacapp_objectid'/>\n"
1227 " <menuitem name='bacapp_service' action='/Statistics/BACnet/bacapp_service'/>\n"
1228 " </menu>\n"
1229 " <menuitem name='Collectd' action='/Statistics/collectd'/>\n"
1230 " <menuitem name='Compare' action='/Statistics/compare'/>\n"
1231 " <menuitem name='FlowGraph' action='/Statistics/FlowGraph'/>\n"
1232 " <menuitem name='HART-IP' action='/Statistics/hart_ip'/>\n"
1233 " <menu name= 'HTTPMenu' action='/Statistics/HTTP'>\n"
1234 " <menuitem name='http' action='/Statistics/HTTP/http'/>\n"
1235 " <menuitem name='http_req' action='/Statistics/HTTP/http_req'/>\n"
1236 " <menuitem name='http_srv' action='/Statistics/HTTP/http_srv'/>\n"
1237 " </menu>\n"
1238 " <menuitem name='ONC-RPC-Programs' action='/Statistics/ONC-RPC-Programs'/>\n"
1239 " <menu name= 'SametimeMenu' action='/Statistics/Sametime'>\n"
1240 " <menuitem name='sametime' action='/Statistics/Sametime/sametime'/>\n"
1241 " </menu>\n"
1242 " <menu name= 'TCPStreamGraphMenu' action='/Statistics/TCPStreamGraphMenu'>\n"
1243 " <menuitem name='Sequence-Graph-Stevens' action='/Statistics/TCPStreamGraphMenu/Time-Sequence-Graph-Stevens'/>\n"
1244 " <menuitem name='Sequence-Graph-tcptrace' action='/Statistics/TCPStreamGraphMenu/Time-Sequence-Graph-tcptrace'/>\n"
1245 " <menuitem name='Throughput-Graph' action='/Statistics/TCPStreamGraphMenu/Throughput-Graph'/>\n"
1246 " <menuitem name='RTT-Graph' action='/Statistics/TCPStreamGraphMenu/RTT-Graph'/>\n"
1247 " <menuitem name='Window-Scaling-Graph' action='/Statistics/TCPStreamGraphMenu/Window-Scaling-Graph'/>\n"
1248 " </menu>\n"
1249 " <menuitem name='UDPMulticastStreams' action='/Statistics/UDPMulticastStreams'/>\n"
1250 " <menuitem name='WLANTraffic' action='/Statistics/WLANTraffic'/>\n"
1251 " </menu>\n"
1252 " <menu name= 'TelephonyMenu' action='/Telephony'>\n"
1253 " <menu name= 'ANSI' action='/Telephony/ANSI'>\n"
1254 " <menuitem name='BSMAP' action='/Telephony/ANSI/BSMAP'/>\n"
1255 " <menuitem name='DTAP' action='/Telephony/ANSI/DTAP'/>\n"
1256 " <menuitem name='MAP-OP' action='/Telephony/ANSI/MAP-OP'/>\n"
1257 " </menu>\n"
1258 " <menu name= 'GSM' action='/Telephony/GSM'>\n"
1259 " <menuitem name='BSSMAP' action='/Telephony/GSM/BSSMAP'/>\n"
1260 " <menu name='GSM-DTAP' action='/Telephony/GSM/DTAP'>\n"
1261 " <menuitem name='CallControl' action='/Telephony/GSM/DTAP/CC'/>\n"
1262 " <menuitem name='GPRS-MM' action='/Telephony/GSM/DTAP/GMM'/>\n"
1263 " <menuitem name='GPRS-SM' action='/Telephony/GSM/DTAP/SM'/>\n"
1264 " <menuitem name='MM' action='/Telephony/GSM/DTAP/MM'/>\n"
1265 " <menuitem name='RR' action='/Telephony/GSM/DTAP/RR'/>\n"
1266 " <menuitem name='SMS' action='/Telephony/GSM/DTAP/SMS'/>\n"
1267 " <menuitem name='TP' action='/Telephony/GSM/DTAP/TP'/>\n"
1268 " <menuitem name='SS' action='/Telephony/GSM/DTAP/SS'/>\n"
1269 " </menu>\n"
1270 " <menuitem name='SACCH' action='/Telephony/GSM/SACCH'/>\n"
1271 " <menuitem name='MAP-OP' action='/Telephony/GSM/MAP-OP'/>\n"
1272 " <menuitem name='MAP-Summary' action='/Telephony/GSM/MAPSummary'/>\n"
1273 " </menu>\n"
1274 " <menu name= 'IAX2menu' action='/Telephony/IAX2'>\n"
1275 " <menuitem name='StreamAnalysis' action='/Telephony/IAX2/StreamAnalysis'/>\n"
1276 " </menu>\n"
1277 " <menuitem name='ISUP' action='/Telephony/isup_msg'/>\n"
1278 " <menu name= 'LTEmenu' action='/Telephony/LTE'>\n"
1279 " <menuitem name='LTE_RLC_Graph' action='/Telephony/LTE/RLCGraph'/>\n"
1280 " </menu>\n"
1281 " <menu name= 'MTP3menu' action='/Telephony/MTP3'>\n"
1282 " <menuitem name='MSUs' action='/Telephony/MTP3/MSUs'/>\n"
1283 " <menuitem name='MSUSummary' action='/Telephony/MTP3/MSUSummary'/>\n"
1284 " </menu>\n"
1285 " <menu name= 'RTPmenu' action='/Telephony/RTP'>\n"
1286 " <menuitem name='ShowAllStreams' action='/Telephony/RTP/ShowAllStreams'/>\n"
1287 " <menuitem name='StreamAnalysis' action='/Telephony/RTP/StreamAnalysis'/>\n"
1288 " </menu>\n"
1289 " <menu name= 'RTSPmenu' action='/Telephony/RTSP'>\n"
1290 " <menuitem name='rtsp' action='/Telephony/RTSP/rtsp'/>\n"
1291 " </menu>\n"
1292 " <menu name= 'SCTPmenu' action='/Telephony/SCTP'>\n"
1293 " <menuitem name='AnalysethisAssociation' action='/Telephony/SCTP/AnalysethisAssociation'/>\n"
1294 " <menuitem name='ShowAllAssociations' action='/Telephony/SCTP/ShowAllAssociations'/>\n"
1295 " </menu>\n"
1296 " <menuitem name='SMPP' action='/Telephony/smpp_commands'/>\n"
1297 " <menuitem name='UCP' action='/Telephony/ucp_messages'/>\n"
1298 " <menuitem name='VoIPCalls' action='/Telephony/VoIPCalls'/>\n"
1299 " </menu>\n"
1300 " <menu name= 'ToolsMenu' action='/Tools'>\n"
1301 " <menuitem name='FirewallACLRules' action='/Tools/FirewallACLRules'/>\n"
1302 " </menu>\n"
1303 " <menu name= 'InternalsMenu' action='/Internals'>\n"
1304 " <menuitem name='Dissectortables' action='/Internals/Dissectortables'/>\n"
1305 " <menuitem name='Conversations' action='/Internals/Conversations'/>\n"
1306 " <menuitem name='SupportedProtocols' action='/Internals/SupportedProtocols'/>\n"
1307 " </menu>\n"
1308 " <menu name= 'HelpMenu' action='/Help'>\n"
1309 " <menuitem name='Contents' action='/Help/Contents'/>\n"
1310 " <menu name= 'ManualPages' action='/Help/ManualPages'>\n"
1311 " <menuitem name='Wireshark' action='/Help/ManualPages/Wireshark'/>\n"
1312 " <menuitem name='WiresharkFilter' action='/Help/ManualPages/WiresharkFilter'/>\n"
1313 " <separator/>\n"
1314 " <menuitem name='Capinfos' action='/Help/ManualPages/Capinfos'/>\n"
1315 " <menuitem name='Dumpcap' action='/Help/ManualPages/Dumpcap'/>\n"
1316 " <menuitem name='Editcap' action='/Help/ManualPages/Editcap'/>\n"
1317 " <menuitem name='Mergecap' action='/Help/ManualPages/Mergecap'/>\n"
1318 " <menuitem name='RawShark' action='/Help/ManualPages/RawShark'/>\n"
1319 " <menuitem name='Reordercap' action='/Help/ManualPages/Reordercap'/>\n"
1320 " <menuitem name='Text2pcap' action='/Help/ManualPages/Text2pcap'/>\n"
1321 " <menuitem name='TShark' action='/Help/ManualPages/TShark'/>\n"
1322 " </menu>\n"
1323 " <separator/>\n"
1324 " <menuitem name='Website' action='/Help/Website'/>\n"
1325 " <menuitem name='FAQs' action='/Help/FAQs'/>\n"
1326 " <menuitem name='Ask' action='/Help/ASK'/>\n"
1327 " <menuitem name='Downloads' action='/Help/Downloads'/>\n"
1328 " <separator/>\n"
1329 " <menuitem name='Wiki' action='/Help/Wiki'/>\n"
1330 " <menuitem name='SampleCaptures' action='/Help/SampleCaptures'/>\n"
1331 #ifdef HAVE_SOFTWARE_UPDATE
1332 " <separator/>\n"
1333 " <menuitem name='CheckForUpdates' action='/Help/CheckForUpdates'/>\n"
1334 #endif /* HAVE_SOFTWARE_UPDATE */
1335 " <separator/>\n"
1336 " <menuitem name='AboutWireshark' action='/Help/AboutWireshark'/>\n"
1337 " </menu>\n"
1338 " </menubar>\n"
1339 "</ui>\n";
1344 * Main menu.
1346 * Please do not use keystrokes that are used as "universal" shortcuts in
1347 * various desktop environments:
1349 * Windows:
1350 * http://support.microsoft.com/kb/126449
1352 * GNOME:
1353 * http://library.gnome.org/users/user-guide/nightly/keyboard-skills.html.en
1355 * KDE:
1356 * http://developer.kde.org/documentation/standards/kde/style/keys/shortcuts.html
1358 * In particular, do not use the following <control> sequences for anything
1359 * other than their standard purposes:
1361 * <control>O File->Open
1362 * <control>S File->Save
1363 * <control>P File->Print
1364 * <control>W File->Close
1365 * <control>Q File->Quit
1366 * <control>Z Edit->Undo (which we don't currently have)
1367 * <control>X Edit->Cut (which we don't currently have)
1368 * <control>C Edit->Copy (which we don't currently have)
1369 * <control>V Edit->Paste (which we don't currently have)
1370 * <control>A Edit->Select All (which we don't currently have)
1372 * Note that some if not all of the Edit keys above already perform those
1373 * functions in text boxes, such as the Filter box. Do no, under any
1374 * circumstances, make a change that keeps them from doing so.
1378 * GtkActionEntry
1379 * typedef struct {
1380 * const gchar *name;
1381 * const gchar *stock_id;
1382 * const gchar *label;
1383 * const gchar *accelerator;
1384 * const gchar *tooltip;
1385 * GCallback callback;
1386 * } GtkActionEntry;
1387 * const gchar *name; The name of the action.
1388 * const gchar *stock_id; The stock id for the action, or the name of an icon from the icon theme.
1389 * const gchar *label; The label for the action. This field should typically be marked for translation,
1390 * see gtk_action_group_set_translation_domain().
1391 * If label is NULL, the label of the stock item with id stock_id is used.
1392 * const gchar *accelerator; The accelerator for the action, in the format understood by gtk_accelerator_parse().
1393 * const gchar *tooltip; The tooltip for the action. This field should typically be marked for translation,
1394 * see gtk_action_group_set_translation_domain().
1395 * GCallback callback; The function to call when the action is activated.
1399 #ifdef HAVE_LIBPCAP
1401 * TODO Move this menu to capture_if_dlg.c
1402 * eg put a "place holder" in the UI description and
1403 * make a call from main_menubar.c i.e build_capture_menu()
1404 * ad do the UI stuff there.
1406 static const GtkActionEntry capture_menu_entries[] = {
1407 { "/Capture", NULL, "_Capture", NULL, NULL, NULL },
1408 { "/Capture/Interfaces", WIRESHARK_STOCK_CAPTURE_INTERFACES, "_Interfaces...", "<control>I", NULL, G_CALLBACK(capture_if_action_cb) },
1409 { "/Capture/Options", WIRESHARK_STOCK_CAPTURE_OPTIONS, "_Options...", "<control>K", NULL, G_CALLBACK(capture_prep_action_cb) },
1410 { "/Capture/Start", WIRESHARK_STOCK_CAPTURE_START, "_Start", "<control>E", NULL, G_CALLBACK(capture_start_action_cb) },
1411 { "/Capture/Stop", WIRESHARK_STOCK_CAPTURE_STOP, "S_top", "<control>E", NULL, G_CALLBACK(capture_stop_action_cb) },
1412 { "/Capture/Restart", WIRESHARK_STOCK_CAPTURE_RESTART, "_Restart", "<control>R", NULL, G_CALLBACK(capture_restart_action_cb) },
1413 { "/Capture/CaptureFilters", WIRESHARK_STOCK_CAPTURE_FILTER, "Capture _Filters...", NULL, NULL, G_CALLBACK(capture_filters_action_cb) },
1414 { "/Capture/RefreshInterfaces", GTK_STOCK_REFRESH, "Refresh Interfaces", NULL, NULL, G_CALLBACK(refresh_interfaces_action_cb) },
1416 #endif
1418 static const GtkActionEntry main_menu_bar_entries[] = {
1419 /* Top level */
1420 { "/File", NULL, "_File", NULL, NULL, NULL },
1421 { "/Edit", NULL, "_Edit", NULL, NULL, NULL },
1422 { "/View", NULL, "_View", NULL, NULL, NULL },
1423 { "/Go", NULL, "_Go", NULL, NULL, NULL },
1424 { "/Analyze", NULL, "_Analyze", NULL, NULL, NULL },
1425 { "/Statistics", NULL, "_Statistics", NULL, NULL, NULL },
1426 { "/Telephony", NULL, "Telephon_y", NULL, NULL, NULL },
1427 { "/Tools", NULL, "_Tools", NULL, NULL, NULL },
1428 { "/Internals", NULL, "_Internals", NULL, NULL, NULL },
1429 { "/Help", NULL, "_Help", NULL, NULL, NULL },
1431 { "/File/Open", GTK_STOCK_OPEN, "_Open...", "<control>O", "Open a file", G_CALLBACK(file_open_cmd_cb) },
1432 { "/File/OpenRecent", NULL, "Open _Recent", NULL, NULL, NULL },
1433 { "/File/Merge", NULL, "_Merge...", NULL, NULL, G_CALLBACK(file_merge_cmd_cb) },
1434 { "/File/ImportFromHexDump", NULL, "_Import from Hex Dump...", NULL, NULL, G_CALLBACK(file_import_cmd_cb) },
1435 { "/File/Close", GTK_STOCK_CLOSE, "_Close", "<control>W", NULL, G_CALLBACK(file_close_cmd_cb) },
1437 { "/File/Save", WIRESHARK_STOCK_SAVE, "_Save", "<control>S", NULL, G_CALLBACK(file_save_cmd_cb) },
1438 { "/File/SaveAs", WIRESHARK_STOCK_SAVE, "Save _As...", "<shift><control>S", NULL, G_CALLBACK(file_save_as_cmd_cb) },
1440 { "/File/Set", NULL, "File Set", NULL, NULL, NULL },
1441 { "/File/ExportSpecifiedPackets", NULL, "Export Specified Packets...", NULL, NULL, G_CALLBACK(file_export_specified_packets_cmd_cb) },
1442 { "/File/ExportPacketDissections", NULL, "Export Packet Dissections", NULL, NULL, NULL },
1443 { "/File/ExportSelectedPacketBytes", NULL, "Export Selected Packet _Bytes...", "<control>H", NULL, G_CALLBACK(savehex_cb) },
1444 { "/File/ExportPDUs", NULL, "Export PDUs to file", NULL, NULL, G_CALLBACK(export_pdu_show_cb) },
1445 { "/File/ExportSSLSessionKeys", NULL, "Export SSL Session Keys...", NULL, NULL, G_CALLBACK(savesslkeys_cb) },
1446 { "/File/ExportObjects", NULL, "Export Objects", NULL, NULL, NULL },
1447 { "/File/Print", GTK_STOCK_PRINT, "_Print...", "<control>P", NULL, G_CALLBACK(file_print_cmd_cb) },
1448 { "/File/Quit", GTK_STOCK_QUIT, "_Quit", "<control>Q", NULL, G_CALLBACK(file_quit_cmd_cb) },
1450 { "/File/Set/ListFiles", WIRESHARK_STOCK_FILE_SET_LIST, "List Files", NULL, NULL, G_CALLBACK(fileset_cb) },
1451 { "/File/Set/NextFile", WIRESHARK_STOCK_FILE_SET_NEXT, "Next File", NULL, NULL, G_CALLBACK(fileset_next_cb) },
1452 { "/File/Set/PreviousFile", WIRESHARK_STOCK_FILE_SET_PREVIOUS, "Previous File", NULL, NULL, G_CALLBACK(fileset_previous_cb) },
1454 { "/File/ExportPacketDissections/Text", NULL, "as \"Plain _Text\" file...", NULL, NULL, G_CALLBACK(export_text_cmd_cb) },
1455 { "/File/ExportPacketDissections/PostScript", NULL, "as \"_PostScript\" file...", NULL, NULL, G_CALLBACK(export_ps_cmd_cb) },
1456 { "/File/ExportPacketDissections/CSV", NULL, "as \"_CSV\" (Comma Separated Values packet summary) file...",
1457 NULL, NULL, G_CALLBACK(export_csv_cmd_cb) },
1458 { "/File/ExportPacketDissections/CArrays", NULL, "as \"C _Arrays\" (packet bytes) file...",
1459 NULL, NULL, G_CALLBACK(export_carrays_cmd_cb) },
1460 { "/File/ExportPacketDissections/PSML", NULL, "as XML - \"P_SML\" (packet summary) file...",
1461 NULL, NULL, G_CALLBACK(export_psml_cmd_cb) },
1462 { "/File/ExportPacketDissections/PDML", NULL, "as XML - \"P_DML\" (packet details) file...",
1463 NULL, NULL, G_CALLBACK(export_pdml_cmd_cb) },
1464 { "/File/ExportObjects/HTTP", NULL, "_HTTP", NULL, NULL, G_CALLBACK(eo_http_cb) },
1465 { "/File/ExportObjects/DICOM", NULL, "_DICOM", NULL, NULL, G_CALLBACK(eo_dicom_cb) },
1466 { "/File/ExportObjects/SMB", NULL, "_SMB/SMB2", NULL, NULL, G_CALLBACK(eo_smb_cb) },
1469 { "/Edit/Copy", NULL, "Copy", NULL, NULL, NULL },
1471 { "/Edit/Copy/Description", NULL, "Description", "<shift><control>D", NULL, G_CALLBACK(copy_description_cb) },
1472 { "/Edit/Copy/Fieldname", NULL, "Fieldname", "<shift><control>F", NULL, G_CALLBACK(copy_fieldname_cb) },
1473 { "/Edit/Copy/Value", NULL, "Value", "<shift><control>V", NULL, G_CALLBACK(copy_value_cb) },
1474 { "/Edit/Copy/AsFilter", NULL, "As Filter", "<shift><control>C", NULL, G_CALLBACK(copy_as_filter_cb) },
1476 #if 0
1478 * Un-#if this when we actually implement Cut/Copy/Paste for the
1479 * packet list and packet detail windows.
1481 * Note: when we implement Cut/Copy/Paste in those windows, we
1482 * will almost certainly want to allow multiple packets to be
1483 * selected in the packet list pane and multiple packet detail
1484 * items to be selected in the packet detail pane, so that
1485 * the user can, for example, copy the summaries of multiple
1486 * packets to the clipboard from the packet list pane and multiple
1487 * packet detail items - perhaps *all* packet detail items - from
1488 * the packet detail pane. Given that, we'll also want to
1489 * implement Select All.
1491 * If multiple packets are selected, we would probably display nothing
1492 * in the packet detail pane, just as we do if no packet is selected,
1493 * and any menu items etc. that would pertain only to a single packet
1494 * would be disabled.
1496 * If multiple packet detail items are selected, we would probably
1497 * disable all items that pertain only to a single packet detail
1498 * item, such as some items in the status bar.
1500 * XXX - the actions for these will be different depending on what
1501 * widget we're in; ^C should copy from the filter text widget if
1502 * we're in that widget, the packet list if we're in that widget
1503 * (presumably copying the summaries of selected packets to the
1504 * clipboard, e.g. the text copy would be the text of the columns),
1505 * the packet detail if we're in that widget (presumably copying
1506 * the contents of selected protocol tree items to the clipboard,
1507 * e.g. the text copy would be the text displayed for those items),
1508 * etc..
1510 * Given that those menu items should also affect text widgets
1511 * such as the filter box, we would again want Select All, and,
1512 * at least for the filter box, we would also want Undo and Redo.
1513 * We would only want Cut, Paste, Undo, and Redo for the packet
1514 * list and packet detail panes if we support modifying them.
1516 {"/Edit/_Undo", "<control>Z", NULL,
1517 0, "<StockItem>", GTK_STOCK_UNDO,},
1518 {"/Edit/_Redo", "<shift><control>Z", NULL,
1519 0, "<StockItem>", GTK_STOCK_REDO,},
1520 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1521 {"/Edit/Cu_t", "<control>X", NULL,
1522 0, "<StockItem>", GTK_STOCK_CUT,},
1523 {"/Edit/_Copy", "<control>C", NULL,
1524 0, "<StockItem>", GTK_STOCK_COPY,},
1525 {"/Edit/_Paste", "<control>V", NULL,
1526 0, "<StockItem>", GTK_STOCK_PASTE,},
1527 {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
1528 {"/Edit/Select _All", "<control>A", NULL, 0,
1529 "<StockItem>", GTK_STOCK_SELECT_ALL,},
1530 #endif /* 0 */
1531 { "/Edit/FindPacket", GTK_STOCK_FIND, "_Find Packet...", "<control>F", NULL, G_CALLBACK(find_frame_cb) },
1532 { "/Edit/FindNext", NULL, "Find Ne_xt", "<control>N", NULL, G_CALLBACK(find_next_cb) },
1533 { "/Edit/FindPrevious", NULL, "Find Pre_vious", "<control>B", NULL, G_CALLBACK(find_previous_cb) },
1535 { "/Edit/MarkPacket", NULL, "_Mark/Unmark Packet", "<control>M", NULL, G_CALLBACK(packet_list_mark_frame_cb) },
1536 /* XXX - Unused. Should this and its associated code be removed? */
1537 { "/Edit/ToggleMarkingOfAllDisplayedPackets", NULL, "Toggle Marking of All Displayed Packets", "<shift><alt><control>M", NULL, G_CALLBACK(packet_list_toggle_mark_all_displayed_frames_cb) },
1538 { "/Edit/MarkAllDisplayedPackets", NULL, "Mark All Displayed Packets", "<shift><control>M", NULL, G_CALLBACK(packet_list_mark_all_displayed_frames_cb) },
1539 { "/Edit/UnmarkAllDisplayedPackets", NULL, "_Unmark All Displayed Packets", "<alt><control>M", NULL, G_CALLBACK(packet_list_unmark_all_displayed_frames_cb) },
1540 { "/Edit/FindNextMark", NULL, "Next Mark", "<shift><control>N", NULL, G_CALLBACK(find_next_mark_cb) },
1541 { "/Edit/FindPreviousMark", NULL, "Previous Mark", "<shift><control>B", NULL, G_CALLBACK(find_prev_mark_cb) },
1543 { "/Edit/IgnorePacket", NULL, "_Ignore/Unignore Packet", "<control>D", NULL, G_CALLBACK(packet_list_ignore_frame_cb) },
1545 * XXX - this next one overrides /Edit/Copy/Description
1547 { "/Edit/IgnoreAllDisplayedPackets", NULL, "Ignore All Displayed Packets", "<shift><control>D", NULL, G_CALLBACK(packet_list_ignore_all_displayed_frames_cb) },
1548 { "/Edit/Un-IgnoreAllPackets", NULL, "U_nignore All Packets", "<alt><control>D", NULL, G_CALLBACK(packet_list_unignore_all_frames_cb) },
1549 { "/Edit/SetTimeReference", WIRESHARK_STOCK_TIME, "Set/Unset Time Reference", "<control>T", NULL, G_CALLBACK(set_reftime_cb) },
1550 { "/Edit/Un-TimeReferenceAllPackets",NULL, "Unset All Time References", "<alt><control>T", NULL, G_CALLBACK(packet_list_untime_reference_all_frames_cb) },
1551 { "/Edit/FindNextTimeReference", NULL, "Next Time Reference", "<alt><control>N", NULL, G_CALLBACK(find_next_ref_time_cb) },
1552 { "/Edit/FindPreviousTimeReference", NULL, "Previous Time Reference", "<alt><control>B", NULL, G_CALLBACK(find_previous_ref_time_cb) },
1553 { "/Edit/TimeShift", WIRESHARK_STOCK_TIME, "Time Shift...", "<shift><control>T", NULL, G_CALLBACK(time_shift_cb) },
1555 { "/Edit/ConfigurationProfiles", NULL, "_Configuration Profiles...", "<shift><control>A", NULL, G_CALLBACK(profile_dialog_cb) },
1556 { "/Edit/Preferences", GTK_STOCK_PREFERENCES, "_Preferences...", "<shift><control>P", NULL, G_CALLBACK(menus_prefs_cb) },
1557 #ifdef WANT_PACKET_EDITOR
1558 { "/Edit/EditPacket", NULL, "_Edit Packet", NULL, NULL, G_CALLBACK(edit_window_cb) },
1559 #endif
1560 { "/Edit/AddEditPktComment", WIRESHARK_STOCK_EDIT, "Packet Comment...", NULL, NULL, G_CALLBACK(edit_packet_comment_dlg) },
1562 { "/View/TimeDisplayFormat", NULL, "_Time Display Format", NULL, NULL, NULL },
1564 { "/View/NameResolution", NULL, "Name Resol_ution", NULL, NULL, NULL },
1565 { "/View/NameResolution/ResolveName", NULL, "_Resolve Name", NULL, NULL, G_CALLBACK(resolve_name_cb) },
1566 { "/View/NameResolution/ManuallyResolveName",NULL, "Manually Resolve Name", NULL, NULL, G_CALLBACK(manual_addr_resolv_dlg) },
1568 { "/View/ZoomIn", GTK_STOCK_ZOOM_IN, "_Zoom In", "<control>plus", NULL, G_CALLBACK(view_zoom_in_cb) },
1569 { "/View/ZoomOut", GTK_STOCK_ZOOM_OUT, "Zoom _Out", "<control>minus", NULL, G_CALLBACK(view_zoom_out_cb) },
1570 { "/View/NormalSize", GTK_STOCK_ZOOM_100, "_Normal Size", "<control>equal", NULL, G_CALLBACK(view_zoom_100_cb) },
1571 { "/View/ResizeAllColumns", WIRESHARK_STOCK_RESIZE_COLUMNS, "Resize All Columns", "<shift><control>R", NULL, G_CALLBACK(packet_list_resize_columns_cb) },
1572 { "/View/DisplayedColumns", NULL, "Displayed Columns", NULL, NULL, NULL },
1573 { "/View/ExpandSubtrees", NULL, "E_xpand Subtrees", "<shift>Right", NULL, G_CALLBACK(expand_tree_cb) },
1574 { "/View/CollapseSubtrees", NULL, "Collapse Subtrees", "<shift>Left", NULL, G_CALLBACK(collapse_tree_cb) },
1575 { "/View/ExpandAll", NULL, "_Expand All", "<control>Right", NULL, G_CALLBACK(expand_all_cb) },
1576 { "/View/CollapseAll", NULL, "Collapse _All", "<control>Left", NULL, G_CALLBACK(collapse_all_cb) },
1577 { "/View/ColorizeConversation", NULL, "Colorize Conversation",NULL, NULL, NULL },
1579 { "/View/ColorizeConversation/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", "<control>1", NULL, G_CALLBACK(view_menu_color_conv_color1_cb) },
1580 { "/View/ColorizeConversation/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", "<control>2", NULL, G_CALLBACK(view_menu_color_conv_color2_cb) },
1581 { "/View/ColorizeConversation/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", "<control>3", NULL, G_CALLBACK(view_menu_color_conv_color3_cb) },
1582 { "/View/ColorizeConversation/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", "<control>4", NULL, G_CALLBACK(view_menu_color_conv_color4_cb) },
1583 { "/View/ColorizeConversation/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", "<control>5", NULL, G_CALLBACK(view_menu_color_conv_color5_cb) },
1584 { "/View/ColorizeConversation/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", "<control>6", NULL, G_CALLBACK(view_menu_color_conv_color6_cb) },
1585 { "/View/ColorizeConversation/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", "<control>7", NULL, G_CALLBACK(view_menu_color_conv_color7_cb) },
1586 { "/View/ColorizeConversation/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", "<control>8", NULL, G_CALLBACK(view_menu_color_conv_color8_cb) },
1587 { "/View/ColorizeConversation/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", "<control>9", NULL, G_CALLBACK(view_menu_color_conv_color9_cb) },
1588 { "/View/ColorizeConversation/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", "<control>0", NULL, G_CALLBACK(view_menu_color_conv_color10_cb) },
1589 { "/View/ColorizeConversation/NewColoringRule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(view_menu_color_conv_new_rule_cb) },
1591 { "/View/ResetColoring1-10", NULL, "Reset Coloring 1-10", "<control>space", NULL, G_CALLBACK(view_menu_reset_coloring_cb) },
1592 { "/View/ColoringRules", GTK_STOCK_SELECT_COLOR, "_Coloring Rules...", NULL, NULL, G_CALLBACK(color_display_cb) },
1593 { "/View/ShowPacketinNewWindow", NULL, "Show Packet in New _Window", NULL, NULL, G_CALLBACK(new_window_cb) },
1594 { "/View/Reload", GTK_STOCK_REFRESH, "_Reload", "<control>R", NULL, G_CALLBACK(file_reload_cmd_cb) },
1597 { "/Go/Back", GTK_STOCK_GO_BACK, "_Back", "<alt>Left", NULL, G_CALLBACK(history_back_cb) },
1598 { "/Go/Forward", GTK_STOCK_GO_FORWARD, "_Forward", "<alt>Right", NULL, G_CALLBACK(history_forward_cb) },
1599 { "/Go/Goto", GTK_STOCK_JUMP_TO, "_Go to Packet...", "<control>G", NULL, G_CALLBACK(goto_frame_cb) },
1600 { "/Go/GotoCorrespondingPacket", NULL, "Go to _Corresponding Packet", NULL, NULL, G_CALLBACK(goto_framenum_cb) },
1601 { "/Go/PreviousPacket", GTK_STOCK_GO_UP, "Previous Packet", "<control>Up", NULL, G_CALLBACK(goto_previous_frame_cb) },
1602 { "/Go/NextPacket", GTK_STOCK_GO_DOWN, "Next Packet", "<control>Down", NULL, G_CALLBACK(goto_next_frame_cb) },
1603 { "/Go/FirstPacket", GTK_STOCK_GOTO_TOP, "F_irst Packet", "<control>Home", NULL, G_CALLBACK(goto_top_frame_cb) },
1604 { "/Go/LastPacket", GTK_STOCK_GOTO_BOTTOM, "_Last Packet", "<control>End", NULL, G_CALLBACK(goto_bottom_frame_cb) },
1605 { "/Go/PreviousPacketInConversation", GTK_STOCK_GO_UP, "Previous Packet In Conversation", "<control>comma", NULL, G_CALLBACK(goto_previous_frame_conversation_cb) },
1606 { "/Go/NextPacketInConversation", GTK_STOCK_GO_DOWN, "Next Packet In Conversation", "<control>period", NULL, G_CALLBACK(goto_next_frame_conversation_cb) },
1609 { "/Analyze/DisplayFilters", WIRESHARK_STOCK_DISPLAY_FILTER, "_Display Filters...", NULL, NULL, G_CALLBACK(dfilter_dialog_cb) },
1611 { "/Analyze/DisplayFilterMacros", NULL, "Display Filter _Macros...", NULL, NULL, G_CALLBACK(macros_dialog_cb) },
1612 { "/Analyze/ApplyasColumn", NULL, "Apply as Column", NULL, NULL, G_CALLBACK(apply_as_custom_column_cb) },
1614 { "/Analyze/EnabledProtocols", WIRESHARK_STOCK_CHECKBOX, "_Enabled Protocols...", "<shift><control>E", NULL, G_CALLBACK(proto_cb) },
1615 { "/Analyze/DecodeAs", WIRESHARK_STOCK_DECODE_AS, "Decode _As...", NULL, NULL, G_CALLBACK(decode_as_cb) },
1616 { "/Analyze/UserSpecifiedDecodes", WIRESHARK_STOCK_DECODE_AS, "_User Specified Decodes...", NULL, NULL, G_CALLBACK(decode_show_cb) },
1618 { "/Analyze/FollowTCPStream", NULL, "Follow TCP Stream", NULL, NULL, G_CALLBACK(follow_tcp_stream_cb) },
1619 { "/Analyze/FollowUDPStream", NULL, "Follow UDP Stream", NULL, NULL, G_CALLBACK(follow_udp_stream_cb) },
1620 { "/Analyze/FollowSSLStream", NULL, "Follow SSL Stream", NULL, NULL, G_CALLBACK(follow_ssl_stream_cb) },
1622 { "/Analyze/ExpertInfo", WIRESHARK_STOCK_EXPERT_INFO, "Expert _Info", NULL, NULL, G_CALLBACK(expert_comp_dlg_launch) },
1624 { "/Analyze/ConversationFilter", NULL, "Conversation Filter", NULL, NULL, NULL },
1627 { "/Statistics/ConversationList", NULL, "_Conversation List", NULL, NULL, NULL },
1628 { "/Statistics/ConversationList/Ethernet", WIRESHARK_STOCK_CONVERSATIONS, "Ethernet", NULL, NULL, G_CALLBACK(eth_endpoints_cb) },
1629 { "/Statistics/ConversationList/FibreChannel", WIRESHARK_STOCK_CONVERSATIONS, "Fibre Channel", NULL, NULL, G_CALLBACK(fc_endpoints_cb) },
1630 { "/Statistics/ConversationList/FDDI", WIRESHARK_STOCK_CONVERSATIONS, "FDDI", NULL, NULL, G_CALLBACK(fddi_endpoints_cb) },
1631 { "/Statistics/ConversationList/IP", WIRESHARK_STOCK_CONVERSATIONS, "IPv4", NULL, NULL, G_CALLBACK(ip_endpoints_cb) },
1632 { "/Statistics/ConversationList/IPv6", WIRESHARK_STOCK_CONVERSATIONS, "IPv6", NULL, NULL, G_CALLBACK(ipv6_endpoints_cb) },
1633 { "/Statistics/ConversationList/IPX", WIRESHARK_STOCK_CONVERSATIONS, "IPX", NULL, NULL, G_CALLBACK(ipx_endpoints_cb) },
1634 { "/Statistics/ConversationList/JXTA", WIRESHARK_STOCK_CONVERSATIONS, "JXTA", NULL, NULL, G_CALLBACK(jxta_conversation_cb) },
1635 { "/Statistics/ConversationList/NCP", WIRESHARK_STOCK_CONVERSATIONS, "NCP", NULL, NULL, G_CALLBACK(ncp_endpoints_cb) },
1636 { "/Statistics/ConversationList/RSVP", WIRESHARK_STOCK_CONVERSATIONS, "RSVP", NULL, NULL, G_CALLBACK(rsvp_endpoints_cb) },
1637 { "/Statistics/ConversationList/SCTP", WIRESHARK_STOCK_CONVERSATIONS, "SCTP", NULL, NULL, G_CALLBACK(sctp_conversation_cb) },
1638 { "/Statistics/ConversationList/TCPIP", WIRESHARK_STOCK_CONVERSATIONS, "TCP (IPv4 & IPv6)", NULL, NULL, G_CALLBACK(tcpip_conversation_cb) },
1639 { "/Statistics/ConversationList/TR", WIRESHARK_STOCK_CONVERSATIONS, "Token Ring", NULL, NULL, G_CALLBACK(tr_conversation_cb) },
1640 { "/Statistics/ConversationList/UDPIP", WIRESHARK_STOCK_CONVERSATIONS, "UDP (IPv4 & IPv6)", NULL, NULL, G_CALLBACK(udpip_conversation_cb) },
1641 { "/Statistics/ConversationList/USB", WIRESHARK_STOCK_CONVERSATIONS, "USB", NULL, NULL, G_CALLBACK(usb_endpoints_cb) },
1642 { "/Statistics/ConversationList/WLAN", WIRESHARK_STOCK_CONVERSATIONS, "WLAN", NULL, NULL, G_CALLBACK(wlan_endpoints_cb) },
1644 { "/Statistics/EndpointList", NULL, "_Endpoint List", NULL, NULL, NULL },
1645 { "/Statistics/EndpointList/Ethernet", WIRESHARK_STOCK_ENDPOINTS, "Ethernet", NULL, NULL, G_CALLBACK(gtk_eth_hostlist_cb) },
1646 { "/Statistics/EndpointList/FibreChannel", WIRESHARK_STOCK_ENDPOINTS, "Fibre Channel", NULL, NULL, G_CALLBACK(gtk_fc_hostlist_cb) },
1647 { "/Statistics/EndpointList/FDDI", WIRESHARK_STOCK_ENDPOINTS, "FDDI", NULL, NULL, G_CALLBACK(gtk_fddi_hostlist_cb) },
1648 { "/Statistics/EndpointList/IP", WIRESHARK_STOCK_ENDPOINTS, "IPv4", NULL, NULL, G_CALLBACK(gtk_ip_hostlist_cb) },
1649 { "/Statistics/EndpointList/IPv6", WIRESHARK_STOCK_ENDPOINTS, "IPv6", NULL, NULL, G_CALLBACK(gtk_ipv6_hostlist_cb) },
1650 { "/Statistics/EndpointList/IPX", WIRESHARK_STOCK_ENDPOINTS, "IPX", NULL, NULL, G_CALLBACK(gtk_ipx_hostlist_cb) },
1651 { "/Statistics/EndpointList/JXTA", WIRESHARK_STOCK_ENDPOINTS, "JXTA", NULL, NULL, G_CALLBACK(gtk_jxta_hostlist_cb) },
1652 { "/Statistics/EndpointList/NCP", WIRESHARK_STOCK_ENDPOINTS, "NCP", NULL, NULL, G_CALLBACK(gtk_ncp_hostlist_cb) },
1653 { "/Statistics/EndpointList/RSVP", WIRESHARK_STOCK_ENDPOINTS, "RSVP", NULL, NULL, G_CALLBACK(gtk_rsvp_hostlist_cb) },
1654 { "/Statistics/EndpointList/SCTP", WIRESHARK_STOCK_ENDPOINTS, "SCTP", NULL, NULL, G_CALLBACK(gtk_sctp_hostlist_cb) },
1655 { "/Statistics/EndpointList/TCPIP", WIRESHARK_STOCK_ENDPOINTS, "TCP (IPv4 & IPv6)", NULL, NULL, G_CALLBACK(gtk_tcpip_hostlist_cb) },
1656 { "/Statistics/EndpointList/TR", WIRESHARK_STOCK_ENDPOINTS, "Token Ring", NULL, NULL, G_CALLBACK(gtk_tr_hostlist_cb) },
1657 { "/Statistics/EndpointList/UDPIP", WIRESHARK_STOCK_ENDPOINTS, "UDP (IPv4 & IPv6)", NULL, NULL, G_CALLBACK(gtk_udpip_hostlist_cb) },
1658 { "/Statistics/EndpointList/USB", WIRESHARK_STOCK_ENDPOINTS, "USB", NULL, NULL, G_CALLBACK(gtk_usb_hostlist_cb) },
1659 { "/Statistics/EndpointList/WLAN", WIRESHARK_STOCK_ENDPOINTS, "WLAN", NULL, NULL, G_CALLBACK(gtk_wlan_hostlist_cb) },
1661 { "/Statistics/ServiceResponseTime", NULL, "Service _Response Time", NULL, NULL, NULL },
1662 { "/Statistics/ServiceResponseTime/DCE-RPC", WIRESHARK_STOCK_TIME, "DCE-RPC...", NULL, NULL, G_CALLBACK(gtk_dcerpcstat_cb) },
1663 { "/Statistics/ServiceResponseTime/ONC-RPC", WIRESHARK_STOCK_TIME, "ONC-RPC...", NULL, NULL, G_CALLBACK(gtk_rpcstat_cb) },
1665 { "/Statistics/ancp", NULL, "ANCP", NULL, NULL, G_CALLBACK(gtk_stats_tree_cb) },
1666 { "/Statistics/BACnet", NULL, "BACnet", NULL, NULL, NULL },
1667 { "/Statistics/BACnet/bacapp_instanceid", NULL, "Packets sorted by Instance ID", NULL, NULL, G_CALLBACK(gtk_stats_tree_cb) },
1668 { "/Statistics/BACnet/bacapp_ip", NULL, "Packets sorted by IP", NULL, NULL, G_CALLBACK(gtk_stats_tree_cb) },
1669 { "/Statistics/BACnet/bacapp_objectid", NULL, "Packets sorted by Object Type", NULL, NULL, G_CALLBACK(gtk_stats_tree_cb) },
1670 { "/Statistics/BACnet/bacapp_service", NULL, "Packets sorted by Service", NULL, NULL, G_CALLBACK(gtk_stats_tree_cb) },
1672 { "/Statistics/collectd", NULL, "Collectd...", NULL, NULL, G_CALLBACK(gtk_stats_tree_cb) },
1673 { "/Statistics/compare", NULL, "Compare...", NULL, NULL, G_CALLBACK(gtk_comparestat_cb) },
1674 { "/Statistics/FlowGraph", WIRESHARK_STOCK_FLOW_GRAPH, "Flo_w Graph...", NULL, NULL, G_CALLBACK(flow_graph_launch) },
1675 { "/Statistics/hart_ip", NULL, "HART-IP", NULL, NULL, G_CALLBACK(gtk_stats_tree_cb) },
1676 { "/Statistics/HTTP", NULL, "HTTP", NULL, NULL, NULL },
1677 { "/Statistics/HTTP/http", NULL, "Packet Counter", NULL, NULL, G_CALLBACK(gtk_stats_tree_cb) },
1678 { "/Statistics/HTTP/http_req", NULL, "Requests", NULL, NULL, G_CALLBACK(gtk_stats_tree_cb) },
1679 { "/Statistics/HTTP/http_srv", NULL, "Load Distribution", NULL, NULL, G_CALLBACK(gtk_stats_tree_cb) },
1681 { "/Statistics/ONC-RPC-Programs", NULL, "ONC-RPC Programs", NULL, NULL, G_CALLBACK(gtk_rpcprogs_cb) },
1682 { "/Statistics/Sametime", NULL, "Sametime", NULL, NULL, NULL },
1683 { "/Statistics/Sametime/sametime", NULL, "Messages", NULL, NULL, G_CALLBACK(gtk_stats_tree_cb) },
1684 { "/Statistics/TCPStreamGraphMenu", NULL, "TCP StreamGraph", NULL, NULL, NULL },
1685 { "/Statistics/TCPStreamGraphMenu/Time-Sequence-Graph-Stevens", NULL, "Time-Sequence Graph (Stevens)", NULL, NULL, G_CALLBACK(tcp_graph_cb) },
1686 { "/Statistics/TCPStreamGraphMenu/Time-Sequence-Graph-tcptrace", NULL, "Time-Sequence Graph (tcptrace)", NULL, NULL, G_CALLBACK(tcp_graph_cb) },
1687 { "/Statistics/TCPStreamGraphMenu/Throughput-Graph", NULL, "Throughput Graph", NULL, NULL, G_CALLBACK(tcp_graph_cb) },
1688 { "/Statistics/TCPStreamGraphMenu/RTT-Graph", NULL, "Round Trip Time Graph", NULL, NULL, G_CALLBACK(tcp_graph_cb) },
1689 { "/Statistics/TCPStreamGraphMenu/Window-Scaling-Graph", NULL, "Window Scaling Graph", NULL, NULL, G_CALLBACK(tcp_graph_cb) },
1691 { "/Statistics/UDPMulticastStreams", NULL, "UDP Multicast Streams", NULL, NULL, G_CALLBACK(mcaststream_launch) },
1692 { "/Statistics/WLANTraffic", NULL, "WLAN Traffic", NULL, NULL, G_CALLBACK(wlanstat_launch) },
1694 { "/Statistics/Summary", GTK_STOCK_PROPERTIES, "_Summary", NULL, NULL, G_CALLBACK(summary_open_cb) },
1695 { "/Statistics/CommentsSummary", NULL, "Comments Summary", NULL, NULL, G_CALLBACK(show_packet_comment_summary_dlg) },
1696 { "/Statistics/ShowAddreRes", NULL, "Show address resolution", NULL, NULL, G_CALLBACK(addr_resolution_dlg) },
1697 { "/Statistics/ProtocolHierarchy", NULL, "_Protocol Hierarchy", NULL, NULL, G_CALLBACK(proto_hier_stats_cb) },
1698 { "/Statistics/Conversations", WIRESHARK_STOCK_CONVERSATIONS, "Conversations", NULL, NULL, G_CALLBACK(init_conversation_notebook_cb) },
1699 { "/Statistics/Endpoints", WIRESHARK_STOCK_ENDPOINTS, "Endpoints", NULL, NULL, G_CALLBACK(init_hostlist_notebook_cb) },
1700 { "/Statistics/IOGraphs", WIRESHARK_STOCK_GRAPHS, "_IO Graph", NULL, NULL, G_CALLBACK(gui_iostat_cb) },
1701 { "/Statistics/plen", NULL, "Packet Lengths...", NULL, NULL, G_CALLBACK(gtk_stats_tree_cb) },
1703 { "/Telephony/ANSI", NULL, "_ANSI", NULL, NULL, NULL },
1704 { "/Telephony/ANSI/BSMAP", NULL, "A-Interface BSMAP", NULL, NULL, G_CALLBACK(ansi_a_stat_gtk_bsmap_cb) },
1705 { "/Telephony/ANSI/DTAP", NULL, "A-Interface DTAP", NULL, NULL, G_CALLBACK(ansi_a_stat_gtk_dtap_cb) },
1706 { "/Telephony/ANSI/MAP-OP", NULL, "MAP Operation", NULL, NULL, G_CALLBACK(ansi_map_stat_gtk_cb) },
1708 { "/Telephony/GSM", NULL, "_GSM", NULL, NULL, NULL },
1709 { "/Telephony/GSM/BSSMAP", NULL, "A-Interface BSSMAP", NULL, NULL, G_CALLBACK(gsm_a_stat_gtk_bssmap_cb) },
1711 { "/Telephony/GSM/DTAP", NULL, "A-Interface DTAP", NULL, NULL, NULL },
1712 { "/Telephony/GSM/DTAP/CC", NULL, "Call Control", NULL, NULL, G_CALLBACK(gsm_a_stat_gtk_dtap_cc_cb) },
1713 { "/Telephony/GSM/DTAP/GMM", NULL, "GPRS Mobility Management", NULL, NULL, G_CALLBACK(gsm_a_stat_gtk_dtap_gmm_cb) },
1714 { "/Telephony/GSM/DTAP/SM", NULL, "GPRS Session Management", NULL, NULL, G_CALLBACK(gsm_a_stat_gtk_dtap_sm_cb) },
1715 { "/Telephony/GSM/DTAP/MM", NULL, "Mobility Management", NULL, NULL, G_CALLBACK(gsm_a_stat_gtk_dtap_mm_cb) },
1716 { "/Telephony/GSM/DTAP/RR", NULL, "Radio Resource Management",NULL, NULL, G_CALLBACK(gsm_a_stat_gtk_dtap_rr_cb) },
1717 { "/Telephony/GSM/DTAP/SMS", NULL, "Short Message Service", NULL, NULL, G_CALLBACK(gsm_a_stat_gtk_dtap_sms_cb) },
1718 { "/Telephony/GSM/DTAP/TP", NULL, "Special Conformance Testing Functions", NULL, NULL, G_CALLBACK(gsm_a_stat_gtk_dtap_tp_cb) },
1719 { "/Telephony/GSM/DTAP/SS", NULL, "Supplementary Services", NULL, NULL, G_CALLBACK(gsm_a_stat_gtk_dtap_ss_cb) },
1721 { "/Telephony/GSM/SACCH", NULL, "A-Interface SACCH", NULL, NULL, G_CALLBACK(gsm_a_stat_gtk_sacch_rr_cb) },
1722 { "/Telephony/GSM/MAP-OP", NULL, "MAP Operation", NULL, NULL, G_CALLBACK(gsm_map_stat_gtk_cb) },
1723 { "/Telephony/GSM/MAPSummary", NULL, "MAP Summary", NULL, NULL, G_CALLBACK(gsm_map_stat_gtk_sum_cb) },
1725 { "/Telephony/IAX2", NULL, "IA_X2", NULL, NULL, NULL },
1726 { "/Telephony/IAX2/StreamAnalysis", NULL, "Stream Analysis...", NULL, NULL, G_CALLBACK(iax2_analysis_cb) },
1728 { "/Telephony/isup_msg", NULL, "_ISUP Messages", NULL, NULL, G_CALLBACK(gtk_stats_tree_cb) },
1730 { "/Telephony/LTE", NULL, "_LTE", NULL, NULL, NULL },
1731 { "/Telephony/LTE/RLCGraph", NULL, "RLC _Graph...", NULL, NULL, G_CALLBACK(rlc_lte_graph_cb) },
1732 { "/Telephony/MTP3", NULL, "_MTP3", NULL, NULL, NULL },
1733 { "/Telephony/MTP3/MSUs", NULL, "MSUs", NULL, NULL, G_CALLBACK(mtp3_stat_gtk_cb) },
1734 { "/Telephony/MTP3/MSUSummary", NULL, "MSU Summary", NULL, NULL, G_CALLBACK(mtp3_sum_gtk_sum_cb) },
1735 { "/Telephony/RTP", NULL, "_RTP", NULL, NULL, NULL },
1736 { "/Telephony/RTP/StreamAnalysis", NULL, "Stream Analysis...", NULL, NULL, G_CALLBACK(rtp_analysis_cb) },
1737 { "/Telephony/RTP/ShowAllStreams", NULL, "Show All Streams", NULL, NULL, G_CALLBACK(rtpstream_launch) },
1738 { "/Telephony/RTSP", NULL, "RTSP", NULL, NULL, NULL },
1739 { "/Telephony/RTSP/rtsp", NULL, "Packet Counter", NULL, NULL, G_CALLBACK(gtk_stats_tree_cb) },
1740 { "/Telephony/SCTP", NULL, "S_CTP", NULL, NULL, NULL },
1741 { "/Telephony/SCTP/AnalysethisAssociation", NULL, "Analyse this Association", NULL, NULL, G_CALLBACK(sctp_analyse_start) },
1742 { "/Telephony/SCTP/ShowAllAssociations", NULL, "Show All Associations...", NULL, NULL, G_CALLBACK(sctp_stat_start) },
1743 { "/Telephony/smpp_commands", NULL, "SM_PPOperations", NULL, NULL, G_CALLBACK(gtk_stats_tree_cb) },
1744 { "/Telephony/ucp_messages", NULL, "_UCP Messages", NULL, NULL, G_CALLBACK(gtk_stats_tree_cb) },
1745 { "/Telephony/VoIPCalls", WIRESHARK_STOCK_TELEPHONE, "_VoIP Calls", NULL, NULL, G_CALLBACK(voip_calls_launch) },
1747 { "/Tools/FirewallACLRules", NULL, "Firewall ACL Rules", NULL, NULL, G_CALLBACK(firewall_rule_cb) },
1749 { "/Internals/Dissectortables", NULL, "_Dissector tables", NULL, NULL, G_CALLBACK(dissector_tables_dlg_cb) },
1750 { "/Internals/Conversations", NULL, "_Conversation hash tables",NULL, NULL, G_CALLBACK(conversation_hastables_dlg) },
1751 { "/Internals/SupportedProtocols", NULL, "_Supported Protocols (slow!)", NULL, NULL, G_CALLBACK(supported_cb) },
1753 { "/Help/Contents", GTK_STOCK_HELP, "_Contents", "F1", NULL, G_CALLBACK(help_menu_cont_cb) },
1754 { "/Help/ManualPages", NULL, "ManualPages", NULL, NULL, NULL },
1755 { "/Help/ManualPages/Wireshark", NULL, "Wireshark", NULL, NULL, G_CALLBACK(help_menu_wireshark_cb) },
1756 { "/Help/ManualPages/WiresharkFilter", NULL, "Wireshark Filter", NULL, NULL, G_CALLBACK(help_menu_wireshark_flt_cb) },
1757 { "/Help/ManualPages/Capinfos", NULL, "Capinfos", NULL, NULL, G_CALLBACK(help_menu_Capinfos_cb) },
1758 { "/Help/ManualPages/Dumpcap", NULL, "Dumpcap", NULL, NULL, G_CALLBACK(help_menu_Dumpcap_cb) },
1759 { "/Help/ManualPages/Editcap", NULL, "Editcap", NULL, NULL, G_CALLBACK(help_menu_Editcap_cb) },
1760 { "/Help/ManualPages/Mergecap", NULL, "Mergecap", NULL, NULL, G_CALLBACK(help_menu_Mergecap_cb) },
1761 { "/Help/ManualPages/RawShark", NULL, "RawShark", NULL, NULL, G_CALLBACK(help_menu_RawShark_cb) },
1762 { "/Help/ManualPages/Reordercap", NULL, "Reordercap", NULL, NULL, G_CALLBACK(help_menu_Reorder_cb) },
1763 { "/Help/ManualPages/Text2pcap", NULL, "Text2pcap", NULL, NULL, G_CALLBACK(help_menu_Text2pcap_cb) },
1764 { "/Help/ManualPages/TShark", NULL, "TShark", NULL, NULL, G_CALLBACK(help_menu_TShark_cb) },
1766 { "/Help/Website", GTK_STOCK_HOME, "Website", NULL, NULL, G_CALLBACK(help_menu_Website_cb) },
1767 { "/Help/FAQs", NULL, "FAQ's", NULL, NULL, G_CALLBACK(help_menu_faq_cb) },
1768 { "/Help/ASK", NULL, "Ask (Q&A)", NULL, NULL, G_CALLBACK(help_menu_ask_cb) },
1769 { "/Help/Downloads", NULL, "Downloads", NULL, NULL, G_CALLBACK(help_menu_Downloads_cb) },
1770 { "/Help/Wiki", WIRESHARK_STOCK_WIKI, "Wiki", NULL, NULL, G_CALLBACK(help_menu_Wiki_cb) },
1771 { "/Help/SampleCaptures", NULL, "Sample Captures", NULL, NULL, G_CALLBACK(help_menu_SampleCaptures_cb) },
1772 #ifdef HAVE_SOFTWARE_UPDATE
1773 { "/Help/CheckForUpdates", NULL, "Check for Updates...", NULL, NULL, G_CALLBACK(check_for_updates_cb) },
1774 #endif /* HAVE_SOFTWARE_UPDATE */
1775 { "/Help/AboutWireshark", WIRESHARK_STOCK_ABOUT, "_About Wireshark", NULL, NULL, G_CALLBACK(about_wireshark_cb) },
1778 static const GtkToggleActionEntry main_menu_bar_toggle_action_entries[] =
1780 /* name, stock id, label, accel, tooltip, callback, is_active */
1781 {"/View/MainToolbar", NULL, "_Main Toolbar", NULL, NULL, G_CALLBACK(main_toolbar_show_hide_cb), TRUE},
1782 {"/View/FilterToolbar", NULL, "_Filter Toolbar", NULL, NULL, G_CALLBACK(filter_toolbar_show_hide_cb), TRUE},
1783 {"/View/WirelessToolbar", NULL, "Wire_less Toolbar", NULL, NULL, G_CALLBACK(wireless_toolbar_show_hide_cb), FALSE},
1784 {"/View/StatusBar", NULL, "_Status Bar", NULL, NULL, G_CALLBACK(status_bar_show_hide_cb), TRUE},
1785 {"/View/PacketList", NULL, "Packet _List", NULL, NULL, G_CALLBACK(packet_list_show_hide_cb), TRUE},
1786 {"/View/PacketDetails", NULL, "Packet _Details", NULL, NULL, G_CALLBACK(packet_details_show_hide_cb), TRUE},
1787 {"/View/PacketBytes", NULL, "Packet _Bytes", NULL, NULL, G_CALLBACK(packet_bytes_show_hide_cb), TRUE},
1788 {"/View/TimeDisplayFormat/DisplaySecondsWithHoursAndMinutes", NULL, "Display Seconds with hours and minutes", NULL, NULL, G_CALLBACK(timestamp_seconds_time_cb), FALSE},
1789 {"/View/NameResolution/EnableforMACLayer", NULL, "Enable for _MAC Layer", NULL, NULL, G_CALLBACK(view_menu_en_for_MAC_cb), TRUE},
1790 {"/View/NameResolution/EnableforTransportLayer", NULL, "Enable for _Transport Layer", NULL, NULL, G_CALLBACK(view_menu_en_for_transport_cb), TRUE },
1791 {"/View/NameResolution/EnableforNetworkLayer", NULL, "Enable for _Network Layer", NULL, NULL, G_CALLBACK(view_menu_en_for_network_cb), TRUE },
1792 {"/View/NameResolution/UseExternalNetworkNameResolver", NULL, "Use _External Network Name Resolver", NULL, NULL, G_CALLBACK(view_menu_en_use_external_resolver_cb), TRUE },
1793 {"/View/ColorizePacketList", NULL, "Colorize Packet List", NULL, NULL, G_CALLBACK(view_menu_colorize_pkt_lst_cb), TRUE },
1794 #ifdef HAVE_LIBPCAP
1795 {"/View/AutoScrollinLiveCapture", NULL, "Auto Scroll in Li_ve Capture", NULL, NULL, G_CALLBACK(view_menu_auto_scroll_live_cb), TRUE },
1796 #endif
1799 static const GtkRadioActionEntry main_menu_bar_radio_view_time_entries [] =
1801 /* name, stock id, label, accel, tooltip, value */
1802 { "/View/TimeDisplayFormat/DateYMDandTimeofDay", NULL, "Date and Time of Day: 1970-01-01 01:02:03.123456", "<alt><control>1", NULL, TS_ABSOLUTE_WITH_YMD },
1803 { "/View/TimeDisplayFormat/DateYDOYandTimeofDay", NULL, "Date (with day of year) and Time of Day: 1970/001 01:02:03.123456", NULL, NULL, TS_ABSOLUTE_WITH_YDOY },
1804 { "/View/TimeDisplayFormat/TimeofDay", NULL, "Time of Day: 01:02:03.123456", "<alt><control>2", NULL, TS_ABSOLUTE },
1805 { "/View/TimeDisplayFormat/SecondsSinceEpoch", NULL, "Seconds Since Epoch (1970-01-01): 1234567890.123456", "<alt><control>3", NULL, TS_EPOCH },
1806 { "/View/TimeDisplayFormat/SecondsSinceBeginningofCapture", NULL, "Seconds Since Beginning of Capture: 123.123456", "<alt><control>4", NULL, TS_RELATIVE },
1807 { "/View/TimeDisplayFormat/SecondsSincePreviousCapturedPacket", NULL, "Seconds Since Previous Captured Packet: 1.123456", "<alt><control>5", NULL, TS_DELTA },
1808 { "/View/TimeDisplayFormat/SecondsSincePreviousDisplayedPacket",NULL, "Seconds Since Previous Displayed Packet: 1.123456", "<alt><control>6", NULL, TS_DELTA_DIS },
1809 { "/View/TimeDisplayFormat/UTCDateYMDandTimeofDay", NULL, "UTC Date and Time of Day: 1970-01-01 01:02:03.123456", "<alt><control>7", NULL, TS_UTC_WITH_YMD },
1810 { "/View/TimeDisplayFormat/UTCDateYDOYandTimeofDay", NULL, "UTC Date (with day of year) and Time of Day: 1970/001 01:02:03.123456", NULL, NULL, TS_UTC_WITH_YDOY },
1811 { "/View/TimeDisplayFormat/UTCTimeofDay", NULL, "UTC Time of Day: 01:02:03.123456", "<alt><control>7", NULL, TS_UTC },
1814 static const GtkRadioActionEntry main_menu_bar_radio_view_time_fileformat_prec_entries [] =
1816 /* name, stock id, label, accel, tooltip, value */
1817 { "/View/TimeDisplayFormat/FileFormatPrecision-Automatic", NULL, "Automatic (File Format Precision)", NULL, NULL, TS_PREC_AUTO },
1818 { "/View/TimeDisplayFormat/FileFormatPrecision-Seconds", NULL, "Seconds: 0", NULL, NULL, TS_PREC_FIXED_SEC },
1819 { "/View/TimeDisplayFormat/FileFormatPrecision-Deciseconds", NULL, "Deciseconds: 0.1", NULL, NULL, TS_PREC_FIXED_DSEC },
1820 { "/View/TimeDisplayFormat/FileFormatPrecision-Centiseconds", NULL, "Centiseconds: 0.12", NULL, NULL, TS_PREC_FIXED_CSEC },
1821 { "/View/TimeDisplayFormat/FileFormatPrecision-Milliseconds", NULL, "Milliseconds: 0.123", NULL, NULL, TS_PREC_FIXED_MSEC },
1822 { "/View/TimeDisplayFormat/FileFormatPrecision-Microseconds", NULL, "Microseconds: 0.123456", NULL, NULL, TS_PREC_FIXED_USEC },
1823 { "/View/TimeDisplayFormat/FileFormatPrecision-Nanoseconds", NULL, "Nanoseconds: 0.123456789", NULL, NULL, TS_PREC_FIXED_NSEC },
1827 static void
1828 select_bytes_view_cb (GtkRadioAction *action, GtkRadioAction *current _U_, gpointer user_data _U_)
1830 gint value;
1832 value = gtk_radio_action_get_current_value (action);
1833 /* Fix me */
1834 select_bytes_view( NULL, NULL, value);
1837 static void
1838 sort_ascending_cb(GtkAction *action _U_, gpointer user_data)
1840 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/SortAscending");
1841 packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_SORT_ASCENDING);
1844 static void
1845 sort_descending_cb(GtkAction *action _U_, gpointer user_data)
1847 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/SortDescending");
1848 packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_SORT_DESCENDING);
1851 static void
1852 no_sorting_cb(GtkAction *action _U_, gpointer user_data)
1854 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/NoSorting");
1855 packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_SORT_NONE);
1858 static void
1859 packet_list_heading_show_resolved_cb(GtkAction *action _U_, gpointer user_data _U_)
1861 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/ShowResolved");
1863 packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_TOGGLE_RESOLVED);
1866 static void
1867 packet_list_heading_align_left_cb(GtkAction *action _U_, gpointer user_data)
1869 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/AlignLeft");
1870 packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_ALIGN_LEFT);
1873 static void
1874 packet_list_heading_align_center_cb(GtkAction *action _U_, gpointer user_data)
1876 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/AlignCenter");
1877 packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_ALIGN_CENTER);
1880 static void
1881 packet_list_heading_align_right_cb(GtkAction *action _U_, gpointer user_data)
1883 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/AlignRight");
1884 packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_ALIGN_RIGHT);
1887 static void
1888 packet_list_heading_col_pref_cb(GtkAction *action _U_, gpointer user_data)
1890 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/ColumnPreferences");
1891 prefs_page_cb( widget , user_data, PREFS_PAGE_COLUMNS);
1894 static void
1895 packet_list_heading_resize_col_cb(GtkAction *action _U_, gpointer user_data)
1897 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/ResizeColumn");
1898 packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_RESIZE);
1901 static void
1902 packet_list_heading_change_col_cb(GtkAction *action _U_, gpointer user_data)
1904 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/EditColumnDetails");
1905 packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_CHANGE);
1908 static void
1909 packet_list_heading_activate_all_columns_cb(GtkAction *action _U_, gpointer user_data _U_)
1911 packet_list_set_all_columns_visible ();
1914 static void
1915 packet_list_heading_hide_col_cb(GtkAction *action _U_, gpointer user_data)
1917 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/HideColumn");
1918 packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_HIDE);
1921 static void
1922 packet_list_heading_remove_col_cb(GtkAction *action _U_, gpointer user_data)
1924 GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/RemoveColumn");
1925 packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_REMOVE);
1928 static void
1929 packet_list_menu_set_ref_time_cb(GtkAction *action _U_, gpointer user_data)
1931 reftime_frame_cb( NULL /* widget _U_ */ , user_data, REFTIME_TOGGLE);
1935 static void
1936 apply_selected_filter_cb(GtkAction *action, gpointer user_data)
1938 const gchar *path = gtk_action_get_accel_path(action);
1939 /*g_warning("Accelerator path %s",path+9);*/
1941 /* path starts with "<Actions>" */
1942 if (strncmp (path+9,"/PacketListPopUpMenuActionGroup",31) == 0){
1943 /* Use different callbacks depending action path */
1944 match_selected_plist_cb(user_data, (MATCH_SELECTED_E)(MATCH_SELECTED_REPLACE|MATCH_SELECTED_APPLY_NOW));
1945 } else {
1946 match_selected_ptree_cb(user_data, (MATCH_SELECTED_E)(MATCH_SELECTED_REPLACE|MATCH_SELECTED_APPLY_NOW));
1950 static void
1951 apply_not_selected_cb(GtkAction *action, gpointer user_data)
1953 const gchar *path = gtk_action_get_accel_path(action);
1955 /* path starts with "<Actions>" */
1956 if (strncmp (path+9,"/PacketListPopUpMenuActionGroup",31) == 0){
1957 /* Use different callbacks depending action path */
1958 match_selected_plist_cb(user_data, (MATCH_SELECTED_E)(MATCH_SELECTED_NOT|MATCH_SELECTED_APPLY_NOW));
1959 } else {
1960 match_selected_ptree_cb(user_data, (MATCH_SELECTED_E)(MATCH_SELECTED_NOT|MATCH_SELECTED_APPLY_NOW));
1964 static void
1965 apply_and_selected_cb(GtkAction *action, gpointer user_data)
1967 const gchar *path = gtk_action_get_accel_path(action);
1969 /* path starts with "<Actions>" */
1970 if (strncmp (path+9,"/PacketListPopUpMenuActionGroup",31) == 0){
1971 /* Use different callbacks depending action path */
1972 match_selected_plist_cb(user_data, (MATCH_SELECTED_E)(MATCH_SELECTED_AND|MATCH_SELECTED_APPLY_NOW));
1973 } else {
1974 match_selected_ptree_cb(user_data, (MATCH_SELECTED_E)(MATCH_SELECTED_AND|MATCH_SELECTED_APPLY_NOW));
1978 static void
1979 apply_or_selected_cb(GtkAction *action, gpointer user_data)
1981 const gchar *path = gtk_action_get_accel_path(action);
1983 /* path starts with "<Actions>" */
1984 if (strncmp (path+9,"/PacketListPopUpMenuActionGroup",31) == 0){
1985 /* Use different callbacks depending action path */
1986 match_selected_plist_cb(user_data, (MATCH_SELECTED_E)(MATCH_SELECTED_OR|MATCH_SELECTED_APPLY_NOW));
1987 } else {
1988 match_selected_ptree_cb(user_data, (MATCH_SELECTED_E)(MATCH_SELECTED_OR|MATCH_SELECTED_APPLY_NOW));
1992 static void
1993 apply_and_not_selected_cb(GtkAction *action, gpointer user_data)
1995 const gchar *path = gtk_action_get_accel_path(action);
1997 /* path starts with "<Actions>" */
1998 if (strncmp (path+9,"/PacketListPopUpMenuActionGroup",31) == 0){
1999 /* Use different callbacks depending action path */
2000 match_selected_plist_cb(user_data, (MATCH_SELECTED_E)(MATCH_SELECTED_AND_NOT|MATCH_SELECTED_APPLY_NOW));
2001 } else {
2002 match_selected_ptree_cb(user_data, (MATCH_SELECTED_E)(MATCH_SELECTED_AND_NOT|MATCH_SELECTED_APPLY_NOW));
2006 static void
2007 apply_or_not_selected_cb(GtkAction *action, gpointer user_data)
2009 const gchar *path = gtk_action_get_accel_path(action);
2011 /* path starts with "<Actions>" */
2012 if (strncmp (path+9,"/PacketListPopUpMenuActionGroup",31) == 0){
2013 /* Use different callbacks depending action path */
2014 match_selected_plist_cb(user_data,(MATCH_SELECTED_E)(MATCH_SELECTED_OR_NOT|MATCH_SELECTED_APPLY_NOW));
2015 } else {
2016 match_selected_ptree_cb(user_data, (MATCH_SELECTED_E)(MATCH_SELECTED_OR_NOT|MATCH_SELECTED_APPLY_NOW));
2020 /* Prepare a filter */
2021 static void
2022 prepare_selected_cb(GtkAction *action, gpointer user_data)
2024 const gchar *path = gtk_action_get_accel_path(action);
2026 /* path starts with "<Actions>" */
2027 if (strncmp (path+9,"/PacketListPopUpMenuActionGroup",31) == 0){
2028 /* Use different callbacks depending action path */
2029 match_selected_plist_cb(user_data, MATCH_SELECTED_REPLACE);
2030 } else {
2031 match_selected_ptree_cb(user_data, MATCH_SELECTED_REPLACE);
2035 static void
2036 prepare_not_selected_cb(GtkAction *action, gpointer user_data)
2038 const gchar *path = gtk_action_get_accel_path(action);
2040 /* path starts with "<Actions>" */
2041 if (strncmp (path+9,"/PacketListPopUpMenuActionGroup",31) == 0){
2042 /* Use different callbacks depending action path */
2043 match_selected_plist_cb(user_data, MATCH_SELECTED_NOT);
2044 } else {
2045 match_selected_ptree_cb(user_data, MATCH_SELECTED_NOT);
2049 static void
2050 prepare_and_selected_cb(GtkAction *action, gpointer user_data)
2052 const gchar *path = gtk_action_get_accel_path(action);
2054 /* path starts with "<Actions>" */
2055 if (strncmp (path+9,"/PacketListPopUpMenuActionGroup",31) == 0){
2056 /* Use different callbacks depending action path */
2057 match_selected_plist_cb(user_data, MATCH_SELECTED_AND);
2058 } else {
2059 match_selected_ptree_cb(user_data, MATCH_SELECTED_AND);
2063 static void
2064 prepare_or_selected_cb(GtkAction *action, gpointer user_data)
2066 const gchar *path = gtk_action_get_accel_path(action);
2068 /* path starts with "<Actions>" */
2069 if (strncmp (path+9,"/PacketListPopUpMenuActionGroup",31) == 0){
2070 /* Use different callbacks depending action path */
2071 match_selected_plist_cb(user_data, MATCH_SELECTED_OR);
2072 } else {
2073 match_selected_ptree_cb(user_data, MATCH_SELECTED_OR);
2077 static void
2078 prepare_and_not_selected_cb(GtkAction *action, gpointer user_data)
2080 const gchar *path = gtk_action_get_accel_path(action);
2082 /* path starts with "<Actions>" */
2083 if (strncmp (path+9,"/PacketListPopUpMenuActionGroup",31) == 0){
2084 /* Use different callbacks depending action path */
2085 match_selected_plist_cb(user_data, MATCH_SELECTED_AND_NOT);
2086 } else {
2087 match_selected_ptree_cb(user_data, MATCH_SELECTED_AND_NOT);
2091 static void
2092 prepare_or_not_selected_cb(GtkAction *action, gpointer user_data)
2094 const gchar *path = gtk_action_get_accel_path(action);
2096 /* path starts with "<Actions>" */
2097 if (strncmp (path+9,"/PacketListPopUpMenuActionGroup",31) == 0){
2098 /* Use different callbacks depending action path */
2099 match_selected_plist_cb(user_data, MATCH_SELECTED_OR_NOT);
2100 } else {
2101 match_selected_ptree_cb(user_data, MATCH_SELECTED_OR_NOT);
2105 static void
2106 packet_list_menu_conversation_ethernet_cb(GtkAction *action, gpointer user_data)
2108 conversation_cb( action, user_data, CONV_ETHER);
2111 static void
2112 packet_list_menu_conversation_ip_cb(GtkAction *action _U_, gpointer user_data)
2114 conversation_cb( action, user_data, CONV_IP);
2117 static void
2118 packet_list_menu_conversation_tcp_cb(GtkAction *action _U_, gpointer user_data)
2120 conversation_cb( action, user_data, CONV_TCP);
2123 static void
2124 packet_list_menu_conversation_udp_cb(GtkAction *action _U_, gpointer user_data)
2126 conversation_cb( action, user_data, CONV_UDP);
2129 static void
2130 packet_list_menu_conversation_pn_cba_cb(GtkAction *action _U_, gpointer user_data)
2132 conversation_cb( action, user_data, CONV_CBA);
2135 /* Ethernet */
2137 static void
2138 packet_list_menu_color_conv_ethernet_color1_cb(GtkAction *action, gpointer user_data)
2140 colorize_conversation_cb(action, user_data, CONV_ETHER+1*256);
2143 static void
2144 packet_list_menu_color_conv_ethernet_color2_cb(GtkAction *action, gpointer user_data)
2146 colorize_conversation_cb(action, user_data, CONV_ETHER+2*256);
2149 static void
2150 packet_list_menu_color_conv_ethernet_color3_cb(GtkAction *action, gpointer user_data)
2152 colorize_conversation_cb(action, user_data, CONV_ETHER+3*256);
2155 static void
2156 packet_list_menu_color_conv_ethernet_color4_cb(GtkAction *action, gpointer user_data)
2158 colorize_conversation_cb(action, user_data, CONV_ETHER+4*256);
2161 static void
2162 packet_list_menu_color_conv_ethernet_color5_cb(GtkAction *action, gpointer user_data)
2164 colorize_conversation_cb(action, user_data, CONV_ETHER+5*256);
2167 static void
2168 packet_list_menu_color_conv_ethernet_color6_cb(GtkAction *action, gpointer user_data)
2170 colorize_conversation_cb(action, user_data, CONV_ETHER+6*256);
2173 static void
2174 packet_list_menu_color_conv_ethernet_color7_cb(GtkAction *action, gpointer user_data)
2176 colorize_conversation_cb(action, user_data, CONV_ETHER+7*256);
2179 static void
2180 packet_list_menu_color_conv_ethernet_color8_cb(GtkAction *action, gpointer user_data)
2182 colorize_conversation_cb(action, user_data, CONV_ETHER+8*256);
2185 static void
2186 packet_list_menu_color_conv_ethernet_color9_cb(GtkAction *action, gpointer user_data)
2188 colorize_conversation_cb(action, user_data, CONV_ETHER+9*256);
2191 static void
2192 packet_list_menu_color_conv_ethernet_color10_cb(GtkAction *action, gpointer user_data)
2194 colorize_conversation_cb(action, user_data, CONV_ETHER+10*256);
2197 static void
2198 packet_list_menu_color_conv_ethernet_new_rule_cb(GtkAction *action, gpointer user_data)
2200 colorize_conversation_cb(action, user_data, CONV_ETHER);
2203 /* IP */
2205 static void
2206 packet_list_menu_color_conv_ip_color1_cb(GtkAction *action, gpointer user_data)
2208 colorize_conversation_cb(action, user_data, CONV_IP+1*256);
2211 static void
2212 packet_list_menu_color_conv_ip_color2_cb(GtkAction *action, gpointer user_data)
2214 colorize_conversation_cb(action, user_data, CONV_IP+2*256);
2217 static void
2218 packet_list_menu_color_conv_ip_color3_cb(GtkAction *action, gpointer user_data)
2220 colorize_conversation_cb(action, user_data, CONV_IP+3*256);
2223 static void
2224 packet_list_menu_color_conv_ip_color4_cb(GtkAction *action, gpointer user_data)
2226 colorize_conversation_cb(action, user_data, CONV_IP+4*256);
2229 static void
2230 packet_list_menu_color_conv_ip_color5_cb(GtkAction *action, gpointer user_data)
2232 colorize_conversation_cb(action, user_data, CONV_IP+5*256);
2235 static void
2236 packet_list_menu_color_conv_ip_color6_cb(GtkAction *action, gpointer user_data)
2238 colorize_conversation_cb(action, user_data, CONV_IP+6*256);
2241 static void
2242 packet_list_menu_color_conv_ip_color7_cb(GtkAction *action, gpointer user_data)
2244 colorize_conversation_cb(action, user_data, CONV_IP+7*256);
2247 static void
2248 packet_list_menu_color_conv_ip_color8_cb(GtkAction *action, gpointer user_data)
2250 colorize_conversation_cb(action, user_data, CONV_IP+8*256);
2253 static void
2254 packet_list_menu_color_conv_ip_color9_cb(GtkAction *action, gpointer user_data)
2256 colorize_conversation_cb(action, user_data, CONV_IP+9*256);
2259 static void
2260 packet_list_menu_color_conv_ip_color10_cb(GtkAction *action, gpointer user_data)
2262 colorize_conversation_cb(action, user_data, CONV_IP+10*256);
2265 static void
2266 packet_list_menu_color_conv_ip_new_rule_cb(GtkAction *action, gpointer user_data)
2268 colorize_conversation_cb(action, user_data, CONV_TCP);
2271 /* TCP */
2273 static void
2274 packet_list_menu_color_conv_tcp_color1_cb(GtkAction *action, gpointer user_data)
2276 colorize_conversation_cb(action, user_data, CONV_TCP+1*256);
2279 static void
2280 packet_list_menu_color_conv_tcp_color2_cb(GtkAction *action, gpointer user_data)
2282 colorize_conversation_cb(action, user_data, CONV_TCP+2*256);
2285 static void
2286 packet_list_menu_color_conv_tcp_color3_cb(GtkAction *action, gpointer user_data)
2288 colorize_conversation_cb(action, user_data, CONV_TCP+3*256);
2291 static void
2292 packet_list_menu_color_conv_tcp_color4_cb(GtkAction *action, gpointer user_data)
2294 colorize_conversation_cb(action, user_data, CONV_TCP+4*256);
2297 static void
2298 packet_list_menu_color_conv_tcp_color5_cb(GtkAction *action, gpointer user_data)
2300 colorize_conversation_cb(action, user_data, CONV_TCP+5*256);
2303 static void
2304 packet_list_menu_color_conv_tcp_color6_cb(GtkAction *action, gpointer user_data)
2306 colorize_conversation_cb(action, user_data, CONV_TCP+6*256);
2309 static void
2310 packet_list_menu_color_conv_tcp_color7_cb(GtkAction *action, gpointer user_data)
2312 colorize_conversation_cb(action, user_data, CONV_TCP+7*256);
2315 static void
2316 packet_list_menu_color_conv_tcp_color8_cb(GtkAction *action, gpointer user_data)
2318 colorize_conversation_cb(action, user_data, CONV_TCP+8*256);
2321 static void
2322 packet_list_menu_color_conv_tcp_color9_cb(GtkAction *action, gpointer user_data)
2324 colorize_conversation_cb(action, user_data, CONV_TCP+9*256);
2327 static void
2328 packet_list_menu_color_conv_tcp_color10_cb(GtkAction *action, gpointer user_data)
2330 colorize_conversation_cb(action, user_data, CONV_TCP+10*256);
2333 static void
2334 packet_list_menu_color_conv_tcp_new_rule_cb(GtkAction *action, gpointer user_data)
2336 colorize_conversation_cb(action, user_data, CONV_TCP);
2339 /* UDP */
2341 static void
2342 packet_list_menu_color_conv_udp_color1_cb(GtkAction *action, gpointer user_data)
2344 colorize_conversation_cb(action, user_data, CONV_UDP+1*256);
2347 static void
2348 packet_list_menu_color_conv_udp_color2_cb(GtkAction *action, gpointer user_data)
2350 colorize_conversation_cb(action, user_data, CONV_UDP+2*256);
2353 static void
2354 packet_list_menu_color_conv_udp_color3_cb(GtkAction *action, gpointer user_data)
2356 colorize_conversation_cb(action, user_data, CONV_UDP+3*256);
2359 static void
2360 packet_list_menu_color_conv_udp_color4_cb(GtkAction *action, gpointer user_data)
2362 colorize_conversation_cb(action, user_data, CONV_UDP+4*256);
2365 static void
2366 packet_list_menu_color_conv_udp_color5_cb(GtkAction *action, gpointer user_data)
2368 colorize_conversation_cb(action, user_data, CONV_UDP+5*256);
2371 static void
2372 packet_list_menu_color_conv_udp_color6_cb(GtkAction *action, gpointer user_data)
2374 colorize_conversation_cb(action, user_data, CONV_UDP+6*256);
2377 static void
2378 packet_list_menu_color_conv_udp_color7_cb(GtkAction *action, gpointer user_data)
2380 colorize_conversation_cb(action, user_data, CONV_UDP+7*256);
2383 static void
2384 packet_list_menu_color_conv_udp_color8_cb(GtkAction *action, gpointer user_data)
2386 colorize_conversation_cb(action, user_data, CONV_UDP+8*256);
2389 static void
2390 packet_list_menu_color_conv_udp_color9_cb(GtkAction *action, gpointer user_data)
2392 colorize_conversation_cb(action, user_data, CONV_UDP+9*256);
2395 static void
2396 packet_list_menu_color_conv_udp_color10_cb(GtkAction *action, gpointer user_data)
2398 colorize_conversation_cb(action, user_data, CONV_UDP+10*256);
2401 static void
2402 packet_list_menu_color_conv_udp_new_rule_cb(GtkAction *action, gpointer user_data)
2404 colorize_conversation_cb(action, user_data, CONV_UDP);
2407 /* CONV_CBA */
2409 static void
2410 packet_list_menu_color_conv_cba_color1_cb(GtkAction *action, gpointer user_data)
2412 colorize_conversation_cb(action, user_data, CONV_CBA+1*256);
2415 static void
2416 packet_list_menu_color_conv_cba_color2_cb(GtkAction *action, gpointer user_data)
2418 colorize_conversation_cb(action, user_data, CONV_CBA+2*256);
2421 static void
2422 packet_list_menu_color_conv_cba_color3_cb(GtkAction *action, gpointer user_data)
2424 colorize_conversation_cb(action, user_data, CONV_CBA+3*256);
2427 static void
2428 packet_list_menu_color_conv_cba_color4_cb(GtkAction *action, gpointer user_data)
2430 colorize_conversation_cb(action, user_data, CONV_CBA+4*256);
2433 static void
2434 packet_list_menu_color_conv_cba_color5_cb(GtkAction *action, gpointer user_data)
2436 colorize_conversation_cb(action, user_data, CONV_CBA+5*256);
2439 static void
2440 packet_list_menu_color_conv_cba_color6_cb(GtkAction *action, gpointer user_data)
2442 colorize_conversation_cb(action, user_data, CONV_CBA+6*256);
2445 static void
2446 packet_list_menu_color_conv_cba_color7_cb(GtkAction *action, gpointer user_data)
2448 colorize_conversation_cb(action, user_data, CONV_CBA+7*256);
2451 static void
2452 packet_list_menu_color_conv_cba_color8_cb(GtkAction *action, gpointer user_data)
2454 colorize_conversation_cb(action, user_data, CONV_CBA+8*256);
2457 static void
2458 packet_list_menu_color_conv_cba_color9_cb(GtkAction *action, gpointer user_data)
2460 colorize_conversation_cb(action, user_data, CONV_CBA+9*256);
2463 static void
2464 packet_list_menu_color_conv_cba_color10_cb(GtkAction *action, gpointer user_data)
2466 colorize_conversation_cb(action, user_data, CONV_CBA+10*256);
2469 static void
2470 packet_list_menu_color_conv_cba_new_rule_cb(GtkAction *action, gpointer user_data)
2472 colorize_conversation_cb(action, user_data, CONV_CBA);
2475 static void
2476 packet_list_menu_copy_sum_txt(GtkAction *action _U_, gpointer user_data)
2478 packet_list_copy_summary_cb(user_data, CS_TEXT);
2481 static void
2482 packet_list_menu_copy_sum_csv(GtkAction *action _U_, gpointer user_data)
2484 packet_list_copy_summary_cb(user_data, CS_CSV);
2487 static void
2488 packet_list_menu_copy_as_flt(GtkAction *action _U_, gpointer user_data)
2490 match_selected_plist_cb(user_data, (MATCH_SELECTED_E)(MATCH_SELECTED_REPLACE|MATCH_SELECTED_COPY_ONLY));
2493 static void
2494 packet_list_menu_copy_bytes_oht_cb(GtkAction *action _U_, gpointer user_data)
2496 copy_hex_cb( NULL /* widget _U_ */ , user_data, (copy_data_type)(CD_ALLINFO | CD_FLAGS_SELECTEDONLY));
2499 static void
2500 packet_list_menu_copy_bytes_oh_cb(GtkAction *action _U_, gpointer user_data)
2502 copy_hex_cb( NULL /* widget _U_ */ , user_data, (copy_data_type)(CD_HEXCOLUMNS | CD_FLAGS_SELECTEDONLY));
2505 static void
2506 packet_list_menu_copy_bytes_text_cb(GtkAction *action _U_, gpointer user_data)
2508 copy_hex_cb( NULL /* widget _U_ */ , user_data, (copy_data_type)(CD_TEXTONLY | CD_FLAGS_SELECTEDONLY));
2511 static void
2512 packet_list_menu_copy_bytes_hex_strm_cb(GtkAction *action _U_, gpointer user_data)
2514 copy_hex_cb( NULL /* widget _U_ */ , user_data, (copy_data_type)(CD_HEX | CD_FLAGS_SELECTEDONLY));
2517 static void
2518 packet_list_menu_copy_bytes_bin_strm_cb(GtkAction *action _U_, gpointer user_data)
2520 copy_hex_cb( NULL /* widget _U_ */ , user_data, (copy_data_type)(CD_BINARY | CD_FLAGS_SELECTEDONLY));
2523 /* tree */
2525 static void
2526 tree_view_menu_color_with_flt_color1_cb(GtkAction *action _U_, gpointer user_data)
2528 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 1);
2531 static void
2532 tree_view_menu_color_with_flt_color2_cb(GtkAction *action _U_, gpointer user_data)
2534 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 2);
2537 static void
2538 tree_view_menu_color_with_flt_color3_cb(GtkAction *action _U_, gpointer user_data)
2540 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 3);
2543 static void
2544 tree_view_menu_color_with_flt_color4_cb(GtkAction *action _U_, gpointer user_data)
2546 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 4);
2549 static void
2550 tree_view_menu_color_with_flt_color5_cb(GtkAction *action _U_, gpointer user_data)
2552 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 5);
2555 static void
2556 tree_view_menu_color_with_flt_color6_cb(GtkAction *action _U_, gpointer user_data)
2558 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 6);
2561 static void
2562 tree_view_menu_color_with_flt_color7_cb(GtkAction *action _U_, gpointer user_data)
2564 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 7);
2567 static void
2568 tree_view_menu_color_with_flt_color8_cb(GtkAction *action _U_, gpointer user_data)
2570 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 8);
2573 static void
2574 tree_view_menu_color_with_flt_color9_cb(GtkAction *action _U_, gpointer user_data)
2576 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 9);
2579 static void
2580 tree_view_menu_color_with_flt_color10_cb(GtkAction *action _U_, gpointer user_data)
2582 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 10);
2585 static void
2586 tree_view_menu_color_with_flt_new_rule_cb(GtkAction *action _U_, gpointer user_data)
2588 colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 0);
2592 static void
2593 tree_view_menu_copy_desc(GtkAction *action _U_, gpointer user_data)
2595 copy_selected_plist_cb( NULL /* widget _U_ */ , user_data, COPY_SELECTED_DESCRIPTION);
2598 static void
2599 tree_view_menu_copy_field(GtkAction *action _U_, gpointer user_data)
2601 copy_selected_plist_cb( NULL /* widget _U_ */ , user_data, COPY_SELECTED_FIELDNAME);
2604 static void
2605 tree_view_menu_copy_value(GtkAction *action _U_, gpointer user_data)
2607 copy_selected_plist_cb( NULL /* widget _U_ */ , user_data, COPY_SELECTED_VALUE);
2610 static void
2611 tree_view_menu_copy_as_flt(GtkAction *action _U_, gpointer user_data _U_)
2613 /* match_selected_ptree_cb needs the popup_menu_object to get the right object E_DFILTER_TE_KEY */
2614 match_selected_ptree_cb( popup_menu_object, (MATCH_SELECTED_E)(MATCH_SELECTED_REPLACE|MATCH_SELECTED_COPY_ONLY));
2617 static const char *ui_desc_packet_list_heading_menu_popup =
2618 "<ui>\n"
2619 " <popup name='PacketListHeadingPopup' action='PopupAction'>\n"
2620 " <menuitem name='SortAscending' action='/Sort Ascending'/>\n"
2621 " <menuitem name='SortDescending' action='/Sort Descending'/>\n"
2622 " <menuitem name='NoSorting' action='/No Sorting'/>\n"
2623 " <separator/>\n"
2624 " <menuitem name='ShowResolved' action='/Show Resolved'/>\n"
2625 " <separator/>\n"
2626 " <menuitem name='AlignLeft' action='/Align Left'/>\n"
2627 " <menuitem name='AlignCenter' action='/Align Center'/>\n"
2628 " <menuitem name='AlignRight' action='/Align Right'/>\n"
2629 " <separator/>\n"
2630 " <menuitem name='ColumnPreferences' action='/Column Preferences'/>\n"
2631 " <menuitem name='EditColumnDetails' action='/Edit Column Details'/>\n"
2632 " <menuitem name='ResizeColumn' action='/Resize Column'/>\n"
2633 " <separator/>\n"
2634 " <menu name='DisplayedColumns' action='/Displayed Columns'>\n"
2635 " <menuitem name='Display All' action='/Displayed Columns/Display All'/>\n"
2636 " </menu>\n"
2637 " <menuitem name='HideColumn' action='/Hide Column'/>\n"
2638 " <menuitem name='RemoveColumn' action='/Remove Column'/>\n"
2639 " </popup>\n"
2640 "</ui>\n";
2642 static const GtkActionEntry packet_list_heading_menu_popup_action_entries[] = {
2643 { "/Sort Ascending", GTK_STOCK_SORT_ASCENDING, "Sort Ascending", NULL, NULL, G_CALLBACK(sort_ascending_cb) },
2644 { "/Sort Descending", GTK_STOCK_SORT_DESCENDING, "Sort Descending", NULL, NULL, G_CALLBACK(sort_descending_cb) },
2645 { "/No Sorting", NULL, "No Sorting", NULL, NULL, G_CALLBACK(no_sorting_cb) },
2646 { "/Align Left", GTK_STOCK_JUSTIFY_LEFT, "Align Left", NULL, NULL, G_CALLBACK(packet_list_heading_align_left_cb) },
2647 { "/Align Center", GTK_STOCK_JUSTIFY_CENTER, "Align Center", NULL, NULL, G_CALLBACK(packet_list_heading_align_center_cb) },
2648 { "/Align Right", GTK_STOCK_JUSTIFY_RIGHT, "Align Right", NULL, NULL, G_CALLBACK(packet_list_heading_align_right_cb) },
2649 { "/Column Preferences", GTK_STOCK_PREFERENCES, "Column Preferences...", NULL, NULL, G_CALLBACK(packet_list_heading_col_pref_cb) },
2650 { "/Edit Column Details", WIRESHARK_STOCK_EDIT, "Edit Column Details...", NULL, NULL, G_CALLBACK(packet_list_heading_change_col_cb) },
2651 { "/Resize Column", WIRESHARK_STOCK_RESIZE_COLUMNS, "Resize Column", NULL, NULL, G_CALLBACK(packet_list_heading_resize_col_cb) },
2652 { "/Displayed Columns", NULL, "Displayed Columns", NULL, NULL, NULL },
2653 { "/Displayed Columns/Display All", NULL, "Display All", NULL, NULL, G_CALLBACK(packet_list_heading_activate_all_columns_cb) },
2654 { "/Hide Column", NULL, "Hide Column", NULL, NULL, G_CALLBACK(packet_list_heading_hide_col_cb) },
2655 { "/Remove Column", GTK_STOCK_DELETE, "Remove Column", NULL, NULL, G_CALLBACK(packet_list_heading_remove_col_cb) },
2658 static const GtkToggleActionEntry packet_list_heading_menu_toggle_action_entries[] =
2660 /* name, stock id, label, accel, tooltip, callback, is_active */
2661 {"/Show Resolved", NULL, "Show Resolved", NULL, NULL, G_CALLBACK(packet_list_heading_show_resolved_cb), FALSE},
2664 static const char *ui_desc_packet_list_menu_popup =
2665 "<ui>\n"
2666 " <popup name='PacketListMenuPopup' action='PopupAction'>\n"
2667 " <menuitem name='MarkPacket' action='/MarkPacket'/>\n"
2668 " <menuitem name='IgnorePacket' action='/IgnorePacket'/>\n"
2669 " <menuitem name='SetTimeReference' action='/Set Time Reference'/>\n"
2670 " <menuitem name='TimeShift' action='/TimeShift'/>\n"
2671 #ifdef WANT_PACKET_EDITOR
2672 " <menuitem name='EditPacket' action='/Edit/EditPacket'/>\n"
2673 #endif
2674 " <menuitem name='AddEditPktComment' action='/Edit/AddEditPktComment'/>\n"
2675 " <separator/>\n"
2676 " <menuitem name='ManuallyResolveAddress' action='/ManuallyResolveAddress'/>\n"
2677 " <separator/>\n"
2678 " <menu name= 'ApplyAsFilter' action='/ApplyasFilter'>\n"
2679 " <menuitem name='Selected' action='/ApplyasFilter/Selected'/>\n"
2680 " <menuitem name='NotSelected' action='/ApplyasFilter/Not Selected'/>\n"
2681 " <menuitem name='AndSelected' action='/ApplyasFilter/AndSelected'/>\n"
2682 " <menuitem name='OrSelected' action='/ApplyasFilter/OrSelected'/>\n"
2683 " <menuitem name='AndNotSelected' action='/ApplyasFilter/AndNotSelected'/>\n"
2684 " <menuitem name='OrNotSelected' action='/ApplyasFilter/OrNotSelected'/>\n"
2685 " </menu>\n"
2686 " <menu name= 'PrepareaFilter' action='/PrepareaFilter'>\n"
2687 " <menuitem name='Selected' action='/PrepareaFilter/Selected'/>\n"
2688 " <menuitem name='NotSelected' action='/PrepareaFilter/Not Selected'/>\n"
2689 " <menuitem name='AndSelected' action='/PrepareaFilter/AndSelected'/>\n"
2690 " <menuitem name='OrSelected' action='/PrepareaFilter/OrSelected'/>\n"
2691 " <menuitem name='AndNotSelected' action='/PrepareaFilter/AndNotSelected'/>\n"
2692 " <menuitem name='OrNotSelected' action='/PrepareaFilter/OrNotSelected'/>\n"
2693 " </menu>\n"
2694 " <menu name= 'ConversationFilter' action='/Conversation Filter'>\n"
2695 " <menuitem name='Ethernet' action='/Conversation Filter/Ethernet'/>\n"
2696 " <menuitem name='IP' action='/Conversation Filter/IP'/>\n"
2697 " <menuitem name='TCP' action='/Conversation Filter/TCP'/>\n"
2698 " <menuitem name='UDP' action='/Conversation Filter/UDP'/>\n"
2699 " <menuitem name='PN-CBA' action='/Conversation Filter/PN-CBA'/>\n"
2700 " </menu>\n"
2701 " <menu name= 'ColorizeConversation' action='/Colorize Conversation'>\n"
2702 " <menu name= 'Ethernet' action='/Colorize Conversation/Ethernet'>\n"
2703 " <menuitem name='Color1' action='/Colorize Conversation/Ethernet/Color 1'/>\n"
2704 " <menuitem name='Color2' action='/Colorize Conversation/Ethernet/Color 2'/>\n"
2705 " <menuitem name='Color3' action='/Colorize Conversation/Ethernet/Color 3'/>\n"
2706 " <menuitem name='Color4' action='/Colorize Conversation/Ethernet/Color 4'/>\n"
2707 " <menuitem name='Color5' action='/Colorize Conversation/Ethernet/Color 5'/>\n"
2708 " <menuitem name='Color6' action='/Colorize Conversation/Ethernet/Color 6'/>\n"
2709 " <menuitem name='Color7' action='/Colorize Conversation/Ethernet/Color 7'/>\n"
2710 " <menuitem name='Color8' action='/Colorize Conversation/Ethernet/Color 8'/>\n"
2711 " <menuitem name='Color9' action='/Colorize Conversation/Ethernet/Color 9'/>\n"
2712 " <menuitem name='Color10' action='/Colorize Conversation/Ethernet/Color 10'/>\n"
2713 " <menuitem name='NewColoringRule' action='/Colorize Conversation/Ethernet/New Coloring Rule'/>\n"
2714 " </menu>\n"
2715 " <menu name= 'IP' action='/Colorize Conversation/IP'>\n"
2716 " <menuitem name='Color1' action='/Colorize Conversation/IP/Color 1'/>\n"
2717 " <menuitem name='Color2' action='/Colorize Conversation/IP/Color 2'/>\n"
2718 " <menuitem name='Color3' action='/Colorize Conversation/IP/Color 3'/>\n"
2719 " <menuitem name='Color4' action='/Colorize Conversation/IP/Color 4'/>\n"
2720 " <menuitem name='Color5' action='/Colorize Conversation/IP/Color 5'/>\n"
2721 " <menuitem name='Color6' action='/Colorize Conversation/IP/Color 6'/>\n"
2722 " <menuitem name='Color7' action='/Colorize Conversation/IP/Color 7'/>\n"
2723 " <menuitem name='Color8' action='/Colorize Conversation/IP/Color 8'/>\n"
2724 " <menuitem name='Color9' action='/Colorize Conversation/IP/Color 9'/>\n"
2725 " <menuitem name='Color10' action='/Colorize Conversation/IP/Color 10'/>\n"
2726 " <menuitem name='NewColoringRule' action='/Colorize Conversation/IP/New Coloring Rule'/>\n"
2727 " </menu>\n"
2728 " <menu name= 'TCP' action='/Colorize Conversation/TCP'>\n"
2729 " <menuitem name='Color1' action='/Colorize Conversation/TCP/Color 1'/>\n"
2730 " <menuitem name='Color2' action='/Colorize Conversation/TCP/Color 2'/>\n"
2731 " <menuitem name='Color3' action='/Colorize Conversation/TCP/Color 3'/>\n"
2732 " <menuitem name='Color4' action='/Colorize Conversation/TCP/Color 4'/>\n"
2733 " <menuitem name='Color5' action='/Colorize Conversation/TCP/Color 5'/>\n"
2734 " <menuitem name='Color6' action='/Colorize Conversation/TCP/Color 6'/>\n"
2735 " <menuitem name='Color7' action='/Colorize Conversation/TCP/Color 7'/>\n"
2736 " <menuitem name='Color8' action='/Colorize Conversation/TCP/Color 8'/>\n"
2737 " <menuitem name='Color9' action='/Colorize Conversation/TCP/Color 9'/>\n"
2738 " <menuitem name='Color10' action='/Colorize Conversation/TCP/Color 10'/>\n"
2739 " <menuitem name='NewColoringRule' action='/Colorize Conversation/TCP/New Coloring Rule'/>\n"
2740 " </menu>\n"
2741 " <menu name= 'UDP' action='/Colorize Conversation/UDP'>\n"
2742 " <menuitem name='Color1' action='/Colorize Conversation/UDP/Color 1'/>\n"
2743 " <menuitem name='Color2' action='/Colorize Conversation/UDP/Color 2'/>\n"
2744 " <menuitem name='Color3' action='/Colorize Conversation/UDP/Color 3'/>\n"
2745 " <menuitem name='Color4' action='/Colorize Conversation/UDP/Color 4'/>\n"
2746 " <menuitem name='Color5' action='/Colorize Conversation/UDP/Color 5'/>\n"
2747 " <menuitem name='Color6' action='/Colorize Conversation/UDP/Color 6'/>\n"
2748 " <menuitem name='Color7' action='/Colorize Conversation/UDP/Color 7'/>\n"
2749 " <menuitem name='Color8' action='/Colorize Conversation/UDP/Color 8'/>\n"
2750 " <menuitem name='Color9' action='/Colorize Conversation/UDP/Color 9'/>\n"
2751 " <menuitem name='Color10' action='/Colorize Conversation/UDP/Color 10'/>\n"
2752 " <menuitem name='NewColoringRule' action='/Colorize Conversation/UDP/New Coloring Rule'/>\n"
2753 " </menu>\n"
2754 " <menu name= 'PN-CBA' action='/Colorize Conversation/PN-CBA'>\n"
2755 " <menuitem name='Color1' action='/Colorize Conversation/PN-CBA/Color 1'/>\n"
2756 " <menuitem name='Color2' action='/Colorize Conversation/PN-CBA/Color 2'/>\n"
2757 " <menuitem name='Color3' action='/Colorize Conversation/PN-CBA/Color 3'/>\n"
2758 " <menuitem name='Color4' action='/Colorize Conversation/PN-CBA/Color 4'/>\n"
2759 " <menuitem name='Color5' action='/Colorize Conversation/PN-CBA/Color 5'/>\n"
2760 " <menuitem name='Color6' action='/Colorize Conversation/PN-CBA/Color 6'/>\n"
2761 " <menuitem name='Color7' action='/Colorize Conversation/PN-CBA/Color 7'/>\n"
2762 " <menuitem name='Color8' action='/Colorize Conversation/PN-CBA/Color 8'/>\n"
2763 " <menuitem name='Color9' action='/Colorize Conversation/PN-CBA/Color 9'/>\n"
2764 " <menuitem name='Color10' action='/Colorize Conversation/PN-CBA/Color 10'/>\n"
2765 " <menuitem name='NewColoringRule' action='/Colorize Conversation/PN-CBA/New Coloring Rule'/>\n"
2766 " </menu>\n"
2767 " </menu>\n"
2768 " <menu name= 'SCTP' action='/SCTP'>\n"
2769 " <menuitem name='AnalysethisAssociation' action='/SCTP/Analyse this Association'/>\n"
2770 " <menuitem name='PrepareFilterforthisAssociation' action='/SCTP/Prepare Filter for this Association'/>\n"
2771 " </menu>\n"
2772 " <menuitem name='FollowTCPStream' action='/Follow TCP Stream'/>\n"
2773 " <menuitem name='FollowUDPStream' action='/Follow UDP Stream'/>\n"
2774 " <menuitem name='FollowSSLStream' action='/Follow SSL Stream'/>\n"
2775 " <separator/>\n"
2776 " <menu name= 'Copy' action='/Copy'>\n"
2777 " <menuitem name='SummaryTxt' action='/Copy/SummaryTxt'/>\n"
2778 " <menuitem name='SummaryCSV' action='/Copy/SummaryCSV'/>\n"
2779 " <menuitem name='AsFilter' action='/Copy/AsFilter'/>\n"
2780 " <separator/>\n"
2781 " <menu name= 'Bytes' action='/Copy/Bytes'>\n"
2782 " <menuitem name='OffsetHexText' action='/Copy/Bytes/OffsetHexText'/>\n"
2783 " <menuitem name='OffsetHex' action='/Copy/Bytes/OffsetHex'/>\n"
2784 " <menuitem name='PrintableTextOnly' action='/Copy/Bytes/PrintableTextOnly'/>\n"
2785 " <separator/>\n"
2786 " <menuitem name='HexStream' action='/Copy/Bytes/HexStream'/>\n"
2787 " <menuitem name='BinaryStream' action='/Copy/Bytes/BinaryStream'/>\n"
2788 " </menu>\n"
2789 " </menu>\n"
2790 " <separator/>\n"
2791 " <menuitem name='ProtocolPreferences' action='/ProtocolPreferences'/>\n"
2792 " <menuitem name='DecodeAs' action='/DecodeAs'/>\n"
2793 " <menuitem name='Print' action='/Print'/>\n"
2794 " <menuitem name='ShowPacketinNewWindow' action='/ShowPacketinNewWindow'/>\n"
2795 " </popup>\n"
2796 "</ui>\n";
2798 static const GtkActionEntry apply_prepare_filter_action_entries[] = {
2799 { "/ApplyasFilter", NULL, "Apply as Filter", NULL, NULL, NULL },
2800 { "/ApplyasFilter/Selected", NULL, "_Selected" , NULL, NULL, G_CALLBACK(apply_selected_filter_cb) },
2801 { "/ApplyasFilter/Not Selected", NULL, "_Not Selected", NULL, NULL, G_CALLBACK(apply_not_selected_cb) },
2802 { "/ApplyasFilter/AndSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _and Selected", NULL, NULL, G_CALLBACK(apply_and_selected_cb) },
2803 { "/ApplyasFilter/OrSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _or Selected", NULL, NULL, G_CALLBACK(apply_or_selected_cb) },
2804 { "/ApplyasFilter/AndNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " a_nd not Selected", NULL, NULL, G_CALLBACK(apply_and_not_selected_cb) },
2805 { "/ApplyasFilter/OrNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " o_r not Selected", NULL, NULL, G_CALLBACK(apply_or_not_selected_cb) },
2807 { "/PrepareaFilter", NULL, "Prepare a Filter", NULL, NULL, NULL },
2808 { "/PrepareaFilter/Selected", NULL, "_Selected" , NULL, NULL, G_CALLBACK(prepare_selected_cb) },
2809 { "/PrepareaFilter/Not Selected", NULL, "_Not Selected", NULL, NULL, G_CALLBACK(prepare_not_selected_cb) },
2810 { "/PrepareaFilter/AndSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _and Selected", NULL, NULL, G_CALLBACK(prepare_and_selected_cb) },
2811 { "/PrepareaFilter/OrSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _or Selected", NULL, NULL, G_CALLBACK(prepare_or_selected_cb) },
2812 { "/PrepareaFilter/AndNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " a_nd not Selected", NULL, NULL, G_CALLBACK(prepare_and_not_selected_cb) },
2813 { "/PrepareaFilter/OrNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " o_r not Selected", NULL, NULL, G_CALLBACK(prepare_or_not_selected_cb) },
2817 static const GtkActionEntry packet_list_menu_popup_action_entries[] = {
2818 { "/MarkPacket", NULL, "Mark Packet (toggle)", NULL, NULL, G_CALLBACK(packet_list_mark_frame_cb) },
2819 { "/IgnorePacket", NULL, "Ignore Packet (toggle)", NULL, NULL, G_CALLBACK(packet_list_ignore_frame_cb) },
2820 { "/Set Time Reference", WIRESHARK_STOCK_TIME, "Set Time Reference (toggle)", NULL, NULL, G_CALLBACK(packet_list_menu_set_ref_time_cb) },
2821 { "/TimeShift", WIRESHARK_STOCK_TIME, "Time Shift...", NULL, NULL, G_CALLBACK(time_shift_cb) },
2822 { "/ManuallyResolveAddress", NULL, "Manually Resolve Address", NULL, NULL, G_CALLBACK(manual_addr_resolv_dlg) },
2823 #ifdef WANT_PACKET_EDITOR
2824 { "/Edit/EditPacket", NULL, "_Edit Packet", NULL, NULL, G_CALLBACK(edit_window_cb) },//AL
2825 #endif
2826 { "/Edit/AddEditPktComment", WIRESHARK_STOCK_EDIT, "Packet Comment...", NULL, NULL, G_CALLBACK(edit_packet_comment_dlg) },
2828 { "/Conversation Filter", NULL, "Conversation Filter", NULL, NULL, NULL },
2829 { "/Conversation Filter/Ethernet", NULL, "Ethernet", NULL, NULL, G_CALLBACK(packet_list_menu_conversation_ethernet_cb) },
2830 { "/Conversation Filter/IP", NULL, "IP", NULL, NULL, G_CALLBACK(packet_list_menu_conversation_ip_cb) },
2831 { "/Conversation Filter/TCP", NULL, "TCP", NULL, NULL, G_CALLBACK(packet_list_menu_conversation_tcp_cb) },
2832 { "/Conversation Filter/UDP", NULL, "UDP", NULL, NULL, G_CALLBACK(packet_list_menu_conversation_udp_cb) },
2833 { "/Conversation Filter/PN-CBA", NULL, "PN-CBA", NULL, NULL, G_CALLBACK(packet_list_menu_conversation_pn_cba_cb) },
2835 { "/Colorize Conversation", NULL, "Colorize Conversation", NULL, NULL, NULL },
2837 { "/Colorize Conversation/Ethernet", NULL, "Ethernet", NULL, NULL, NULL },
2839 { "/Colorize Conversation/Ethernet/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color1_cb) },
2840 { "/Colorize Conversation/Ethernet/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color2_cb) },
2841 { "/Colorize Conversation/Ethernet/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color3_cb) },
2842 { "/Colorize Conversation/Ethernet/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color4_cb) },
2843 { "/Colorize Conversation/Ethernet/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color5_cb) },
2844 { "/Colorize Conversation/Ethernet/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color6_cb) },
2845 { "/Colorize Conversation/Ethernet/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color7_cb) },
2846 { "/Colorize Conversation/Ethernet/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color8_cb) },
2847 { "/Colorize Conversation/Ethernet/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color9_cb) },
2848 { "/Colorize Conversation/Ethernet/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color10_cb) },
2849 { "/Colorize Conversation/Ethernet/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_new_rule_cb) },
2851 { "/Colorize Conversation/IP", NULL, "IP", NULL, NULL, NULL },
2853 { "/Colorize Conversation/IP/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color1_cb) },
2854 { "/Colorize Conversation/IP/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color2_cb) },
2855 { "/Colorize Conversation/IP/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color3_cb) },
2856 { "/Colorize Conversation/IP/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color4_cb) },
2857 { "/Colorize Conversation/IP/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color5_cb) },
2858 { "/Colorize Conversation/IP/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color6_cb) },
2859 { "/Colorize Conversation/IP/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color7_cb) },
2860 { "/Colorize Conversation/IP/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color8_cb) },
2861 { "/Colorize Conversation/IP/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color9_cb) },
2862 { "/Colorize Conversation/IP/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color10_cb) },
2863 { "/Colorize Conversation/IP/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_new_rule_cb) },
2865 { "/Colorize Conversation/TCP", NULL, "TCP", NULL, NULL, NULL },
2867 { "/Colorize Conversation/TCP/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color1_cb) },
2868 { "/Colorize Conversation/TCP/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color2_cb) },
2869 { "/Colorize Conversation/TCP/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color3_cb) },
2870 { "/Colorize Conversation/TCP/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color4_cb) },
2871 { "/Colorize Conversation/TCP/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color5_cb) },
2872 { "/Colorize Conversation/TCP/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color6_cb) },
2873 { "/Colorize Conversation/TCP/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color7_cb) },
2874 { "/Colorize Conversation/TCP/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color8_cb) },
2875 { "/Colorize Conversation/TCP/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color9_cb) },
2876 { "/Colorize Conversation/TCP/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color10_cb) },
2877 { "/Colorize Conversation/TCP/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_new_rule_cb) },
2879 { "/Colorize Conversation/UDP", NULL, "UDP", NULL, NULL, NULL },
2881 { "/Colorize Conversation/UDP/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color1_cb) },
2882 { "/Colorize Conversation/UDP/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color2_cb) },
2883 { "/Colorize Conversation/UDP/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color3_cb) },
2884 { "/Colorize Conversation/UDP/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color4_cb) },
2885 { "/Colorize Conversation/UDP/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color5_cb) },
2886 { "/Colorize Conversation/UDP/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color6_cb) },
2887 { "/Colorize Conversation/UDP/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color7_cb) },
2888 { "/Colorize Conversation/UDP/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color8_cb) },
2889 { "/Colorize Conversation/UDP/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color9_cb) },
2890 { "/Colorize Conversation/UDP/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color10_cb) },
2891 { "/Colorize Conversation/UDP/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_new_rule_cb) },
2893 { "/Colorize Conversation/PN-CBA", NULL, "PN-CBA Server", NULL, NULL, NULL },
2895 { "/Colorize Conversation/PN-CBA/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color1_cb) },
2896 { "/Colorize Conversation/PN-CBA/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color2_cb) },
2897 { "/Colorize Conversation/PN-CBA/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color3_cb) },
2898 { "/Colorize Conversation/PN-CBA/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color4_cb) },
2899 { "/Colorize Conversation/PN-CBA/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color5_cb) },
2900 { "/Colorize Conversation/PN-CBA/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color6_cb) },
2901 { "/Colorize Conversation/PN-CBA/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color7_cb) },
2902 { "/Colorize Conversation/PN-CBA/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color8_cb) },
2903 { "/Colorize Conversation/PN-CBA/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color9_cb) },
2904 { "/Colorize Conversation/PN-CBA/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color10_cb) },
2905 { "/Colorize Conversation/PN-CBA/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_new_rule_cb) },
2907 { "/SCTP", NULL, "SCTP", NULL, NULL, NULL },
2908 { "/SCTP/Analyse this Association", NULL, "Analyse this Association", NULL, NULL, G_CALLBACK(sctp_analyse_start) },
2909 { "/SCTP/Prepare Filter for this Association", NULL, "Prepare Filter for this Association", NULL, NULL, G_CALLBACK(sctp_set_assoc_filter) },
2912 { "/Follow TCP Stream", NULL, "Follow TCP Stream", NULL, NULL, G_CALLBACK(follow_tcp_stream_cb) },
2913 { "/Follow UDP Stream", NULL, "Follow UDP Stream", NULL, NULL, G_CALLBACK(follow_udp_stream_cb) },
2914 { "/Follow SSL Stream", NULL, "Follow SSL Stream", NULL, NULL, G_CALLBACK(follow_ssl_stream_cb) },
2916 { "/Copy", NULL, "Copy", NULL, NULL, NULL },
2917 { "/Copy/SummaryTxt", NULL, "Summary (Text)", NULL, NULL, G_CALLBACK(packet_list_menu_copy_sum_txt) },
2918 { "/Copy/SummaryCSV", NULL, "Summary (CSV)", NULL, NULL, G_CALLBACK(packet_list_menu_copy_sum_csv) },
2919 { "/Copy/AsFilter", NULL, "As Filter", NULL, NULL, G_CALLBACK(packet_list_menu_copy_as_flt) },
2922 { "/Copy/Bytes", NULL, "Bytes", NULL, NULL, NULL },
2923 { "/Copy/Bytes/OffsetHexText", NULL, "Offset Hex Text", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_oht_cb) },
2924 { "/Copy/Bytes/OffsetHex", NULL, "Offset Hex", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_oh_cb) },
2925 { "/Copy/Bytes/PrintableTextOnly", NULL, "Printable Text Only", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_text_cb) },
2927 { "/Copy/Bytes/HexStream", NULL, "Hex Stream", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_hex_strm_cb) },
2928 { "/Copy/Bytes/BinaryStream", NULL, "Binary Stream", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_bin_strm_cb) },
2930 { "/ProtocolPreferences", NULL, "Protocol Preferences", NULL, NULL, NULL },
2931 { "/DecodeAs", WIRESHARK_STOCK_DECODE_AS, "Decode As...", NULL, NULL, G_CALLBACK(decode_as_cb) },
2932 { "/Print", GTK_STOCK_PRINT, "Print...", NULL, NULL, G_CALLBACK(file_print_selected_cmd_cb) },
2933 { "/ShowPacketinNewWindow", NULL, "Show Packet in New Window", NULL, NULL, G_CALLBACK(new_window_cb) },
2937 static const char *ui_desc_tree_view_menu_popup =
2938 "<ui>\n"
2939 " <popup name='TreeViewPopup' action='PopupAction'>\n"
2940 " <menuitem name='ExpandSubtrees' action='/ExpandSubtrees'/>\n"
2941 " <menuitem name='CollapseSubtrees' action='/CollapseSubtrees'/>\n"
2942 " <menuitem name='ExpandAll' action='/ExpandAll'/>\n"
2943 " <menuitem name='CollapseAll' action='/CollapseAll'/>\n"
2944 " <separator/>\n"
2945 " <menuitem name='ApplyasColumn' action='/Apply as Column'/>\n"
2946 " <separator/>\n"
2947 " <menu name= 'ApplyAsFilter' action='/ApplyasFilter'>\n"
2948 " <menuitem name='Selected' action='/ApplyasFilter/Selected'/>\n"
2949 " <menuitem name='NotSelected' action='/ApplyasFilter/Not Selected'/>\n"
2950 " <menuitem name='AndSelected' action='/ApplyasFilter/AndSelected'/>\n"
2951 " <menuitem name='OrSelected' action='/ApplyasFilter/OrSelected'/>\n"
2952 " <menuitem name='AndNotSelected' action='/ApplyasFilter/AndNotSelected'/>\n"
2953 " <menuitem name='OrNotSelected' action='/ApplyasFilter/OrNotSelected'/>\n"
2954 " </menu>\n"
2955 " <menu name= 'PrepareaFilter' action='/PrepareaFilter'>\n"
2956 " <menuitem name='Selected' action='/PrepareaFilter/Selected'/>\n"
2957 " <menuitem name='NotSelected' action='/PrepareaFilter/Not Selected'/>\n"
2958 " <menuitem name='AndSelected' action='/PrepareaFilter/AndSelected'/>\n"
2959 " <menuitem name='OrSelected' action='/PrepareaFilter/OrSelected'/>\n"
2960 " <menuitem name='AndNotSelected' action='/PrepareaFilter/AndNotSelected'/>\n"
2961 " <menuitem name='OrNotSelected' action='/PrepareaFilter/OrNotSelected'/>\n"
2962 " </menu>\n"
2963 " <menu name= 'ColorizewithFilter' action='/Colorize with Filter'>\n"
2964 " <menuitem name='Color1' action='/Colorize with Filter/Color 1'/>\n"
2965 " <menuitem name='Color2' action='/Colorize with Filter/Color 2'/>\n"
2966 " <menuitem name='Color3' action='/Colorize with Filter/Color 3'/>\n"
2967 " <menuitem name='Color4' action='/Colorize with Filter/Color 4'/>\n"
2968 " <menuitem name='Color5' action='/Colorize with Filter/Color 5'/>\n"
2969 " <menuitem name='Color6' action='/Colorize with Filter/Color 6'/>\n"
2970 " <menuitem name='Color7' action='/Colorize with Filter/Color 7'/>\n"
2971 " <menuitem name='Color8' action='/Colorize with Filter/Color 8'/>\n"
2972 " <menuitem name='Color9' action='/Colorize with Filter/Color 9'/>\n"
2973 " <menuitem name='Color10' action='/Colorize with Filter/Color 10'/>\n"
2974 " <menuitem name='NewColoringRule' action='/Colorize with Filter/New Coloring Rule'/>\n"
2975 " </menu>\n"
2976 " <menuitem name='FollowTCPStream' action='/Follow TCP Stream'/>\n"
2977 " <menuitem name='FollowUDPStream' action='/Follow UDP Stream'/>\n"
2978 " <menuitem name='FollowSSLStream' action='/Follow SSL Stream'/>\n"
2979 " <separator/>\n"
2980 " <menu name= 'Copy' action='/Copy'>\n"
2981 " <menuitem name='Description' action='/Copy/Description'/>\n"
2982 " <menuitem name='Fieldname' action='/Copy/Fieldname'/>\n"
2983 " <menuitem name='Value' action='/Copy/Value'/>\n"
2984 " <separator/>\n"
2985 " <menuitem name='AsFilter' action='/Copy/AsFilter'/>\n"
2986 " <separator/>\n"
2987 " <menu name= 'Bytes' action='/Copy/Bytes'>\n"
2988 " <menuitem name='OffsetHexText' action='/Copy/Bytes/OffsetHexText'/>\n"
2989 " <menuitem name='OffsetHex' action='/Copy/Bytes/OffsetHex'/>\n"
2990 " <menuitem name='PrintableTextOnly' action='/Copy/Bytes/PrintableTextOnly'/>\n"
2991 " <separator/>\n"
2992 " <menuitem name='HexStream' action='/Copy/Bytes/HexStream'/>\n"
2993 " <menuitem name='BinaryStream' action='/Copy/Bytes/BinaryStream'/>\n"
2994 " </menu>\n"
2995 " </menu>\n"
2996 " <menuitem name='ExportSelectedPacketBytes' action='/ExportSelectedPacketBytes'/>\n"
2997 #ifdef WANT_PACKET_EDITOR
2998 " <menuitem name='EditPacket' action='/Edit/EditPacket'/>\n"
2999 #endif
3000 " <separator/>\n"
3001 " <menuitem name='WikiProtocolPage' action='/WikiProtocolPage'/>\n"
3002 " <menuitem name='FilterFieldReference' action='/FilterFieldReference'/>\n"
3003 " <menuitem name='ProtocolHelp' action='/ProtocolHelp'/>\n"
3004 " <menuitem name='ProtocolPreferences' action='/ProtocolPreferences'/>\n"
3005 " <separator/>\n"
3006 " <menuitem name='DecodeAs' action='/DecodeAs'/>\n"
3007 " <menuitem name='DisableProtocol' action='/DisableProtocol'/>\n"
3008 " <menuitem name='ResolveName' action='/ResolveName'/>\n"
3009 " <menuitem name='GotoCorrespondingPacket' action='/GotoCorrespondingPacket'/>\n"
3010 " <menuitem name='ShowPacketRefinNewWindow' action='/ShowPacketRefinNewWindow'/>\n"
3011 " </popup>\n"
3012 "</ui>\n";
3014 static const GtkActionEntry tree_view_menu_popup_action_entries[] = {
3015 { "/ExpandSubtrees", NULL, "Expand Subtrees", NULL, NULL, G_CALLBACK(expand_tree_cb) },
3016 { "/CollapseSubtrees", NULL, "Collapse Subtrees", NULL, NULL, G_CALLBACK(collapse_tree_cb) },
3017 { "/ExpandAll", NULL, "Expand All", NULL, NULL, G_CALLBACK(expand_all_cb) },
3018 { "/CollapseAll", NULL, "Collapse All", NULL, NULL, G_CALLBACK(collapse_all_cb) },
3019 { "/Apply as Column", NULL, "Apply as Column", NULL, NULL, G_CALLBACK(apply_as_custom_column_cb) },
3021 { "/Colorize with Filter", NULL, "Colorize with Filter", NULL, NULL, NULL },
3022 { "/Colorize with Filter/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color1_cb) },
3023 { "/Colorize with Filter/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color2_cb) },
3024 { "/Colorize with Filter/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color3_cb) },
3025 { "/Colorize with Filter/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color4_cb) },
3026 { "/Colorize with Filter/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color5_cb) },
3027 { "/Colorize with Filter/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color6_cb) },
3028 { "/Colorize with Filter/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color7_cb) },
3029 { "/Colorize with Filter/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color8_cb) },
3030 { "/Colorize with Filter/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color9_cb) },
3031 { "/Colorize with Filter/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color10_cb) },
3032 { "/Colorize with Filter/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_new_rule_cb) },
3034 { "/Follow TCP Stream", NULL, "Follow TCP Stream", NULL, NULL, G_CALLBACK(follow_tcp_stream_cb) },
3035 { "/Follow UDP Stream", NULL, "Follow UDP Stream", NULL, NULL, G_CALLBACK(follow_udp_stream_cb) },
3036 { "/Follow SSL Stream", NULL, "Follow SSL Stream", NULL, NULL, G_CALLBACK(follow_ssl_stream_cb) },
3038 { "/Copy", NULL, "Copy", NULL, NULL, NULL },
3039 { "/Copy/Description", NULL, "Description", NULL, NULL, G_CALLBACK(tree_view_menu_copy_desc) },
3040 { "/Copy/Fieldname", NULL, "Fieldname", NULL, NULL, G_CALLBACK(tree_view_menu_copy_field) },
3041 { "/Copy/Value", NULL, "Value", NULL, NULL, G_CALLBACK(tree_view_menu_copy_value) },
3043 { "/Copy/AsFilter", NULL, "As Filter", NULL, NULL, G_CALLBACK(tree_view_menu_copy_as_flt) },
3045 { "/Copy/Bytes", NULL, "Bytes", NULL, NULL, NULL },
3046 { "/Copy/Bytes/OffsetHexText", NULL, "Offset Hex Text", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_oht_cb) },
3047 { "/Copy/Bytes/OffsetHex", NULL, "Offset Hex", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_oh_cb) },
3048 { "/Copy/Bytes/PrintableTextOnly", NULL, "Printable Text Only", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_text_cb) },
3050 { "/Copy/Bytes/HexStream", NULL, "Hex Stream", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_hex_strm_cb) },
3051 { "/Copy/Bytes/BinaryStream", NULL, "Binary Stream", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_bin_strm_cb) },
3053 { "/ExportSelectedPacketBytes", NULL, "Export Selected Packet Bytes...", NULL, NULL, G_CALLBACK(savehex_cb) },
3054 #ifdef WANT_PACKET_EDITOR
3055 { "/Edit/EditPacket", NULL, "_Edit Packet", NULL, NULL, G_CALLBACK(edit_window_cb) },
3056 #endif
3057 { "/WikiProtocolPage", WIRESHARK_STOCK_WIKI, "Wiki Protocol Page", NULL, NULL, G_CALLBACK(selected_ptree_info_cb) },
3058 { "/FilterFieldReference", WIRESHARK_STOCK_INTERNET, "Filter Field Reference", NULL, NULL, G_CALLBACK(selected_ptree_ref_cb) },
3059 { "/ProtocolHelp", NULL, "Protocol Help", NULL, NULL, NULL },
3060 { "/ProtocolPreferences", NULL, "Protocol Preferences", NULL, NULL, NULL },
3061 { "/DecodeAs", WIRESHARK_STOCK_DECODE_AS, "Decode As...", NULL, NULL, G_CALLBACK(decode_as_cb) },
3062 { "/DisableProtocol", WIRESHARK_STOCK_CHECKBOX, "Disable Protocol...", NULL, NULL, G_CALLBACK(proto_disable_cb) },
3063 { "/ResolveName", NULL, "_Resolve Name", NULL, NULL, G_CALLBACK(resolve_name_cb) },
3064 { "/GotoCorrespondingPacket", NULL, "_Go to Corresponding Packet", NULL, NULL, G_CALLBACK(goto_framenum_cb) },
3065 { "/ShowPacketRefinNewWindow", NULL, "Show Packet Reference in New Window", NULL, NULL, G_CALLBACK(new_window_cb_ref) },
3068 static const char *ui_desc_bytes_menu_popup =
3069 "<ui>\n"
3070 " <popup name='BytesMenuPopup' action='PopupAction'>\n"
3071 " <menuitem name='HexView' action='/HexView'/>\n"
3072 " <menuitem name='BitsView' action='/BitsView'/>\n"
3073 " </popup>\n"
3074 "</ui>\n";
3076 static const GtkRadioActionEntry bytes_menu_radio_action_entries [] =
3078 /* name, stock id, label, accel, tooltip, value */
3079 { "/HexView", NULL, "Hex View", NULL, NULL, BYTES_HEX },
3080 { "/BitsView", NULL, "Bits View", NULL, NULL, BYTES_BITS },
3083 static const char *ui_statusbar_profiles_menu_popup =
3084 "<ui>\n"
3085 " <popup name='ProfilesMenuPopup' action='PopupAction'>\n"
3086 " <menuitem name='Profiles' action='/Profiles'/>\n"
3087 " <separator/>\n"
3088 " <menuitem name='New' action='/New'/>\n"
3089 " <menuitem name='Rename' action='/Rename'/>\n"
3090 " <menuitem name='Delete' action='/Delete'/>\n"
3091 " <separator/>\n"
3092 " <menu name='Change' action='/Change'>\n"
3093 " <menuitem name='Default' action='/Change/Default'/>\n"
3094 " </menu>\n"
3095 " </popup>\n"
3096 "</ui>\n";
3097 static const GtkActionEntry statusbar_profiles_menu_action_entries [] =
3099 { "/Profiles", GTK_STOCK_INDEX, "Manage Profiles...", NULL, NULL, G_CALLBACK(profile_dialog_cb) },
3100 { "/New", GTK_STOCK_NEW, "New...", NULL, NULL, G_CALLBACK(profile_new_cb) },
3101 { "/Rename", GTK_STOCK_EDIT, "Rename...", NULL, NULL, G_CALLBACK(profile_rename_cb) },
3102 { "/Delete", GTK_STOCK_DELETE, "Delete", NULL, NULL, G_CALLBACK(profile_delete_cb) },
3103 { "/Change", GTK_STOCK_JUMP_TO, "Switch to", NULL, NULL, NULL },
3104 { "/Change/Default", NULL, "Default", NULL, NULL, NULL },
3107 GtkWidget *
3108 main_menu_new(GtkAccelGroup ** table)
3110 GtkWidget *menubar;
3111 #ifdef HAVE_IGE_MAC_INTEGRATION
3112 GtkWidget *quit_item, *about_item, *preferences_item;
3113 IgeMacMenuGroup *group;
3114 #endif
3115 #ifdef HAVE_GTKOSXAPPLICATION
3116 GtkosxApplication *theApp;
3117 GtkWidget * item;
3118 GtkWidget * dock_menu;
3119 #endif
3121 grp = gtk_accel_group_new();
3123 if (initialize)
3124 menus_init();
3126 menubar = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar");
3127 #ifdef HAVE_IGE_MAC_INTEGRATION
3128 if(prefs.gui_macosx_style) {
3129 ige_mac_menu_set_menu_bar(GTK_MENU_SHELL(menubar));
3130 ige_mac_menu_set_global_key_handler_enabled(TRUE);
3132 /* Create menu items to populate the application menu with. We have to
3133 * do this because we are still using the old GtkItemFactory API for
3134 * the main menu. */
3135 group = ige_mac_menu_add_app_menu_group();
3136 about_item = gtk_menu_item_new_with_label("About");
3137 g_signal_connect(about_item, "activate", G_CALLBACK(about_wireshark_cb),
3138 NULL);
3139 ige_mac_menu_add_app_menu_item(group, GTK_MENU_ITEM(about_item), NULL);
3141 group = ige_mac_menu_add_app_menu_group();
3142 preferences_item = gtk_menu_item_new_with_label("Preferences");
3143 g_signal_connect(preferences_item, "activate", G_CALLBACK(prefs_cb),
3144 NULL);
3145 ige_mac_menu_add_app_menu_item(group, GTK_MENU_ITEM(preferences_item),
3146 NULL);
3149 /* The quit item in the application menu shows up whenever ige mac
3150 * integration is enabled, even if the OS X UI style in Wireshark isn't
3151 * turned on. */
3152 quit_item = gtk_menu_item_new_with_label("Quit");
3153 g_signal_connect(quit_item, "activate", G_CALLBACK(file_quit_cmd_cb), NULL);
3154 ige_mac_menu_set_quit_menu_item(GTK_MENU_ITEM(quit_item));
3155 #endif
3157 #ifdef HAVE_GTKOSXAPPLICATION
3158 theApp = (GtkosxApplication *)g_object_new(GTKOSX_TYPE_APPLICATION, NULL);
3160 if(prefs.gui_macosx_style) {
3161 gtk_widget_hide(menubar);
3163 gtkosx_application_set_menu_bar(theApp, GTK_MENU_SHELL(menubar));
3164 gtkosx_application_set_use_quartz_accelerators(theApp, TRUE);
3166 /* Construct a conventional looking OSX App menu */
3168 item = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/HelpMenu/AboutWireshark");
3169 gtkosx_application_insert_app_menu_item(theApp, item, 0);
3171 gtkosx_application_insert_app_menu_item(theApp, gtk_separator_menu_item_new(), 1);
3173 item = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/EditMenu/Preferences");
3174 gtkosx_application_insert_app_menu_item(theApp, item, 2);
3176 /* Set OSX help menu */
3178 item = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/HelpMenu");
3179 gtkosx_application_set_help_menu(theApp,GTK_MENU_ITEM(item));
3181 /* Hide the File menu Quit item (a Quit item is automagically placed within the OSX App menu) */
3183 item = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/FileMenu/Quit");
3184 gtk_widget_hide(item);
3187 /* generate dock menu */
3188 dock_menu = gtk_menu_new();
3190 item = gtk_menu_item_new_with_label("Start");
3191 g_signal_connect(item, "activate", G_CALLBACK (capture_start_cb), NULL);
3192 gtk_menu_shell_append(GTK_MENU_SHELL(dock_menu), item);
3194 item = gtk_menu_item_new_with_label("Stop");
3195 g_signal_connect(item, "activate", G_CALLBACK (capture_stop_cb), NULL);
3196 gtk_menu_shell_append(GTK_MENU_SHELL(dock_menu), item);
3198 item = gtk_menu_item_new_with_label("Restart");
3199 g_signal_connect(item, "activate", G_CALLBACK (capture_restart_cb), NULL);
3200 gtk_menu_shell_append(GTK_MENU_SHELL(dock_menu), item);
3202 gtkosx_application_set_dock_menu(theApp, GTK_MENU_SHELL(dock_menu));
3203 #endif
3205 if (table)
3206 *table = grp;
3208 return menubar;
3211 static void
3212 menu_dissector_filter_cb(GtkAction *action _U_, gpointer callback_data)
3214 dissector_filter_t *filter_entry = (dissector_filter_t *)callback_data;
3215 GtkWidget *filter_te;
3216 const char *buf;
3218 filter_te = gtk_bin_get_child(GTK_BIN(g_object_get_data(G_OBJECT(top_level), E_DFILTER_CM_KEY)));
3220 /* XXX - this gets the packet_info of the last dissected packet, */
3221 /* which is not necessarily the last selected packet */
3222 /* e.g. "Update list of packets in real time" won't work correct */
3223 buf = filter_entry->build_filter_string(&cfile.edt->pi);
3225 gtk_entry_set_text(GTK_ENTRY(filter_te), buf);
3227 /* Run the display filter so it goes in effect - even if it's the
3228 same as the previous display filter. */
3229 main_filter_packets(&cfile, buf, TRUE);
3231 g_free( (void *) buf);
3234 static gboolean
3235 menu_dissector_filter_spe_cb(frame_data *fd _U_, epan_dissect_t *edt, gpointer callback_data)
3237 dissector_filter_t *filter_entry = (dissector_filter_t *)callback_data;
3239 /* XXX - this gets the packet_info of the last dissected packet, */
3240 /* which is not necessarily the last selected packet */
3241 /* e.g. "Update list of packets in real time" won't work correct */
3242 return (edt != NULL) ? filter_entry->is_filter_valid(&edt->pi) : FALSE;
3245 static void
3246 menu_dissector_filter(capture_file *cf)
3248 GList *list_entry = dissector_filter_list;
3249 dissector_filter_t *filter_entry;
3251 guint merge_id;
3252 GtkActionGroup *action_group;
3253 GtkAction *action;
3254 GtkWidget *submenu_dissector_filters;
3255 gchar *action_name;
3256 guint i = 0;
3259 merge_id = gtk_ui_manager_new_merge_id (ui_manager_main_menubar);
3261 action_group = gtk_action_group_new ("dissector-filters-group");
3263 submenu_dissector_filters = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/ConversationFilterMenu");
3264 if(!submenu_dissector_filters){
3265 g_warning("add_recent_items: No submenu_dissector_filters found, path= /Menubar/AnalyzeMenu/ConversationFilterMenu");
3268 gtk_ui_manager_insert_action_group (ui_manager_main_menubar, action_group, 0);
3269 g_object_set_data (G_OBJECT (ui_manager_main_menubar),
3270 "diessector-filters-merge-id", GUINT_TO_POINTER (merge_id));
3272 /* no items */
3273 if (!list_entry){
3275 action = (GtkAction *)g_object_new (GTK_TYPE_ACTION,
3276 "name", "filter-list-empty",
3277 "label", "No filters",
3278 "sensitive", FALSE,
3279 NULL);
3280 gtk_action_group_add_action (action_group, action);
3281 gtk_action_set_sensitive(action, FALSE);
3282 g_object_unref (action);
3284 gtk_ui_manager_add_ui (ui_manager_main_menubar, merge_id,
3285 "/Menubar/AnalyzeMenu/ConversationFilterMenu/Filters",
3286 "filter-list-empty",
3287 "filter-list-empty",
3288 GTK_UI_MANAGER_MENUITEM,
3289 FALSE);
3291 return;
3294 while (list_entry != NULL) {
3295 filter_entry = (dissector_filter_t *)list_entry->data;
3296 action_name = g_strdup_printf ("filter-%u", i);
3297 /*g_warning("action_name %s, filter_entry->name %s",action_name,filter_entry->name);*/
3298 action = (GtkAction *)g_object_new (GTK_TYPE_ACTION,
3299 "name", action_name,
3300 "label", filter_entry->name,
3301 "sensitive", menu_dissector_filter_spe_cb(/* frame_data *fd _U_*/ NULL, cf->edt, filter_entry),
3302 NULL);
3303 g_signal_connect (action, "activate",
3304 G_CALLBACK (menu_dissector_filter_cb), filter_entry);
3305 gtk_action_group_add_action (action_group, action);
3306 g_object_unref (action);
3308 gtk_ui_manager_add_ui (ui_manager_main_menubar, merge_id,
3309 "/Menubar/AnalyzeMenu/ConversationFilterMenu/Filters",
3310 action_name,
3311 action_name,
3312 GTK_UI_MANAGER_MENUITEM,
3313 FALSE);
3314 g_free(action_name);
3315 i++;
3316 list_entry = g_list_next(list_entry);
3320 static void
3321 menus_init(void)
3323 GtkActionGroup *packet_list_heading_action_group, *packet_list_action_group,
3324 *packet_list_details_action_group, *packet_list_byte_menu_action_group,
3325 *statusbar_profiles_action_group;
3326 GtkAction *name_res_action;
3327 GError *error = NULL;
3328 guint merge_id;
3330 if (initialize) {
3331 initialize = FALSE;
3333 popup_menu_object = gtk_menu_new();
3335 /* packet list heading pop-up menu */
3336 packet_list_heading_action_group = gtk_action_group_new ("PacketListHeadingPopUpMenuActionGroup");
3338 gtk_action_group_add_actions (packet_list_heading_action_group, /* the action group */
3339 packet_list_heading_menu_popup_action_entries, /* an array of action descriptions */
3340 G_N_ELEMENTS(packet_list_heading_menu_popup_action_entries), /* the number of entries */
3341 popup_menu_object); /* data to pass to the action callbacks */
3343 gtk_action_group_add_toggle_actions(packet_list_heading_action_group, /* the action group */
3344 (GtkToggleActionEntry *)packet_list_heading_menu_toggle_action_entries, /* an array of action descriptions */
3345 G_N_ELEMENTS(packet_list_heading_menu_toggle_action_entries), /* the number of entries */
3346 NULL); /* data to pass to the action callbacks */
3348 ui_manager_packet_list_heading = gtk_ui_manager_new ();
3349 gtk_ui_manager_insert_action_group (ui_manager_packet_list_heading,
3350 packet_list_heading_action_group,
3351 0); /* the position at which the group will be inserted. */
3353 gtk_ui_manager_add_ui_from_string (ui_manager_packet_list_heading,ui_desc_packet_list_heading_menu_popup, -1, &error);
3354 if (error != NULL)
3356 fprintf (stderr, "Warning: building Packet List Heading Pop-Up failed: %s\n",
3357 error->message);
3358 g_error_free (error);
3359 error = NULL;
3362 g_object_set_data(G_OBJECT(popup_menu_object), PM_PACKET_LIST_COL_KEY,
3363 gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup"));
3365 popup_menu_list = g_slist_append((GSList *)popup_menu_list, ui_manager_packet_list_heading);
3367 /* packet list pop-up menu */
3368 packet_list_action_group = gtk_action_group_new ("PacketListPopUpMenuActionGroup");
3370 gtk_action_group_add_actions (packet_list_action_group, /* the action group */
3371 (GtkActionEntry *)packet_list_menu_popup_action_entries, /* an array of action descriptions */
3372 G_N_ELEMENTS(packet_list_menu_popup_action_entries), /* the number of entries */
3373 popup_menu_object); /* data to pass to the action callbacks */
3375 /* Add the filter menu items */
3376 gtk_action_group_add_actions (packet_list_action_group, /* the action group */
3377 (GtkActionEntry *)apply_prepare_filter_action_entries, /* an array of action descriptions */
3378 G_N_ELEMENTS(apply_prepare_filter_action_entries), /* the number of entries */
3379 popup_menu_object); /* data to pass to the action callbacks */
3381 ui_manager_packet_list_menu = gtk_ui_manager_new ();
3383 gtk_ui_manager_insert_action_group (ui_manager_packet_list_menu,
3384 packet_list_action_group,
3385 0); /* the position at which the group will be inserted. */
3387 gtk_ui_manager_add_ui_from_string (ui_manager_packet_list_menu, ui_desc_packet_list_menu_popup, -1, &error);
3388 if (error != NULL)
3390 fprintf (stderr, "Warning: building Packet List Pop-Up menu failed: %s\n",
3391 error->message);
3392 g_error_free (error);
3393 error = NULL;
3396 g_object_set_data(G_OBJECT(popup_menu_object), PM_PACKET_LIST_KEY,
3397 gtk_ui_manager_get_widget(ui_manager_packet_list_menu, "/PacketListMenuPopup"));
3399 popup_menu_list = g_slist_append((GSList *)popup_menu_list, ui_manager_packet_list_menu);
3402 /* packet detail pop-up menu */
3403 packet_list_details_action_group = gtk_action_group_new ("PacketListDetailsMenuPopUpActionGroup");
3405 gtk_action_group_add_actions (packet_list_details_action_group, /* the action group */
3406 (GtkActionEntry *)tree_view_menu_popup_action_entries, /* an array of action descriptions */
3407 G_N_ELEMENTS(tree_view_menu_popup_action_entries), /* the number of entries */
3408 popup_menu_object); /* data to pass to the action callbacks */
3410 /* Add the filter menu items */
3411 gtk_action_group_add_actions (packet_list_details_action_group, /* the action group */
3412 (GtkActionEntry *)apply_prepare_filter_action_entries, /* an array of action descriptions */
3413 G_N_ELEMENTS(apply_prepare_filter_action_entries), /* the number of entries */
3414 popup_menu_object); /* data to pass to the action callbacks */
3417 ui_manager_tree_view_menu = gtk_ui_manager_new ();
3419 gtk_ui_manager_insert_action_group (ui_manager_tree_view_menu,
3420 packet_list_details_action_group,
3421 0); /* the position at which the group will be inserted. */
3422 gtk_ui_manager_add_ui_from_string (ui_manager_tree_view_menu, ui_desc_tree_view_menu_popup, -1, &error);
3423 #if 0
3424 /* If we want to load the treewiew popup UI description from file */
3425 gui_desc_file_name_and_path = get_ui_file_path("tree-view-ui.xml");
3426 gtk_ui_manager_add_ui_from_file ( ui_manager_tree_view_menu, gui_desc_file_name_and_path, &error);
3427 g_free (gui_desc_file_name_and_path);
3428 #endif
3429 if (error != NULL)
3431 fprintf (stderr, "Warning: building TreeView Pop-Up menu failed: %s\n",
3432 error->message);
3433 g_error_free (error);
3434 error = NULL;
3437 g_object_set_data(G_OBJECT(popup_menu_object), PM_TREE_VIEW_KEY,
3438 gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup"));
3440 popup_menu_list = g_slist_append((GSList *)popup_menu_list, ui_manager_tree_view_menu);
3443 * Hex dump pop-up menu.
3444 * We provide our own empty menu to suppress the default pop-up menu
3445 * for text widgets.
3447 packet_list_byte_menu_action_group = gtk_action_group_new ("PacketListByteMenuPopUpActionGroup");
3450 gtk_action_group_add_radio_actions (packet_list_byte_menu_action_group, /* the action group */
3451 (GtkRadioActionEntry *)bytes_menu_radio_action_entries, /* an array of radio action descriptions */
3452 G_N_ELEMENTS(bytes_menu_radio_action_entries), /* the number of entries */
3453 recent.gui_bytes_view, /* the value of the action to activate initially, or -1 if no action should be activated */
3454 G_CALLBACK(select_bytes_view_cb), /* the callback to connect to the changed signal */
3455 popup_menu_object); /* data to pass to the action callbacks */
3457 ui_manager_bytes_menu = gtk_ui_manager_new ();
3459 gtk_ui_manager_insert_action_group (ui_manager_bytes_menu,
3460 packet_list_byte_menu_action_group,
3461 0); /* the position at which the group will be inserted. */
3462 gtk_ui_manager_add_ui_from_string (ui_manager_bytes_menu, ui_desc_bytes_menu_popup, -1, &error);
3463 #if 0
3464 /* If we want to load the bytesview poupup UI description from file */
3465 gui_desc_file_name_and_path = get_ui_file_path("bytes-view-ui.xml");
3466 gtk_ui_manager_add_ui_from_file ( ui_manager_bytes_menu, gui_desc_file_name_and_path, &error);
3467 g_free (gui_desc_file_name_and_path);
3468 #endif
3469 if (error != NULL)
3471 fprintf (stderr, "Warning: building Bytes Pop-Up menu failed: %s\n",
3472 error->message);
3473 g_error_free (error);
3474 error = NULL;
3476 g_object_unref(packet_list_byte_menu_action_group);
3478 g_object_set_data(G_OBJECT(popup_menu_object), PM_BYTES_VIEW_KEY,
3479 gtk_ui_manager_get_widget(ui_manager_bytes_menu, "/BytesMenuPopup"));
3481 popup_menu_list = g_slist_append((GSList *)popup_menu_list, ui_manager_bytes_menu);
3483 /* main */
3484 main_menu_bar_action_group = gtk_action_group_new ("MenuActionGroup");
3486 gtk_action_group_add_actions (main_menu_bar_action_group, /* the action group */
3487 main_menu_bar_entries, /* an array of action descriptions */
3488 G_N_ELEMENTS(main_menu_bar_entries), /* the number of entries */
3489 NULL); /* data to pass to the action callbacks */
3491 #ifdef HAVE_LIBPCAP
3492 /* Add the capture menu actions */
3493 gtk_action_group_add_actions (main_menu_bar_action_group, /* the action group */
3494 capture_menu_entries, /* an array of action descriptions */
3495 G_N_ELEMENTS(capture_menu_entries), /* the number of entries */
3496 NULL); /* data to pass to the action callbacks */
3497 #endif
3499 /* Add the filter menu actions */
3500 gtk_action_group_add_actions (main_menu_bar_action_group, /* the action group */
3501 (GtkActionEntry *)apply_prepare_filter_action_entries, /* an array of action descriptions */
3502 G_N_ELEMENTS(apply_prepare_filter_action_entries), /* the number of entries */
3503 popup_menu_object); /* data to pass to the action callbacks */
3505 gtk_action_group_add_toggle_actions(main_menu_bar_action_group, /* the action group */
3506 main_menu_bar_toggle_action_entries, /* an array of action descriptions */
3507 G_N_ELEMENTS(main_menu_bar_toggle_action_entries), /* the number of entries */
3508 NULL); /* data to pass to the action callbacks */
3510 gtk_action_group_add_radio_actions (main_menu_bar_action_group, /* the action group */
3511 main_menu_bar_radio_view_time_entries, /* an array of radio action descriptions */
3512 G_N_ELEMENTS(main_menu_bar_radio_view_time_entries), /* the number of entries */
3513 recent.gui_time_format, /* the value of the action to activate initially, or -1 if no action should be activated */
3514 G_CALLBACK(timestamp_format_new_cb), /* the callback to connect to the changed signal */
3515 NULL); /* data to pass to the action callbacks */
3517 gtk_action_group_add_radio_actions (main_menu_bar_action_group, /* the action group */
3518 main_menu_bar_radio_view_time_fileformat_prec_entries, /* an array of radio action descriptions */
3519 G_N_ELEMENTS(main_menu_bar_radio_view_time_fileformat_prec_entries), /* the number of entries */
3520 recent.gui_time_precision, /* the value of the action to activate initially, or -1 if no action should be activated */
3521 G_CALLBACK(timestamp_precision_new_cb), /* the callback to connect to the changed signal */
3522 NULL); /* data to pass to the action callbacks */
3526 ui_manager_main_menubar = gtk_ui_manager_new ();
3527 gtk_ui_manager_insert_action_group (ui_manager_main_menubar, main_menu_bar_action_group, 0);
3529 gtk_ui_manager_add_ui_from_string (ui_manager_main_menubar,ui_desc_menubar, -1, &error);
3530 if (error != NULL)
3532 fprintf (stderr, "Warning: building main menubar failed: %s\n",
3533 error->message);
3534 g_error_free (error);
3535 error = NULL;
3537 g_object_unref(main_menu_bar_action_group);
3538 gtk_window_add_accel_group (GTK_WINDOW(top_level),
3539 gtk_ui_manager_get_accel_group(ui_manager_main_menubar));
3542 /* Add the recent files items to the menu
3543 * use place holders and
3544 * gtk_ui_manager_add_ui().
3546 merge_id = gtk_ui_manager_new_merge_id (ui_manager_main_menubar);
3547 add_recent_items (merge_id, ui_manager_main_menubar);
3549 /* Add statistics tap plug-in to the menu
3551 merge_id = gtk_ui_manager_new_merge_id (ui_manager_main_menubar);
3552 add_tap_plugins (merge_id, ui_manager_main_menubar);
3554 statusbar_profiles_action_group = gtk_action_group_new ("StatusBarProfilesPopUpMenuActionGroup");
3556 gtk_action_group_add_actions (statusbar_profiles_action_group, /* the action group */
3557 (GtkActionEntry *)statusbar_profiles_menu_action_entries, /* an array of action descriptions */
3558 G_N_ELEMENTS(statusbar_profiles_menu_action_entries), /* the number of entries */
3559 popup_menu_object); /* data to pass to the action callbacks */
3561 ui_manager_statusbar_profiles_menu = gtk_ui_manager_new ();
3562 gtk_ui_manager_insert_action_group (ui_manager_statusbar_profiles_menu,
3563 statusbar_profiles_action_group,
3564 0); /* the position at which the group will be inserted. */
3566 gtk_ui_manager_add_ui_from_string (ui_manager_statusbar_profiles_menu,ui_statusbar_profiles_menu_popup, -1, &error);
3567 if (error != NULL)
3569 fprintf (stderr, "Warning: building StatusBar Profiles Pop-Up failed: %s\n",
3570 error->message);
3571 g_error_free (error);
3572 error = NULL;
3575 g_object_unref(statusbar_profiles_action_group);
3577 g_object_set_data(G_OBJECT(popup_menu_object), PM_STATUSBAR_PROFILES_KEY,
3578 gtk_ui_manager_get_widget(ui_manager_statusbar_profiles_menu, "/ProfilesMenuPopup"));
3580 popup_menu_list = g_slist_append((GSList *)popup_menu_list, ui_manager_statusbar_profiles_menu);
3582 menu_dissector_filter(&cfile);
3583 merge_menu_items(merge_menu_items_list);
3585 /* Add external menus and items */
3586 ws_menubar_build_external_menus();
3588 /* Initialize enabled/disabled state of menu items */
3589 set_menus_for_capture_file(NULL);
3590 #if 0
3591 /* Un-#if this when we actually implement Cut/Copy/Paste.
3592 Then make sure you enable them when they can be done. */
3593 set_menu_sensitivity_old("/Edit/Cut", FALSE);
3594 set_menu_sensitivity_old("/Edit/Copy", FALSE);
3595 set_menu_sensitivity_old("/Edit/Paste", FALSE);
3596 #endif
3597 /* Hide not usable menus */
3599 set_menus_for_captured_packets(FALSE);
3600 set_menus_for_selected_packet(&cfile);
3601 set_menus_for_selected_tree_row(&cfile);
3602 set_menus_for_capture_in_progress(FALSE);
3603 set_menus_for_file_set(/* dialog */TRUE, /* previous file */ FALSE, /* next_file */ FALSE);
3605 /* Set callback to update name resolution settings when activated */
3606 name_res_action = gtk_action_group_get_action(main_menu_bar_action_group, "/View/NameResolution");
3607 g_signal_connect (name_res_action, "activate", G_CALLBACK (menu_name_resolution_update_cb), NULL);
3611 /* Get a merge id for the menubar */
3612 void
3613 ws_add_build_menubar_items_callback(gpointer callback)
3615 build_menubar_items_callback_list = g_list_append(build_menubar_items_callback_list, callback);
3619 static void
3620 ws_menubar_build_external_menus(void)
3622 void (*callback)(gpointer);
3624 while (build_menubar_items_callback_list != NULL) {
3625 callback = (void (*)(gpointer))build_menubar_items_callback_list->data;
3626 callback(ui_manager_main_menubar);
3627 build_menubar_items_callback_list = g_list_next(build_menubar_items_callback_list);
3633 typedef struct _menu_item {
3634 const char *gui_path;
3635 const char *name;
3636 const char *stock_id;
3637 const char *label;
3638 const char *accelerator;
3639 const gchar *tooltip;
3640 GCallback callback;
3641 gpointer callback_data;
3642 gboolean enabled;
3643 gboolean (*selected_packet_enabled)(frame_data *, epan_dissect_t *, gpointer callback_data);
3644 gboolean (*selected_tree_row_enabled)(field_info *, gpointer callback_data);
3645 } menu_item_t;
3647 static gint
3648 insert_sorted_by_label(gconstpointer aparam, gconstpointer bparam)
3650 const menu_item_t *a = (menu_item_t *)aparam;
3651 const menu_item_t *b = (menu_item_t *)bparam;
3653 return g_ascii_strcasecmp(a->label, b->label);
3656 void register_menu_bar_menu_items(
3657 const char *gui_path,
3658 const char *name,
3659 const gchar *stock_id,
3660 const char *label,
3661 const char *accelerator,
3662 const gchar *tooltip,
3663 gpointer callback,
3664 gpointer callback_data,
3665 gboolean enabled,
3666 gboolean (*selected_packet_enabled)(frame_data *, epan_dissect_t *, gpointer callback_data),
3667 gboolean (*selected_tree_row_enabled)(field_info *, gpointer callback_data))
3669 menu_item_t *menu_item_data;
3671 menu_item_data = g_new0(menu_item_t,1);
3672 menu_item_data->gui_path = gui_path;
3673 menu_item_data->name = name;
3674 menu_item_data->label = label;
3675 menu_item_data->stock_id = stock_id;
3676 menu_item_data->accelerator = accelerator;
3677 menu_item_data->tooltip = tooltip;
3678 menu_item_data->callback = (GCallback)callback;
3679 menu_item_data->callback_data = callback_data;
3680 menu_item_data->enabled = enabled;
3681 menu_item_data->selected_packet_enabled = selected_packet_enabled;
3682 menu_item_data->selected_tree_row_enabled = selected_tree_row_enabled;
3684 merge_menu_items_list = g_list_insert_sorted(merge_menu_items_list,
3685 menu_item_data,
3686 insert_sorted_by_label);
3689 #define XMENU_MAX_DEPTH (1 + 32) /* max number of menus in an xpath (+1 for Menubar) */
3690 #define XMENU_HEADER "<ui><menubar name='Menubar'>\n"
3691 #define XMENU_FOOTER "</menubar></ui>\n"
3694 * Creates an XML string, containing a UI definition that can be merged
3695 * with Wireshark's menu bar using gtk_ui_manager_add_ui_from_string().
3696 * Free the returned string with g_free() when no longer needed.
3698 * The last item in the path is treated as the menu item; all preceding path
3699 * elements are the names of parent menus. Path elements are stripped of
3700 * leading/trailing spaces.
3702 * |'s separate an existing menu's name from its action.
3703 * If the action has a / in it, it must have been "escaped" into a # before
3704 * entering this function; this function will translate it back to a /.
3705 * There must be an easier way!
3707 * Examples:
3708 * make_menu_xml("/Foo/Bar|/BarAction/I_tem");
3709 * -->
3710 * "<ui><menubar name='Menubar'>
3711 * <menu action='Foo'>
3712 * <menu name='Bar' action='/BarAction'>
3713 * <menuitem action='I_tem'/> <!-- puts shortcut on 't' -->
3714 * </menu>
3715 * </menu>
3716 * <menubar></ui>"
3718 * make_menu_xml("/Foo/Bar|BarAction/-/Baz|BarAction#BazAction/Item");
3719 * -->
3720 * "<ui><menubar name='Menubar'>
3721 * <menu action='Foo'>
3722 * <menu name='Bar' action='/BarAction'>
3723 * <separator/>
3724 * <menu name='Baz' action='BarAction/BazAction'>
3725 * <menuitem action='Item'/>
3726 * </menu>
3727 * </menu>
3728 * </menu>
3729 * <menubar></ui>"
3731 * http://developer.gnome.org/gtk/2.24/GtkUIManager.html#XML-UI
3732 * http://developer.gnome.org/gtk/2.24/GtkUIManager.html#gtk-ui-manager-add-ui-from-string
3734 static const gchar*
3735 make_menu_xml(const char *path)
3737 GString *xml;
3738 char **p;
3739 char **tokens, **name_action_tokens;
3740 const char *tok = path;
3741 gchar *markup;
3742 guint num_menus;
3743 size_t len;
3744 int i;
3746 if (path == NULL) return NULL;
3748 xml = g_string_new(XMENU_HEADER);
3750 /* no need to specify menu bar...skip it */
3751 len = strlen("/Menubar");
3752 if (g_ascii_strncasecmp(path, "/Menubar", len) == 0) {
3753 path += len;
3756 /* open nested menu tag for each path token */
3757 num_menus = 0;
3758 tokens = g_strsplit(path, "/", XMENU_MAX_DEPTH);
3759 for (p = tokens; (p != NULL) && (*p != NULL); p++) {
3761 tok = g_strstrip(*p);
3762 if (tok[0] == '\0') continue;
3764 /* reserve last token for menu-item processing */
3765 if (*(p+1) == NULL) break;
3767 if (g_strcmp0(tok, "-") == 0) {
3768 xml = g_string_append(xml, "<separator/>\n");
3769 } else {
3770 /* Split the name of the menu from its action (if any) */
3771 name_action_tokens = g_strsplit(tok, "|", 2);
3773 if (name_action_tokens[1]) {
3774 i = -1;
3775 /* Replace #'s with /'s.
3776 * Necessary for menus whose action includes a "/".
3777 * There MUST be an easier way...
3779 while (name_action_tokens[1][++i])
3780 if (name_action_tokens[1][i] == '#')
3781 name_action_tokens[1][i] = '/';
3784 if (name_action_tokens[1])
3785 markup = g_markup_printf_escaped("<menu name='%s' action='/%s'>\n", name_action_tokens[0], name_action_tokens[1]);
3786 else
3787 markup = g_markup_printf_escaped("<menu action='%s'>\n", tok);
3788 xml = g_string_append(xml, markup);
3789 g_free(markup);
3790 g_strfreev(name_action_tokens);
3791 num_menus++;
3795 /* Use the last path element as the name of the menu item. Allow blank
3796 * menu name or else the menu is hidden (and thus useless). Showing a
3797 * blank menu allows the developer to see the problem and fix it.
3799 if ( (tok != NULL) /* && (tok[0] != '\0') */ ) {
3800 if (g_strcmp0(tok, "-") == 0) {
3801 xml = g_string_append(xml, "<separator/>\n");
3802 } else {
3803 /* append self-closing menu-item tag */
3804 markup = g_markup_printf_escaped("<menuitem action='%s'/>\n", tok);
3805 xml = g_string_append(xml, markup);
3806 g_free(markup);
3810 /* we just processed the last token, so free the list */
3811 g_strfreev(tokens);
3813 /* close all menu tags, and then append the footer */
3814 for (; num_menus > 0; num_menus--) {
3815 xml = g_string_append(xml, "</menu>");
3817 xml = g_string_append(xml, XMENU_FOOTER);
3819 /* free the GString object, return the allocated char buf which must be g_freed */
3820 markup = g_string_free(xml, FALSE);
3822 return markup;
3826 * Creates an action group for the menu items in xpath, and returns it. The caller should
3827 * use g_object_unref() on the returned pointer if transferring scope.
3829 static GtkActionGroup*
3830 make_menu_actions(char *path, const menu_item_t *menu_item_data)
3832 GtkActionGroup *action_group;
3833 GtkAction *action;
3834 char **p;
3835 char **tokens;
3836 char *tok = path, *lbl;
3838 action_group = gtk_action_group_new (path);
3840 tokens = g_strsplit(path, "/", XMENU_MAX_DEPTH);
3841 for (p = tokens; (p != NULL) && (*p != NULL); p++) {
3843 tok = g_strstrip(*p);
3845 if (tok[0] == '\0') continue;
3847 /* reserve last token for item name */
3848 if ( *(p+1) == NULL ) break;
3850 if (g_strcmp0(tok, "-") != 0) {
3852 /* parse label from token */
3853 lbl = strchr(tok, '|');
3854 if (lbl != NULL) {
3855 *lbl++ = '\0';
3857 if ((lbl == NULL) || (*lbl == '\0')) {
3858 lbl = tok;
3861 action = (GtkAction *)g_object_new (
3862 GTK_TYPE_ACTION,
3863 "name", tok,
3864 "label", lbl,
3865 NULL
3867 gtk_action_group_add_action (action_group, action);
3868 g_object_unref (action);
3872 /* handle menu item (blank names ok) */
3873 if ( (tok != NULL) /* && (tok[0] != '\0') */ && (menu_item_data != NULL) ) {
3874 action = (GtkAction *)g_object_new (
3875 GTK_TYPE_ACTION,
3876 "name", tok,
3877 "label", menu_item_data->label,
3878 "stock-id", menu_item_data->stock_id,
3879 "tooltip", menu_item_data->tooltip,
3880 "sensitive", menu_item_data->enabled,
3881 NULL
3883 if (menu_item_data->callback != NULL) {
3884 g_signal_connect (
3885 action,
3886 "activate",
3887 G_CALLBACK (menu_item_data->callback),
3888 menu_item_data->callback_data
3891 gtk_action_group_add_action (action_group, action);
3892 g_object_unref (action);
3895 /* we just processed the last token, so free the list */
3896 g_strfreev(tokens);
3898 return action_group;
3901 static void
3902 merge_menu_items(GList *lcl_merge_menu_items_list)
3904 guint merge_id;
3905 GtkActionGroup *action_group;
3906 menu_item_t *menu_item_data;
3907 GError *err;
3908 const gchar *xml;
3909 gchar *xpath;
3911 while (lcl_merge_menu_items_list != NULL) {
3912 menu_item_data = (menu_item_t *)lcl_merge_menu_items_list->data;
3913 xpath = g_strdup_printf("%s/%s", menu_item_data->gui_path, menu_item_data->name);
3914 xml = make_menu_xml(xpath);
3915 if (xml != NULL) {
3916 /* create action group for menu elements */
3917 action_group = make_menu_actions(xpath, menu_item_data);
3918 gtk_ui_manager_insert_action_group (ui_manager_main_menubar, action_group, 0);
3920 /* add menu elements to menu bar */
3921 err = NULL;
3922 merge_id = gtk_ui_manager_add_ui_from_string (ui_manager_main_menubar, xml, -1, &err);
3923 if (err != NULL) {
3924 fprintf (stderr, "Warning: building menus failed: %s\n",
3925 err->message);
3926 g_error_free (err);
3928 /* undo the mess */
3929 gtk_ui_manager_remove_ui (ui_manager_main_menubar, merge_id);
3930 gtk_ui_manager_remove_action_group (ui_manager_main_menubar, action_group);
3932 g_free ((gchar*)xml);
3933 g_object_unref (action_group);
3936 g_free(xpath);
3937 lcl_merge_menu_items_list = g_list_next(lcl_merge_menu_items_list);
3941 const char *
3942 stat_group_name(register_stat_group_t group)
3944 /* See make_menu_xml() for an explanation of the string format */
3945 static const value_string group_name_vals[] = {
3946 {REGISTER_ANALYZE_GROUP_UNSORTED, "/Menubar/AnalyzeMenu|Analyze"}, /* unsorted analyze stuff */
3947 {REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER, "/Menubar/AnalyzeMenu|Analyze/ConversationFilterMenu|Analyze#ConversationFilter"}, /* conversation filters */
3948 {REGISTER_STAT_GROUP_UNSORTED, "/Menubar/StatisticsMenu|Statistics"}, /* unsorted statistic function */
3949 {REGISTER_STAT_GROUP_GENERIC, "/Menubar/StatisticsMenu|Statistics"}, /* generic statistic function, not specific to a protocol */
3950 {REGISTER_STAT_GROUP_CONVERSATION_LIST, "/Menubar/StatisticsMenu|Statistics/ConversationListMenu|Statistics#ConversationList"}, /* member of the conversation list */
3951 {REGISTER_STAT_GROUP_ENDPOINT_LIST, "/Menubar/StatisticsMenu|Statistics/EndpointListMenu|Statistics#EndpointList"}, /* member of the endpoint list */
3952 {REGISTER_STAT_GROUP_RESPONSE_TIME, "/Menubar/StatisticsMenu|Statistics/ServiceResponseTimeMenu|Statistics#ServiceResponseTime"}, /* member of the service response time list */
3953 {REGISTER_STAT_GROUP_TELEPHONY, "/Menubar/TelephonyMenu|Telephony"}, /* telephony specific */
3954 {REGISTER_STAT_GROUP_TELEPHONY_GSM, "/Menubar/TelephonyMenu|Telephony/GSM|Telephony#GSM"}, /* GSM-specific */
3955 {REGISTER_STAT_GROUP_TELEPHONY_LTE, "/Menubar/TelephonyMenu|Telephony/LTEmenu|Telephony#LTE"}, /* LTE-specific */
3956 {REGISTER_STAT_GROUP_TELEPHONY_SCTP, "/Menubar/TelephonyMenu|Telephony/SCTPmenu|Telephony#SCTP"}, /* SCTP-specific */
3957 {REGISTER_TOOLS_GROUP_UNSORTED, "/Menubar/ToolsMenu|Tools"}, /* unsorted tools */
3958 {0, NULL}
3960 return val_to_str_const(group, group_name_vals, "/Menubar/ToolsMenu|Tools");
3964 * Enable/disable menu sensitivity.
3966 static void
3967 set_menu_sensitivity(GtkUIManager *ui_manager, const gchar *path, gint val)
3969 GtkAction *action;
3971 action = gtk_ui_manager_get_action(ui_manager, path);
3972 if(!action){
3973 fprintf (stderr, "Warning: set_menu_sensitivity couldn't find action path= %s\n",
3974 path);
3975 return;
3977 gtk_action_set_sensitive (action, val); /* TRUE to make the action sensitive */
3980 static void
3981 set_menu_object_data_meat(GtkUIManager *ui_manager, const gchar *path, const gchar *key, gpointer data)
3983 GtkWidget *menu = NULL;
3985 if ((menu = gtk_ui_manager_get_widget(ui_manager, path)) != NULL){
3986 g_object_set_data(G_OBJECT(menu), key, data);
3987 }else{
3988 #if 0
3989 g_warning("set_menu_object_data_meat: no menu, path: %s",path);
3990 #endif
3994 void
3995 set_menu_object_data (const gchar *path, const gchar *key, gpointer data)
3997 if (strncmp (path,"/Menubar",8) == 0){
3998 set_menu_object_data_meat(ui_manager_main_menubar, path, key, data);
3999 }else if (strncmp (path,"/PacketListMenuPopup",20) == 0){
4000 set_menu_object_data_meat(ui_manager_packet_list_menu, path, key, data);
4001 }else if (strncmp (path,"/TreeViewPopup",14) == 0){
4002 set_menu_object_data_meat(ui_manager_tree_view_menu, path, key, data);
4003 }else if (strncmp (path,"/BytesMenuPopup",15) == 0){
4004 set_menu_object_data_meat(ui_manager_bytes_menu, path, key, data);
4005 }else if (strncmp (path,"/ProfilesMenuPopup",18) == 0){
4006 set_menu_object_data_meat(ui_manager_statusbar_profiles_menu, path, key, data);
4011 /* Recently used capture files submenu:
4012 * Submenu containing the recently used capture files.
4013 * The capture filenames are always kept with the absolute path to be independent
4014 * of the current path.
4015 * They are only stored inside the labels of the submenu (no separate list). */
4017 #define MENU_RECENT_FILES_PATH "/Menubar/FileMenu/OpenRecent"
4018 #define MENU_RECENT_FILES_KEY "Recent File Name"
4020 /* Add a file name to the top of the list; if it's already present remove it first */
4021 static GList *
4022 remove_present_file_name(GList *recent_files_list, const gchar *cf_name)
4024 GList *li;
4025 gchar *widget_cf_name;
4027 for (li = g_list_first(recent_files_list); li; li = li->next) {
4028 widget_cf_name = (gchar *)li->data;
4029 if (
4030 #ifdef _WIN32
4031 /* do a case insensitive compare on win32 */
4032 g_ascii_strncasecmp(widget_cf_name, cf_name, 1000) == 0){
4033 #else /* _WIN32 */
4034 /* do a case sensitive compare on unix */
4035 strncmp(widget_cf_name, cf_name, 1000) == 0 ){
4036 #endif
4037 recent_files_list = g_list_remove(recent_files_list,widget_cf_name);
4041 return recent_files_list;
4044 static void
4045 recent_changed_cb (GtkUIManager *ui_manager,
4046 gpointer user_data _U_)
4048 guint merge_id;
4049 GList *action_groups, *l;
4052 merge_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (ui_manager),
4053 "recent-files-merge-id"));
4055 /* remove the UI */
4056 gtk_ui_manager_remove_ui (ui_manager, merge_id);
4058 /* remove the action group; gtk_ui_manager_remove_action_group()
4059 * should really take the action group's name instead of its
4060 * pointer.
4062 action_groups = gtk_ui_manager_get_action_groups (ui_manager);
4063 for (l = action_groups; l != NULL; l = l->next)
4065 GtkActionGroup *group = (GtkActionGroup *)l->data;
4067 if (strcmp (gtk_action_group_get_name (group), "recent-files-group") == 0){
4068 /* this unrefs the action group and all of its actions */
4069 gtk_ui_manager_remove_action_group (ui_manager, group);
4070 break;
4074 /* generate a new merge id and re-add everything */
4075 merge_id = gtk_ui_manager_new_merge_id (ui_manager);
4076 add_recent_items (merge_id, ui_manager);
4079 static void
4080 recent_clear_cb(GtkAction *action _U_, gpointer user_data _U_)
4082 GtkWidget *submenu_recent_files;
4083 GList *recent_files_list;
4085 /* Get the list of recent files, free the list and store the empty list with the widget */
4086 submenu_recent_files = gtk_ui_manager_get_widget(ui_manager_main_menubar, MENU_RECENT_FILES_PATH);
4087 recent_files_list = (GList *)g_object_get_data(G_OBJECT(submenu_recent_files), "recent-files-list");
4088 /* Free the name strings ?? */
4089 g_list_free(recent_files_list);
4090 recent_files_list = NULL;
4091 g_object_set_data(G_OBJECT(submenu_recent_files), "recent-files-list", recent_files_list);
4092 /* Calling recent_changed_cb will rebuild the GUI call add_recent_items which will in turn call
4093 * main_welcome_reset_recent_capture_files
4095 recent_changed_cb(ui_manager_main_menubar, NULL);
4098 static void
4099 add_recent_items (guint merge_id, GtkUIManager *ui_manager)
4101 GtkActionGroup *action_group;
4102 GtkAction *action;
4103 GtkWidget *submenu_recent_files;
4104 GList *items, *l;
4105 gchar *action_name;
4106 guint i;
4108 /* Reset the recent files list in the welcome screen */
4109 main_welcome_reset_recent_capture_files();
4111 action_group = gtk_action_group_new ("recent-files-group");
4113 submenu_recent_files = gtk_ui_manager_get_widget(ui_manager, MENU_RECENT_FILES_PATH);
4114 if(!submenu_recent_files){
4115 g_warning("add_recent_items: No submenu_recent_files found, path= MENU_RECENT_FILES_PATH");
4117 items = (GList *)g_object_get_data(G_OBJECT(submenu_recent_files), "recent-files-list");
4119 gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
4120 g_object_set_data (G_OBJECT (ui_manager),
4121 "recent-files-merge-id", GUINT_TO_POINTER (merge_id));
4123 /* no items */
4124 if (!items){
4126 action = (GtkAction *)g_object_new (GTK_TYPE_ACTION,
4127 "name", "recent-info-empty",
4128 "label", "No recently used files",
4129 "sensitive", FALSE,
4130 NULL);
4131 gtk_action_group_add_action (action_group, action);
4132 gtk_action_set_sensitive(action, FALSE);
4133 g_object_unref (action);
4135 gtk_ui_manager_add_ui (ui_manager, merge_id,
4136 "/Menubar/FileMenu/OpenRecent/RecentFiles",
4137 "recent-info-empty",
4138 "recent-info-empty",
4139 GTK_UI_MANAGER_MENUITEM,
4140 FALSE);
4142 return;
4145 for (i = 0, l = items;
4146 i < prefs.gui_recent_files_count_max && l != NULL;
4147 i +=1, l = l->next)
4149 gchar *item_name = (gchar *)l->data;
4150 action_name = g_strdup_printf ("recent-info-%u", i);
4152 action = (GtkAction *)g_object_new (GTK_TYPE_ACTION,
4153 "name", action_name,
4154 "label", item_name,
4155 "stock_id", WIRESHARK_STOCK_SAVE,
4156 NULL);
4157 g_signal_connect (action, "activate",
4158 G_CALLBACK (menu_open_recent_file_cmd_cb), NULL);
4159 #if !GTK_CHECK_VERSION(2,16,0)
4160 g_object_set_data (G_OBJECT (action), "FileName", item_name);
4161 #endif
4162 gtk_action_group_add_action (action_group, action);
4163 g_object_unref (action);
4165 gtk_ui_manager_add_ui (ui_manager, merge_id,
4166 "/Menubar/FileMenu/OpenRecent/RecentFiles",
4167 action_name,
4168 action_name,
4169 GTK_UI_MANAGER_MENUITEM,
4170 FALSE);
4172 /* Add the file name to the recent files list on the Welcome screen */
4173 main_welcome_add_recent_capture_file(item_name, G_OBJECT(action));
4175 g_free (action_name);
4177 /* Add a Separator */
4178 gtk_ui_manager_add_ui (ui_manager, merge_id,
4179 "/Menubar/FileMenu/OpenRecent/RecentFiles",
4180 "separator-recent-info",
4181 NULL,
4182 GTK_UI_MANAGER_SEPARATOR,
4183 FALSE);
4185 /* Add a clear Icon */
4186 action = (GtkAction *)g_object_new (GTK_TYPE_ACTION,
4187 "name", "clear-recent-info",
4188 "label", "Clear the recent files list",
4189 "stock_id", GTK_STOCK_CLEAR,
4190 NULL);
4192 g_signal_connect (action, "activate",
4193 G_CALLBACK (recent_clear_cb), NULL);
4195 gtk_action_group_add_action (action_group, action);
4196 g_object_unref (action);
4198 gtk_ui_manager_add_ui (ui_manager, merge_id,
4199 "/Menubar/FileMenu/OpenRecent/RecentFiles",
4200 "clear-recent-info",
4201 "clear-recent-info",
4202 GTK_UI_MANAGER_MENUITEM,
4203 FALSE);
4207 #define MENU_STATISTICS_PATH "/Menubar/StatisticsMenu"
4209 static void
4210 add_tap_plugins (guint merge_id, GtkUIManager *ui_manager)
4212 GtkActionGroup *action_group;
4213 GtkAction *action;
4214 GtkWidget *submenu_statistics;
4215 GList *cfg_list;
4216 GList *iter;
4217 gchar *action_name;
4219 action_group = gtk_action_group_new ("tap-plugins-group");
4221 submenu_statistics = gtk_ui_manager_get_widget(ui_manager_main_menubar, MENU_STATISTICS_PATH);
4222 if(!submenu_statistics){
4223 g_warning("add_tap_plugins: No submenu_statistics found, path= MENU_STATISTICS_PATH");
4224 return;
4226 gtk_ui_manager_insert_action_group (ui_manager_main_menubar, action_group, 0);
4227 g_object_set_data (G_OBJECT (ui_manager_main_menubar),
4228 "tap-plugins-merge-id", GUINT_TO_POINTER (merge_id));
4230 cfg_list = stats_tree_get_cfg_list();
4231 iter = g_list_first(cfg_list);
4232 while (iter) {
4233 stats_tree_cfg *cfg = (stats_tree_cfg*)iter->data;
4234 if (cfg->plugin) {
4235 action_name = g_strdup_printf(MENU_STATISTICS_PATH "/%s", cfg->abbr);
4236 action = (GtkAction *)g_object_new (GTK_TYPE_ACTION,
4237 "name", action_name,
4238 "label", cfg->name,
4239 NULL);
4240 g_signal_connect (action, "activate", G_CALLBACK (gtk_stats_tree_cb), NULL);
4241 gtk_action_group_add_action (action_group, action);
4242 g_object_unref (action);
4244 gtk_ui_manager_add_ui (ui_manager, merge_id,
4245 MENU_STATISTICS_PATH,
4246 action_name,
4247 action_name,
4248 GTK_UI_MANAGER_MENUITEM,
4249 FALSE);
4251 g_free (action_name);
4253 iter = g_list_next(iter);
4255 g_list_free(cfg_list);
4258 /* Open a file by its name
4259 (Beware: will not ask to close existing capture file!) */
4260 void
4261 menu_open_filename(gchar *cf_name)
4263 GtkWidget *submenu_recent_files;
4264 int err;
4265 GList *recent_files_list;
4268 submenu_recent_files = gtk_ui_manager_get_widget(ui_manager_main_menubar, MENU_RECENT_FILES_PATH);
4269 if(!submenu_recent_files){
4270 g_warning("menu_open_filename: No submenu_recent_files found, path= MENU_RECENT_FILES_PATH");
4272 recent_files_list = (GList *)g_object_get_data(G_OBJECT(submenu_recent_files), "recent-files-list");
4273 /* XXX: ask user to remove item, it's maybe only a temporary problem */
4274 /* open and read the capture file (this will close an existing file) */
4275 if (cf_open(&cfile, cf_name, FALSE, &err) == CF_OK) {
4276 cf_read(&cfile, FALSE);
4277 }else{
4278 recent_files_list = remove_present_file_name(recent_files_list, cf_name);
4279 g_object_set_data(G_OBJECT(submenu_recent_files), "recent-files-list", recent_files_list);
4280 /* Calling recent_changed_cb will rebuild the GUI call add_recent_items which will in turn call
4281 * main_welcome_reset_recent_capture_files
4283 recent_changed_cb(ui_manager_main_menubar, NULL);
4287 /* callback, if the user pushed a recent file submenu item */
4288 static void
4289 menu_open_recent_file_cmd(GtkAction *action)
4291 GtkWidget *submenu_recent_files;
4292 GList *recent_files_list;
4293 const gchar *cf_name;
4294 int err;
4296 #if GTK_CHECK_VERSION(2,16,0)
4297 cf_name = gtk_action_get_label(action);
4298 #else
4299 cf_name = (const gchar *)g_object_get_data(G_OBJECT(action), "FileName");
4300 #endif
4302 /* open and read the capture file (this will close an existing file) */
4303 if (cf_open(&cfile, cf_name, FALSE, &err) == CF_OK) {
4304 cf_read(&cfile, FALSE);
4305 } else {
4306 submenu_recent_files = gtk_ui_manager_get_widget(ui_manager_main_menubar, MENU_RECENT_FILES_PATH);
4307 recent_files_list = (GList *)g_object_get_data(G_OBJECT(submenu_recent_files), "recent-files-list");
4309 recent_files_list = remove_present_file_name(recent_files_list, cf_name);
4310 g_object_set_data(G_OBJECT(submenu_recent_files), "recent-files-list", recent_files_list);
4311 /* Calling recent_changed_cb will rebuild the GUI call add_recent_items which will in turn call
4312 * main_welcome_reset_recent_capture_files
4314 recent_changed_cb(ui_manager_main_menubar, NULL);
4318 static void
4319 menu_open_recent_file_cmd_cb(GtkAction *action, gpointer data _U_)
4321 /* If there's unsaved data, let the user save it first.
4322 If they cancel out of it, don't open the file. */
4323 if (do_file_close(&cfile, FALSE, " before opening a new capture file"))
4324 menu_open_recent_file_cmd(action);
4327 static void
4328 add_menu_recent_capture_file_absolute(const gchar *cf_name)
4330 GtkWidget *submenu_recent_files;
4331 GList *li;
4332 gchar *widget_cf_name;
4333 gchar *normalized_cf_name;
4334 guint cnt;
4335 GList *recent_files_list;
4337 normalized_cf_name = g_strdup(cf_name);
4338 #ifdef _WIN32
4339 /* replace all slashes by backslashes */
4340 g_strdelimit(normalized_cf_name, "/", '\\');
4341 #endif
4343 /* get the submenu container item */
4344 submenu_recent_files = gtk_ui_manager_get_widget(ui_manager_main_menubar, MENU_RECENT_FILES_PATH);
4345 if(!submenu_recent_files){
4346 g_warning("add_menu_recent_capture_file_absolute: No submenu_recent_files found, path= MENU_RECENT_FILES_PATH");
4347 g_free(normalized_cf_name);
4348 return;
4350 recent_files_list = (GList *)g_object_get_data(G_OBJECT(submenu_recent_files), "recent-files-list");
4351 cnt = 1;
4352 for (li = g_list_first(recent_files_list); li; cnt++) {
4353 widget_cf_name = (gchar *)li->data;
4355 /* Find the next element BEFORE we (possibly) free the current one below */
4356 li = li->next;
4358 if (
4359 #ifdef _WIN32
4360 /* do a case insensitive compare on win32 */
4361 g_ascii_strncasecmp(widget_cf_name, normalized_cf_name, 1000) == 0 ||
4362 #else /* _WIN32 */
4363 /* do a case sensitive compare on unix */
4364 strncmp(widget_cf_name, normalized_cf_name, 1000) == 0 ||
4365 #endif
4366 cnt >= prefs.gui_recent_files_count_max) {
4367 recent_files_list = g_list_remove(recent_files_list,widget_cf_name);
4368 cnt--;
4371 recent_files_list = g_list_prepend(recent_files_list, normalized_cf_name);
4372 g_object_set_data(G_OBJECT(submenu_recent_files), "recent-files-list", recent_files_list);
4373 recent_changed_cb( ui_manager_main_menubar, NULL);
4377 /* add the capture filename to the "Recent Files" menu */
4378 /* (will change nothing, if this filename is already in the menu) */
4380 * XXX - We might want to call SHAddToRecentDocs under Windows 7:
4381 * http: //stackoverflow.com/questions/437212/how-do-you-register-a-most-recently-used-list-with-windows-in-preparation-for-win
4383 void
4384 add_menu_recent_capture_file(const gchar *cf_name)
4386 gchar *curr;
4387 gchar *absolute;
4389 /* if this filename is an absolute path, we can use it directly */
4390 if (g_path_is_absolute(cf_name)) {
4391 add_menu_recent_capture_file_absolute(cf_name);
4392 return;
4395 /* this filename is not an absolute path, prepend the current dir */
4396 curr = g_get_current_dir();
4397 absolute = g_strdup_printf("%s%s%s", curr, G_DIR_SEPARATOR_S, cf_name);
4398 add_menu_recent_capture_file_absolute(absolute);
4399 g_free(curr);
4400 g_free(absolute);
4404 /* write all capture filenames of the menu to the user's recent file */
4405 void
4406 menu_recent_file_write_all(FILE *rf)
4408 GtkWidget *submenu_recent_files;
4409 GList *children;
4410 GList *child;
4411 gchar *cf_name;
4412 GList *recent_files_list, *list;
4414 submenu_recent_files = gtk_ui_manager_get_widget(ui_manager_main_menubar, MENU_RECENT_FILES_PATH);
4415 if(!submenu_recent_files){
4416 g_warning("menu_recent_file_write_all: No submenu_recent_files found, path= MENU_RECENT_FILES_PATH");
4418 recent_files_list = (GList *)g_object_get_data(G_OBJECT(submenu_recent_files), "recent-files-list");
4419 list = g_list_last(recent_files_list);
4420 while (list != NULL) {
4421 cf_name = (gchar *)list->data;
4422 if (cf_name) {
4423 if(u3_active())
4424 fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", u3_contract_device_path(cf_name));
4425 else
4426 fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", cf_name);
4428 list = g_list_previous(list);
4430 g_list_free(recent_files_list);
4431 return;
4433 /* we have to iterate backwards through the children's list,
4434 * so we get the latest item last in the file.
4435 * (don't use gtk_container_foreach() here, it will return the wrong iteration order) */
4436 children = gtk_container_get_children(GTK_CONTAINER(submenu_recent_files));
4437 child = g_list_last(children);
4438 while (child != NULL) {
4439 /* get capture filename from the menu item label */
4440 cf_name = (gchar *)g_object_get_data(G_OBJECT(child->data), MENU_RECENT_FILES_KEY);
4441 if (cf_name) {
4442 if(u3_active())
4443 fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", u3_contract_device_path(cf_name));
4444 else
4445 fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", cf_name);
4448 child = g_list_previous(child);
4451 g_list_free(children);
4454 void
4455 menu_name_resolution_changed(void)
4457 GtkWidget *menu;
4459 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/EnableforMACLayer");
4460 if(!menu){
4461 g_warning("menu_name_resolution_changed: No menu found, path= /Menubar/ViewMenu/NameResolution/EnableforMACLayer");
4463 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), gbl_resolv_flags.mac_name);
4465 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/EnableforNetworkLayer");
4466 if(!menu){
4467 g_warning("menu_name_resolution_changed: No menu found, path= /Menubar/ViewMenu/NameResolution/EnableforNetworkLayer");
4469 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), gbl_resolv_flags.network_name);
4471 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/EnableforTransportLayer");
4472 if(!menu){
4473 g_warning("menu_name_resolution_changed: No menu found, path= /Menubar/ViewMenu/NameResolution/EnableforTransportLayer");
4475 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), gbl_resolv_flags.transport_name);
4477 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/UseExternalNetworkNameResolver");
4478 if(!menu){
4479 g_warning("menu_name_resolution_changed: No menu found, path= /Menubar/ViewMenu/NameResolution/UseExternalNetworkNameResolver");
4481 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), gbl_resolv_flags.use_external_net_name_resolver);
4484 static void
4485 menu_name_resolution_update_cb(GtkAction *action _U_, gpointer data _U_)
4487 menu_name_resolution_changed();
4490 static void
4491 name_resolution_cb(GtkWidget *w, gpointer d _U_, gboolean* res_flag)
4493 if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w))) {
4494 *res_flag = TRUE;
4495 } else {
4496 *res_flag = FALSE;
4499 packet_list_recreate();
4500 redraw_packet_bytes_all();
4503 #ifdef HAVE_LIBPCAP
4504 void
4505 menu_auto_scroll_live_changed(gboolean auto_scroll_live_in)
4507 GtkWidget *menu;
4509 /* tell menu about it */
4510 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/AutoScrollinLiveCapture");
4511 if(!menu){
4512 g_warning("menu_auto_scroll_live_changed: No menu found, path= /Menubar/ViewMenu/AutoScrollinLiveCapture");
4514 if( ((gboolean) gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menu)) != auto_scroll_live_in) ) {
4515 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), auto_scroll_live_in);
4518 #endif /*HAVE_LIBPCAP */
4523 void
4524 menu_colorize_changed(gboolean packet_list_colorize)
4526 GtkWidget *menu;
4528 /* tell menu about it */
4529 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/ColorizePacketList");
4530 if(!menu){
4531 g_warning("menu_colorize_changed: No menu found, path= /Menubar/ViewMenu/ColorizePacketList");
4533 if( (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menu)) != packet_list_colorize) ) {
4534 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), packet_list_colorize);
4538 static void
4539 colorize_cb(GtkWidget *w, gpointer d _U_)
4541 main_colorize_changed(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w)));
4545 /* the recent file read has finished, update the menu corresponding */
4546 void
4547 menu_recent_read_finished(void)
4549 GtkWidget *menu;
4551 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/MainToolbar");
4552 if(!menu){
4553 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/MainToolbar");
4554 }else{
4555 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.main_toolbar_show);
4557 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/FilterToolbar");
4558 if(!menu){
4559 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/FilterToolbar");
4560 }else{
4561 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.filter_toolbar_show);
4563 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/WirelessToolbar");
4564 if(!menu){
4565 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/WirelessToolbar");
4566 }else{
4567 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.wireless_toolbar_show);
4570 /* Fix me? */
4571 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/StatusBar");
4572 if(!menu){
4573 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/StatusBar");
4574 }else{
4575 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.statusbar_show);
4578 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/PacketList");
4579 if(!menu){
4580 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/PacketList");
4581 }else{
4582 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.packet_list_show);
4585 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/PacketDetails");
4586 if(!menu){
4587 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/PacketDetails");
4588 }else{
4589 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.tree_view_show);
4592 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/PacketBytes");
4593 if(!menu){
4594 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/PacketBytes");
4595 }else{
4596 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.byte_view_show);
4599 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/ColorizePacketList");
4600 if(!menu){
4601 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/ColorizePacketList");
4602 }else{
4603 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.packet_list_colorize);
4606 menu_name_resolution_changed();
4608 #ifdef HAVE_LIBPCAP
4609 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/AutoScrollinLiveCapture");
4610 if(!menu){
4611 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/AutoScrollinLiveCapture");
4612 }else{
4613 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), auto_scroll_live);
4615 #endif
4616 main_widgets_rearrange();
4618 /* don't change the time format, if we had a command line value */
4619 if (timestamp_get_type() != TS_NOT_SET) {
4620 recent.gui_time_format = timestamp_get_type();
4623 /* XXX Fix me */
4624 timestamp_set_type(recent.gui_time_format);
4625 /* This call adjusts column width */
4626 cf_timestamp_auto_precision(&cfile);
4627 packet_list_queue_draw();
4628 /* the actual precision will be set in packet_list_queue_draw() below */
4629 if (recent.gui_time_precision == TS_PREC_AUTO) {
4630 timestamp_set_precision(TS_PREC_AUTO_SEC);
4631 } else {
4632 timestamp_set_precision(recent.gui_time_precision);
4634 /* This call adjusts column width */
4635 cf_timestamp_auto_precision(&cfile);
4636 packet_list_queue_draw();
4638 /* don't change the seconds format, if we had a command line value */
4639 if (timestamp_get_seconds_type() != TS_SECONDS_NOT_SET) {
4640 recent.gui_seconds_format = timestamp_get_seconds_type();
4642 menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/TimeDisplayFormat/DisplaySecondsWithHoursAndMinutes");
4643 if(!menu){
4644 g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/TimeDisplayFormat/DisplaySecondsWithHoursAndMinutes");
4647 switch (recent.gui_seconds_format) {
4648 case TS_SECONDS_DEFAULT:
4649 recent.gui_seconds_format = (ts_seconds_type)-1;
4650 /* set_active will not trigger the callback when deactivating an inactive item! */
4651 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
4652 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), FALSE);
4653 break;
4654 case TS_SECONDS_HOUR_MIN_SEC:
4655 recent.gui_seconds_format = (ts_seconds_type)-1;
4656 /* set_active will not trigger the callback when activating an active item! */
4657 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), FALSE);
4658 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
4659 break;
4660 default:
4661 g_assert_not_reached();
4664 main_colorize_changed(recent.packet_list_colorize);
4668 gboolean
4669 popup_menu_handler(GtkWidget *widget, GdkEvent *event, gpointer data)
4671 GtkWidget *menu = (GtkWidget *)data;
4672 GdkEventButton *event_button = NULL;
4673 gint row, column;
4675 if(widget == NULL || event == NULL || data == NULL) {
4676 return FALSE;
4680 * If we ever want to make the menu differ based on what row
4681 * and/or column we're above, we'd use "eth_clist_get_selection_info()"
4682 * to find the row and column number for the coordinates; a CTree is,
4683 * I guess, like a CList with one column(?) and the expander widget
4684 * as a pixmap.
4686 /* Check if we are on packet_list object */
4687 if (widget == g_object_get_data(G_OBJECT(popup_menu_object), E_MPACKET_LIST_KEY) &&
4688 ((GdkEventButton *)event)->button != 1) {
4689 gint physical_row;
4690 if (packet_list_get_event_row_column((GdkEventButton *)event, &physical_row, &row, &column)) {
4691 g_object_set_data(G_OBJECT(popup_menu_object), E_MPACKET_LIST_ROW_KEY,
4692 GINT_TO_POINTER(row));
4693 g_object_set_data(G_OBJECT(popup_menu_object), E_MPACKET_LIST_COL_KEY,
4694 GINT_TO_POINTER(column));
4695 packet_list_set_selected_row(row);
4699 /* Check if we are on tree_view object */
4700 if (widget == tree_view_gbl) {
4701 tree_view_select(widget, (GdkEventButton *) event);
4704 /* context menu handler */
4705 if(event->type == GDK_BUTTON_PRESS) {
4706 event_button = (GdkEventButton *) event;
4708 /* To quote the "Gdk Event Structures" doc:
4709 * "Normally button 1 is the left mouse button, 2 is the middle button, and 3 is the right button" */
4710 if(event_button->button == 3) {
4711 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
4712 event_button->button,
4713 event_button->time);
4714 g_signal_stop_emission_by_name(widget, "button_press_event");
4715 return TRUE;
4719 /* Check if we are on byte_view object */
4720 if(widget == get_notebook_bv_ptr(byte_nb_ptr_gbl)) {
4721 byte_view_select(widget, (GdkEventButton *) event);
4724 /* GDK_2BUTTON_PRESS is a doubleclick -> expand/collapse tree row */
4725 /* GTK version 1 seems to be doing this automatically */
4726 if (widget == tree_view_gbl && event->type == GDK_2BUTTON_PRESS) {
4727 GtkTreePath *path;
4729 if (gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(widget),
4730 (gint) (((GdkEventButton *)event)->x),
4731 (gint) (((GdkEventButton *)event)->y),
4732 &path, NULL, NULL, NULL))
4734 if (gtk_tree_view_row_expanded(GTK_TREE_VIEW(widget), path))
4735 gtk_tree_view_collapse_row(GTK_TREE_VIEW(widget), path);
4736 else
4737 gtk_tree_view_expand_row(GTK_TREE_VIEW(widget), path,
4738 FALSE);
4739 gtk_tree_path_free(path);
4742 return FALSE;
4745 /* Enable or disable menu items based on whether you have a capture file
4746 you've finished reading and, if you have one, whether it's been saved
4747 and whether it could be saved except by copying the raw packet data. */
4748 void
4749 set_menus_for_capture_file(capture_file *cf)
4751 if (cf == NULL || cf->state == FILE_READ_IN_PROGRESS) {
4752 /* We have no capture file or we're currently reading a file */
4753 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Merge", FALSE);
4754 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Close", FALSE);
4755 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Save", FALSE);
4756 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/SaveAs", FALSE);
4757 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportSpecifiedPackets", FALSE);
4758 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportPacketDissections", FALSE);
4759 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportSelectedPacketBytes", FALSE);
4760 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportSSLSessionKeys", FALSE);
4761 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportObjects", FALSE);
4762 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportPDUs", FALSE);
4763 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/Reload", FALSE);
4764 } else {
4765 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Merge", cf_can_write_with_wiretap(cf));
4766 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Close", TRUE);
4767 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Save",
4768 cf_can_save(cf));
4769 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/SaveAs",
4770 cf_can_save_as(cf));
4772 * "Export Specified Packets..." should be available only if
4773 * we can write the file out in at least one format.
4775 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportSpecifiedPackets",
4776 cf_can_write_with_wiretap(cf));
4777 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportPacketDissections", TRUE);
4778 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportSelectedPacketBytes", TRUE);
4779 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportSSLSessionKeys", TRUE);
4780 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportObjects", TRUE);
4781 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportPDUs", TRUE);
4782 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/Reload", TRUE);
4786 /* Enable or disable menu items based on whether there's a capture in
4787 progress. */
4788 void
4789 set_menus_for_capture_in_progress(gboolean capture_in_progress)
4791 /* Either a capture was started or stopped; in either case, it's not
4792 in the process of stopping, so allow quitting. */
4793 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Quit",
4794 TRUE);
4796 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Open",
4797 !capture_in_progress);
4798 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/OpenRecent",
4799 !capture_in_progress);
4800 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportPacketDissections",
4801 capture_in_progress);
4802 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportSelectedPacketBytes",
4803 capture_in_progress);
4804 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportSSLSessionKeys",
4805 capture_in_progress);
4806 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportObjects",
4807 capture_in_progress);
4808 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Set",
4809 !capture_in_progress);
4810 set_menu_sensitivity(ui_manager_packet_list_heading, "/PacketListHeadingPopup/SortAscending",
4811 !capture_in_progress);
4812 set_menu_sensitivity(ui_manager_packet_list_heading, "/PacketListHeadingPopup/SortDescending",
4813 !capture_in_progress);
4814 set_menu_sensitivity(ui_manager_packet_list_heading, "/PacketListHeadingPopup/NoSorting",
4815 !capture_in_progress);
4817 #ifdef HAVE_LIBPCAP
4818 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/CaptureMenu/Options",
4819 !capture_in_progress);
4820 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/CaptureMenu/Start",
4821 !capture_in_progress && global_capture_opts.num_selected > 0);
4822 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/CaptureMenu/Stop",
4823 capture_in_progress);
4824 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/CaptureMenu/Restart",
4825 capture_in_progress);
4826 #endif /* HAVE_LIBPCAP */
4829 #ifdef HAVE_LIBPCAP
4830 void
4831 set_menus_capture_start_sensitivity(gboolean enable)
4833 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/CaptureMenu/Start",
4834 enable);
4836 #endif
4838 /* Disable menu items while we're waiting for the capture child to
4839 finish. We disallow quitting until it finishes, and also disallow
4840 stopping or restarting the capture. */
4841 void
4842 set_menus_for_capture_stopping(void)
4844 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Quit",
4845 FALSE);
4846 #ifdef HAVE_LIBPCAP
4847 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/CaptureMenu/Stop",
4848 FALSE);
4849 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/CaptureMenu/Restart",
4850 FALSE);
4851 #endif /* HAVE_LIBPCAP */
4855 void
4856 set_menus_for_captured_packets(gboolean have_captured_packets)
4858 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Print",
4859 have_captured_packets);
4860 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/Print",
4861 have_captured_packets);
4863 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/FindPacket",
4864 have_captured_packets);
4865 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/FindNext",
4866 have_captured_packets);
4867 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/FindPrevious",
4868 have_captured_packets);
4869 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ZoomIn",
4870 have_captured_packets);
4871 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ZoomOut",
4872 have_captured_packets);
4873 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/NormalSize",
4874 have_captured_packets);
4875 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/Goto",
4876 have_captured_packets);
4877 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/PreviousPacket",
4878 have_captured_packets);
4879 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/NextPacket",
4880 have_captured_packets);
4881 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/FirstPacket",
4882 have_captured_packets);
4883 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/LastPacket",
4884 have_captured_packets);
4885 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/PreviousPacketInConversation",
4886 have_captured_packets);
4887 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/NextPacketInConversation",
4888 have_captured_packets);
4889 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/StatisticsMenu/Summary",
4890 have_captured_packets);
4891 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/StatisticsMenu/ShowCommentsSummary",
4892 have_captured_packets);
4893 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/StatisticsMenu/ProtocolHierarchy",
4894 have_captured_packets);
4897 void
4898 set_menus_for_selected_packet(capture_file *cf)
4900 GList *list_entry = dissector_filter_list;
4901 guint i = 0;
4902 gboolean properties = FALSE;
4903 const char *abbrev = NULL;
4904 char *prev_abbrev;
4906 /* Making the menu context-sensitive allows for easier selection of the
4907 desired item and has the added benefit, with large captures, of
4908 avoiding needless looping through huge lists for marked, ignored,
4909 or time-referenced packets. */
4910 gboolean is_ssl = epan_dissect_packet_contains_field(cf->edt, "ssl");
4911 gboolean frame_selected = cf->current_frame != NULL;
4912 /* A frame is selected */
4913 gboolean have_marked = frame_selected && cf->marked_count > 0;
4914 /* We have marked frames. (XXX - why check frame_selected?) */
4915 gboolean another_is_marked = have_marked &&
4916 !(cf->marked_count == 1 && cf->current_frame->flags.marked);
4917 /* We have a marked frame other than the current frame (i.e.,
4918 we have at least one marked frame, and either there's more
4919 than one marked frame or the current frame isn't marked). */
4920 gboolean have_time_ref = cf->ref_time_count > 0;
4921 gboolean another_is_time_ref = frame_selected && have_time_ref &&
4922 !(cf->ref_time_count == 1 && cf->current_frame->flags.ref_time);
4923 /* We have a time reference frame other than the current frame (i.e.,
4924 we have at least one time reference frame, and either there's more
4925 than one time reference frame or the current frame isn't a
4926 time reference frame). (XXX - why check frame_selected?) */
4928 gboolean tcp_packet_selected = FALSE;
4930 tcp_packet_selected = frame_selected && (cf->edt->pi.ipproto == IP_PROTO_TCP);
4932 if (cfile.edt && cfile.edt->tree) {
4933 GPtrArray *ga;
4934 header_field_info *hfinfo;
4935 field_info *v;
4936 guint ii;
4938 ga = proto_all_finfos(cfile.edt->tree);
4940 for (ii = ga->len - 1; ii > 0 ; ii -= 1) {
4942 v = (field_info *)g_ptr_array_index (ga, ii);
4943 hfinfo = v->hfinfo;
4945 if (!g_str_has_prefix(hfinfo->abbrev, "text") &&
4946 !g_str_has_prefix(hfinfo->abbrev, "_ws.expert") &&
4947 !g_str_has_prefix(hfinfo->abbrev, "_ws.malformed")) {
4949 if (hfinfo->parent == -1) {
4950 abbrev = hfinfo->abbrev;
4951 } else {
4952 abbrev = proto_registrar_get_abbrev(hfinfo->parent);
4954 properties = prefs_is_registered_protocol(abbrev);
4955 break;
4960 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/MarkPacket",
4961 frame_selected);
4962 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/MarkPacket",
4963 frame_selected);
4964 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/MarkAllDisplayedPackets",
4965 cf->displayed_count > 0);
4966 /* Unlike un-ignore, do not allow unmark of all frames when no frames are displayed */
4967 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/UnmarkAllDisplayedPackets",
4968 have_marked);
4969 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/FindNextMark",
4970 another_is_marked);
4971 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/FindPreviousMark",
4972 another_is_marked);
4974 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/IgnorePacket",
4975 frame_selected);
4976 #ifdef WANT_PACKET_EDITOR
4977 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/EditPacket",
4978 prefs.gui_packet_editor ? frame_selected : FALSE);
4979 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/EditPacket",
4980 prefs.gui_packet_editor ? frame_selected : FALSE);
4981 #endif /* WANT_PACKET_EDITOR */
4982 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/AddEditPktComment",
4983 frame_selected && wtap_dump_can_write(cf->linktypes, WTAP_COMMENT_PER_PACKET));
4984 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/IgnorePacket",
4985 frame_selected);
4986 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/IgnoreAllDisplayedPackets",
4987 cf->displayed_count > 0 && cf->displayed_count != cf->count);
4988 /* Allow un-ignore of all frames even with no frames currently displayed */
4989 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Un-IgnoreAllPackets",
4990 cf->ignored_count > 0);
4992 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/SetTimeReference",
4993 frame_selected);
4994 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Un-TimeReferenceAllPackets",
4995 have_time_ref);
4996 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/TimeShift",
4997 cf->count > 0);
4998 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/SetTimeReference",
4999 frame_selected);
5000 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/FindNextTimeReference",
5001 another_is_time_ref);
5002 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/FindPreviousTimeReference",
5003 another_is_time_ref);
5005 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ResizeAllColumns",
5006 frame_selected);
5007 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/CollapseAll",
5008 frame_selected);
5009 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/CollapseAll",
5010 frame_selected);
5011 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ExpandAll",
5012 frame_selected);
5013 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ExpandAll",
5014 frame_selected);
5015 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ColorizeConversation",
5016 frame_selected);
5017 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ResetColoring1-10",
5018 tmp_color_filters_used());
5019 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ShowPacketinNewWindow",
5020 frame_selected);
5021 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ShowPacketinNewWindow",
5022 frame_selected);
5023 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ManuallyResolveAddress",
5024 frame_selected ? ((cf->edt->pi.ethertype == ETHERTYPE_IP)||(cf->edt->pi.ethertype == ETHERTYPE_IPv6)) : FALSE);
5025 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/SCTP",
5026 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_SCTP) : FALSE);
5027 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/FollowTCPStream",
5028 tcp_packet_selected);
5029 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FollowTCPStream",
5030 tcp_packet_selected);
5031 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/FollowUDPStream",
5032 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
5033 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/FollowSSLStream",
5034 frame_selected ? is_ssl : FALSE);
5035 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FollowSSLStream",
5036 frame_selected ? is_ssl : FALSE);
5037 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter",
5038 frame_selected);
5039 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/Ethernet",
5040 frame_selected ? (cf->edt->pi.dl_src.type == AT_ETHER) : FALSE);
5041 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/IP",
5042 frame_selected ? ((cf->edt->pi.ethertype == ETHERTYPE_IP)||(cf->edt->pi.ethertype == ETHERTYPE_IPv6)) : FALSE);
5043 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/TCP",
5044 tcp_packet_selected);
5045 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/UDP",
5046 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
5047 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FollowUDPStream",
5048 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
5049 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/PN-CBA",
5050 frame_selected ? (cf->edt->pi.profinet_type != 0 && cf->edt->pi.profinet_type < 10) : FALSE);
5051 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation",
5052 frame_selected);
5053 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/Ethernet",
5054 frame_selected ? (cf->edt->pi.dl_src.type == AT_ETHER) : FALSE);
5055 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/IP",
5056 frame_selected ? ((cf->edt->pi.ethertype == ETHERTYPE_IP)||(cf->edt->pi.ethertype == ETHERTYPE_IPv6)) : FALSE);
5057 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/TCP",
5058 tcp_packet_selected);
5059 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/UDP",
5060 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
5061 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/PN-CBA",
5062 frame_selected ? (cf->edt->pi.profinet_type != 0 && cf->edt->pi.profinet_type < 10) : FALSE);
5063 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/DecodeAs",
5064 frame_selected && decode_as_ok());
5066 if (properties) {
5067 prev_abbrev = (char *)g_object_get_data(G_OBJECT(ui_manager_packet_list_menu), "menu_abbrev");
5068 if (!prev_abbrev || (strcmp(prev_abbrev, abbrev) != 0)) {
5069 /*No previous protocol or protocol changed - update Protocol Preferences menu*/
5070 module_t *prefs_module_p = prefs_find_module(abbrev);
5071 rebuild_protocol_prefs_menu(prefs_module_p, properties, ui_manager_packet_list_menu, "/PacketListMenuPopup/ProtocolPreferences");
5073 g_object_set_data(G_OBJECT(ui_manager_packet_list_menu), "menu_abbrev", g_strdup(abbrev));
5074 g_free (prev_abbrev);
5078 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ProtocolPreferences",
5079 properties);
5080 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/DecodeAs",
5081 frame_selected && decode_as_ok());
5082 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/Copy",
5083 frame_selected);
5084 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ApplyAsFilter",
5085 frame_selected);
5086 set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/PrepareaFilter",
5087 frame_selected);
5088 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ResolveName",
5089 frame_selected && (gbl_resolv_flags.mac_name || gbl_resolv_flags.network_name ||
5090 gbl_resolv_flags.transport_name || gbl_resolv_flags.concurrent_dns));
5091 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/FollowTCPStream",
5092 tcp_packet_selected);
5093 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/FollowUDPStream",
5094 frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
5095 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/FollowSSLStream",
5096 frame_selected ? is_ssl : FALSE);
5097 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/DecodeAs",
5098 frame_selected && decode_as_ok());
5099 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/ResolveName",
5100 frame_selected && (gbl_resolv_flags.mac_name || gbl_resolv_flags.network_name ||
5101 gbl_resolv_flags.transport_name || gbl_resolv_flags.concurrent_dns));
5102 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ToolsMenu/FirewallACLRules",
5103 frame_selected);
5104 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/StatisticsMenu/TCPStreamGraphMenu",
5105 tcp_packet_selected);
5107 while (list_entry != NULL) {
5108 dissector_filter_t *filter_entry;
5109 gchar *path;
5111 filter_entry = (dissector_filter_t *)list_entry->data;
5112 path = g_strdup_printf("/Menubar/AnalyzeMenu/ConversationFilterMenu/Filters/filter-%u", i);
5114 set_menu_sensitivity(ui_manager_main_menubar, path,
5115 menu_dissector_filter_spe_cb(/* frame_data *fd _U_*/ NULL, cf->edt, filter_entry));
5116 g_free(path);
5117 i++;
5118 list_entry = g_list_next(list_entry);
5123 static void
5124 menu_prefs_toggle_bool (GtkWidget *w, gpointer data)
5126 gboolean *value = (gboolean *)data;
5127 module_t *module = (module_t *)g_object_get_data (G_OBJECT(w), "module");
5129 module->prefs_changed = TRUE;
5130 *value = !(*value);
5132 prefs_apply (module);
5133 if (!prefs.gui_use_pref_save) {
5134 prefs_main_write();
5136 redissect_packets();
5137 redissect_all_packet_windows();
5140 static void
5141 menu_prefs_change_enum (GtkWidget *w, gpointer data)
5143 gint *value = (gint *)data;
5144 module_t *module = (module_t *)g_object_get_data (G_OBJECT(w), "module");
5145 gint new_value = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(w), "enumval"));
5147 if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM(w)))
5148 return;
5150 if (*value != new_value) {
5151 module->prefs_changed = TRUE;
5152 *value = new_value;
5154 prefs_apply (module);
5155 if (!prefs.gui_use_pref_save) {
5156 prefs_main_write();
5158 redissect_packets();
5159 redissect_all_packet_windows();
5163 void
5164 menu_prefs_reset(void)
5166 g_free (g_object_get_data(G_OBJECT(ui_manager_tree_view_menu), "menu_abbrev"));
5167 g_object_set_data(G_OBJECT(ui_manager_tree_view_menu), "menu_abbrev", NULL);
5170 static void
5171 menu_prefs_change_ok (GtkWidget *w, gpointer parent_w)
5173 GtkWidget *entry = (GtkWidget *)g_object_get_data (G_OBJECT(w), "entry");
5174 module_t *module = (module_t *)g_object_get_data (G_OBJECT(w), "module");
5175 pref_t *pref = (pref_t *)g_object_get_data (G_OBJECT(w), "pref");
5176 const gchar *new_value = gtk_entry_get_text(GTK_ENTRY(entry));
5177 range_t *newrange;
5178 gchar *p;
5179 guint uval;
5181 switch (pref->type) {
5182 case PREF_UINT:
5183 uval = (guint)strtoul(new_value, &p, pref->info.base);
5184 if (p == new_value || *p != '\0') {
5185 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
5186 "The value \"%s\" isn't a valid number.",
5187 new_value);
5188 return;
5190 if (*pref->varp.uint != uval) {
5191 module->prefs_changed = TRUE;
5192 *pref->varp.uint = uval;
5194 break;
5195 case PREF_STRING:
5196 if (strcmp (*pref->varp.string, new_value) != 0) {
5197 module->prefs_changed = TRUE;
5198 g_free((void*)*pref->varp.string);
5199 *pref->varp.string = g_strdup(new_value);
5201 break;
5202 case PREF_RANGE:
5203 if (range_convert_str(&newrange, new_value, pref->info.max_value) != CVT_NO_ERROR) {
5204 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
5205 "The value \"%s\" isn't a valid range.",
5206 new_value);
5207 return;
5209 if (!ranges_are_equal(*pref->varp.range, newrange)) {
5210 module->prefs_changed = TRUE;
5211 g_free(*pref->varp.range);
5212 *pref->varp.range = newrange;
5213 } else {
5214 g_free (newrange);
5216 break;
5217 default:
5218 g_assert_not_reached();
5219 break;
5222 if (module->prefs_changed) {
5223 /* Ensure we reload the sub menu */
5224 menu_prefs_reset();
5225 prefs_apply (module);
5226 if (!prefs.gui_use_pref_save) {
5227 prefs_main_write();
5229 redissect_packets();
5230 redissect_all_packet_windows();
5233 window_destroy(GTK_WIDGET(parent_w));
5236 static void
5237 menu_prefs_change_cancel (GtkWidget *w _U_, gpointer parent_w)
5239 window_destroy(GTK_WIDGET(parent_w));
5242 static void
5243 menu_prefs_edit_dlg (GtkWidget *w, gpointer data)
5245 pref_t *pref = (pref_t *)data;
5246 module_t *module = (module_t *)g_object_get_data (G_OBJECT(w), "module");
5247 gchar *value = NULL;
5249 GtkWidget *win, *main_grid, *main_vb, *bbox, *cancel_bt, *ok_bt;
5250 GtkWidget *entry, *label;
5252 switch (pref->type) {
5253 case PREF_UINT:
5254 switch (pref->info.base) {
5255 case 8:
5256 value = g_strdup_printf("%o", *pref->varp.uint);
5257 break;
5258 case 10:
5259 value = g_strdup_printf("%u", *pref->varp.uint);
5260 break;
5261 case 16:
5262 value = g_strdup_printf("%x", *pref->varp.uint);
5263 break;
5264 default:
5265 g_assert_not_reached();
5266 break;
5268 break;
5269 case PREF_STRING:
5270 value = g_strdup(*pref->varp.string);
5271 break;
5272 case PREF_RANGE:
5273 value = g_strdup(range_convert_range (*pref->varp.range));
5274 break;
5275 default:
5276 g_assert_not_reached();
5277 break;
5280 win = dlg_window_new(module->description);
5282 gtk_window_set_resizable(GTK_WINDOW(win),FALSE);
5283 gtk_window_resize(GTK_WINDOW(win), 400, 100);
5285 main_vb = ws_gtk_box_new(GTK_ORIENTATION_VERTICAL, 5, FALSE);
5286 gtk_container_add(GTK_CONTAINER(win), main_vb);
5287 gtk_container_set_border_width(GTK_CONTAINER(main_vb), 6);
5289 main_grid = ws_gtk_grid_new();
5290 gtk_box_pack_start(GTK_BOX(main_vb), main_grid, FALSE, FALSE, 0);
5291 ws_gtk_grid_set_column_spacing(GTK_GRID(main_grid), 10);
5293 label = gtk_label_new(ep_strdup_printf("%s:", pref->title));
5294 ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), label, 0, 1, 1, 1);
5295 gtk_misc_set_alignment(GTK_MISC(label), 1.0f, 0.5f);
5296 if (pref->description)
5297 gtk_widget_set_tooltip_text(label, pref->description);
5299 entry = gtk_entry_new();
5300 ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), entry, 1, 1, 1, 1);
5301 gtk_entry_set_text(GTK_ENTRY(entry), value);
5302 if (pref->description)
5303 gtk_widget_set_tooltip_text(entry, pref->description);
5305 bbox = dlg_button_row_new(GTK_STOCK_CANCEL,GTK_STOCK_OK, NULL);
5306 gtk_box_pack_end(GTK_BOX(main_vb), bbox, FALSE, FALSE, 0);
5308 ok_bt = (GtkWidget *)g_object_get_data(G_OBJECT(bbox), GTK_STOCK_OK);
5309 g_object_set_data (G_OBJECT(ok_bt), "module", module);
5310 g_object_set_data (G_OBJECT(ok_bt), "entry", entry);
5311 g_object_set_data (G_OBJECT(ok_bt), "pref", pref);
5312 g_signal_connect(ok_bt, "clicked", G_CALLBACK(menu_prefs_change_ok), win);
5314 dlg_set_activate(entry, ok_bt);
5316 cancel_bt = (GtkWidget *)g_object_get_data(G_OBJECT(bbox), GTK_STOCK_CANCEL);
5317 g_signal_connect(cancel_bt, "clicked", G_CALLBACK(menu_prefs_change_cancel), win);
5318 window_set_cancel_button(win, cancel_bt, NULL);
5320 gtk_widget_grab_default(ok_bt);
5321 gtk_widget_show_all(win);
5322 g_free(value);
5325 static guint
5326 add_protocol_prefs_generic_menu(pref_t *pref, gpointer data, GtkUIManager *ui_menu, const char *path)
5328 GtkWidget *menu_preferences;
5329 GtkWidget *menu_item, *menu_sub_item, *sub_menu;
5330 GSList *group = NULL;
5331 module_t *module = (module_t *)data;
5332 const enum_val_t *enum_valp;
5333 gchar *label = NULL;
5335 switch (pref->type) {
5336 case PREF_UINT:
5337 switch (pref->info.base) {
5338 case 8:
5339 label = g_strdup_printf ("%s: %o", pref->title, *pref->varp.uint);
5340 break;
5341 case 10:
5342 label = g_strdup_printf ("%s: %u", pref->title, *pref->varp.uint);
5343 break;
5344 case 16:
5345 label = g_strdup_printf ("%s: %x", pref->title, *pref->varp.uint);
5346 break;
5347 default:
5348 g_assert_not_reached();
5349 break;
5351 menu_item = gtk_menu_item_new_with_label(label);
5352 g_object_set_data (G_OBJECT(menu_item), "module", module);
5353 g_signal_connect(menu_item, "activate", G_CALLBACK(menu_prefs_edit_dlg), pref);
5354 g_free (label);
5355 break;
5356 case PREF_BOOL:
5357 menu_item = gtk_check_menu_item_new_with_label(pref->title);
5358 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menu_item), *pref->varp.boolp);
5359 g_object_set_data (G_OBJECT(menu_item), "module", module);
5360 g_signal_connect(menu_item, "activate", G_CALLBACK(menu_prefs_toggle_bool), pref->varp.boolp);
5361 break;
5362 case PREF_ENUM:
5363 menu_item = gtk_menu_item_new_with_label(pref->title);
5364 sub_menu = gtk_menu_new();
5365 gtk_menu_item_set_submenu (GTK_MENU_ITEM(menu_item), sub_menu);
5366 enum_valp = pref->info.enum_info.enumvals;
5367 while (enum_valp->name != NULL) {
5368 menu_sub_item = gtk_radio_menu_item_new_with_label(group, enum_valp->description);
5369 group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_sub_item));
5370 if (enum_valp->value == *pref->varp.enump) {
5371 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menu_sub_item), TRUE);
5373 g_object_set_data (G_OBJECT(menu_sub_item), "module", module);
5374 g_object_set_data (G_OBJECT(menu_sub_item), "enumval", GINT_TO_POINTER(enum_valp->value));
5375 g_signal_connect(menu_sub_item, "activate", G_CALLBACK(menu_prefs_change_enum), pref->varp.enump);
5376 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_sub_item);
5377 gtk_widget_show (menu_sub_item);
5378 enum_valp++;
5380 break;
5381 case PREF_STRING:
5382 label = g_strdup_printf ("%s: %s", pref->title, *pref->varp.string);
5383 menu_item = gtk_menu_item_new_with_label(label);
5384 g_object_set_data (G_OBJECT(menu_item), "module", module);
5385 g_signal_connect(menu_item, "activate", G_CALLBACK(menu_prefs_edit_dlg), pref);
5386 g_free (label);
5387 break;
5388 case PREF_RANGE:
5389 label = g_strdup_printf ("%s: %s", pref->title, range_convert_range (*pref->varp.range));
5390 menu_item = gtk_menu_item_new_with_label(label);
5391 g_object_set_data (G_OBJECT(menu_item), "module", module);
5392 g_signal_connect(menu_item, "activate", G_CALLBACK(menu_prefs_edit_dlg), pref);
5393 g_free (label);
5394 break;
5395 case PREF_UAT:
5396 label = g_strdup_printf ("%s...", pref->title);
5397 menu_item = gtk_menu_item_new_with_label(label);
5398 g_signal_connect (menu_item, "activate", G_CALLBACK(uat_window_cb), pref->varp.uat);
5399 g_free (label);
5400 break;
5402 case PREF_COLOR:
5403 case PREF_CUSTOM:
5404 /* currently not supported */
5406 case PREF_STATIC_TEXT:
5407 case PREF_OBSOLETE:
5408 default:
5409 /* Nothing to add */
5410 return 0;
5413 menu_preferences = gtk_ui_manager_get_widget(ui_menu, path);
5414 if(!menu_preferences)
5415 g_warning("menu_preferences Not found path");
5416 sub_menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM(menu_preferences));
5417 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
5418 gtk_widget_show (menu_item);
5420 return 0;
5423 static guint
5424 add_protocol_prefs_menu(pref_t *pref, gpointer data)
5426 return add_protocol_prefs_generic_menu(pref, data, ui_manager_tree_view_menu, "/TreeViewPopup/ProtocolPreferences");
5429 static guint
5430 add_protocol_prefs_packet_list_menu(pref_t *pref, gpointer data)
5432 return add_protocol_prefs_generic_menu(pref, data, ui_manager_packet_list_menu, "/PacketListMenuPopup/ProtocolPreferences");
5436 static void
5437 rebuild_protocol_prefs_menu(module_t *prefs_module_p, gboolean preferences,
5438 GtkUIManager *ui_menu, const char *path)
5440 GtkWidget *menu_preferences, *menu_item;
5441 GtkWidget *sub_menu;
5442 gchar *label;
5444 menu_preferences = gtk_ui_manager_get_widget(ui_menu, path);
5445 if (prefs_module_p && preferences) {
5446 sub_menu = gtk_menu_new();
5447 gtk_menu_item_set_submenu (GTK_MENU_ITEM(menu_preferences), sub_menu);
5449 label = g_strdup_printf ("%s Preferences...", prefs_module_p->description);
5450 menu_item = gtk_image_menu_item_new_with_label(label);
5451 gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM(menu_item),
5452 gtk_image_new_from_stock(GTK_STOCK_PREFERENCES, GTK_ICON_SIZE_MENU));
5453 gtk_menu_shell_append(GTK_MENU_SHELL(sub_menu), menu_item);
5454 g_signal_connect_swapped(G_OBJECT(menu_item), "activate",
5455 G_CALLBACK(properties_cb), (GObject *) menu_item);
5456 gtk_widget_show(menu_item);
5457 g_free(label);
5459 menu_item = gtk_menu_item_new();
5460 gtk_menu_shell_append(GTK_MENU_SHELL(sub_menu), menu_item);
5461 gtk_widget_show(menu_item);
5463 if (ui_menu == ui_manager_tree_view_menu) {
5464 prefs_pref_foreach(prefs_module_p, add_protocol_prefs_menu, prefs_module_p);
5465 } else {
5466 prefs_pref_foreach(prefs_module_p, add_protocol_prefs_packet_list_menu, prefs_module_p);
5468 } else {
5469 /* No preferences, remove sub menu */
5470 gtk_menu_item_set_submenu (GTK_MENU_ITEM(menu_preferences), NULL);
5475 static void
5476 menu_visible_column_toggle (GtkWidget *w _U_, gpointer data)
5478 packet_list_toggle_visible_column (GPOINTER_TO_INT(data));
5481 void
5482 rebuild_visible_columns_menu (void)
5484 GtkWidget *menu_columns[2], *menu_item;
5485 GtkWidget *sub_menu;
5486 GList *clp;
5487 fmt_data *cfmt;
5488 gchar *title;
5489 gint i, col_id;
5491 menu_columns[0] = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/DisplayedColumns");
5492 if(! menu_columns[0]){
5493 fprintf (stderr, "Warning: couldn't find menu_columns[0] path=/Menubar/ViewMenu/DisplayedColumns");
5495 menu_columns[1] = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/DisplayedColumns");
5496 /* Debug */
5497 if(! menu_columns[1]){
5498 fprintf (stderr, "Warning: couldn't find menu_columns[1] path=/PacketListHeadingPopup/DisplayedColumns");
5501 for (i = 0; i < 2; i++) {
5502 sub_menu = gtk_menu_new();
5503 gtk_menu_item_set_submenu (GTK_MENU_ITEM(menu_columns[i]), sub_menu);
5505 clp = g_list_first (prefs.col_list);
5506 col_id = 0;
5507 while (clp) {
5508 cfmt = (fmt_data *) clp->data;
5509 if (cfmt->title[0]) {
5510 if (cfmt->fmt == COL_CUSTOM) {
5511 title = g_strdup_printf ("%s (%s)", cfmt->title, cfmt->custom_field);
5512 } else {
5513 title = g_strdup_printf ("%s (%s)", cfmt->title, col_format_desc (cfmt->fmt));
5515 } else {
5516 if (cfmt->fmt == COL_CUSTOM) {
5517 title = g_strdup_printf ("(%s)", cfmt->custom_field);
5518 } else {
5519 title = g_strdup_printf ("(%s)", col_format_desc (cfmt->fmt));
5522 menu_item = gtk_check_menu_item_new_with_label(title);
5523 g_free (title);
5524 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menu_item), cfmt->visible);
5525 g_signal_connect(menu_item, "activate", G_CALLBACK(menu_visible_column_toggle), GINT_TO_POINTER(col_id));
5526 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
5527 gtk_widget_show (menu_item);
5528 clp = g_list_next (clp);
5529 col_id++;
5532 menu_item = gtk_separator_menu_item_new();
5533 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
5534 gtk_widget_show (menu_item);
5536 menu_item = gtk_menu_item_new_with_label ("Display All");
5537 gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
5538 g_signal_connect(menu_item, "activate", G_CALLBACK(packet_list_heading_activate_all_columns_cb), NULL);
5539 gtk_widget_show (menu_item);
5543 void
5544 menus_set_column_resolved (gboolean resolved, gboolean can_resolve)
5546 GtkWidget *menu;
5548 menu = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/ShowResolved");
5549 if(!menu){
5550 fprintf (stderr, "Warning: couldn't find menu path=/PacketListHeadingPopup/ShowResolved");
5552 g_object_set_data(G_OBJECT(menu), "skip-update", (void *)1);
5553 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), resolved && can_resolve);
5554 set_menu_sensitivity(ui_manager_packet_list_heading, "/PacketListHeadingPopup/ShowResolved", can_resolve);
5555 g_object_set_data(G_OBJECT(menu), "skip-update", NULL);
5558 void
5559 menus_set_column_align_default (gboolean right_justify)
5561 GtkWidget *submenu, *menu_item_child;
5562 GList *child_list, *child_list_item;
5563 const gchar *menu_item_name;
5564 size_t menu_item_len;
5566 /* get the submenu container item */
5567 submenu = gtk_ui_manager_get_widget (ui_manager_packet_list_heading, "/PacketListHeadingPopup");
5568 if(!submenu){
5569 fprintf (stderr, "Warning: couldn't find submenu path=/PacketListHeadingPopup");
5572 /* find the corresponding menu items to update */
5573 child_list = gtk_container_get_children(GTK_CONTAINER(submenu));
5574 child_list_item = child_list;
5575 while (child_list_item) {
5576 menu_item_child = gtk_bin_get_child(GTK_BIN(child_list_item->data));
5577 if (menu_item_child != NULL) {
5578 menu_item_name = gtk_label_get_text(GTK_LABEL(menu_item_child));
5579 menu_item_len = strlen (menu_item_name);
5580 if(strncmp(menu_item_name, "Align Left", 10) == 0) {
5581 if (!right_justify && menu_item_len == 10) {
5582 gtk_label_set_text(GTK_LABEL(menu_item_child), "Align Left\t(default)");
5583 } else if (right_justify && menu_item_len > 10) {
5584 gtk_label_set_text(GTK_LABEL(menu_item_child), "Align Left");
5586 } else if (strncmp (menu_item_name, "Align Right", 11) == 0) {
5587 if (right_justify && menu_item_len == 11) {
5588 gtk_label_set_text(GTK_LABEL(menu_item_child), "Align Right\t(default)");
5589 } else if (!right_justify && menu_item_len > 11) {
5590 gtk_label_set_text(GTK_LABEL(menu_item_child), "Align Right");
5594 child_list_item = g_list_next(child_list_item);
5596 g_list_free(child_list);
5599 void
5600 set_menus_for_selected_tree_row(capture_file *cf)
5602 gboolean properties;
5603 gint id;
5605 if (cf->finfo_selected != NULL) {
5606 header_field_info *hfinfo = cf->finfo_selected->hfinfo;
5607 const char *abbrev;
5608 char *prev_abbrev;
5610 if (hfinfo->parent == -1) {
5611 abbrev = hfinfo->abbrev;
5612 id = (hfinfo->type == FT_PROTOCOL) ? proto_get_id((protocol_t *)hfinfo->strings) : -1;
5613 } else {
5614 abbrev = proto_registrar_get_abbrev(hfinfo->parent);
5615 id = hfinfo->parent;
5617 properties = prefs_is_registered_protocol(abbrev);
5618 set_menu_sensitivity(ui_manager_tree_view_menu,
5619 "/TreeViewPopup/GotoCorrespondingPacket", hfinfo->type == FT_FRAMENUM);
5620 set_menu_sensitivity(ui_manager_tree_view_menu,
5621 "/TreeViewPopup/ShowPacketRefinNewWindow", hfinfo->type == FT_FRAMENUM);
5622 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/Copy",
5623 TRUE);
5624 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/Copy/AsFilter",
5625 proto_can_match_selected(cf->finfo_selected, cf->edt));
5626 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyasColumn",
5627 hfinfo->type != FT_NONE);
5628 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter",
5629 proto_can_match_selected(cf->finfo_selected, cf->edt));
5630 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter",
5631 proto_can_match_selected(cf->finfo_selected, cf->edt));
5632 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ColorizewithFilter",
5633 proto_can_match_selected(cf->finfo_selected, cf->edt));
5634 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ProtocolPreferences",
5635 properties);
5636 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/DisableProtocol",
5637 (id == -1) ? FALSE : proto_can_toggle_protocol(id));
5638 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ExpandSubtrees",
5639 cf->finfo_selected->tree_type != -1);
5640 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/CollapseSubtrees",
5641 cf->finfo_selected->tree_type != -1);
5642 #ifdef WANT_PACKET_EDITOR
5643 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/EditPacket",
5644 prefs.gui_packet_editor ? TRUE : FALSE);
5645 #endif
5646 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/WikiProtocolPage",
5647 (id == -1) ? FALSE : TRUE);
5648 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FilterFieldReference",
5649 (id == -1) ? FALSE : TRUE);
5650 set_menu_sensitivity(ui_manager_main_menubar,
5651 "/Menubar/FileMenu/ExportSelectedPacketBytes", TRUE);
5652 set_menu_sensitivity(ui_manager_main_menubar,
5653 "/Menubar/GoMenu/GotoCorrespondingPacket", hfinfo->type == FT_FRAMENUM);
5654 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Copy/Description",
5655 proto_can_match_selected(cf->finfo_selected, cf->edt));
5656 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Copy/Fieldname",
5657 proto_can_match_selected(cf->finfo_selected, cf->edt));
5658 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Copy/Value",
5659 proto_can_match_selected(cf->finfo_selected, cf->edt));
5660 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Copy/AsFilter",
5661 proto_can_match_selected(cf->finfo_selected, cf->edt));
5662 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/ApplyasColumn",
5663 hfinfo->type != FT_NONE);
5664 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/ApplyAsFilter",
5665 proto_can_match_selected(cf->finfo_selected, cf->edt));
5666 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/PrepareaFilter",
5667 proto_can_match_selected(cf->finfo_selected, cf->edt));
5668 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ExpandSubtrees",
5669 cf->finfo_selected->tree_type != -1);
5670 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/CollapseSubtrees",
5671 cf->finfo_selected->tree_type != -1);
5672 prev_abbrev = (char *)g_object_get_data(G_OBJECT(ui_manager_tree_view_menu), "menu_abbrev");
5673 if (!prev_abbrev || (strcmp (prev_abbrev, abbrev) != 0)) {
5674 /* No previous protocol or protocol changed - update Protocol Preferences menu */
5675 module_t *prefs_module_p = prefs_find_module(abbrev);
5676 rebuild_protocol_prefs_menu(prefs_module_p, properties, ui_manager_tree_view_menu, "/TreeViewPopup/ProtocolPreferences");
5678 g_object_set_data(G_OBJECT(ui_manager_tree_view_menu), "menu_abbrev", g_strdup(abbrev));
5679 g_free (prev_abbrev);
5681 } else {
5682 set_menu_sensitivity(ui_manager_tree_view_menu,
5683 "/TreeViewPopup/GotoCorrespondingPacket", FALSE);
5684 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/Copy", FALSE);
5685 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyasColumn", FALSE);
5686 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter", FALSE);
5687 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter", FALSE);
5688 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ColorizewithFilter", FALSE);
5689 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ProtocolPreferences",
5690 FALSE);
5691 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/DisableProtocol", FALSE);
5692 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ExpandSubtrees", FALSE);
5693 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/CollapseSubtrees", FALSE);
5694 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/WikiProtocolPage",
5695 FALSE);
5696 set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FilterFieldReference",
5697 FALSE);
5698 set_menu_sensitivity(ui_manager_main_menubar,
5699 "/Menubar/FileMenu/ExportSelectedPacketBytes", FALSE);
5700 set_menu_sensitivity(ui_manager_main_menubar,
5701 "/Menubar/GoMenu/GotoCorrespondingPacket", FALSE);
5702 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Copy/Description", FALSE);
5703 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Copy/Fieldname", FALSE);
5704 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Copy/Value", FALSE);
5705 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Copy/AsFilter", FALSE);
5706 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/ApplyasColumn", FALSE);
5707 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/ApplyAsFilter", FALSE);
5708 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/PrepareaFilter", FALSE);
5709 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ExpandSubtrees", FALSE);
5710 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/CollapseSubtrees", FALSE);
5714 void set_menus_for_packet_history(gboolean back_history, gboolean forward_history)
5716 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/Back", back_history);
5717 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/Forward", forward_history);
5721 void set_menus_for_file_set(gboolean file_set, gboolean previous_file, gboolean next_file)
5723 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Set/ListFiles", file_set);
5724 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Set/PreviousFile", previous_file);
5725 set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Set/NextFile", next_file);
5728 GtkWidget *menus_get_profiles_rename_menu (void)
5730 return gtk_ui_manager_get_widget(ui_manager_statusbar_profiles_menu, "/ProfilesMenuPopup/Rename");
5733 GtkWidget *menus_get_profiles_delete_menu (void)
5735 return gtk_ui_manager_get_widget(ui_manager_statusbar_profiles_menu, "/ProfilesMenuPopup/Delete");
5738 GtkWidget *menus_get_profiles_change_menu (void)
5740 return gtk_ui_manager_get_widget(ui_manager_statusbar_profiles_menu, "/ProfilesMenuPopup/Change");
5743 void set_menus_for_profiles(gboolean default_profile)
5745 set_menu_sensitivity(ui_manager_statusbar_profiles_menu, "/ProfilesMenuPopup/Rename", !default_profile);
5746 set_menu_sensitivity(ui_manager_statusbar_profiles_menu, "/ProfilesMenuPopup/Delete", !default_profile);
5750 * Editor modelines
5752 * Local Variables:
5753 * c-basic-offset: 4
5754 * tab-width: 8
5755 * indent-tabs-mode: nil
5756 * End:
5758 * ex: set shiftwidth=4 tabstop=8 expandtab:
5759 * :indentSize=4:tabSize=8:noTabs=true: