PageRenderTime 94ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 2ms

/ui/gtk/main_menubar.c

https://github.com/labx-technologies-llc/wireshark
C | 5722 lines | 4541 code | 715 blank | 466 comment | 475 complexity | fbd6208c3ec2216cd908c85ba63afb34 MD5 | raw file
Possible License(s): GPL-2.0, BSD-3-Clause
  1. /* main_menubar.c
  2. * Menu routines
  3. *
  4. * $Id$
  5. *
  6. * Wireshark - Network traffic analyzer
  7. * By Gerald Combs <gerald@wireshark.org>
  8. * Copyright 1998 Gerald Combs
  9. *
  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.
  14. *
  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.
  19. *
  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.
  23. */
  24. #include "config.h"
  25. #include <gtk/gtk.h>
  26. #include <stdio.h>
  27. #include <string.h>
  28. #include <wsutil/u3.h>
  29. #include <epan/packet.h>
  30. #include <epan/addr_resolv.h>
  31. #include <epan/prefs.h>
  32. #include <epan/prefs-int.h>
  33. #include <epan/tap.h>
  34. #include <epan/timestamp.h>
  35. #include <epan/etypes.h>
  36. #include <epan/ipproto.h>
  37. #include <epan/dissector_filters.h>
  38. #include <epan/strutil.h>
  39. #include <epan/plugins.h>
  40. #include <epan/epan_dissect.h>
  41. #include <epan/column.h>
  42. #include <epan/stats_tree_priv.h>
  43. #include <epan/filesystem.h>
  44. #include <epan/print.h>
  45. #include "cfile.h"
  46. #include "globals.h"
  47. #include "color_filters.h"
  48. #include "stat_menu.h"
  49. #include "ui/iface_lists.h"
  50. #include "ui/main_statusbar.h"
  51. #include "ui/preference_utils.h"
  52. #include "ui/recent.h"
  53. #include "ui/recent_utils.h"
  54. #include "ui/simple_dialog.h"
  55. #include "ui/software_update.h"
  56. #include "ui/ui_util.h"
  57. #include "ui/utf8_entities.h"
  58. #include "ui/gtk/about_dlg.h"
  59. #include "ui/gtk/capture_dlg.h"
  60. #include "ui/gtk/capture_if_dlg.h"
  61. #include "ui/gtk/color_dlg.h"
  62. #include "ui/gtk/export_object_dlg.h"
  63. #include "ui/gtk/filter_dlg.h"
  64. #include "ui/gtk/profile_dlg.h"
  65. #include "ui/gtk/dlg_utils.h"
  66. #include "ui/gtk/capture_file_dlg.h"
  67. #include "ui/gtk/fileset_dlg.h"
  68. #include "ui/gtk/file_import_dlg.h"
  69. #include "ui/gtk/find_dlg.h"
  70. #include "ui/gtk/goto_dlg.h"
  71. #include "ui/gtk/summary_dlg.h"
  72. #include "ui/gtk/prefs_dlg.h"
  73. #include "ui/gtk/packet_win.h"
  74. #include "ui/gtk/follow_tcp.h"
  75. #include "ui/gtk/follow_udp.h"
  76. #include "ui/gtk/follow_ssl.h"
  77. #include "ui/gtk/decode_as_dlg.h"
  78. #include "ui/gtk/help_dlg.h"
  79. #include "ui/gtk/supported_protos_dlg.h"
  80. #include "ui/gtk/proto_dlg.h"
  81. #include "ui/gtk/proto_hier_stats_dlg.h"
  82. #include "ui/gtk/keys.h"
  83. #include "ui/gtk/stock_icons.h"
  84. #include "ui/gtk/gtkglobals.h"
  85. #include "ui/gtk/packet_panes.h"
  86. #include "ui/gtk/conversations_table.h"
  87. #include "ui/gtk/hostlist_table.h"
  88. #include "ui/gtk/packet_history.h"
  89. #include "ui/gtk/sctp_stat.h"
  90. #include "ui/gtk/firewall_dlg.h"
  91. #include "ui/gtk/macros_dlg.h"
  92. #include "epan/dissectors/packet-ssl-utils.h"
  93. #include "ui/gtk/export_sslkeys.h"
  94. #include "ui/gtk/gui_stat_menu.h"
  95. #include "ui/gtk/main.h"
  96. #include "ui/gtk/menus.h"
  97. #include "ui/gtk/main_menubar_private.h"
  98. #include "ui/gtk/main_toolbar.h"
  99. #include "ui/gtk/main_welcome.h"
  100. #include "ui/gtk/uat_gui.h"
  101. #include "ui/gtk/gui_utils.h"
  102. #include "ui/gtk/manual_addr_resolv.h"
  103. #include "ui/gtk/proto_help.h"
  104. #include "ui/gtk/dissector_tables_dlg.h"
  105. #include "ui/gtk/expert_comp_dlg.h"
  106. #include "ui/gtk/time_shift_dlg.h"
  107. #include "ui/gtk/edit_packet_comment_dlg.h"
  108. #include "ui/gtk/addr_resolution_dlg.h"
  109. #include "ui/gtk/export_pdu_dlg.h"
  110. #include "ui/gtk/packet_list.h"
  111. #ifdef HAVE_LIBPCAP
  112. #include "capture_opts.h"
  113. #include "ui/capture_globals.h"
  114. #endif
  115. #ifdef HAVE_IGE_MAC_INTEGRATION
  116. #include <ige-mac-menu.h>
  117. #endif
  118. #ifdef HAVE_GTKOSXAPPLICATION
  119. #include <gtkmacintegration/gtkosxapplication.h>
  120. #endif
  121. static int initialize = TRUE;
  122. GtkActionGroup *main_menu_bar_action_group;
  123. static GtkUIManager *ui_manager_main_menubar = NULL;
  124. static GtkUIManager *ui_manager_packet_list_heading = NULL;
  125. static GtkUIManager *ui_manager_packet_list_menu = NULL;
  126. static GtkUIManager *ui_manager_tree_view_menu = NULL;
  127. static GtkUIManager *ui_manager_bytes_menu = NULL;
  128. static GtkUIManager *ui_manager_statusbar_profiles_menu = NULL;
  129. static GSList *popup_menu_list = NULL;
  130. static GtkAccelGroup *grp;
  131. static GList *merge_menu_items_list = NULL;
  132. static GList *build_menubar_items_callback_list = NULL;
  133. GtkWidget *popup_menu_object;
  134. static void menu_open_recent_file_cmd_cb(GtkAction *action, gpointer data _U_ );
  135. static void add_recent_items (guint merge_id, GtkUIManager *ui_manager);
  136. static void add_tap_plugins (guint merge_id, GtkUIManager *ui_manager);
  137. static void menus_init(void);
  138. static void merge_menu_items(GList *node);
  139. static void ws_menubar_build_external_menus(void);
  140. static void set_menu_sensitivity (GtkUIManager *ui_manager, const gchar *, gint);
  141. static void menu_name_resolution_update_cb(GtkAction *action, gpointer data);
  142. static void name_resolution_cb(GtkWidget *w, gpointer d, gboolean* res_flag);
  143. static void colorize_cb(GtkWidget *w, gpointer d);
  144. static void rebuild_protocol_prefs_menu (module_t *prefs_module_p, gboolean preferences,
  145. GtkUIManager *ui_menu, const char *path);
  146. /* As a general GUI guideline, we try to follow the Gnome Human Interface Guidelines, which can be found at:
  147. http://developer.gnome.org/projects/gup/hig/1.0/index.html
  148. Please note: there are some differences between the Gnome HIG menu suggestions and our implementation:
  149. File/Open Recent: the Gnome HIG suggests putting the list of recently used files as elements into the File menuitem.
  150. As this is ok for only a few items, this will become unhandy for 10 or even more list entries.
  151. For this reason, we use a submenu for this.
  152. File/Close: the Gnome HIG suggests putting this item just above the Quit item.
  153. This results in unintuitive behaviour as both Close and Quit items are very near together.
  154. By putting the Close item near the open item(s), it better suggests that it will close the
  155. currently opened/captured file only.
  156. */
  157. typedef enum {
  158. CONV_ETHER = 1,
  159. CONV_IP,
  160. CONV_TCP,
  161. CONV_UDP,
  162. CONV_CBA
  163. } conv_values_e;
  164. static char *
  165. build_conversation_filter(int action, gboolean show_dialog)
  166. {
  167. packet_info *pi = &cfile.edt->pi;
  168. char *buf;
  169. switch(action) {
  170. case(CONV_CBA):
  171. if (pi->profinet_type == 0) {
  172. if (show_dialog) {
  173. simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
  174. "Error filtering conversation. Please make\n"
  175. "sure you have a PROFINET CBA packet selected.");
  176. }
  177. return NULL;
  178. }
  179. if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4
  180. && pi->ipproto == IP_PROTO_TCP ) {
  181. /* IPv4 */
  182. switch(pi->profinet_type) {
  183. case(1):
  184. 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)",
  185. ip_to_str( (const guint8 *)pi->net_dst.data),
  186. ip_to_str( (const guint8 *)pi->net_src.data),
  187. ip_to_str( (const guint8 *)pi->net_src.data),
  188. ip_to_str( (const guint8 *)pi->net_dst.data));
  189. break;
  190. case(2):
  191. 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)",
  192. ip_to_str( (const guint8 *)pi->net_src.data),
  193. ip_to_str( (const guint8 *)pi->net_dst.data),
  194. ip_to_str( (const guint8 *)pi->net_dst.data),
  195. ip_to_str( (const guint8 *)pi->net_src.data));
  196. break;
  197. case(3):
  198. 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)",
  199. ip_to_str( (const guint8 *)pi->net_dst.data),
  200. ip_to_str( (const guint8 *)pi->net_src.data),
  201. ip_to_str( (const guint8 *)pi->net_src.data),
  202. ip_to_str( (const guint8 *)pi->net_dst.data));
  203. break;
  204. case(4):
  205. 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)",
  206. ip_to_str( (const guint8 *)pi->net_src.data),
  207. ip_to_str( (const guint8 *)pi->net_dst.data),
  208. ip_to_str( (const guint8 *)pi->net_dst.data),
  209. ip_to_str( (const guint8 *)pi->net_src.data));
  210. break;
  211. default:
  212. return NULL;
  213. }
  214. } else {
  215. return NULL;
  216. }
  217. break;
  218. case(CONV_TCP):
  219. if (pi->ipproto != IP_PROTO_TCP) {
  220. if (show_dialog) {
  221. simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
  222. "Error filtering conversation. Please make\n"
  223. "sure you have a TCP packet selected.");
  224. }
  225. return NULL;
  226. }
  227. if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4 ) {
  228. /* TCP over IPv4 */
  229. buf = g_strdup_printf("(ip.addr eq %s and ip.addr eq %s) and (tcp.port eq %d and tcp.port eq %d)",
  230. ip_to_str( (const guint8 *)pi->net_src.data),
  231. ip_to_str( (const guint8 *)pi->net_dst.data),
  232. pi->srcport, pi->destport );
  233. } else if( pi->net_src.type == AT_IPv6 && pi->net_dst.type == AT_IPv6 ) {
  234. /* TCP over IPv6 */
  235. buf = g_strdup_printf("(ipv6.addr eq %s and ipv6.addr eq %s) and (tcp.port eq %d and tcp.port eq %d)",
  236. ip6_to_str((const struct e_in6_addr *)pi->net_src.data),
  237. ip6_to_str((const struct e_in6_addr *)pi->net_dst.data),
  238. pi->srcport, pi->destport );
  239. } else {
  240. return NULL;
  241. }
  242. break;
  243. case(CONV_UDP):
  244. if (pi->ipproto != IP_PROTO_UDP) {
  245. if (show_dialog) {
  246. simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
  247. "Error filtering conversation. Please make\n"
  248. "sure you have a UDP packet selected.");
  249. }
  250. return NULL;
  251. }
  252. if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4 ) {
  253. /* UDP over IPv4 */
  254. buf = g_strdup_printf("(ip.addr eq %s and ip.addr eq %s) and (udp.port eq %d and udp.port eq %d)",
  255. ip_to_str( (const guint8 *)pi->net_src.data),
  256. ip_to_str( (const guint8 *)pi->net_dst.data),
  257. pi->srcport, pi->destport );
  258. } else if( pi->net_src.type == AT_IPv6 && pi->net_dst.type == AT_IPv6 ) {
  259. /* UDP over IPv6 */
  260. buf = g_strdup_printf("(ipv6.addr eq %s and ipv6.addr eq %s) and (udp.port eq %d and udp.port eq %d)",
  261. ip6_to_str((const struct e_in6_addr *)pi->net_src.data),
  262. ip6_to_str((const struct e_in6_addr *)pi->net_dst.data),
  263. pi->srcport, pi->destport );
  264. } else {
  265. return NULL;
  266. }
  267. break;
  268. case(CONV_IP):
  269. if ((pi->ethertype != ETHERTYPE_IP) && (pi->ethertype != ETHERTYPE_IPv6)) {
  270. if (show_dialog) {
  271. simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
  272. "Error filtering conversation. Please make\n"
  273. "sure you have a IP packet selected.");
  274. }
  275. return NULL;
  276. }
  277. if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4 ) {
  278. /* IPv4 */
  279. buf = g_strdup_printf("ip.addr eq %s and ip.addr eq %s",
  280. ip_to_str( (const guint8 *)pi->net_src.data),
  281. ip_to_str( (const guint8 *)pi->net_dst.data));
  282. } else if( pi->net_src.type == AT_IPv6 && pi->net_dst.type == AT_IPv6 ) {
  283. /* IPv6 */
  284. buf = g_strdup_printf("ipv6.addr eq %s and ipv6.addr eq %s",
  285. ip6_to_str((const struct e_in6_addr *)pi->net_src.data),
  286. ip6_to_str((const struct e_in6_addr *)pi->net_dst.data));
  287. } else {
  288. return NULL;
  289. }
  290. break;
  291. case(CONV_ETHER):
  292. /* XXX - is this the right way to check for Ethernet? */
  293. /* check for the data link address type */
  294. /* (ethertype will be 0 when used as length field) */
  295. if (pi->dl_src.type != AT_ETHER) {
  296. if (show_dialog) {
  297. simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
  298. "Error filtering conversation. Please make\n"
  299. "sure you have a Ethernet packet selected.");
  300. }
  301. return NULL;
  302. }
  303. if( pi->dl_src.type == AT_ETHER && pi->dl_dst.type == AT_ETHER ) {
  304. /* Ethernet */
  305. buf = g_strdup_printf("eth.addr eq %s and eth.addr eq %s",
  306. ether_to_str( (const guint8 *)pi->dl_src.data),
  307. ether_to_str( (const guint8 *)pi->dl_dst.data));
  308. } else {
  309. return NULL;
  310. }
  311. break;
  312. default:
  313. return NULL;
  314. }
  315. return buf;
  316. }
  317. static void
  318. new_window_cb(GtkWidget *widget)
  319. {
  320. new_packet_window(widget, FALSE, FALSE);
  321. }
  322. static void
  323. new_window_cb_ref(GtkWidget *widget)
  324. {
  325. new_packet_window(widget, TRUE, FALSE);
  326. }
  327. #ifdef WANT_PACKET_EDITOR
  328. static void
  329. edit_window_cb(GtkWidget *widget _U_)
  330. {
  331. new_packet_window(widget, FALSE, TRUE);
  332. }
  333. #endif
  334. static void
  335. conversation_cb(GtkAction *a _U_, gpointer data _U_, int action)
  336. {
  337. gchar *filter;
  338. GtkWidget *filter_te;
  339. if (cfile.current_frame) {
  340. /* create a filter-string based on the selected packet and action */
  341. filter = build_conversation_filter(action, TRUE);
  342. /* Run the display filter so it goes in effect - even if it's the
  343. same as the previous display filter. */
  344. filter_te = gtk_bin_get_child(GTK_BIN(g_object_get_data(G_OBJECT(top_level), E_DFILTER_CM_KEY)));
  345. gtk_entry_set_text(GTK_ENTRY(filter_te), filter);
  346. main_filter_packets(&cfile, filter, TRUE);
  347. g_free(filter);
  348. }
  349. }
  350. static void
  351. colorize_conversation_cb(GtkAction *action _U_, gpointer data _U_, int action_num)
  352. {
  353. gchar *filter = NULL;
  354. if( (action_num>>8) == 255 ) {
  355. color_filters_reset_tmp();
  356. packet_list_colorize_packets();
  357. } else if (cfile.current_frame) {
  358. if( (action_num&0xff) == 0 ) {
  359. /* colorize_conversation_cb was called from the window-menu
  360. * or through an accelerator key. Try to build a conversation
  361. * filter in the order TCP, UDP, IP, Ethernet and apply the
  362. * coloring */
  363. filter = build_conversation_filter(CONV_TCP,FALSE);
  364. if( filter == NULL )
  365. filter = build_conversation_filter(CONV_UDP,FALSE);
  366. if( filter == NULL )
  367. filter = build_conversation_filter(CONV_IP,FALSE);
  368. if( filter == NULL )
  369. filter = build_conversation_filter(CONV_ETHER,FALSE);
  370. if( filter == NULL ) {
  371. simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Unable to build conversation filter.");
  372. return;
  373. }
  374. } else {
  375. /* create a filter-string based on the selected packet and action_num */
  376. filter = build_conversation_filter(action_num&0xff, TRUE);
  377. }
  378. if( (action_num>>8) == 0) {
  379. /* Open the "new coloring filter" dialog with the filter */
  380. color_display_with_filter(filter);
  381. } else {
  382. /* Set one of the temporary coloring filters */
  383. color_filters_set_tmp((guint8)(action_num>>8),filter,FALSE);
  384. packet_list_colorize_packets();
  385. }
  386. g_free(filter);
  387. }
  388. }
  389. static void
  390. goto_conversation_frame(gboolean dir)
  391. {
  392. gchar *filter;
  393. dfilter_t *dfcode = NULL;
  394. gboolean found_packet = FALSE;
  395. filter = build_conversation_filter(CONV_TCP,FALSE);
  396. if( filter == NULL )
  397. filter = build_conversation_filter(CONV_UDP,FALSE);
  398. if( filter == NULL )
  399. filter = build_conversation_filter(CONV_IP,FALSE);
  400. if( filter == NULL ) {
  401. statusbar_push_temporary_msg("Unable to build conversation filter.");
  402. g_free(filter);
  403. return;
  404. }
  405. if (!dfilter_compile(filter, &dfcode)) {
  406. /* The attempt failed; report an error. */
  407. statusbar_push_temporary_msg("Error compiling filter for this conversation.");
  408. g_free(filter);
  409. return;
  410. }
  411. found_packet = cf_find_packet_dfilter(&cfile, dfcode, dir?SD_BACKWARD:SD_FORWARD);
  412. if (!found_packet) {
  413. /* We didn't find a packet */
  414. statusbar_push_temporary_msg("No previous/next packet in conversation.");
  415. }
  416. dfilter_free(dfcode);
  417. g_free(filter);
  418. }
  419. static void
  420. goto_next_frame_conversation_cb(GtkAction *action _U_, gpointer user_data _U_)
  421. {
  422. goto_conversation_frame(FALSE);
  423. }
  424. static void
  425. goto_previous_frame_conversation_cb(GtkAction *action _U_, gpointer user_data _U_)
  426. {
  427. goto_conversation_frame(TRUE);
  428. }
  429. static void
  430. copy_description_cb(GtkAction *action _U_, gpointer user_data)
  431. {
  432. copy_selected_plist_cb( NULL /* widget _U_ */ , user_data, COPY_SELECTED_DESCRIPTION);
  433. }
  434. static void
  435. copy_fieldname_cb(GtkAction *action _U_, gpointer user_data)
  436. {
  437. copy_selected_plist_cb( NULL /* widget _U_ */ , user_data, COPY_SELECTED_FIELDNAME);
  438. }
  439. static void
  440. copy_value_cb(GtkAction *action _U_, gpointer user_data)
  441. {
  442. copy_selected_plist_cb( NULL /* widget _U_ */ , user_data, COPY_SELECTED_VALUE);
  443. }
  444. static void
  445. copy_as_filter_cb(GtkAction *action _U_, gpointer user_data _U_)
  446. {
  447. /* match_selected_ptree_cb needs the popup_menu_object to get the right object E_DFILTER_TE_KEY */
  448. match_selected_ptree_cb( popup_menu_object, (MATCH_SELECTED_E)(MATCH_SELECTED_REPLACE|MATCH_SELECTED_COPY_ONLY));
  449. }
  450. static void
  451. set_reftime_cb(GtkAction *action _U_, gpointer user_data)
  452. {
  453. reftime_frame_cb( NULL /* widget _U_ */ , user_data, REFTIME_TOGGLE);
  454. }
  455. static void
  456. find_next_ref_time_cb(GtkAction *action _U_, gpointer user_data)
  457. {
  458. reftime_frame_cb( NULL /* widget _U_ */ , user_data, REFTIME_FIND_NEXT);
  459. }
  460. static void
  461. find_previous_ref_time_cb(GtkAction *action _U_, gpointer user_data)
  462. {
  463. reftime_frame_cb( NULL /* widget _U_ */ , user_data, REFTIME_FIND_PREV);
  464. }
  465. static void
  466. menus_prefs_cb(GtkAction *action _U_, gpointer user_data)
  467. {
  468. prefs_page_cb( NULL /* widget _U_ */ , user_data, PREFS_PAGE_USER_INTERFACE);
  469. }
  470. static void
  471. main_toolbar_show_hide_cb(GtkAction *action _U_, gpointer user_data _U_)
  472. {
  473. GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/MainToolbar");
  474. recent.main_toolbar_show = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
  475. main_widgets_show_or_hide();
  476. }
  477. static void
  478. filter_toolbar_show_hide_cb(GtkAction * action _U_, gpointer user_data _U_)
  479. {
  480. GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/FilterToolbar");
  481. recent.filter_toolbar_show = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
  482. main_widgets_show_or_hide();
  483. }
  484. static void
  485. wireless_toolbar_show_hide_cb(GtkAction *action _U_, gpointer user_data _U_)
  486. {
  487. GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/WirelessToolbar");
  488. if(widget) {
  489. recent.wireless_toolbar_show = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
  490. } else {
  491. recent.wireless_toolbar_show = FALSE;
  492. }
  493. main_widgets_show_or_hide();
  494. }
  495. static void
  496. status_bar_show_hide_cb(GtkAction *action _U_, gpointer user_data _U_)
  497. {
  498. GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/StatusBar");
  499. recent.statusbar_show = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
  500. main_widgets_show_or_hide();
  501. }
  502. static void
  503. packet_list_show_hide_cb(GtkAction *action _U_, gpointer user_data _U_)
  504. {
  505. GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/PacketList");
  506. recent.packet_list_show = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
  507. main_widgets_show_or_hide();
  508. }
  509. static void
  510. packet_details_show_hide_cb(GtkAction *action _U_, gpointer user_data _U_)
  511. {
  512. GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/PacketDetails");
  513. recent.tree_view_show = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
  514. main_widgets_show_or_hide();
  515. }
  516. static void
  517. packet_bytes_show_hide_cb(GtkAction *action _U_, gpointer user_data _U_)
  518. {
  519. GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/PacketBytes");
  520. recent.byte_view_show = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
  521. main_widgets_show_or_hide();
  522. }
  523. static void
  524. timestamp_seconds_time_cb(GtkAction *action _U_, gpointer user_data _U_)
  525. {
  526. GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/TimeDisplayFormat/DisplaySecondsWithHoursAndMinutes");
  527. if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) {
  528. recent.gui_seconds_format = TS_SECONDS_HOUR_MIN_SEC;
  529. } else {
  530. recent.gui_seconds_format = TS_SECONDS_DEFAULT;
  531. }
  532. timestamp_set_seconds_type (recent.gui_seconds_format);
  533. /* This call adjusts column width */
  534. cf_timestamp_auto_precision(&cfile);
  535. packet_list_queue_draw();
  536. }
  537. static void
  538. timestamp_format_new_cb (GtkRadioAction *action, GtkRadioAction *current _U_, gpointer user_data _U_)
  539. {
  540. ts_type value;
  541. value = (ts_type) gtk_radio_action_get_current_value (action);
  542. if (recent.gui_time_format != value) {
  543. timestamp_set_type(value);
  544. recent.gui_time_format = value;
  545. /* This call adjusts column width */
  546. cf_timestamp_auto_precision(&cfile);
  547. packet_list_queue_draw();
  548. }
  549. }
  550. static void
  551. timestamp_precision_new_cb (GtkRadioAction *action, GtkRadioAction *current _U_, gpointer user_data _U_)
  552. {
  553. gint value;
  554. value = gtk_radio_action_get_current_value (action);
  555. if (recent.gui_time_precision != value) {
  556. /* the actual precision will be set in packet_list_queue_draw() below */
  557. if (value == TS_PREC_AUTO) {
  558. timestamp_set_precision(TS_PREC_AUTO_SEC);
  559. } else {
  560. timestamp_set_precision(value);
  561. }
  562. recent.gui_time_precision = value;
  563. /* This call adjusts column width */
  564. cf_timestamp_auto_precision(&cfile);
  565. packet_list_queue_draw();
  566. }
  567. }
  568. static void
  569. view_menu_en_for_MAC_cb(GtkAction *action _U_, gpointer user_data)
  570. {
  571. GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/EnableforMACLayer");
  572. if (!widget){
  573. g_warning("view_menu_en_for_MAC_cb: No widget found");
  574. }else{
  575. name_resolution_cb( widget , user_data, &gbl_resolv_flags.mac_name);
  576. }
  577. }
  578. static void
  579. view_menu_en_for_network_cb(GtkAction *action _U_, gpointer user_data)
  580. {
  581. GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/EnableforNetworkLayer");
  582. if (!widget){
  583. g_warning("view_menu_en_for_network_cb: No widget found");
  584. }else{
  585. name_resolution_cb( widget , user_data, &gbl_resolv_flags.network_name);
  586. }
  587. }
  588. static void
  589. view_menu_en_for_transport_cb(GtkAction *action _U_, gpointer user_data)
  590. {
  591. GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/EnableforTransportLayer");
  592. if (!widget){
  593. g_warning("view_menu_en_for_transport_cb: No widget found");
  594. }else{
  595. name_resolution_cb( widget , user_data, &gbl_resolv_flags.transport_name);
  596. }
  597. }
  598. static void
  599. view_menu_en_use_external_resolver_cb(GtkAction *action _U_, gpointer user_data)
  600. {
  601. GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/UseExternalNetworkNameResolver");
  602. if (!widget){
  603. g_warning("view_menu_en_use_external_resolver_cb: No widget found");
  604. }else{
  605. name_resolution_cb( widget , user_data, &gbl_resolv_flags.use_external_net_name_resolver);
  606. }
  607. }
  608. static void
  609. view_menu_colorize_pkt_lst_cb(GtkAction *action _U_, gpointer user_data)
  610. {
  611. GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/ColorizePacketList");
  612. if (!widget){
  613. g_warning("view_menu_colorize_pkt_lst_cb: No widget found");
  614. }else{
  615. colorize_cb( widget , user_data);
  616. }
  617. }
  618. #ifdef HAVE_LIBPCAP
  619. static void
  620. view_menu_auto_scroll_live_cb(GtkAction *action _U_, gpointer user_data _U_)
  621. {
  622. GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/AutoScrollinLiveCapture");
  623. if (!widget){
  624. g_warning("view_menu_auto_scroll_live_cb: No widget found");
  625. }else{
  626. main_auto_scroll_live_changed(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)));
  627. }
  628. }
  629. #endif
  630. static void
  631. view_menu_color_conv_color1_cb(GtkAction *action, gpointer user_data)
  632. {
  633. colorize_conversation_cb(action, user_data, 1*256);
  634. }
  635. static void
  636. view_menu_color_conv_color2_cb(GtkAction *action, gpointer user_data)
  637. {
  638. colorize_conversation_cb(action, user_data, 2*256);
  639. }
  640. static void
  641. view_menu_color_conv_color3_cb(GtkAction *action, gpointer user_data)
  642. {
  643. colorize_conversation_cb(action, user_data, 3*256);
  644. }
  645. static void
  646. view_menu_color_conv_color4_cb(GtkAction *action, gpointer user_data)
  647. {
  648. colorize_conversation_cb(action, user_data, 4*256);
  649. }
  650. static void
  651. view_menu_color_conv_color5_cb(GtkAction *action, gpointer user_data)
  652. {
  653. colorize_conversation_cb(action, user_data, 5*256);
  654. }
  655. static void
  656. view_menu_color_conv_color6_cb(GtkAction *action, gpointer user_data)
  657. {
  658. colorize_conversation_cb(action, user_data, 6*256);
  659. }
  660. static void
  661. view_menu_color_conv_color7_cb(GtkAction *action, gpointer user_data)
  662. {
  663. colorize_conversation_cb(action, user_data, 7*256);
  664. }
  665. static void
  666. view_menu_color_conv_color8_cb(GtkAction *action, gpointer user_data)
  667. {
  668. colorize_conversation_cb(action, user_data, 8*256);
  669. }
  670. static void
  671. view_menu_color_conv_color9_cb(GtkAction *action, gpointer user_data)
  672. {
  673. colorize_conversation_cb(action, user_data, 9*256);
  674. }
  675. static void
  676. view_menu_color_conv_color10_cb(GtkAction *action, gpointer user_data)
  677. {
  678. colorize_conversation_cb(action, user_data, 10*256);
  679. }
  680. static void
  681. view_menu_color_conv_new_rule_cb(GtkAction *action, gpointer user_data)
  682. {
  683. colorize_conversation_cb(action, user_data, 0);
  684. }
  685. static void
  686. view_menu_reset_coloring_cb(GtkAction *action, gpointer user_data)
  687. {
  688. colorize_conversation_cb(action, user_data, 255*256);
  689. }
  690. /*
  691. * TODO Move this menu to capture_if_dlg.c ?
  692. */
  693. #ifdef HAVE_LIBPCAP
  694. static void
  695. capture_if_action_cb(GtkAction *action _U_, gpointer user_data)
  696. {
  697. capture_if_cb(NULL /* GtkWidget *w _U_ */, user_data);
  698. }
  699. static void
  700. capture_prep_action_cb(GtkAction *action _U_, gpointer user_data)
  701. {
  702. capture_prep_cb(NULL /* GtkWidget *w _U_ */, user_data);
  703. }
  704. static void
  705. capture_start_action_cb(GtkAction *action _U_, gpointer user_data)
  706. {
  707. capture_start_cb(NULL /* GtkWidget *w _U_ */, user_data);
  708. }
  709. static void
  710. capture_stop_action_cb(GtkAction *action _U_, gpointer user_data)
  711. {
  712. capture_stop_cb(NULL /* GtkWidget *w _U_ */, user_data);
  713. }
  714. static void
  715. capture_restart_action_cb(GtkAction *action _U_, gpointer user_data)
  716. {
  717. capture_restart_cb(NULL /* GtkWidget *w _U_ */, user_data);
  718. }
  719. static void
  720. capture_filters_action_cb(GtkAction *action _U_, gpointer user_data _U_)
  721. {
  722. cfilter_dialog_cb(NULL /* GtkWidget *w _U_ */);
  723. }
  724. static void
  725. refresh_interfaces_action_cb(GtkAction *action _U_, gpointer user_data _U_)
  726. {
  727. refresh_local_interface_lists();
  728. }
  729. #endif /* HAVE_LIBPCAP */
  730. static void
  731. help_menu_cont_cb(GtkAction *action _U_, gpointer user_data _U_)
  732. {
  733. topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(HELP_CONTENT));
  734. }
  735. static void
  736. help_menu_faq_cb(GtkAction *action _U_, gpointer user_data _U_)
  737. {
  738. topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(ONLINEPAGE_FAQ));
  739. }
  740. static void
  741. help_menu_ask_cb(GtkAction *action _U_, gpointer user_data _U_)
  742. {
  743. topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(ONLINEPAGE_ASK));
  744. }
  745. static void
  746. help_menu_wireshark_cb(GtkAction *action _U_, gpointer user_data _U_)
  747. {
  748. topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_WIRESHARK));
  749. }
  750. static void
  751. help_menu_wireshark_flt_cb(GtkAction *action _U_, gpointer user_data _U_)
  752. {
  753. topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_WIRESHARK_FILTER));
  754. }
  755. static void
  756. help_menu_Capinfos_cb(GtkAction *action _U_, gpointer user_data _U_)
  757. {
  758. topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_CAPINFOS));
  759. }
  760. static void
  761. help_menu_Dumpcap_cb(GtkAction *action _U_, gpointer user_data _U_)
  762. {
  763. topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_DUMPCAP));
  764. }
  765. static void
  766. help_menu_Editcap_cb(GtkAction *action _U_, gpointer user_data _U_)
  767. {
  768. topic_menu_cb(NULL/* widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_EDITCAP));
  769. }
  770. static void
  771. help_menu_Mergecap_cb(GtkAction *action _U_, gpointer user_data _U_)
  772. {
  773. topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_MERGECAP));
  774. }
  775. static void
  776. help_menu_RawShark_cb(GtkAction *action _U_, gpointer user_data _U_)
  777. {
  778. topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_RAWSHARK));
  779. }
  780. static void
  781. help_menu_Reorder_cb(GtkAction *action _U_, gpointer user_data _U_)
  782. {
  783. topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_REORDERCAP));
  784. }
  785. static void
  786. help_menu_Text2pcap_cb(GtkAction *action _U_, gpointer user_data _U_)
  787. {
  788. topic_menu_cb(NULL/* widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_TEXT2PCAP));
  789. }
  790. static void
  791. help_menu_TShark_cb(GtkAction *action _U_, gpointer user_data _U_)
  792. {
  793. topic_menu_cb(NULL/*widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(LOCALPAGE_MAN_TSHARK));
  794. }
  795. static void
  796. help_menu_Website_cb(GtkAction *action _U_, gpointer user_data _U_)
  797. {
  798. topic_menu_cb(NULL/* widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(ONLINEPAGE_HOME));
  799. }
  800. static void
  801. help_menu_Wiki_cb(GtkAction *action _U_, gpointer user_data _U_)
  802. {
  803. topic_menu_cb(NULL/* widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(ONLINEPAGE_WIKI));
  804. }
  805. static void
  806. help_menu_Downloads_cb(GtkAction *action _U_, gpointer user_data _U_)
  807. {
  808. topic_menu_cb(NULL/* widget _U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(ONLINEPAGE_DOWNLOAD));
  809. }
  810. static void
  811. help_menu_SampleCaptures_cb(GtkAction *action _U_, gpointer user_data _U_)
  812. {
  813. topic_menu_cb( NULL/* widget_U_ */, NULL /*GdkEventButton *event _U_*/, GINT_TO_POINTER(ONLINEPAGE_SAMPLE_FILES));
  814. }
  815. #ifdef HAVE_SOFTWARE_UPDATE
  816. static void
  817. check_for_updates_cb(GtkAction *action _U_, gpointer user_data _U_)
  818. {
  819. software_update_check();
  820. }
  821. #endif /* HAVE_SOFTWARE_UPDATE */
  822. static const char *ui_desc_menubar =
  823. "<ui>\n"
  824. " <menubar name ='Menubar'>\n"
  825. " <menu name= 'FileMenu' action='/File'>\n"
  826. " <menuitem name='Open' action='/File/Open'/>\n"
  827. " <menu name='OpenRecent' action='/File/OpenRecent'>\n"
  828. " <placeholder name='RecentFiles'/>\n"
  829. " </menu>\n"
  830. " <menuitem name='Merge' action='/File/Merge'/>\n"
  831. " <menuitem name='ImportFromHexDump' action='/File/ImportFromHexDump'/>\n"
  832. " <menuitem name='Close' action='/File/Close'/>\n"
  833. " <separator/>\n"
  834. " <menuitem name='Save' action='/File/Save'/>\n"
  835. " <menuitem name='SaveAs' action='/File/SaveAs'/>\n"
  836. " <separator/>\n"
  837. " <menu name= 'Set' action='/File/Set'>\n"
  838. " <menuitem name='ListFiles' action='/File/Set/ListFiles'/>\n"
  839. " <menuitem name='NextFile' action='/File/Set/NextFile'/>\n"
  840. " <menuitem name='PreviousFile' action='/File/Set/PreviousFile'/>\n"
  841. " </menu>\n"
  842. " <separator/>\n"
  843. " <menuitem name='ExportSpecifiedPackets' action='/File/ExportSpecifiedPackets'/>\n"
  844. " <menu name= 'ExportPacketDissections' action='/File/ExportPacketDissections'>\n"
  845. " <menuitem name='AsTxt' action='/File/ExportPacketDissections/Text'/>\n"
  846. " <menuitem name='AsPostScript' action='/File/ExportPacketDissections/PostScript'/>\n"
  847. " <menuitem name='AsCSV' action='/File/ExportPacketDissections/CSV'/>\n"
  848. " <menuitem name='AsCArrays' action='/File/ExportPacketDissections/CArrays'/>\n"
  849. " <separator/>\n"
  850. " <menuitem name='AsPSML' action='/File/ExportPacketDissections/PSML'/>\n"
  851. " <menuitem name='AsPDML' action='/File/ExportPacketDissections/PDML'/>\n"
  852. " <separator/>\n"
  853. " </menu>\n"
  854. " <menuitem name='ExportSelectedPacketBytes' action='/File/ExportSelectedPacketBytes'/>\n"
  855. " <menuitem name='ExportPDUs' action='/File/ExportPDUs'/>\n"
  856. " <menuitem name='ExportSSLSessionKeys' action='/File/ExportSSLSessionKeys'/>\n"
  857. " <menu name= 'ExportObjects' action='/File/ExportObjects'>\n"
  858. " <menuitem name='HTTP' action='/File/ExportObjects/HTTP'/>\n"
  859. " <menuitem name='DICOM' action='/File/ExportObjects/DICOM'/>\n"
  860. " <menuitem name='SMB' action='/File/ExportObjects/SMB'/>\n"
  861. " </menu>\n"
  862. " <separator/>\n"
  863. " <menuitem name='Print' action='/File/Print'/>\n"
  864. " <separator/>\n"
  865. " <menuitem name='Quit' action='/File/Quit'/>\n"
  866. " </menu>\n"
  867. " <menu name= 'EditMenu' action='/Edit'>\n"
  868. " <menu name= 'Copy' action='/Edit/Copy'>\n"
  869. " <menuitem name='Description' action='/Edit/Copy/Description'/>\n"
  870. " <menuitem name='Fieldname' action='/Edit/Copy/Fieldname'/>\n"
  871. " <menuitem name='Value' action='/Edit/Copy/Value'/>\n"
  872. " <separator/>\n"
  873. " <menuitem name='AsFilter' action='/Edit/Copy/AsFilter'/>\n"
  874. " </menu>\n"
  875. " <menuitem name='FindPacket' action='/Edit/FindPacket'/>\n"
  876. " <menuitem name='FindNext' action='/Edit/FindNext'/>\n"
  877. " <menuitem name='FindPrevious' action='/Edit/FindPrevious'/>\n"
  878. " <separator/>\n"
  879. " <menuitem name='MarkPacket' action='/Edit/MarkPacket'/>\n"
  880. " <menuitem name='MarkAllDisplayedPackets' action='/Edit/MarkAllDisplayedPackets'/>\n"
  881. " <menuitem name='UnmarkAllDisplayedPackets' action='/Edit/UnmarkAllDisplayedPackets'/>\n"
  882. " <menuitem name='FindNextMark' action='/Edit/FindNextMark'/>\n"
  883. " <menuitem name='FindPreviousMark' action='/Edit/FindPreviousMark'/>\n"
  884. " <separator/>\n"
  885. " <menuitem name='IgnorePacket' action='/Edit/IgnorePacket'/>\n"
  886. " <menuitem name='IgnoreAllDisplayedPackets' action='/Edit/IgnoreAllDisplayedPackets'/>\n"
  887. " <menuitem name='Un-IgnoreAllPackets' action='/Edit/Un-IgnoreAllPackets'/>\n"
  888. " <separator/>\n"
  889. " <menuitem name='SetTimeReference' action='/Edit/SetTimeReference'/>\n"
  890. " <menuitem name='Un-TimeReferenceAllPackets' action='/Edit/Un-TimeReferenceAllPackets'/>\n"
  891. " <menuitem name='FindNextTimeReference' action='/Edit/FindNextTimeReference'/>\n"
  892. " <menuitem name='FindPreviousTimeReference' action='/Edit/FindPreviousTimeReference'/>\n"
  893. " <separator/>\n"
  894. " <menuitem name='TimeShift' action='/Edit/TimeShift'/>\n"
  895. " <separator/>\n"
  896. #ifdef WANT_PACKET_EDITOR
  897. " <menuitem name='EditPacket' action='/Edit/EditPacket'/>\n"
  898. #endif
  899. " <menuitem name='AddEditPktComment' action='/Edit/AddEditPktComment'/>\n"
  900. " <separator/>\n"
  901. " <menuitem name='ConfigurationProfiles' action='/Edit/ConfigurationProfiles'/>\n"
  902. " <menuitem name='Preferences' action='/Edit/Preferences'/>\n"
  903. " </menu>\n"
  904. " <menu name= 'ViewMenu' action='/View'>\n"
  905. " <menuitem name='MainToolbar' action='/View/MainToolbar'/>\n"
  906. " <menuitem name='FilterToolbar' action='/View/FilterToolbar'/>\n"
  907. " <menuitem name='WirelessToolbar' action='/View/WirelessToolbar'/>\n"
  908. " <menuitem name='StatusBar' action='/View/StatusBar'/>\n"
  909. " <separator/>\n"
  910. " <menuitem name='PacketList' action='/View/PacketList'/>\n"
  911. " <menuitem name='PacketDetails' action='/View/PacketDetails'/>\n"
  912. " <menuitem name='PacketBytes' action='/View/PacketBytes'/>\n"
  913. " <separator/>\n"
  914. " <menu name= 'TimeDisplayFormat' action='/View/TimeDisplayFormat'>\n"
  915. " <menuitem name='DateandTimeofDay' action='/View/TimeDisplayFormat/DateandTimeofDay'/>\n"
  916. " <menuitem name='TimeofDay' action='/View/TimeDisplayFormat/TimeofDay'/>\n"
  917. " <menuitem name='SecondsSinceEpoch' action='/View/TimeDisplayFormat/SecondsSinceEpoch'/>\n"
  918. " <menuitem name='SecondsSinceBeginningofCapture' action='/View/TimeDisplayFormat/SecondsSinceBeginningofCapture'/>\n"
  919. " <menuitem name='SecondsSincePreviousCapturedPacket' action='/View/TimeDisplayFormat/SecondsSincePreviousCapturedPacket'/>\n"
  920. " <menuitem name='SecondsSincePreviousDisplayedPacket' action='/View/TimeDisplayFormat/SecondsSincePreviousDisplayedPacket'/>\n"
  921. " <menuitem name='UTCDateandTimeofDay' action='/View/TimeDisplayFormat/UTCDateandTimeofDay'/>\n"
  922. " <menuitem name='UTCTimeofDay' action='/View/TimeDisplayFormat/UTCTimeofDay'/>\n"
  923. " <separator/>\n"
  924. " <menuitem name='FileFormatPrecision-Automatic' action='/View/TimeDisplayFormat/FileFormatPrecision-Automatic'/>\n"
  925. " <menuitem name='FileFormatPrecision-Seconds' action='/View/TimeDisplayFormat/FileFormatPrecision-Seconds'/>\n"
  926. " <menuitem name='FileFormatPrecision-Deciseconds' action='/View/TimeDisplayFormat/FileFormatPrecision-Deciseconds'/>\n"
  927. " <menuitem name='FileFormatPrecision-Centiseconds' action='/View/TimeDisplayFormat/FileFormatPrecision-Centiseconds'/>\n"
  928. " <menuitem name='FileFormatPrecision-Milliseconds' action='/View/TimeDisplayFormat/FileFormatPrecision-Milliseconds'/>\n"
  929. " <menuitem name='FileFormatPrecision-Microseconds' action='/View/TimeDisplayFormat/FileFormatPrecision-Microseconds'/>\n"
  930. " <menuitem name='FileFormatPrecision-Nanoseconds' action='/View/TimeDisplayFormat/FileFormatPrecision-Nanoseconds'/>\n"
  931. " <separator/>\n"
  932. " <menuitem name='DisplaySecondsWithHoursAndMinutes' action='/View/TimeDisplayFormat/DisplaySecondsWithHoursAndMinutes'/>\n"
  933. " </menu>\n"
  934. " <menu name= 'NameResolution' action='/View/NameResolution'>\n"
  935. " <menuitem name='ResolveName' action='/View/NameResolution/ResolveName'/>\n"
  936. " <menuitem name='ManuallyResolveName' action='/View/NameResolution/ManuallyResolveName'/>\n"
  937. " <separator/>\n"
  938. " <menuitem name='EnableforMACLayer' action='/View/NameResolution/EnableforMACLayer'/>\n"
  939. " <menuitem name='EnableforTransportLayer' action='/View/NameResolution/EnableforTransportLayer'/>\n"
  940. " <menuitem name='EnableforNetworkLayer' action='/View/NameResolution/EnableforNetworkLayer'/>\n"
  941. " <menuitem name='UseExternalNetworkNameResolver' action='/View/NameResolution/UseExternalNetworkNameResolver'/>\n"
  942. " </menu>\n"
  943. " <menuitem name='ColorizePacketList' action='/View/ColorizePacketList'/>\n"
  944. #ifdef HAVE_LIBPCAP
  945. " <menuitem name='AutoScrollinLiveCapture' action='/View/AutoScrollinLiveCapture'/>\n"
  946. #endif
  947. " <separator/>\n"
  948. " <menuitem name='ZoomIn' action='/View/ZoomIn'/>\n"
  949. " <menuitem name='ZoomOut' action='/View/ZoomOut'/>\n"
  950. " <menuitem name='NormalSize' action='/View/NormalSize'/>\n"
  951. " <separator/>\n"
  952. " <menuitem name='ResizeAllColumns' action='/View/ResizeAllColumns'/>\n"
  953. " <menuitem name='DisplayedColumns' action='/View/DisplayedColumns'/>\n"
  954. " <separator/>\n"
  955. " <menuitem name='ExpandSubtrees' action='/View/ExpandSubtrees'/>\n"
  956. " <menuitem name='ExpandAll' action='/View/ExpandAll'/>\n"
  957. " <menuitem name='CollapseAll' action='/View/CollapseAll'/>\n"
  958. " <separator/>\n"
  959. " <menu name= 'ColorizeConversation' action='/View/ColorizeConversation'>\n"
  960. " <menuitem name='Color1' action='/View/ColorizeConversation/Color 1'/>\n"
  961. " <menuitem name='Color2' action='/View/ColorizeConversation/Color 2'/>\n"
  962. " <menuitem name='Color3' action='/View/ColorizeConversation/Color 3'/>\n"
  963. " <menuitem name='Color4' action='/View/ColorizeConversation/Color 4'/>\n"
  964. " <menuitem name='Color5' action='/View/ColorizeConversation/Color 5'/>\n"
  965. " <menuitem name='Color6' action='/View/ColorizeConversation/Color 6'/>\n"
  966. " <menuitem name='Color7' action='/View/ColorizeConversation/Color 7'/>\n"
  967. " <menuitem name='Color8' action='/View/ColorizeConversation/Color 8'/>\n"
  968. " <menuitem name='Color9' action='/View/ColorizeConversation/Color 9'/>\n"
  969. " <menuitem name='Color10' action='/View/ColorizeConversation/Color 10'/>\n"
  970. " <menuitem name='NewColoringRule' action='/View/ColorizeConversation/NewColoringRule'/>\n"
  971. " </menu>\n"
  972. " <separator/>\n"
  973. " <menuitem name='ResetColoring1-10' action='/View/ResetColoring1-10'/>\n"
  974. " <menuitem name='ColoringRules' action='/View/ColoringRules'/>\n"
  975. " <separator/>\n"
  976. " <menuitem name='ShowPacketinNewWindow' action='/View/ShowPacketinNewWindow'/>\n"
  977. " <menuitem name='Reload' action='/View/Reload'/>\n"
  978. " </menu>\n"
  979. " <menu name= 'GoMenu' action='/Go'>\n"
  980. " <menuitem name='Back' action='/Go/Back'/>\n"
  981. " <menuitem name='Forward' action='/Go/Forward'/>\n"
  982. " <menuitem name='Goto' action='/Go/Goto'/>\n"
  983. " <menuitem name='GotoCorrespondingPacket' action='/Go/GotoCorrespondingPacket'/>\n"
  984. " <separator/>\n"
  985. " <menuitem name='PreviousPacket' action='/Go/PreviousPacket'/>\n"
  986. " <menuitem name='NextPacket' action='/Go/NextPacket'/>\n"
  987. " <menuitem name='FirstPacket' action='/Go/FirstPacket'/>\n"
  988. " <menuitem name='LastPacket' action='/Go/LastPacket'/>\n"
  989. " <menuitem name='PreviousPacketInConversation' action='/Go/PreviousPacketInConversation'/>\n"
  990. " <menuitem name='NextPacketInConversation' action='/Go/NextPacketInConversation'/>\n"
  991. " </menu>\n"
  992. #ifdef HAVE_LIBPCAP
  993. " <menu name= 'CaptureMenu' action='/Capture'>\n"
  994. " <menuitem name='Interfaces' action='/Capture/Interfaces'/>\n"
  995. " <menuitem name='Options' action='/Capture/Options'/>\n"
  996. " <menuitem name='Start' action='/Capture/Start'/>\n"
  997. " <menuitem name='Stop' action='/Capture/Stop'/>\n"
  998. " <menuitem name='Restart' action='/Capture/Restart'/>\n"
  999. " <menuitem name='CaptureFilters' action='/Capture/CaptureFilters'/>\n"
  1000. " <menuitem name='RefreshInterfaces' action='/Capture/RefreshInterfaces'/>\n"
  1001. " </menu>\n"
  1002. #endif
  1003. " <menu name= 'AnalyzeMenu' action='/Analyze'>\n"
  1004. " <menuitem name='DisplayFilters' action='/Analyze/DisplayFilters'/>\n"
  1005. " <menuitem name='DisplayFilterMacros' action='/Analyze/DisplayFilterMacros'/>\n"
  1006. " <separator/>\n"
  1007. " <menuitem name='ApplyasColumn' action='/Analyze/ApplyasColumn'/>\n"
  1008. " <menu name= 'ApplyAsFilter' action='/ApplyasFilter'>\n"
  1009. " <menuitem name='Selected' action='/ApplyasFilter/Selected'/>\n"
  1010. " <menuitem name='NotSelected' action='/ApplyasFilter/Not Selected'/>\n"
  1011. " <menuitem name='AndSelected' action='/ApplyasFilter/AndSelected'/>\n"
  1012. " <menuitem name='OrSelected' action='/ApplyasFilter/OrSelected'/>\n"
  1013. " <menuitem name='AndNotSelected' action='/ApplyasFilter/AndNotSelected'/>\n"
  1014. " <menuitem name='OrNotSelected' action='/ApplyasFilter/OrNotSelected'/>\n"
  1015. " </menu>\n"
  1016. " <menu name= 'PrepareaFilter' action='/PrepareaFilter'>\n"
  1017. " <menuitem name='Selected' action='/PrepareaFilter/Selected'/>\n"
  1018. " <menuitem name='NotSelected' action='/PrepareaFilter/Not Selected'/>\n"
  1019. " <menuitem name='AndSelected' action='/PrepareaFilter/AndSelected'/>\n"
  1020. " <menuitem name='OrSelected' action='/PrepareaFilter/OrSelected'/>\n"
  1021. " <menuitem name='AndNotSelected' action='/PrepareaFilter/AndNotSelected'/>\n"
  1022. " <menuitem name='OrNotSelected' action='/PrepareaFilter/OrNotSelected'/>\n"
  1023. " </menu>\n"
  1024. " <separator/>\n"
  1025. " <menuitem name='EnabledProtocols' action='/Analyze/EnabledProtocols'/>\n"
  1026. " <menuitem name='DecodeAs' action='/Analyze/DecodeAs'/>\n"
  1027. " <menuitem name='UserSpecifiedDecodes' action='/Analyze/UserSpecifiedDecodes'/>\n"
  1028. " <separator/>\n"
  1029. " <menuitem name='FollowTCPStream' action='/Analyze/FollowTCPStream'/>\n"
  1030. " <menuitem name='FollowUDPStream' action='/Analyze/FollowUDPStream'/>\n"
  1031. " <menuitem name='FollowSSLStream' action='/Analyze/FollowSSLStream'/>\n"
  1032. " <menuitem name='ExpertInfo' action='/Analyze/ExpertInfo'/>\n"
  1033. " <menu name= 'ConversationFilterMenu' action='/Analyze/ConversationFilter'>\n"
  1034. " <placeholder name='Filters'/>\n"
  1035. " </menu>\n"
  1036. " </menu>\n"
  1037. " <menu name= 'StatisticsMenu' action='/Statistics'>\n"
  1038. " <menuitem name='Summary' action='/Statistics/Summary'/>\n"
  1039. " <menuitem name='ShowCommentsSummary' action='/Statistics/CommentsSummary'/>\n"
  1040. " <menuitem name='ShowAddreRes' action='/Statistics/ShowAddreRes'/>\n"
  1041. " <menuitem name='ProtocolHierarchy' action='/Statistics/ProtocolHierarchy'/>\n"
  1042. " <menuitem name='Conversations' action='/Statistics/Conversations'/>\n"
  1043. " <menuitem name='Endpoints' action='/Statistics/Endpoints'/>\n"
  1044. " <menuitem name='PacketLengths' action='/Statistics/plen'/>\n"
  1045. " <menuitem name='IOGraphs' action='/Statistics/IOGraphs'/>\n"
  1046. " <separator/>\n"
  1047. " <menu name= 'ConversationListMenu' action='/Statistics/ConversationList'>\n"
  1048. " <menuitem name='Ethernet' action='/Statistics/ConversationList/Ethernet'/>\n"
  1049. " <menuitem name='FibreChannel' action='/Statistics/ConversationList/FibreChannel'/>\n"
  1050. " <menuitem name='FDDI' action='/Statistics/ConversationList/FDDI'/>\n"
  1051. " <menuitem name='IP' action='/Statistics/ConversationList/IP'/>\n"
  1052. " <menuitem name='IPv6' action='/Statistics/ConversationList/IPv6'/>\n"
  1053. " <menuitem name='IPX' action='/Statistics/ConversationList/IPX'/>\n"
  1054. " <menuitem name='JXTA' action='/Statistics/ConversationList/JXTA'/>\n"
  1055. " <menuitem name='NCP' action='/Statistics/ConversationList/NCP'/>\n"
  1056. " <menuitem name='RSVP' action='/Statistics/ConversationList/RSVP'/>\n"
  1057. " <menuitem name='SCTP' action='/Statistics/ConversationList/SCTP'/>\n"
  1058. " <menuitem name='TCPIP' action='/Statistics/ConversationList/TCPIP'/>\n"
  1059. " <menuitem name='TR' action='/Statistics/ConversationList/TR'/>\n"
  1060. " <menuitem name='UDPIP' action='/Statistics/ConversationList/UDPIP'/>\n"
  1061. " <menuitem name='USB' action='/Statistics/ConversationList/USB'/>\n"
  1062. " <menuitem name='WLAN' action='/Statistics/ConversationList/WLAN'/>\n"
  1063. " </menu>\n"
  1064. " <menu name= 'EndpointListMenu' action='/Statistics/EndpointList'>\n"
  1065. " <menuitem name='Ethernet' action='/Statistics/EndpointList/Ethernet'/>\n"
  1066. " <menuitem name='FibreChannel' action='/Statistics/EndpointList/FibreChannel'/>\n"
  1067. " <menuitem name='FDDI' action='/Statistics/EndpointList/FDDI'/>\n"
  1068. " <menuitem name='IP' action='/Statistics/EndpointList/IP'/>\n"
  1069. " <menuitem name='IPv6' action='/Statistics/EndpointList/IPv6'/>\n"
  1070. " <menuitem name='IPX' action='/Statistics/EndpointList/IPX'/>\n"
  1071. " <menuitem name='JXTA' action='/Statistics/EndpointList/JXTA'/>\n"
  1072. " <menuitem name='NCP' action='/Statistics/EndpointList/NCP'/>\n"
  1073. " <menuitem name='RSVP' action='/Statistics/EndpointList/RSVP'/>\n"
  1074. " <menuitem name='SCTP' action='/Statistics/EndpointList/SCTP'/>\n"
  1075. " <menuitem name='TCPIP' action='/Statistics/EndpointList/TCPIP'/>\n"
  1076. " <menuitem name='TR' action='/Statistics/EndpointList/TR'/>\n"
  1077. " <menuitem name='UDPIP' action='/Statistics/EndpointList/UDPIP'/>\n"
  1078. " <menuitem name='USB' action='/Statistics/EndpointList/USB'/>\n"
  1079. " <menuitem name='WLAN' action='/Statistics/EndpointList/WLAN'/>\n"
  1080. " </menu>\n"
  1081. " <menu name='ServiceResponseTimeMenu' action='/Statistics/ServiceResponseTime'>\n"
  1082. " <menuitem name='DCE-RPC' action='/Statistics/ServiceResponseTime/DCE-RPC'/>\n"
  1083. " <menuitem name='ONC-RPC' action='/Statistics/ServiceResponseTime/ONC-RPC'/>\n"
  1084. " </menu>\n"
  1085. " <separator/>\n"
  1086. " <menuitem name='ANCP' action='/Statistics/ancp'/>\n"
  1087. " <menu name= 'BACnetMenu' action='/Statistics/BACnet'>\n"
  1088. " <menuitem name='bacapp_instanceid' action='/Statistics/BACnet/bacapp_instanceid'/>\n"
  1089. " <menuitem name='bacapp_ip' action='/Statistics/BACnet/bacapp_ip'/>\n"
  1090. " <menuitem name='bacapp_objectid' action='/Statistics/BACnet/bacapp_objectid'/>\n"
  1091. " <menuitem name='bacapp_service' action='/Statistics/BACnet/bacapp_service'/>\n"
  1092. " </menu>\n"
  1093. " <menuitem name='Collectd' action='/Statistics/collectd'/>\n"
  1094. " <menuitem name='Compare' action='/Statistics/compare'/>\n"
  1095. " <menuitem name='FlowGraph' action='/Statistics/FlowGraph'/>\n"
  1096. " <menuitem name='HART-IP' action='/Statistics/hart_ip'/>\n"
  1097. " <menu name= 'HTTPMenu' action='/Statistics/HTTP'>\n"
  1098. " <menuitem name='http' action='/Statistics/HTTP/http'/>\n"
  1099. " <menuitem name='http_req' action='/Statistics/HTTP/http_req'/>\n"
  1100. " <menuitem name='http_srv' action='/Statistics/HTTP/http_srv'/>\n"
  1101. " </menu>\n"
  1102. " <menuitem name='ONC-RPC-Programs' action='/Statistics/ONC-RPC-Programs'/>\n"
  1103. " <menu name= 'SametimeMenu' action='/Statistics/Sametime'>\n"
  1104. " <menuitem name='sametime' action='/Statistics/Sametime/sametime'/>\n"
  1105. " </menu>\n"
  1106. " <menu name= 'TCPStreamGraphMenu' action='/Statistics/TCPStreamGraphMenu'>\n"
  1107. " <menuitem name='Sequence-Graph-Stevens' action='/Statistics/TCPStreamGraphMenu/Time-Sequence-Graph-Stevens'/>\n"
  1108. " <menuitem name='Sequence-Graph-tcptrace' action='/Statistics/TCPStreamGraphMenu/Time-Sequence-Graph-tcptrace'/>\n"
  1109. " <menuitem name='Throughput-Graph' action='/Statistics/TCPStreamGraphMenu/Throughput-Graph'/>\n"
  1110. " <menuitem name='RTT-Graph' action='/Statistics/TCPStreamGraphMenu/RTT-Graph'/>\n"
  1111. " <menuitem name='Window-Scaling-Graph' action='/Statistics/TCPStreamGraphMenu/Window-Scaling-Graph'/>\n"
  1112. " </menu>\n"
  1113. " <menuitem name='UDPMulticastStreams' action='/Statistics/UDPMulticastStreams'/>\n"
  1114. " <menuitem name='WLANTraffic' action='/Statistics/WLANTraffic'/>\n"
  1115. " </menu>\n"
  1116. " <menu name= 'TelephonyMenu' action='/Telephony'>\n"
  1117. " <menu name= 'ANSI' action='/Telephony/ANSI'>\n"
  1118. " <menuitem name='BSMAP' action='/Telephony/ANSI/BSMAP'/>\n"
  1119. " <menuitem name='DTAP' action='/Telephony/ANSI/DTAP'/>\n"
  1120. " <menuitem name='MAP-OP' action='/Telephony/ANSI/MAP-OP'/>\n"
  1121. " </menu>\n"
  1122. " <menu name= 'GSM' action='/Telephony/GSM'>\n"
  1123. " <menuitem name='BSSMAP' action='/Telephony/GSM/BSSMAP'/>\n"
  1124. " <menu name='GSM-DTAP' action='/Telephony/GSM/DTAP'>\n"
  1125. " <menuitem name='CallControl' action='/Telephony/GSM/DTAP/CC'/>\n"
  1126. " <menuitem name='GPRS-MM' action='/Telephony/GSM/DTAP/GMM'/>\n"
  1127. " <menuitem name='GPRS-SM' action='/Telephony/GSM/DTAP/SM'/>\n"
  1128. " <menuitem name='MM' action='/Telephony/GSM/DTAP/MM'/>\n"
  1129. " <menuitem name='RR' action='/Telephony/GSM/DTAP/RR'/>\n"
  1130. " <menuitem name='SMS' action='/Telephony/GSM/DTAP/SMS'/>\n"
  1131. " <menuitem name='TP' action='/Telephony/GSM/DTAP/TP'/>\n"
  1132. " <menuitem name='SS' action='/Telephony/GSM/DTAP/SS'/>\n"
  1133. " </menu>\n"
  1134. " <menuitem name='SACCH' action='/Telephony/GSM/SACCH'/>\n"
  1135. " <menuitem name='MAP-OP' action='/Telephony/GSM/MAP-OP'/>\n"
  1136. " <menuitem name='MAP-Summary' action='/Telephony/GSM/MAPSummary'/>\n"
  1137. " </menu>\n"
  1138. " <menu name= 'IAX2menu' action='/Telephony/IAX2'>\n"
  1139. " <menuitem name='StreamAnalysis' action='/Telephony/IAX2/StreamAnalysis'/>\n"
  1140. " </menu>\n"
  1141. " <menuitem name='ISUP' action='/Telephony/isup_msg'/>\n"
  1142. " <menu name= 'LTEmenu' action='/Telephony/LTE'>\n"
  1143. " <menuitem name='LTE_RLC_Graph' action='/Telephony/LTE/RLCGraph'/>\n"
  1144. " </menu>\n"
  1145. " <menu name= 'MTP3menu' action='/Telephony/MTP3'>\n"
  1146. " <menuitem name='MSUs' action='/Telephony/MTP3/MSUs'/>\n"
  1147. " <menuitem name='MSUSummary' action='/Telephony/MTP3/MSUSummary'/>\n"
  1148. " </menu>\n"
  1149. " <menu name= 'RTPmenu' action='/Telephony/RTP'>\n"
  1150. " <menuitem name='ShowAllStreams' action='/Telephony/RTP/ShowAllStreams'/>\n"
  1151. " <menuitem name='StreamAnalysis' action='/Telephony/RTP/StreamAnalysis'/>\n"
  1152. " </menu>\n"
  1153. " <menu name= 'RTSPmenu' action='/Telephony/RTSP'>\n"
  1154. " <menuitem name='rtsp' action='/Telephony/RTSP/rtsp'/>\n"
  1155. " </menu>\n"
  1156. " <menu name= 'SCTPmenu' action='/Telephony/SCTP'>\n"
  1157. " <menuitem name='AnalysethisAssociation' action='/Telephony/SCTP/AnalysethisAssociation'/>\n"
  1158. " <menuitem name='ShowAllAssociations' action='/Telephony/SCTP/ShowAllAssociations'/>\n"
  1159. " </menu>\n"
  1160. " <menuitem name='SMPP' action='/Telephony/smpp_commands'/>\n"
  1161. " <menuitem name='UCP' action='/Telephony/ucp_messages'/>\n"
  1162. " <menuitem name='VoIPCalls' action='/Telephony/VoIPCalls'/>\n"
  1163. " </menu>\n"
  1164. " <menu name= 'ToolsMenu' action='/Tools'>\n"
  1165. " <menuitem name='FirewallACLRules' action='/Tools/FirewallACLRules'/>\n"
  1166. " </menu>\n"
  1167. " <menu name= 'InternalsMenu' action='/Internals'>\n"
  1168. " <menuitem name='Dissectortables' action='/Internals/Dissectortables'/>\n"
  1169. " <menuitem name='SupportedProtocols' action='/Internals/SupportedProtocols'/>\n"
  1170. " </menu>\n"
  1171. " <menu name= 'HelpMenu' action='/Help'>\n"
  1172. " <menuitem name='Contents' action='/Help/Contents'/>\n"
  1173. " <menu name= 'ManualPages' action='/Help/ManualPages'>\n"
  1174. " <menuitem name='Wireshark' action='/Help/ManualPages/Wireshark'/>\n"
  1175. " <menuitem name='WiresharkFilter' action='/Help/ManualPages/WiresharkFilter'/>\n"
  1176. " <separator/>\n"
  1177. " <menuitem name='Capinfos' action='/Help/ManualPages/Capinfos'/>\n"
  1178. " <menuitem name='Dumpcap' action='/Help/ManualPages/Dumpcap'/>\n"
  1179. " <menuitem name='Editcap' action='/Help/ManualPages/Editcap'/>\n"
  1180. " <menuitem name='Mergecap' action='/Help/ManualPages/Mergecap'/>\n"
  1181. " <menuitem name='RawShark' action='/Help/ManualPages/RawShark'/>\n"
  1182. " <menuitem name='Reordercap' action='/Help/ManualPages/Reordercap'/>\n"
  1183. " <menuitem name='Text2pcap' action='/Help/ManualPages/Text2pcap'/>\n"
  1184. " <menuitem name='TShark' action='/Help/ManualPages/TShark'/>\n"
  1185. " </menu>\n"
  1186. " <separator/>\n"
  1187. " <menuitem name='Website' action='/Help/Website'/>\n"
  1188. " <menuitem name='FAQs' action='/Help/FAQs'/>\n"
  1189. " <menuitem name='Ask' action='/Help/ASK'/>\n"
  1190. " <menuitem name='Downloads' action='/Help/Downloads'/>\n"
  1191. " <separator/>\n"
  1192. " <menuitem name='Wiki' action='/Help/Wiki'/>\n"
  1193. " <menuitem name='SampleCaptures' action='/Help/SampleCaptures'/>\n"
  1194. #ifdef HAVE_SOFTWARE_UPDATE
  1195. " <separator/>\n"
  1196. " <menuitem name='CheckForUpdates' action='/Help/CheckForUpdates'/>\n"
  1197. #endif /* HAVE_SOFTWARE_UPDATE */
  1198. " <separator/>\n"
  1199. " <menuitem name='AboutWireshark' action='/Help/AboutWireshark'/>\n"
  1200. " </menu>\n"
  1201. " </menubar>\n"
  1202. "</ui>\n";
  1203. /*
  1204. * Main menu.
  1205. *
  1206. * Please do not use keystrokes that are used as "universal" shortcuts in
  1207. * various desktop environments:
  1208. *
  1209. * Windows:
  1210. * http://support.microsoft.com/kb/126449
  1211. *
  1212. * GNOME:
  1213. * http://library.gnome.org/users/user-guide/nightly/keyboard-skills.html.en
  1214. *
  1215. * KDE:
  1216. * http://developer.kde.org/documentation/standards/kde/style/keys/shortcuts.html
  1217. *
  1218. * In particular, do not use the following <control> sequences for anything
  1219. * other than their standard purposes:
  1220. *
  1221. * <control>O File->Open
  1222. * <control>S File->Save
  1223. * <control>P File->Print
  1224. * <control>W File->Close
  1225. * <control>Q File->Quit
  1226. * <control>Z Edit->Undo (which we don't currently have)
  1227. * <control>X Edit->Cut (which we don't currently have)
  1228. * <control>C Edit->Copy (which we don't currently have)
  1229. * <control>V Edit->Paste (which we don't currently have)
  1230. * <control>A Edit->Select All (which we don't currently have)
  1231. *
  1232. * Note that some if not all of the Edit keys above already perform those
  1233. * functions in text boxes, such as the Filter box. Do no, under any
  1234. * circumstances, make a change that keeps them from doing so.
  1235. */
  1236. /*
  1237. * GtkActionEntry
  1238. * typedef struct {
  1239. * const gchar *name;
  1240. * const gchar *stock_id;
  1241. * const gchar *label;
  1242. * const gchar *accelerator;
  1243. * const gchar *tooltip;
  1244. * GCallback callback;
  1245. * } GtkActionEntry;
  1246. * const gchar *name; The name of the action.
  1247. * const gchar *stock_id; The stock id for the action, or the name of an icon from the icon theme.
  1248. * const gchar *label; The label for the action. This field should typically be marked for translation,
  1249. * see gtk_action_group_set_translation_domain().
  1250. * If label is NULL, the label of the stock item with id stock_id is used.
  1251. * const gchar *accelerator; The accelerator for the action, in the format understood by gtk_accelerator_parse().
  1252. * const gchar *tooltip; The tooltip for the action. This field should typically be marked for translation,
  1253. * see gtk_action_group_set_translation_domain().
  1254. * GCallback callback; The function to call when the action is activated.
  1255. *
  1256. */
  1257. #ifdef HAVE_LIBPCAP
  1258. /*
  1259. * TODO Move this menu to capture_if_dlg.c
  1260. * eg put a "place holder" in the UI description and
  1261. * make a call from main_menubar.c i.e build_capture_menu()
  1262. * ad do the UI stuff there.
  1263. */
  1264. static const GtkActionEntry capture_menu_entries[] = {
  1265. { "/Capture", NULL, "_Capture", NULL, NULL, NULL },
  1266. { "/Capture/Interfaces", WIRESHARK_STOCK_CAPTURE_INTERFACES, "_Interfaces...", "<control>I", NULL, G_CALLBACK(capture_if_action_cb) },
  1267. { "/Capture/Options", WIRESHARK_STOCK_CAPTURE_OPTIONS, "_Options...", "<control>K", NULL, G_CALLBACK(capture_prep_action_cb) },
  1268. { "/Capture/Start", WIRESHARK_STOCK_CAPTURE_START, "_Start", "<control>E", NULL, G_CALLBACK(capture_start_action_cb) },
  1269. { "/Capture/Stop", WIRESHARK_STOCK_CAPTURE_STOP, "S_top", "<control>E", NULL, G_CALLBACK(capture_stop_action_cb) },
  1270. { "/Capture/Restart", WIRESHARK_STOCK_CAPTURE_RESTART, "_Restart", "<control>R", NULL, G_CALLBACK(capture_restart_action_cb) },
  1271. { "/Capture/CaptureFilters", WIRESHARK_STOCK_CAPTURE_FILTER, "Capture _Filters...", NULL, NULL, G_CALLBACK(capture_filters_action_cb) },
  1272. { "/Capture/RefreshInterfaces", GTK_STOCK_REFRESH, "Refresh Interfaces", NULL, NULL, G_CALLBACK(refresh_interfaces_action_cb) },
  1273. };
  1274. #endif
  1275. static const GtkActionEntry main_menu_bar_entries[] = {
  1276. /* Top level */
  1277. { "/File", NULL, "_File", NULL, NULL, NULL },
  1278. { "/Edit", NULL, "_Edit", NULL, NULL, NULL },
  1279. { "/View", NULL, "_View", NULL, NULL, NULL },
  1280. { "/Go", NULL, "_Go", NULL, NULL, NULL },
  1281. { "/Analyze", NULL, "_Analyze", NULL, NULL, NULL },
  1282. { "/Statistics", NULL, "_Statistics", NULL, NULL, NULL },
  1283. { "/Telephony", NULL, "Telephon_y", NULL, NULL, NULL },
  1284. { "/Tools", NULL, "_Tools", NULL, NULL, NULL },
  1285. { "/Internals", NULL, "_Internals", NULL, NULL, NULL },
  1286. { "/Help", NULL, "_Help", NULL, NULL, NULL },
  1287. { "/File/Open", GTK_STOCK_OPEN, "_Open...", "<control>O", "Open a file", G_CALLBACK(file_open_cmd_cb) },
  1288. { "/File/OpenRecent", NULL, "Open _Recent", NULL, NULL, NULL },
  1289. { "/File/Merge", NULL, "_Merge...", NULL, NULL, G_CALLBACK(file_merge_cmd_cb) },
  1290. { "/File/ImportFromHexDump", NULL, "_Import from Hex Dump...", NULL, NULL, G_CALLBACK(file_import_cmd_cb) },
  1291. { "/File/Close", GTK_STOCK_CLOSE, "_Close", "<control>W", NULL, G_CALLBACK(file_close_cmd_cb) },
  1292. { "/File/Save", WIRESHARK_STOCK_SAVE, "_Save", "<control>S", NULL, G_CALLBACK(file_save_cmd_cb) },
  1293. { "/File/SaveAs", WIRESHARK_STOCK_SAVE, "Save _As...", "<shift><control>S", NULL, G_CALLBACK(file_save_as_cmd_cb) },
  1294. { "/File/Set", NULL, "File Set", NULL, NULL, NULL },
  1295. { "/File/ExportSpecifiedPackets", NULL, "Export Specified Packets...", NULL, NULL, G_CALLBACK(file_export_specified_packets_cmd_cb) },
  1296. { "/File/ExportPacketDissections", NULL, "Export Packet Dissections", NULL, NULL, NULL },
  1297. { "/File/ExportSelectedPacketBytes", NULL, "Export Selected Packet _Bytes...", "<control>H", NULL, G_CALLBACK(savehex_cb) },
  1298. { "/File/ExportPDUs", NULL, "Export PDUs to file", NULL, NULL, G_CALLBACK(export_pdu_show_cb) },
  1299. { "/File/ExportSSLSessionKeys", NULL, "Export SSL Session Keys...", NULL, NULL, G_CALLBACK(savesslkeys_cb) },
  1300. { "/File/ExportObjects", NULL, "Export Objects", NULL, NULL, NULL },
  1301. { "/File/Print", GTK_STOCK_PRINT, "_Print...", "<control>P", NULL, G_CALLBACK(file_print_cmd_cb) },
  1302. { "/File/Quit", GTK_STOCK_QUIT, "_Quit", "<control>Q", NULL, G_CALLBACK(file_quit_cmd_cb) },
  1303. { "/File/Set/ListFiles", WIRESHARK_STOCK_FILE_SET_LIST, "List Files", NULL, NULL, G_CALLBACK(fileset_cb) },
  1304. { "/File/Set/NextFile", WIRESHARK_STOCK_FILE_SET_NEXT, "Next File", NULL, NULL, G_CALLBACK(fileset_next_cb) },
  1305. { "/File/Set/PreviousFile", WIRESHARK_STOCK_FILE_SET_PREVIOUS, "Previous File", NULL, NULL, G_CALLBACK(fileset_previous_cb) },
  1306. { "/File/ExportPacketDissections/Text", NULL, "as \"Plain _Text\" file...", NULL, NULL, G_CALLBACK(export_text_cmd_cb) },
  1307. { "/File/ExportPacketDissections/PostScript", NULL, "as \"_PostScript\" file...", NULL, NULL, G_CALLBACK(export_ps_cmd_cb) },
  1308. { "/File/ExportPacketDissections/CSV", NULL, "as \"_CSV\" (Comma Separated Values packet summary) file...",
  1309. NULL, NULL, G_CALLBACK(export_csv_cmd_cb) },
  1310. { "/File/ExportPacketDissections/CArrays", NULL, "as \"C _Arrays\" (packet bytes) file...",
  1311. NULL, NULL, G_CALLBACK(export_carrays_cmd_cb) },
  1312. { "/File/ExportPacketDissections/PSML", NULL, "as XML - \"P_SML\" (packet summary) file...",
  1313. NULL, NULL, G_CALLBACK(export_psml_cmd_cb) },
  1314. { "/File/ExportPacketDissections/PDML", NULL, "as XML - \"P_DML\" (packet details) file...",
  1315. NULL, NULL, G_CALLBACK(export_pdml_cmd_cb) },
  1316. { "/File/ExportObjects/HTTP", NULL, "_HTTP", NULL, NULL, G_CALLBACK(eo_http_cb) },
  1317. { "/File/ExportObjects/DICOM", NULL, "_DICOM", NULL, NULL, G_CALLBACK(eo_dicom_cb) },
  1318. { "/File/ExportObjects/SMB", NULL, "_SMB/SMB2", NULL, NULL, G_CALLBACK(eo_smb_cb) },
  1319. { "/Edit/Copy", NULL, "Copy", NULL, NULL, NULL },
  1320. { "/Edit/Copy/Description", NULL, "Description", "<shift><control>D", NULL, G_CALLBACK(copy_description_cb) },
  1321. { "/Edit/Copy/Fieldname", NULL, "Fieldname", "<shift><control>F", NULL, G_CALLBACK(copy_fieldname_cb) },
  1322. { "/Edit/Copy/Value", NULL, "Value", "<shift><control>V", NULL, G_CALLBACK(copy_value_cb) },
  1323. { "/Edit/Copy/AsFilter", NULL, "As Filter", "<shift><control>C", NULL, G_CALLBACK(copy_as_filter_cb) },
  1324. #if 0
  1325. /*
  1326. * Un-#if this when we actually implement Cut/Copy/Paste for the
  1327. * packet list and packet detail windows.
  1328. *
  1329. * Note: when we implement Cut/Copy/Paste in those windows, we
  1330. * will almost certainly want to allow multiple packets to be
  1331. * selected in the packet list pane and multiple packet detail
  1332. * items to be selected in the packet detail pane, so that
  1333. * the user can, for example, copy the summaries of multiple
  1334. * packets to the clipboard from the packet list pane and multiple
  1335. * packet detail items - perhaps *all* packet detail items - from
  1336. * the packet detail pane. Given that, we'll also want to
  1337. * implement Select All.
  1338. *
  1339. * If multiple packets are selected, we would probably display nothing
  1340. * in the packet detail pane, just as we do if no packet is selected,
  1341. * and any menu items etc. that would pertain only to a single packet
  1342. * would be disabled.
  1343. *
  1344. * If multiple packet detail items are selected, we would probably
  1345. * disable all items that pertain only to a single packet detail
  1346. * item, such as some items in the status bar.
  1347. *
  1348. * XXX - the actions for these will be different depending on what
  1349. * widget we're in; ^C should copy from the filter text widget if
  1350. * we're in that widget, the packet list if we're in that widget
  1351. * (presumably copying the summaries of selected packets to the
  1352. * clipboard, e.g. the text copy would be the text of the columns),
  1353. * the packet detail if we're in that widget (presumably copying
  1354. * the contents of selected protocol tree items to the clipboard,
  1355. * e.g. the text copy would be the text displayed for those items),
  1356. * etc..
  1357. *
  1358. * Given that those menu items should also affect text widgets
  1359. * such as the filter box, we would again want Select All, and,
  1360. * at least for the filter box, we would also want Undo and Redo.
  1361. * We would only want Cut, Paste, Undo, and Redo for the packet
  1362. * list and packet detail panes if we support modifying them.
  1363. */
  1364. {"/Edit/_Undo", "<control>Z", NULL,
  1365. 0, "<StockItem>", GTK_STOCK_UNDO,},
  1366. {"/Edit/_Redo", "<shift><control>Z", NULL,
  1367. 0, "<StockItem>", GTK_STOCK_REDO,},
  1368. {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
  1369. {"/Edit/Cu_t", "<control>X", NULL,
  1370. 0, "<StockItem>", GTK_STOCK_CUT,},
  1371. {"/Edit/_Copy", "<control>C", NULL,
  1372. 0, "<StockItem>", GTK_STOCK_COPY,},
  1373. {"/Edit/_Paste", "<control>V", NULL,
  1374. 0, "<StockItem>", GTK_STOCK_PASTE,},
  1375. {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
  1376. {"/Edit/Select _All", "<control>A", NULL, 0,
  1377. "<StockItem>", GTK_STOCK_SELECT_ALL,},
  1378. #endif /* 0 */
  1379. { "/Edit/FindPacket", GTK_STOCK_FIND, "_Find Packet...", "<control>F", NULL, G_CALLBACK(find_frame_cb) },
  1380. { "/Edit/FindNext", NULL, "Find Ne_xt", "<control>N", NULL, G_CALLBACK(find_next_cb) },
  1381. { "/Edit/FindPrevious", NULL, "Find Pre_vious", "<control>B", NULL, G_CALLBACK(find_previous_cb) },
  1382. { "/Edit/MarkPacket", NULL, "_Mark/Unmark Packet", "<control>M", NULL, G_CALLBACK(packet_list_mark_frame_cb) },
  1383. /* XXX - Unused. Should this and its associated code be removed? */
  1384. { "/Edit/ToggleMarkingOfAllDisplayedPackets", NULL, "Toggle Marking of All Displayed Packets", "<shift><alt><control>M", NULL, G_CALLBACK(packet_list_toggle_mark_all_displayed_frames_cb) },
  1385. { "/Edit/MarkAllDisplayedPackets", NULL, "Mark All Displayed Packets", "<shift><control>M", NULL, G_CALLBACK(packet_list_mark_all_displayed_frames_cb) },
  1386. { "/Edit/UnmarkAllDisplayedPackets", NULL, "_Unmark All Displayed Packets", "<alt><control>M", NULL, G_CALLBACK(packet_list_unmark_all_displayed_frames_cb) },
  1387. { "/Edit/FindNextMark", NULL, "Next Mark", "<shift><control>N", NULL, G_CALLBACK(find_next_mark_cb) },
  1388. { "/Edit/FindPreviousMark", NULL, "Previous Mark", "<shift><control>B", NULL, G_CALLBACK(find_prev_mark_cb) },
  1389. { "/Edit/IgnorePacket", NULL, "_Ignore/Unignore Packet", "<control>D", NULL, G_CALLBACK(packet_list_ignore_frame_cb) },
  1390. /*
  1391. * XXX - this next one overrides /Edit/Copy/Description
  1392. */
  1393. { "/Edit/IgnoreAllDisplayedPackets", NULL, "Ignore All Displayed Packets", "<shift><control>D", NULL, G_CALLBACK(packet_list_ignore_all_displayed_frames_cb) },
  1394. { "/Edit/Un-IgnoreAllPackets", NULL, "U_nignore All Packets", "<alt><control>D", NULL, G_CALLBACK(packet_list_unignore_all_frames_cb) },
  1395. { "/Edit/SetTimeReference", WIRESHARK_STOCK_TIME, "Set/Unset Time Reference", "<control>T", NULL, G_CALLBACK(set_reftime_cb) },
  1396. { "/Edit/Un-TimeReferenceAllPackets",NULL, "Unset All Time References", "<alt><control>T", NULL, G_CALLBACK(packet_list_untime_reference_all_frames_cb) },
  1397. { "/Edit/FindNextTimeReference", NULL, "Next Time Reference", "<alt><control>N", NULL, G_CALLBACK(find_next_ref_time_cb) },
  1398. { "/Edit/FindPreviousTimeReference", NULL, "Previous Time Reference", "<alt><control>B", NULL, G_CALLBACK(find_previous_ref_time_cb) },
  1399. { "/Edit/TimeShift", WIRESHARK_STOCK_TIME, "Time Shift...", "<shift><control>T", NULL, G_CALLBACK(time_shift_cb) },
  1400. { "/Edit/ConfigurationProfiles", NULL, "_Configuration Profiles...", "<shift><control>A", NULL, G_CALLBACK(profile_dialog_cb) },
  1401. { "/Edit/Preferences", GTK_STOCK_PREFERENCES, "_Preferences...", "<shift><control>P", NULL, G_CALLBACK(menus_prefs_cb) },
  1402. #ifdef WANT_PACKET_EDITOR
  1403. { "/Edit/EditPacket", NULL, "_Edit Packet", NULL, NULL, G_CALLBACK(edit_window_cb) },
  1404. #endif
  1405. { "/Edit/AddEditPktComment", WIRESHARK_STOCK_EDIT, "Packet Comment...", NULL, NULL, G_CALLBACK(edit_packet_comment_dlg) },
  1406. { "/View/TimeDisplayFormat", NULL, "_Time Display Format", NULL, NULL, NULL },
  1407. { "/View/NameResolution", NULL, "Name Resol_ution", NULL, NULL, NULL },
  1408. { "/View/NameResolution/ResolveName", NULL, "_Resolve Name", NULL, NULL, G_CALLBACK(resolve_name_cb) },
  1409. { "/View/NameResolution/ManuallyResolveName",NULL, "Manually Resolve Name", NULL, NULL, G_CALLBACK(manual_addr_resolv_dlg) },
  1410. { "/View/ZoomIn", GTK_STOCK_ZOOM_IN, "_Zoom In", "<control>plus", NULL, G_CALLBACK(view_zoom_in_cb) },
  1411. { "/View/ZoomOut", GTK_STOCK_ZOOM_OUT, "Zoom _Out", "<control>minus", NULL, G_CALLBACK(view_zoom_out_cb) },
  1412. { "/View/NormalSize", GTK_STOCK_ZOOM_100, "_Normal Size", "<control>equal", NULL, G_CALLBACK(view_zoom_100_cb) },
  1413. { "/View/ResizeAllColumns", WIRESHARK_STOCK_RESIZE_COLUMNS, "Resize All Columns", "<shift><control>R", NULL, G_CALLBACK(packet_list_resize_columns_cb) },
  1414. { "/View/DisplayedColumns", NULL, "Displayed Columns", NULL, NULL, NULL },
  1415. { "/View/ExpandSubtrees", NULL, "E_xpand Subtrees", "<shift>Right", NULL, G_CALLBACK(expand_tree_cb) },
  1416. { "/View/ExpandAll", NULL, "_Expand All", "<control>Right", NULL, G_CALLBACK(expand_all_cb) },
  1417. { "/View/CollapseAll", NULL, "Collapse _All", "<control>Left", NULL, G_CALLBACK(collapse_all_cb) },
  1418. { "/View/ColorizeConversation", NULL, "Colorize Conversation",NULL, NULL, NULL },
  1419. { "/View/ColorizeConversation/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", "<control>1", NULL, G_CALLBACK(view_menu_color_conv_color1_cb) },
  1420. { "/View/ColorizeConversation/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", "<control>2", NULL, G_CALLBACK(view_menu_color_conv_color2_cb) },
  1421. { "/View/ColorizeConversation/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", "<control>3", NULL, G_CALLBACK(view_menu_color_conv_color3_cb) },
  1422. { "/View/ColorizeConversation/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", "<control>4", NULL, G_CALLBACK(view_menu_color_conv_color4_cb) },
  1423. { "/View/ColorizeConversation/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", "<control>5", NULL, G_CALLBACK(view_menu_color_conv_color5_cb) },
  1424. { "/View/ColorizeConversation/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", "<control>6", NULL, G_CALLBACK(view_menu_color_conv_color6_cb) },
  1425. { "/View/ColorizeConversation/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", "<control>7", NULL, G_CALLBACK(view_menu_color_conv_color7_cb) },
  1426. { "/View/ColorizeConversation/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", "<control>8", NULL, G_CALLBACK(view_menu_color_conv_color8_cb) },
  1427. { "/View/ColorizeConversation/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", "<control>9", NULL, G_CALLBACK(view_menu_color_conv_color9_cb) },
  1428. { "/View/ColorizeConversation/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", "<control>0", NULL, G_CALLBACK(view_menu_color_conv_color10_cb) },
  1429. { "/View/ColorizeConversation/NewColoringRule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(view_menu_color_conv_new_rule_cb) },
  1430. { "/View/ResetColoring1-10", NULL, "Reset Coloring 1-10", "<control>space", NULL, G_CALLBACK(view_menu_reset_coloring_cb) },
  1431. { "/View/ColoringRules", GTK_STOCK_SELECT_COLOR, "_Coloring Rules...", NULL, NULL, G_CALLBACK(color_display_cb) },
  1432. { "/View/ShowPacketinNewWindow", NULL, "Show Packet in New _Window", NULL, NULL, G_CALLBACK(new_window_cb) },
  1433. { "/View/Reload", GTK_STOCK_REFRESH, "_Reload", "<control>R", NULL, G_CALLBACK(file_reload_cmd_cb) },
  1434. { "/Go/Back", GTK_STOCK_GO_BACK, "_Back", "<alt>Left", NULL, G_CALLBACK(history_back_cb) },
  1435. { "/Go/Forward", GTK_STOCK_GO_FORWARD, "_Forward", "<alt>Right", NULL, G_CALLBACK(history_forward_cb) },
  1436. { "/Go/Goto", GTK_STOCK_JUMP_TO, "_Go to Packet...", "<control>G", NULL, G_CALLBACK(goto_frame_cb) },
  1437. { "/Go/GotoCorrespondingPacket", NULL, "Go to _Corresponding Packet", NULL, NULL, G_CALLBACK(goto_framenum_cb) },
  1438. { "/Go/PreviousPacket", GTK_STOCK_GO_UP, "Previous Packet", "<control>Up", NULL, G_CALLBACK(goto_previous_frame_cb) },
  1439. { "/Go/NextPacket", GTK_STOCK_GO_DOWN, "Next Packet", "<control>Down", NULL, G_CALLBACK(goto_next_frame_cb) },
  1440. { "/Go/FirstPacket", GTK_STOCK_GOTO_TOP, "F_irst Packet", "<control>Home", NULL, G_CALLBACK(goto_top_frame_cb) },
  1441. { "/Go/LastPacket", GTK_STOCK_GOTO_BOTTOM, "_Last Packet", "<control>End", NULL, G_CALLBACK(goto_bottom_frame_cb) },
  1442. { "/Go/PreviousPacketInConversation", GTK_STOCK_GO_UP, "Previous Packet In Conversation", "<control>comma", NULL, G_CALLBACK(goto_previous_frame_conversation_cb) },
  1443. { "/Go/NextPacketInConversation", GTK_STOCK_GO_DOWN, "Next Packet In Conversation", "<control>period", NULL, G_CALLBACK(goto_next_frame_conversation_cb) },
  1444. { "/Analyze/DisplayFilters", WIRESHARK_STOCK_DISPLAY_FILTER, "_Display Filters...", NULL, NULL, G_CALLBACK(dfilter_dialog_cb) },
  1445. { "/Analyze/DisplayFilterMacros", NULL, "Display Filter _Macros...", NULL, NULL, G_CALLBACK(macros_dialog_cb) },
  1446. { "/Analyze/ApplyasColumn", NULL, "Apply as Column", NULL, NULL, G_CALLBACK(apply_as_custom_column_cb) },
  1447. { "/Analyze/EnabledProtocols", WIRESHARK_STOCK_CHECKBOX, "_Enabled Protocols...", "<shift><control>E", NULL, G_CALLBACK(proto_cb) },
  1448. { "/Analyze/DecodeAs", WIRESHARK_STOCK_DECODE_AS, "Decode _As...", NULL, NULL, G_CALLBACK(decode_as_cb) },
  1449. { "/Analyze/UserSpecifiedDecodes", WIRESHARK_STOCK_DECODE_AS, "_User Specified Decodes...", NULL, NULL, G_CALLBACK(decode_show_cb) },
  1450. { "/Analyze/FollowTCPStream", NULL, "Follow TCP Stream", NULL, NULL, G_CALLBACK(follow_tcp_stream_cb) },
  1451. { "/Analyze/FollowUDPStream", NULL, "Follow UDP Stream", NULL, NULL, G_CALLBACK(follow_udp_stream_cb) },
  1452. { "/Analyze/FollowSSLStream", NULL, "Follow SSL Stream", NULL, NULL, G_CALLBACK(follow_ssl_stream_cb) },
  1453. { "/Analyze/ExpertInfo", WIRESHARK_STOCK_EXPERT_INFO, "Expert _Info", NULL, NULL, G_CALLBACK(expert_comp_dlg_launch) },
  1454. { "/Analyze/ConversationFilter", NULL, "Conversation Filter", NULL, NULL, NULL },
  1455. { "/Statistics/ConversationList", NULL, "_Conversation List", NULL, NULL, NULL },
  1456. { "/Statistics/ConversationList/Ethernet", WIRESHARK_STOCK_CONVERSATIONS, "Ethernet", NULL, NULL, G_CALLBACK(eth_endpoints_cb) },
  1457. { "/Statistics/ConversationList/FibreChannel", WIRESHARK_STOCK_CONVERSATIONS, "Fibre Channel", NULL, NULL, G_CALLBACK(fc_endpoints_cb) },
  1458. { "/Statistics/ConversationList/FDDI", WIRESHARK_STOCK_CONVERSATIONS, "FDDI", NULL, NULL, G_CALLBACK(fddi_endpoints_cb) },
  1459. { "/Statistics/ConversationList/IP", WIRESHARK_STOCK_CONVERSATIONS, "IPv4", NULL, NULL, G_CALLBACK(ip_endpoints_cb) },
  1460. { "/Statistics/ConversationList/IPv6", WIRESHARK_STOCK_CONVERSATIONS, "IPv6", NULL, NULL, G_CALLBACK(ipv6_endpoints_cb) },
  1461. { "/Statistics/ConversationList/IPX", WIRESHARK_STOCK_CONVERSATIONS, "IPX", NULL, NULL, G_CALLBACK(ipx_endpoints_cb) },
  1462. { "/Statistics/ConversationList/JXTA", WIRESHARK_STOCK_CONVERSATIONS, "JXTA", NULL, NULL, G_CALLBACK(jxta_conversation_cb) },
  1463. { "/Statistics/ConversationList/NCP", WIRESHARK_STOCK_CONVERSATIONS, "NCP", NULL, NULL, G_CALLBACK(ncp_endpoints_cb) },
  1464. { "/Statistics/ConversationList/RSVP", WIRESHARK_STOCK_CONVERSATIONS, "RSVP", NULL, NULL, G_CALLBACK(rsvp_endpoints_cb) },
  1465. { "/Statistics/ConversationList/SCTP", WIRESHARK_STOCK_CONVERSATIONS, "SCTP", NULL, NULL, G_CALLBACK(sctp_conversation_cb) },
  1466. { "/Statistics/ConversationList/TCPIP", WIRESHARK_STOCK_CONVERSATIONS, "TCP (IPv4 & IPv6)", NULL, NULL, G_CALLBACK(tcpip_conversation_cb) },
  1467. { "/Statistics/ConversationList/TR", WIRESHARK_STOCK_CONVERSATIONS, "Token Ring", NULL, NULL, G_CALLBACK(tr_conversation_cb) },
  1468. { "/Statistics/ConversationList/UDPIP", WIRESHARK_STOCK_CONVERSATIONS, "UDP (IPv4 & IPv6)", NULL, NULL, G_CALLBACK(udpip_conversation_cb) },
  1469. { "/Statistics/ConversationList/USB", WIRESHARK_STOCK_CONVERSATIONS, "USB", NULL, NULL, G_CALLBACK(usb_endpoints_cb) },
  1470. { "/Statistics/ConversationList/WLAN", WIRESHARK_STOCK_CONVERSATIONS, "WLAN", NULL, NULL, G_CALLBACK(wlan_endpoints_cb) },
  1471. { "/Statistics/EndpointList", NULL, "_Endpoint List", NULL, NULL, NULL },
  1472. { "/Statistics/EndpointList/Ethernet", WIRESHARK_STOCK_ENDPOINTS, "Ethernet", NULL, NULL, G_CALLBACK(gtk_eth_hostlist_cb) },
  1473. { "/Statistics/EndpointList/FibreChannel", WIRESHARK_STOCK_ENDPOINTS, "Fibre Channel", NULL, NULL, G_CALLBACK(gtk_fc_hostlist_cb) },
  1474. { "/Statistics/EndpointList/FDDI", WIRESHARK_STOCK_ENDPOINTS, "FDDI", NULL, NULL, G_CALLBACK(gtk_fddi_hostlist_cb) },
  1475. { "/Statistics/EndpointList/IP", WIRESHARK_STOCK_ENDPOINTS, "IPv4", NULL, NULL, G_CALLBACK(gtk_ip_hostlist_cb) },
  1476. { "/Statistics/EndpointList/IPv6", WIRESHARK_STOCK_ENDPOINTS, "IPv6", NULL, NULL, G_CALLBACK(gtk_ipv6_hostlist_cb) },
  1477. { "/Statistics/EndpointList/IPX", WIRESHARK_STOCK_ENDPOINTS, "IPX", NULL, NULL, G_CALLBACK(gtk_ipx_hostlist_cb) },
  1478. { "/Statistics/EndpointList/JXTA", WIRESHARK_STOCK_ENDPOINTS, "JXTA", NULL, NULL, G_CALLBACK(gtk_jxta_hostlist_cb) },
  1479. { "/Statistics/EndpointList/NCP", WIRESHARK_STOCK_ENDPOINTS, "NCP", NULL, NULL, G_CALLBACK(gtk_ncp_hostlist_cb) },
  1480. { "/Statistics/EndpointList/RSVP", WIRESHARK_STOCK_ENDPOINTS, "RSVP", NULL, NULL, G_CALLBACK(gtk_rsvp_hostlist_cb) },
  1481. { "/Statistics/EndpointList/SCTP", WIRESHARK_STOCK_ENDPOINTS, "SCTP", NULL, NULL, G_CALLBACK(gtk_sctp_hostlist_cb) },
  1482. { "/Statistics/EndpointList/TCPIP", WIRESHARK_STOCK_ENDPOINTS, "TCP (IPv4 & IPv6)", NULL, NULL, G_CALLBACK(gtk_tcpip_hostlist_cb) },
  1483. { "/Statistics/EndpointList/TR", WIRESHARK_STOCK_ENDPOINTS, "Token Ring", NULL, NULL, G_CALLBACK(gtk_tr_hostlist_cb) },
  1484. { "/Statistics/EndpointList/UDPIP", WIRESHARK_STOCK_ENDPOINTS, "UDP (IPv4 & IPv6)", NULL, NULL, G_CALLBACK(gtk_udpip_hostlist_cb) },
  1485. { "/Statistics/EndpointList/USB", WIRESHARK_STOCK_ENDPOINTS, "USB", NULL, NULL, G_CALLBACK(gtk_usb_hostlist_cb) },
  1486. { "/Statistics/EndpointList/WLAN", WIRESHARK_STOCK_ENDPOINTS, "WLAN", NULL, NULL, G_CALLBACK(gtk_wlan_hostlist_cb) },
  1487. { "/Statistics/ServiceResponseTime", NULL, "Service _Response Time", NULL, NULL, NULL },
  1488. { "/Statistics/ServiceResponseTime/DCE-RPC", WIRESHARK_STOCK_TIME, "DCE-RPC...", NULL, NULL, G_CALLBACK(gtk_dcerpcstat_cb) },
  1489. { "/Statistics/ServiceResponseTime/ONC-RPC", WIRESHARK_STOCK_TIME, "ONC-RPC...", NULL, NULL, G_CALLBACK(gtk_rpcstat_cb) },
  1490. { "/Statistics/ancp", NULL, "ANCP", NULL, NULL, G_CALLBACK(gtk_stats_tree_cb) },
  1491. { "/Statistics/BACnet", NULL, "BACnet", NULL, NULL, NULL },
  1492. { "/Statistics/BACnet/bacapp_instanceid", NULL, "Packets sorted by Instance ID", NULL, NULL, G_CALLBACK(gtk_stats_tree_cb) },
  1493. { "/Statistics/BACnet/bacapp_ip", NULL, "Packets sorted by IP", NULL, NULL, G_CALLBACK(gtk_stats_tree_cb) },
  1494. { "/Statistics/BACnet/bacapp_objectid", NULL, "Packets sorted by Object Type", NULL, NULL, G_CALLBACK(gtk_stats_tree_cb) },
  1495. { "/Statistics/BACnet/bacapp_service", NULL, "Packets sorted by Service", NULL, NULL, G_CALLBACK(gtk_stats_tree_cb) },
  1496. { "/Statistics/collectd", NULL, "Collectd...", NULL, NULL, G_CALLBACK(gtk_stats_tree_cb) },
  1497. { "/Statistics/compare", NULL, "Compare...", NULL, NULL, G_CALLBACK(gtk_comparestat_cb) },
  1498. { "/Statistics/FlowGraph", WIRESHARK_STOCK_FLOW_GRAPH, "Flo_w Graph...", NULL, NULL, G_CALLBACK(flow_graph_launch) },
  1499. { "/Statistics/hart_ip", NULL, "HART-IP", NULL, NULL, G_CALLBACK(gtk_stats_tree_cb) },
  1500. { "/Statistics/HTTP", NULL, "HTTP", NULL, NULL, NULL },
  1501. { "/Statistics/HTTP/http", NULL, "Packet Counter", NULL, NULL, G_CALLBACK(gtk_stats_tree_cb) },
  1502. { "/Statistics/HTTP/http_req", NULL, "Requests", NULL, NULL, G_CALLBACK(gtk_stats_tree_cb) },
  1503. { "/Statistics/HTTP/http_srv", NULL, "Load Distribution", NULL, NULL, G_CALLBACK(gtk_stats_tree_cb) },
  1504. { "/Statistics/ONC-RPC-Programs", NULL, "ONC-RPC Programs", NULL, NULL, G_CALLBACK(gtk_rpcprogs_cb) },
  1505. { "/Statistics/Sametime", NULL, "Sametime", NULL, NULL, NULL },
  1506. { "/Statistics/Sametime/sametime", NULL, "Messages", NULL, NULL, G_CALLBACK(gtk_stats_tree_cb) },
  1507. { "/Statistics/TCPStreamGraphMenu", NULL, "TCP StreamGraph", NULL, NULL, NULL },
  1508. { "/Statistics/TCPStreamGraphMenu/Time-Sequence-Graph-Stevens", NULL, "Time-Sequence Graph (Stevens)", NULL, NULL, G_CALLBACK(tcp_graph_cb) },
  1509. { "/Statistics/TCPStreamGraphMenu/Time-Sequence-Graph-tcptrace", NULL, "Time-Sequence Graph (tcptrace)", NULL, NULL, G_CALLBACK(tcp_graph_cb) },
  1510. { "/Statistics/TCPStreamGraphMenu/Throughput-Graph", NULL, "Throughput Graph", NULL, NULL, G_CALLBACK(tcp_graph_cb) },
  1511. { "/Statistics/TCPStreamGraphMenu/RTT-Graph", NULL, "Round Trip Time Graph", NULL, NULL, G_CALLBACK(tcp_graph_cb) },
  1512. { "/Statistics/TCPStreamGraphMenu/Window-Scaling-Graph", NULL, "Window Scaling Graph", NULL, NULL, G_CALLBACK(tcp_graph_cb) },
  1513. { "/Statistics/UDPMulticastStreams", NULL, "UDP Multicast Streams", NULL, NULL, G_CALLBACK(mcaststream_launch) },
  1514. { "/Statistics/WLANTraffic", NULL, "WLAN Traffic", NULL, NULL, G_CALLBACK(wlanstat_launch) },
  1515. { "/Statistics/Summary", GTK_STOCK_PROPERTIES, "_Summary", NULL, NULL, G_CALLBACK(summary_open_cb) },
  1516. { "/Statistics/CommentsSummary", NULL, "Comments Summary", NULL, NULL, G_CALLBACK(show_packet_comment_summary_dlg) },
  1517. { "/Statistics/ShowAddreRes", NULL, "Show address resolution", NULL, NULL, G_CALLBACK(addr_resolution_dlg) },
  1518. { "/Statistics/ProtocolHierarchy", NULL, "_Protocol Hierarchy", NULL, NULL, G_CALLBACK(proto_hier_stats_cb) },
  1519. { "/Statistics/Conversations", WIRESHARK_STOCK_CONVERSATIONS, "Conversations", NULL, NULL, G_CALLBACK(init_conversation_notebook_cb) },
  1520. { "/Statistics/Endpoints", WIRESHARK_STOCK_ENDPOINTS, "Endpoints", NULL, NULL, G_CALLBACK(init_hostlist_notebook_cb) },
  1521. { "/Statistics/IOGraphs", WIRESHARK_STOCK_GRAPHS, "_IO Graph", NULL, NULL, G_CALLBACK(gui_iostat_cb) },
  1522. { "/Statistics/plen", NULL, "Packet Lengths...", NULL, NULL, G_CALLBACK(gtk_stats_tree_cb) },
  1523. { "/Telephony/ANSI", NULL, "_ANSI", NULL, NULL, NULL },
  1524. { "/Telephony/ANSI/BSMAP", NULL, "A-Interface BSMAP", NULL, NULL, G_CALLBACK(ansi_a_stat_gtk_bsmap_cb) },
  1525. { "/Telephony/ANSI/DTAP", NULL, "A-Interface DTAP", NULL, NULL, G_CALLBACK(ansi_a_stat_gtk_dtap_cb) },
  1526. { "/Telephony/ANSI/MAP-OP", NULL, "MAP Operation", NULL, NULL, G_CALLBACK(ansi_map_stat_gtk_cb) },
  1527. { "/Telephony/GSM", NULL, "_GSM", NULL, NULL, NULL },
  1528. { "/Telephony/GSM/BSSMAP", NULL, "A-Interface BSSMAP", NULL, NULL, G_CALLBACK(gsm_a_stat_gtk_bssmap_cb) },
  1529. { "/Telephony/GSM/DTAP", NULL, "A-Interface DTAP", NULL, NULL, NULL },
  1530. { "/Telephony/GSM/DTAP/CC", NULL, "Call Control", NULL, NULL, G_CALLBACK(gsm_a_stat_gtk_dtap_cc_cb) },
  1531. { "/Telephony/GSM/DTAP/GMM", NULL, "GPRS Mobility Management", NULL, NULL, G_CALLBACK(gsm_a_stat_gtk_dtap_gmm_cb) },
  1532. { "/Telephony/GSM/DTAP/SM", NULL, "GPRS Session Management", NULL, NULL, G_CALLBACK(gsm_a_stat_gtk_dtap_sm_cb) },
  1533. { "/Telephony/GSM/DTAP/MM", NULL, "Mobility Management", NULL, NULL, G_CALLBACK(gsm_a_stat_gtk_dtap_mm_cb) },
  1534. { "/Telephony/GSM/DTAP/RR", NULL, "Radio Resource Management",NULL, NULL, G_CALLBACK(gsm_a_stat_gtk_dtap_rr_cb) },
  1535. { "/Telephony/GSM/DTAP/SMS", NULL, "Short Message Service", NULL, NULL, G_CALLBACK(gsm_a_stat_gtk_dtap_sms_cb) },
  1536. { "/Telephony/GSM/DTAP/TP", NULL, "Special Conformance Testing Functions", NULL, NULL, G_CALLBACK(gsm_a_stat_gtk_dtap_tp_cb) },
  1537. { "/Telephony/GSM/DTAP/SS", NULL, "Supplementary Services", NULL, NULL, G_CALLBACK(gsm_a_stat_gtk_dtap_ss_cb) },
  1538. { "/Telephony/GSM/SACCH", NULL, "A-Interface SACCH", NULL, NULL, G_CALLBACK(gsm_a_stat_gtk_sacch_rr_cb) },
  1539. { "/Telephony/GSM/MAP-OP", NULL, "MAP Operation", NULL, NULL, G_CALLBACK(gsm_map_stat_gtk_cb) },
  1540. { "/Telephony/GSM/MAPSummary", NULL, "MAP Summary", NULL, NULL, G_CALLBACK(gsm_map_stat_gtk_sum_cb) },
  1541. { "/Telephony/IAX2", NULL, "IA_X2", NULL, NULL, NULL },
  1542. { "/Telephony/IAX2/StreamAnalysis", NULL, "Stream Analysis...", NULL, NULL, G_CALLBACK(iax2_analysis_cb) },
  1543. { "/Telephony/isup_msg", NULL, "_ISUP Messages", NULL, NULL, G_CALLBACK(gtk_stats_tree_cb) },
  1544. { "/Telephony/LTE", NULL, "_LTE", NULL, NULL, NULL },
  1545. { "/Telephony/LTE/RLCGraph", NULL, "RLC _Graph...", NULL, NULL, G_CALLBACK(rlc_lte_graph_cb) },
  1546. { "/Telephony/MTP3", NULL, "_MTP3", NULL, NULL, NULL },
  1547. { "/Telephony/MTP3/MSUs", NULL, "MSUs", NULL, NULL, G_CALLBACK(mtp3_stat_gtk_cb) },
  1548. { "/Telephony/MTP3/MSUSummary", NULL, "MSU Summary", NULL, NULL, G_CALLBACK(mtp3_sum_gtk_sum_cb) },
  1549. { "/Telephony/RTP", NULL, "_RTP", NULL, NULL, NULL },
  1550. { "/Telephony/RTP/StreamAnalysis", NULL, "Stream Analysis...", NULL, NULL, G_CALLBACK(rtp_analysis_cb) },
  1551. { "/Telephony/RTP/ShowAllStreams", NULL, "Show All Streams", NULL, NULL, G_CALLBACK(rtpstream_launch) },
  1552. { "/Telephony/RTSP", NULL, "RTSP", NULL, NULL, NULL },
  1553. { "/Telephony/RTSP/rtsp", NULL, "Packet Counter", NULL, NULL, G_CALLBACK(gtk_stats_tree_cb) },
  1554. { "/Telephony/SCTP", NULL, "S_CTP", NULL, NULL, NULL },
  1555. { "/Telephony/SCTP/AnalysethisAssociation", NULL, "Analyse this Association", NULL, NULL, G_CALLBACK(sctp_analyse_start) },
  1556. { "/Telephony/SCTP/ShowAllAssociations", NULL, "Show All Associations...", NULL, NULL, G_CALLBACK(sctp_stat_start) },
  1557. { "/Telephony/smpp_commands", NULL, "SM_PPOperations", NULL, NULL, G_CALLBACK(gtk_stats_tree_cb) },
  1558. { "/Telephony/ucp_messages", NULL, "_UCP Messages", NULL, NULL, G_CALLBACK(gtk_stats_tree_cb) },
  1559. { "/Telephony/VoIPCalls", WIRESHARK_STOCK_TELEPHONE, "_VoIP Calls", NULL, NULL, G_CALLBACK(voip_calls_launch) },
  1560. { "/Tools/FirewallACLRules", NULL, "Firewall ACL Rules", NULL, NULL, G_CALLBACK(firewall_rule_cb) },
  1561. { "/Internals/Dissectortables", NULL, "_Dissector tables", NULL, NULL, G_CALLBACK(dissector_tables_dlg_cb) },
  1562. { "/Internals/SupportedProtocols", NULL, "_Supported Protocols (slow!)", NULL, NULL, G_CALLBACK(supported_cb) },
  1563. { "/Help/Contents", GTK_STOCK_HELP, "_Contents", "F1", NULL, G_CALLBACK(help_menu_cont_cb) },
  1564. { "/Help/ManualPages", NULL, "ManualPages", NULL, NULL, NULL },
  1565. { "/Help/ManualPages/Wireshark", NULL, "Wireshark", NULL, NULL, G_CALLBACK(help_menu_wireshark_cb) },
  1566. { "/Help/ManualPages/WiresharkFilter", NULL, "Wireshark Filter", NULL, NULL, G_CALLBACK(help_menu_wireshark_flt_cb) },
  1567. { "/Help/ManualPages/Capinfos", NULL, "Capinfos", NULL, NULL, G_CALLBACK(help_menu_Capinfos_cb) },
  1568. { "/Help/ManualPages/Dumpcap", NULL, "Dumpcap", NULL, NULL, G_CALLBACK(help_menu_Dumpcap_cb) },
  1569. { "/Help/ManualPages/Editcap", NULL, "Editcap", NULL, NULL, G_CALLBACK(help_menu_Editcap_cb) },
  1570. { "/Help/ManualPages/Mergecap", NULL, "Mergecap", NULL, NULL, G_CALLBACK(help_menu_Mergecap_cb) },
  1571. { "/Help/ManualPages/RawShark", NULL, "RawShark", NULL, NULL, G_CALLBACK(help_menu_RawShark_cb) },
  1572. { "/Help/ManualPages/Reordercap", NULL, "Reordercap", NULL, NULL, G_CALLBACK(help_menu_Reorder_cb) },
  1573. { "/Help/ManualPages/Text2pcap", NULL, "Text2pcap", NULL, NULL, G_CALLBACK(help_menu_Text2pcap_cb) },
  1574. { "/Help/ManualPages/TShark", NULL, "TShark", NULL, NULL, G_CALLBACK(help_menu_TShark_cb) },
  1575. { "/Help/Website", GTK_STOCK_HOME, "Website", NULL, NULL, G_CALLBACK(help_menu_Website_cb) },
  1576. { "/Help/FAQs", NULL, "FAQ's", NULL, NULL, G_CALLBACK(help_menu_faq_cb) },
  1577. { "/Help/ASK", NULL, "Ask (Q&A)", NULL, NULL, G_CALLBACK(help_menu_ask_cb) },
  1578. { "/Help/Downloads", NULL, "Downloads", NULL, NULL, G_CALLBACK(help_menu_Downloads_cb) },
  1579. { "/Help/Wiki", WIRESHARK_STOCK_WIKI, "Wiki", NULL, NULL, G_CALLBACK(help_menu_Wiki_cb) },
  1580. { "/Help/SampleCaptures", NULL, "Sample Captures", NULL, NULL, G_CALLBACK(help_menu_SampleCaptures_cb) },
  1581. #ifdef HAVE_SOFTWARE_UPDATE
  1582. { "/Help/CheckForUpdates", NULL, "Check for Updates...", NULL, NULL, G_CALLBACK(check_for_updates_cb) },
  1583. #endif /* HAVE_SOFTWARE_UPDATE */
  1584. { "/Help/AboutWireshark", WIRESHARK_STOCK_ABOUT, "_About Wireshark", NULL, NULL, G_CALLBACK(about_wireshark_cb) },
  1585. };
  1586. static const GtkToggleActionEntry main_menu_bar_toggle_action_entries[] =
  1587. {
  1588. /* name, stock id, label, accel, tooltip, callback, is_active */
  1589. {"/View/MainToolbar", NULL, "_Main Toolbar", NULL, NULL, G_CALLBACK(main_toolbar_show_hide_cb), TRUE},
  1590. {"/View/FilterToolbar", NULL, "_Filter Toolbar", NULL, NULL, G_CALLBACK(filter_toolbar_show_hide_cb), TRUE},
  1591. {"/View/WirelessToolbar", NULL, "Wire_less Toolbar", NULL, NULL, G_CALLBACK(wireless_toolbar_show_hide_cb), FALSE},
  1592. {"/View/StatusBar", NULL, "_Status Bar", NULL, NULL, G_CALLBACK(status_bar_show_hide_cb), TRUE},
  1593. {"/View/PacketList", NULL, "Packet _List", NULL, NULL, G_CALLBACK(packet_list_show_hide_cb), TRUE},
  1594. {"/View/PacketDetails", NULL, "Packet _Details", NULL, NULL, G_CALLBACK(packet_details_show_hide_cb), TRUE},
  1595. {"/View/PacketBytes", NULL, "Packet _Bytes", NULL, NULL, G_CALLBACK(packet_bytes_show_hide_cb), TRUE},
  1596. {"/View/TimeDisplayFormat/DisplaySecondsWithHoursAndMinutes", NULL, "Display Seconds with hours and minutes", NULL, NULL, G_CALLBACK(timestamp_seconds_time_cb), FALSE},
  1597. {"/View/NameResolution/EnableforMACLayer", NULL, "Enable for _MAC Layer", NULL, NULL, G_CALLBACK(view_menu_en_for_MAC_cb), TRUE},
  1598. {"/View/NameResolution/EnableforTransportLayer", NULL, "Enable for _Transport Layer", NULL, NULL, G_CALLBACK(view_menu_en_for_transport_cb), TRUE },
  1599. {"/View/NameResolution/EnableforNetworkLayer", NULL, "Enable for _Network Layer", NULL, NULL, G_CALLBACK(view_menu_en_for_network_cb), TRUE },
  1600. {"/View/NameResolution/UseExternalNetworkNameResolver", NULL, "Use _External Network Name Resolver", NULL, NULL, G_CALLBACK(view_menu_en_use_external_resolver_cb), TRUE },
  1601. {"/View/ColorizePacketList", NULL, "Colorize Packet List", NULL, NULL, G_CALLBACK(view_menu_colorize_pkt_lst_cb), TRUE },
  1602. #ifdef HAVE_LIBPCAP
  1603. {"/View/AutoScrollinLiveCapture", NULL, "Auto Scroll in Li_ve Capture", NULL, NULL, G_CALLBACK(view_menu_auto_scroll_live_cb), TRUE },
  1604. #endif
  1605. };
  1606. static const GtkRadioActionEntry main_menu_bar_radio_view_time_entries [] =
  1607. {
  1608. /* name, stock id, label, accel, tooltip, value */
  1609. { "/View/TimeDisplayFormat/DateandTimeofDay", NULL, "Date and Time of Day: 1970-01-01 01:02:03.123456", "<alt><control>1", NULL, TS_ABSOLUTE_WITH_DATE },
  1610. { "/View/TimeDisplayFormat/TimeofDay", NULL, "Time of Day: 01:02:03.123456", "<alt><control>2", NULL, TS_ABSOLUTE },
  1611. { "/View/TimeDisplayFormat/SecondsSinceEpoch", NULL, "Seconds Since Epoch (1970-01-01): 1234567890.123456", "<alt><control>3", NULL, TS_EPOCH },
  1612. { "/View/TimeDisplayFormat/SecondsSinceBeginningofCapture", NULL, "Seconds Since Beginning of Capture: 123.123456", "<alt><control>4", NULL, TS_RELATIVE },
  1613. { "/View/TimeDisplayFormat/SecondsSincePreviousCapturedPacket", NULL, "Seconds Since Previous Captured Packet: 1.123456", "<alt><control>5", NULL, TS_DELTA },
  1614. { "/View/TimeDisplayFormat/SecondsSincePreviousDisplayedPacket",NULL, "Seconds Since Previous Displayed Packet: 1.123456", "<alt><control>6", NULL, TS_DELTA_DIS },
  1615. { "/View/TimeDisplayFormat/UTCDateandTimeofDay", NULL, "UTC Date and Time of Day: 1970-01-01 01:02:03.123456", "<alt><control>7", NULL, TS_UTC_WITH_DATE },
  1616. { "/View/TimeDisplayFormat/UTCTimeofDay", NULL, "UTC Time of Day: 01:02:03.123456", "<alt><control>7", NULL, TS_UTC },
  1617. };
  1618. static const GtkRadioActionEntry main_menu_bar_radio_view_time_fileformat_prec_entries [] =
  1619. {
  1620. /* name, stock id, label, accel, tooltip, value */
  1621. { "/View/TimeDisplayFormat/FileFormatPrecision-Automatic", NULL, "Automatic (File Format Precision)", NULL, NULL, TS_PREC_AUTO },
  1622. { "/View/TimeDisplayFormat/FileFormatPrecision-Seconds", NULL, "Seconds: 0", NULL, NULL, TS_PREC_FIXED_SEC },
  1623. { "/View/TimeDisplayFormat/FileFormatPrecision-Deciseconds", NULL, "Deciseconds: 0.1", NULL, NULL, TS_PREC_FIXED_DSEC },
  1624. { "/View/TimeDisplayFormat/FileFormatPrecision-Centiseconds", NULL, "Centiseconds: 0.12", NULL, NULL, TS_PREC_FIXED_CSEC },
  1625. { "/View/TimeDisplayFormat/FileFormatPrecision-Milliseconds", NULL, "Milliseconds: 0.123", NULL, NULL, TS_PREC_FIXED_MSEC },
  1626. { "/View/TimeDisplayFormat/FileFormatPrecision-Microseconds", NULL, "Microseconds: 0.123456", NULL, NULL, TS_PREC_FIXED_USEC },
  1627. { "/View/TimeDisplayFormat/FileFormatPrecision-Nanoseconds", NULL, "Nanoseconds: 0.123456789", NULL, NULL, TS_PREC_FIXED_NSEC },
  1628. };
  1629. static void
  1630. select_bytes_view_cb (GtkRadioAction *action, GtkRadioAction *current _U_, gpointer user_data _U_)
  1631. {
  1632. gint value;
  1633. value = gtk_radio_action_get_current_value (action);
  1634. /* Fix me */
  1635. select_bytes_view( NULL, NULL, value);
  1636. }
  1637. static void
  1638. sort_ascending_cb(GtkAction *action _U_, gpointer user_data)
  1639. {
  1640. GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/SortAscending");
  1641. packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_SORT_ASCENDING);
  1642. }
  1643. static void
  1644. sort_descending_cb(GtkAction *action _U_, gpointer user_data)
  1645. {
  1646. GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/SortDescending");
  1647. packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_SORT_DESCENDING);
  1648. }
  1649. static void
  1650. no_sorting_cb(GtkAction *action _U_, gpointer user_data)
  1651. {
  1652. GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/NoSorting");
  1653. packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_SORT_NONE);
  1654. }
  1655. static void
  1656. packet_list_heading_show_resolved_cb(GtkAction *action _U_, gpointer user_data _U_)
  1657. {
  1658. GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/ShowResolved");
  1659. packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_TOGGLE_RESOLVED);
  1660. }
  1661. static void
  1662. packet_list_heading_align_left_cb(GtkAction *action _U_, gpointer user_data)
  1663. {
  1664. GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/AlignLeft");
  1665. packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_ALIGN_LEFT);
  1666. }
  1667. static void
  1668. packet_list_heading_align_center_cb(GtkAction *action _U_, gpointer user_data)
  1669. {
  1670. GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/AlignCenter");
  1671. packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_ALIGN_CENTER);
  1672. }
  1673. static void
  1674. packet_list_heading_align_right_cb(GtkAction *action _U_, gpointer user_data)
  1675. {
  1676. GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/AlignRight");
  1677. packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_ALIGN_RIGHT);
  1678. }
  1679. static void
  1680. packet_list_heading_col_pref_cb(GtkAction *action _U_, gpointer user_data)
  1681. {
  1682. GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/ColumnPreferences");
  1683. prefs_page_cb( widget , user_data, PREFS_PAGE_COLUMNS);
  1684. }
  1685. static void
  1686. packet_list_heading_resize_col_cb(GtkAction *action _U_, gpointer user_data)
  1687. {
  1688. GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/ResizeColumn");
  1689. packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_RESIZE);
  1690. }
  1691. static void
  1692. packet_list_heading_change_col_cb(GtkAction *action _U_, gpointer user_data)
  1693. {
  1694. GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/EditColumnDetails");
  1695. packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_CHANGE);
  1696. }
  1697. static void
  1698. packet_list_heading_activate_all_columns_cb(GtkAction *action _U_, gpointer user_data _U_)
  1699. {
  1700. packet_list_set_all_columns_visible ();
  1701. }
  1702. static void
  1703. packet_list_heading_hide_col_cb(GtkAction *action _U_, gpointer user_data)
  1704. {
  1705. GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/HideColumn");
  1706. packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_HIDE);
  1707. }
  1708. static void
  1709. packet_list_heading_remove_col_cb(GtkAction *action _U_, gpointer user_data)
  1710. {
  1711. GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/RemoveColumn");
  1712. packet_list_column_menu_cb( widget , user_data, COLUMN_SELECTED_REMOVE);
  1713. }
  1714. static void
  1715. packet_list_menu_set_ref_time_cb(GtkAction *action _U_, gpointer user_data)
  1716. {
  1717. reftime_frame_cb( NULL /* widget _U_ */ , user_data, REFTIME_TOGGLE);
  1718. }
  1719. static void
  1720. apply_selected_filter_cb(GtkAction *action, gpointer user_data)
  1721. {
  1722. const gchar *path = gtk_action_get_accel_path(action);
  1723. /*g_warning("Accelerator path %s",path+9);*/
  1724. /* path starts with "<Actions>" */
  1725. if (strncmp (path+9,"/PacketListPopUpMenuActionGroup",31) == 0){
  1726. /* Use different callbacks depending action path */
  1727. match_selected_plist_cb(user_data, (MATCH_SELECTED_E)(MATCH_SELECTED_REPLACE|MATCH_SELECTED_APPLY_NOW));
  1728. } else {
  1729. match_selected_ptree_cb(user_data, (MATCH_SELECTED_E)(MATCH_SELECTED_REPLACE|MATCH_SELECTED_APPLY_NOW));
  1730. }
  1731. }
  1732. static void
  1733. apply_not_selected_cb(GtkAction *action, gpointer user_data)
  1734. {
  1735. const gchar *path = gtk_action_get_accel_path(action);
  1736. /* path starts with "<Actions>" */
  1737. if (strncmp (path+9,"/PacketListPopUpMenuActionGroup",31) == 0){
  1738. /* Use different callbacks depending action path */
  1739. match_selected_plist_cb(user_data, (MATCH_SELECTED_E)(MATCH_SELECTED_NOT|MATCH_SELECTED_APPLY_NOW));
  1740. } else {
  1741. match_selected_ptree_cb(user_data, (MATCH_SELECTED_E)(MATCH_SELECTED_NOT|MATCH_SELECTED_APPLY_NOW));
  1742. }
  1743. }
  1744. static void
  1745. apply_and_selected_cb(GtkAction *action, gpointer user_data)
  1746. {
  1747. const gchar *path = gtk_action_get_accel_path(action);
  1748. /* path starts with "<Actions>" */
  1749. if (strncmp (path+9,"/PacketListPopUpMenuActionGroup",31) == 0){
  1750. /* Use different callbacks depending action path */
  1751. match_selected_plist_cb(user_data, (MATCH_SELECTED_E)(MATCH_SELECTED_AND|MATCH_SELECTED_APPLY_NOW));
  1752. } else {
  1753. match_selected_ptree_cb(user_data, (MATCH_SELECTED_E)(MATCH_SELECTED_AND|MATCH_SELECTED_APPLY_NOW));
  1754. }
  1755. }
  1756. static void
  1757. apply_or_selected_cb(GtkAction *action, gpointer user_data)
  1758. {
  1759. const gchar *path = gtk_action_get_accel_path(action);
  1760. /* path starts with "<Actions>" */
  1761. if (strncmp (path+9,"/PacketListPopUpMenuActionGroup",31) == 0){
  1762. /* Use different callbacks depending action path */
  1763. match_selected_plist_cb(user_data, (MATCH_SELECTED_E)(MATCH_SELECTED_OR|MATCH_SELECTED_APPLY_NOW));
  1764. } else {
  1765. match_selected_ptree_cb(user_data, (MATCH_SELECTED_E)(MATCH_SELECTED_OR|MATCH_SELECTED_APPLY_NOW));
  1766. }
  1767. }
  1768. static void
  1769. apply_and_not_selected_cb(GtkAction *action, gpointer user_data)
  1770. {
  1771. const gchar *path = gtk_action_get_accel_path(action);
  1772. /* path starts with "<Actions>" */
  1773. if (strncmp (path+9,"/PacketListPopUpMenuActionGroup",31) == 0){
  1774. /* Use different callbacks depending action path */
  1775. match_selected_plist_cb(user_data, (MATCH_SELECTED_E)(MATCH_SELECTED_AND_NOT|MATCH_SELECTED_APPLY_NOW));
  1776. } else {
  1777. match_selected_ptree_cb(user_data, (MATCH_SELECTED_E)(MATCH_SELECTED_AND_NOT|MATCH_SELECTED_APPLY_NOW));
  1778. }
  1779. }
  1780. static void
  1781. apply_or_not_selected_cb(GtkAction *action, gpointer user_data)
  1782. {
  1783. const gchar *path = gtk_action_get_accel_path(action);
  1784. /* path starts with "<Actions>" */
  1785. if (strncmp (path+9,"/PacketListPopUpMenuActionGroup",31) == 0){
  1786. /* Use different callbacks depending action path */
  1787. match_selected_plist_cb(user_data,(MATCH_SELECTED_E)(MATCH_SELECTED_OR_NOT|MATCH_SELECTED_APPLY_NOW));
  1788. } else {
  1789. match_selected_ptree_cb(user_data, (MATCH_SELECTED_E)(MATCH_SELECTED_OR_NOT|MATCH_SELECTED_APPLY_NOW));
  1790. }
  1791. }
  1792. /* Prepare a filter */
  1793. static void
  1794. prepare_selected_cb(GtkAction *action, gpointer user_data)
  1795. {
  1796. const gchar *path = gtk_action_get_accel_path(action);
  1797. /* path starts with "<Actions>" */
  1798. if (strncmp (path+9,"/PacketListPopUpMenuActionGroup",31) == 0){
  1799. /* Use different callbacks depending action path */
  1800. match_selected_plist_cb(user_data, MATCH_SELECTED_REPLACE);
  1801. } else {
  1802. match_selected_ptree_cb(user_data, MATCH_SELECTED_REPLACE);
  1803. }
  1804. }
  1805. static void
  1806. prepare_not_selected_cb(GtkAction *action, gpointer user_data)
  1807. {
  1808. const gchar *path = gtk_action_get_accel_path(action);
  1809. /* path starts with "<Actions>" */
  1810. if (strncmp (path+9,"/PacketListPopUpMenuActionGroup",31) == 0){
  1811. /* Use different callbacks depending action path */
  1812. match_selected_plist_cb(user_data, MATCH_SELECTED_NOT);
  1813. } else {
  1814. match_selected_ptree_cb(user_data, MATCH_SELECTED_NOT);
  1815. }
  1816. }
  1817. static void
  1818. prepare_and_selected_cb(GtkAction *action, gpointer user_data)
  1819. {
  1820. const gchar *path = gtk_action_get_accel_path(action);
  1821. /* path starts with "<Actions>" */
  1822. if (strncmp (path+9,"/PacketListPopUpMenuActionGroup",31) == 0){
  1823. /* Use different callbacks depending action path */
  1824. match_selected_plist_cb(user_data, MATCH_SELECTED_AND);
  1825. } else {
  1826. match_selected_ptree_cb(user_data, MATCH_SELECTED_AND);
  1827. }
  1828. }
  1829. static void
  1830. prepare_or_selected_cb(GtkAction *action, gpointer user_data)
  1831. {
  1832. const gchar *path = gtk_action_get_accel_path(action);
  1833. /* path starts with "<Actions>" */
  1834. if (strncmp (path+9,"/PacketListPopUpMenuActionGroup",31) == 0){
  1835. /* Use different callbacks depending action path */
  1836. match_selected_plist_cb(user_data, MATCH_SELECTED_OR);
  1837. } else {
  1838. match_selected_ptree_cb(user_data, MATCH_SELECTED_OR);
  1839. }
  1840. }
  1841. static void
  1842. prepare_and_not_selected_cb(GtkAction *action, gpointer user_data)
  1843. {
  1844. const gchar *path = gtk_action_get_accel_path(action);
  1845. /* path starts with "<Actions>" */
  1846. if (strncmp (path+9,"/PacketListPopUpMenuActionGroup",31) == 0){
  1847. /* Use different callbacks depending action path */
  1848. match_selected_plist_cb(user_data, MATCH_SELECTED_AND_NOT);
  1849. } else {
  1850. match_selected_ptree_cb(user_data, MATCH_SELECTED_AND_NOT);
  1851. }
  1852. }
  1853. static void
  1854. prepare_or_not_selected_cb(GtkAction *action, gpointer user_data)
  1855. {
  1856. const gchar *path = gtk_action_get_accel_path(action);
  1857. /* path starts with "<Actions>" */
  1858. if (strncmp (path+9,"/PacketListPopUpMenuActionGroup",31) == 0){
  1859. /* Use different callbacks depending action path */
  1860. match_selected_plist_cb(user_data, MATCH_SELECTED_OR_NOT);
  1861. } else {
  1862. match_selected_ptree_cb(user_data, MATCH_SELECTED_OR_NOT);
  1863. }
  1864. }
  1865. static void
  1866. packet_list_menu_conversation_ethernet_cb(GtkAction *action, gpointer user_data)
  1867. {
  1868. conversation_cb( action, user_data, CONV_ETHER);
  1869. }
  1870. static void
  1871. packet_list_menu_conversation_ip_cb(GtkAction *action _U_, gpointer user_data)
  1872. {
  1873. conversation_cb( action, user_data, CONV_IP);
  1874. }
  1875. static void
  1876. packet_list_menu_conversation_tcp_cb(GtkAction *action _U_, gpointer user_data)
  1877. {
  1878. conversation_cb( action, user_data, CONV_TCP);
  1879. }
  1880. static void
  1881. packet_list_menu_conversation_udp_cb(GtkAction *action _U_, gpointer user_data)
  1882. {
  1883. conversation_cb( action, user_data, CONV_UDP);
  1884. }
  1885. static void
  1886. packet_list_menu_conversation_pn_cba_cb(GtkAction *action _U_, gpointer user_data)
  1887. {
  1888. conversation_cb( action, user_data, CONV_CBA);
  1889. }
  1890. /* Ethernet */
  1891. static void
  1892. packet_list_menu_color_conv_ethernet_color1_cb(GtkAction *action, gpointer user_data)
  1893. {
  1894. colorize_conversation_cb(action, user_data, CONV_ETHER+1*256);
  1895. }
  1896. static void
  1897. packet_list_menu_color_conv_ethernet_color2_cb(GtkAction *action, gpointer user_data)
  1898. {
  1899. colorize_conversation_cb(action, user_data, CONV_ETHER+2*256);
  1900. }
  1901. static void
  1902. packet_list_menu_color_conv_ethernet_color3_cb(GtkAction *action, gpointer user_data)
  1903. {
  1904. colorize_conversation_cb(action, user_data, CONV_ETHER+3*256);
  1905. }
  1906. static void
  1907. packet_list_menu_color_conv_ethernet_color4_cb(GtkAction *action, gpointer user_data)
  1908. {
  1909. colorize_conversation_cb(action, user_data, CONV_ETHER+4*256);
  1910. }
  1911. static void
  1912. packet_list_menu_color_conv_ethernet_color5_cb(GtkAction *action, gpointer user_data)
  1913. {
  1914. colorize_conversation_cb(action, user_data, CONV_ETHER+5*256);
  1915. }
  1916. static void
  1917. packet_list_menu_color_conv_ethernet_color6_cb(GtkAction *action, gpointer user_data)
  1918. {
  1919. colorize_conversation_cb(action, user_data, CONV_ETHER+6*256);
  1920. }
  1921. static void
  1922. packet_list_menu_color_conv_ethernet_color7_cb(GtkAction *action, gpointer user_data)
  1923. {
  1924. colorize_conversation_cb(action, user_data, CONV_ETHER+7*256);
  1925. }
  1926. static void
  1927. packet_list_menu_color_conv_ethernet_color8_cb(GtkAction *action, gpointer user_data)
  1928. {
  1929. colorize_conversation_cb(action, user_data, CONV_ETHER+8*256);
  1930. }
  1931. static void
  1932. packet_list_menu_color_conv_ethernet_color9_cb(GtkAction *action, gpointer user_data)
  1933. {
  1934. colorize_conversation_cb(action, user_data, CONV_ETHER+9*256);
  1935. }
  1936. static void
  1937. packet_list_menu_color_conv_ethernet_color10_cb(GtkAction *action, gpointer user_data)
  1938. {
  1939. colorize_conversation_cb(action, user_data, CONV_ETHER+10*256);
  1940. }
  1941. static void
  1942. packet_list_menu_color_conv_ethernet_new_rule_cb(GtkAction *action, gpointer user_data)
  1943. {
  1944. colorize_conversation_cb(action, user_data, CONV_ETHER);
  1945. }
  1946. /* IP */
  1947. static void
  1948. packet_list_menu_color_conv_ip_color1_cb(GtkAction *action, gpointer user_data)
  1949. {
  1950. colorize_conversation_cb(action, user_data, CONV_IP+1*256);
  1951. }
  1952. static void
  1953. packet_list_menu_color_conv_ip_color2_cb(GtkAction *action, gpointer user_data)
  1954. {
  1955. colorize_conversation_cb(action, user_data, CONV_IP+2*256);
  1956. }
  1957. static void
  1958. packet_list_menu_color_conv_ip_color3_cb(GtkAction *action, gpointer user_data)
  1959. {
  1960. colorize_conversation_cb(action, user_data, CONV_IP+3*256);
  1961. }
  1962. static void
  1963. packet_list_menu_color_conv_ip_color4_cb(GtkAction *action, gpointer user_data)
  1964. {
  1965. colorize_conversation_cb(action, user_data, CONV_IP+4*256);
  1966. }
  1967. static void
  1968. packet_list_menu_color_conv_ip_color5_cb(GtkAction *action, gpointer user_data)
  1969. {
  1970. colorize_conversation_cb(action, user_data, CONV_IP+5*256);
  1971. }
  1972. static void
  1973. packet_list_menu_color_conv_ip_color6_cb(GtkAction *action, gpointer user_data)
  1974. {
  1975. colorize_conversation_cb(action, user_data, CONV_IP+6*256);
  1976. }
  1977. static void
  1978. packet_list_menu_color_conv_ip_color7_cb(GtkAction *action, gpointer user_data)
  1979. {
  1980. colorize_conversation_cb(action, user_data, CONV_IP+7*256);
  1981. }
  1982. static void
  1983. packet_list_menu_color_conv_ip_color8_cb(GtkAction *action, gpointer user_data)
  1984. {
  1985. colorize_conversation_cb(action, user_data, CONV_IP+8*256);
  1986. }
  1987. static void
  1988. packet_list_menu_color_conv_ip_color9_cb(GtkAction *action, gpointer user_data)
  1989. {
  1990. colorize_conversation_cb(action, user_data, CONV_IP+9*256);
  1991. }
  1992. static void
  1993. packet_list_menu_color_conv_ip_color10_cb(GtkAction *action, gpointer user_data)
  1994. {
  1995. colorize_conversation_cb(action, user_data, CONV_IP+10*256);
  1996. }
  1997. static void
  1998. packet_list_menu_color_conv_ip_new_rule_cb(GtkAction *action, gpointer user_data)
  1999. {
  2000. colorize_conversation_cb(action, user_data, CONV_TCP);
  2001. }
  2002. /* TCP */
  2003. static void
  2004. packet_list_menu_color_conv_tcp_color1_cb(GtkAction *action, gpointer user_data)
  2005. {
  2006. colorize_conversation_cb(action, user_data, CONV_TCP+1*256);
  2007. }
  2008. static void
  2009. packet_list_menu_color_conv_tcp_color2_cb(GtkAction *action, gpointer user_data)
  2010. {
  2011. colorize_conversation_cb(action, user_data, CONV_TCP+2*256);
  2012. }
  2013. static void
  2014. packet_list_menu_color_conv_tcp_color3_cb(GtkAction *action, gpointer user_data)
  2015. {
  2016. colorize_conversation_cb(action, user_data, CONV_TCP+3*256);
  2017. }
  2018. static void
  2019. packet_list_menu_color_conv_tcp_color4_cb(GtkAction *action, gpointer user_data)
  2020. {
  2021. colorize_conversation_cb(action, user_data, CONV_TCP+4*256);
  2022. }
  2023. static void
  2024. packet_list_menu_color_conv_tcp_color5_cb(GtkAction *action, gpointer user_data)
  2025. {
  2026. colorize_conversation_cb(action, user_data, CONV_TCP+5*256);
  2027. }
  2028. static void
  2029. packet_list_menu_color_conv_tcp_color6_cb(GtkAction *action, gpointer user_data)
  2030. {
  2031. colorize_conversation_cb(action, user_data, CONV_TCP+6*256);
  2032. }
  2033. static void
  2034. packet_list_menu_color_conv_tcp_color7_cb(GtkAction *action, gpointer user_data)
  2035. {
  2036. colorize_conversation_cb(action, user_data, CONV_TCP+7*256);
  2037. }
  2038. static void
  2039. packet_list_menu_color_conv_tcp_color8_cb(GtkAction *action, gpointer user_data)
  2040. {
  2041. colorize_conversation_cb(action, user_data, CONV_TCP+8*256);
  2042. }
  2043. static void
  2044. packet_list_menu_color_conv_tcp_color9_cb(GtkAction *action, gpointer user_data)
  2045. {
  2046. colorize_conversation_cb(action, user_data, CONV_TCP+9*256);
  2047. }
  2048. static void
  2049. packet_list_menu_color_conv_tcp_color10_cb(GtkAction *action, gpointer user_data)
  2050. {
  2051. colorize_conversation_cb(action, user_data, CONV_TCP+10*256);
  2052. }
  2053. static void
  2054. packet_list_menu_color_conv_tcp_new_rule_cb(GtkAction *action, gpointer user_data)
  2055. {
  2056. colorize_conversation_cb(action, user_data, CONV_TCP);
  2057. }
  2058. /* UDP */
  2059. static void
  2060. packet_list_menu_color_conv_udp_color1_cb(GtkAction *action, gpointer user_data)
  2061. {
  2062. colorize_conversation_cb(action, user_data, CONV_UDP+1*256);
  2063. }
  2064. static void
  2065. packet_list_menu_color_conv_udp_color2_cb(GtkAction *action, gpointer user_data)
  2066. {
  2067. colorize_conversation_cb(action, user_data, CONV_UDP+2*256);
  2068. }
  2069. static void
  2070. packet_list_menu_color_conv_udp_color3_cb(GtkAction *action, gpointer user_data)
  2071. {
  2072. colorize_conversation_cb(action, user_data, CONV_UDP+3*256);
  2073. }
  2074. static void
  2075. packet_list_menu_color_conv_udp_color4_cb(GtkAction *action, gpointer user_data)
  2076. {
  2077. colorize_conversation_cb(action, user_data, CONV_UDP+4*256);
  2078. }
  2079. static void
  2080. packet_list_menu_color_conv_udp_color5_cb(GtkAction *action, gpointer user_data)
  2081. {
  2082. colorize_conversation_cb(action, user_data, CONV_UDP+5*256);
  2083. }
  2084. static void
  2085. packet_list_menu_color_conv_udp_color6_cb(GtkAction *action, gpointer user_data)
  2086. {
  2087. colorize_conversation_cb(action, user_data, CONV_UDP+6*256);
  2088. }
  2089. static void
  2090. packet_list_menu_color_conv_udp_color7_cb(GtkAction *action, gpointer user_data)
  2091. {
  2092. colorize_conversation_cb(action, user_data, CONV_UDP+7*256);
  2093. }
  2094. static void
  2095. packet_list_menu_color_conv_udp_color8_cb(GtkAction *action, gpointer user_data)
  2096. {
  2097. colorize_conversation_cb(action, user_data, CONV_UDP+8*256);
  2098. }
  2099. static void
  2100. packet_list_menu_color_conv_udp_color9_cb(GtkAction *action, gpointer user_data)
  2101. {
  2102. colorize_conversation_cb(action, user_data, CONV_UDP+9*256);
  2103. }
  2104. static void
  2105. packet_list_menu_color_conv_udp_color10_cb(GtkAction *action, gpointer user_data)
  2106. {
  2107. colorize_conversation_cb(action, user_data, CONV_UDP+10*256);
  2108. }
  2109. static void
  2110. packet_list_menu_color_conv_udp_new_rule_cb(GtkAction *action, gpointer user_data)
  2111. {
  2112. colorize_conversation_cb(action, user_data, CONV_UDP);
  2113. }
  2114. /* CONV_CBA */
  2115. static void
  2116. packet_list_menu_color_conv_cba_color1_cb(GtkAction *action, gpointer user_data)
  2117. {
  2118. colorize_conversation_cb(action, user_data, CONV_CBA+1*256);
  2119. }
  2120. static void
  2121. packet_list_menu_color_conv_cba_color2_cb(GtkAction *action, gpointer user_data)
  2122. {
  2123. colorize_conversation_cb(action, user_data, CONV_CBA+2*256);
  2124. }
  2125. static void
  2126. packet_list_menu_color_conv_cba_color3_cb(GtkAction *action, gpointer user_data)
  2127. {
  2128. colorize_conversation_cb(action, user_data, CONV_CBA+3*256);
  2129. }
  2130. static void
  2131. packet_list_menu_color_conv_cba_color4_cb(GtkAction *action, gpointer user_data)
  2132. {
  2133. colorize_conversation_cb(action, user_data, CONV_CBA+4*256);
  2134. }
  2135. static void
  2136. packet_list_menu_color_conv_cba_color5_cb(GtkAction *action, gpointer user_data)
  2137. {
  2138. colorize_conversation_cb(action, user_data, CONV_CBA+5*256);
  2139. }
  2140. static void
  2141. packet_list_menu_color_conv_cba_color6_cb(GtkAction *action, gpointer user_data)
  2142. {
  2143. colorize_conversation_cb(action, user_data, CONV_CBA+6*256);
  2144. }
  2145. static void
  2146. packet_list_menu_color_conv_cba_color7_cb(GtkAction *action, gpointer user_data)
  2147. {
  2148. colorize_conversation_cb(action, user_data, CONV_CBA+7*256);
  2149. }
  2150. static void
  2151. packet_list_menu_color_conv_cba_color8_cb(GtkAction *action, gpointer user_data)
  2152. {
  2153. colorize_conversation_cb(action, user_data, CONV_CBA+8*256);
  2154. }
  2155. static void
  2156. packet_list_menu_color_conv_cba_color9_cb(GtkAction *action, gpointer user_data)
  2157. {
  2158. colorize_conversation_cb(action, user_data, CONV_CBA+9*256);
  2159. }
  2160. static void
  2161. packet_list_menu_color_conv_cba_color10_cb(GtkAction *action, gpointer user_data)
  2162. {
  2163. colorize_conversation_cb(action, user_data, CONV_CBA+10*256);
  2164. }
  2165. static void
  2166. packet_list_menu_color_conv_cba_new_rule_cb(GtkAction *action, gpointer user_data)
  2167. {
  2168. colorize_conversation_cb(action, user_data, CONV_CBA);
  2169. }
  2170. static void
  2171. packet_list_menu_copy_sum_txt(GtkAction *action _U_, gpointer user_data)
  2172. {
  2173. packet_list_copy_summary_cb(user_data, CS_TEXT);
  2174. }
  2175. static void
  2176. packet_list_menu_copy_sum_csv(GtkAction *action _U_, gpointer user_data)
  2177. {
  2178. packet_list_copy_summary_cb(user_data, CS_CSV);
  2179. }
  2180. static void
  2181. packet_list_menu_copy_as_flt(GtkAction *action _U_, gpointer user_data)
  2182. {
  2183. match_selected_plist_cb(user_data, (MATCH_SELECTED_E)(MATCH_SELECTED_REPLACE|MATCH_SELECTED_COPY_ONLY));
  2184. }
  2185. static void
  2186. packet_list_menu_copy_bytes_oht_cb(GtkAction *action _U_, gpointer user_data)
  2187. {
  2188. copy_hex_cb( NULL /* widget _U_ */ , user_data, (copy_data_type)(CD_ALLINFO | CD_FLAGS_SELECTEDONLY));
  2189. }
  2190. static void
  2191. packet_list_menu_copy_bytes_oh_cb(GtkAction *action _U_, gpointer user_data)
  2192. {
  2193. copy_hex_cb( NULL /* widget _U_ */ , user_data, (copy_data_type)(CD_HEXCOLUMNS | CD_FLAGS_SELECTEDONLY));
  2194. }
  2195. static void
  2196. packet_list_menu_copy_bytes_text_cb(GtkAction *action _U_, gpointer user_data)
  2197. {
  2198. copy_hex_cb( NULL /* widget _U_ */ , user_data, (copy_data_type)(CD_TEXTONLY | CD_FLAGS_SELECTEDONLY));
  2199. }
  2200. static void
  2201. packet_list_menu_copy_bytes_hex_strm_cb(GtkAction *action _U_, gpointer user_data)
  2202. {
  2203. copy_hex_cb( NULL /* widget _U_ */ , user_data, (copy_data_type)(CD_HEX | CD_FLAGS_SELECTEDONLY));
  2204. }
  2205. static void
  2206. packet_list_menu_copy_bytes_bin_strm_cb(GtkAction *action _U_, gpointer user_data)
  2207. {
  2208. copy_hex_cb( NULL /* widget _U_ */ , user_data, (copy_data_type)(CD_BINARY | CD_FLAGS_SELECTEDONLY));
  2209. }
  2210. /* tree */
  2211. static void
  2212. tree_view_menu_color_with_flt_color1_cb(GtkAction *action _U_, gpointer user_data)
  2213. {
  2214. colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 1);
  2215. }
  2216. static void
  2217. tree_view_menu_color_with_flt_color2_cb(GtkAction *action _U_, gpointer user_data)
  2218. {
  2219. colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 2);
  2220. }
  2221. static void
  2222. tree_view_menu_color_with_flt_color3_cb(GtkAction *action _U_, gpointer user_data)
  2223. {
  2224. colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 3);
  2225. }
  2226. static void
  2227. tree_view_menu_color_with_flt_color4_cb(GtkAction *action _U_, gpointer user_data)
  2228. {
  2229. colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 4);
  2230. }
  2231. static void
  2232. tree_view_menu_color_with_flt_color5_cb(GtkAction *action _U_, gpointer user_data)
  2233. {
  2234. colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 5);
  2235. }
  2236. static void
  2237. tree_view_menu_color_with_flt_color6_cb(GtkAction *action _U_, gpointer user_data)
  2238. {
  2239. colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 6);
  2240. }
  2241. static void
  2242. tree_view_menu_color_with_flt_color7_cb(GtkAction *action _U_, gpointer user_data)
  2243. {
  2244. colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 7);
  2245. }
  2246. static void
  2247. tree_view_menu_color_with_flt_color8_cb(GtkAction *action _U_, gpointer user_data)
  2248. {
  2249. colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 8);
  2250. }
  2251. static void
  2252. tree_view_menu_color_with_flt_color9_cb(GtkAction *action _U_, gpointer user_data)
  2253. {
  2254. colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 9);
  2255. }
  2256. static void
  2257. tree_view_menu_color_with_flt_color10_cb(GtkAction *action _U_, gpointer user_data)
  2258. {
  2259. colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 10);
  2260. }
  2261. static void
  2262. tree_view_menu_color_with_flt_new_rule_cb(GtkAction *action _U_, gpointer user_data)
  2263. {
  2264. colorize_selected_ptree_cb( NULL /* widget _U_ */ , user_data, 0);
  2265. }
  2266. static void
  2267. tree_view_menu_copy_desc(GtkAction *action _U_, gpointer user_data)
  2268. {
  2269. copy_selected_plist_cb( NULL /* widget _U_ */ , user_data, COPY_SELECTED_DESCRIPTION);
  2270. }
  2271. static void
  2272. tree_view_menu_copy_field(GtkAction *action _U_, gpointer user_data)
  2273. {
  2274. copy_selected_plist_cb( NULL /* widget _U_ */ , user_data, COPY_SELECTED_FIELDNAME);
  2275. }
  2276. static void
  2277. tree_view_menu_copy_value(GtkAction *action _U_, gpointer user_data)
  2278. {
  2279. copy_selected_plist_cb( NULL /* widget _U_ */ , user_data, COPY_SELECTED_VALUE);
  2280. }
  2281. static void
  2282. tree_view_menu_copy_as_flt(GtkAction *action _U_, gpointer user_data _U_)
  2283. {
  2284. /* match_selected_ptree_cb needs the popup_menu_object to get the right object E_DFILTER_TE_KEY */
  2285. match_selected_ptree_cb( popup_menu_object, (MATCH_SELECTED_E)(MATCH_SELECTED_REPLACE|MATCH_SELECTED_COPY_ONLY));
  2286. }
  2287. static const char *ui_desc_packet_list_heading_menu_popup =
  2288. "<ui>\n"
  2289. " <popup name='PacketListHeadingPopup' action='PopupAction'>\n"
  2290. " <menuitem name='SortAscending' action='/Sort Ascending'/>\n"
  2291. " <menuitem name='SortDescending' action='/Sort Descending'/>\n"
  2292. " <menuitem name='NoSorting' action='/No Sorting'/>\n"
  2293. " <separator/>\n"
  2294. " <menuitem name='ShowResolved' action='/Show Resolved'/>\n"
  2295. " <separator/>\n"
  2296. " <menuitem name='AlignLeft' action='/Align Left'/>\n"
  2297. " <menuitem name='AlignCenter' action='/Align Center'/>\n"
  2298. " <menuitem name='AlignRight' action='/Align Right'/>\n"
  2299. " <separator/>\n"
  2300. " <menuitem name='ColumnPreferences' action='/Column Preferences'/>\n"
  2301. " <menuitem name='EditColumnDetails' action='/Edit Column Details'/>\n"
  2302. " <menuitem name='ResizeColumn' action='/Resize Column'/>\n"
  2303. " <separator/>\n"
  2304. " <menu name='DisplayedColumns' action='/Displayed Columns'>\n"
  2305. " <menuitem name='Display All' action='/Displayed Columns/Display All'/>\n"
  2306. " </menu>\n"
  2307. " <menuitem name='HideColumn' action='/Hide Column'/>\n"
  2308. " <menuitem name='RemoveColumn' action='/Remove Column'/>\n"
  2309. " </popup>\n"
  2310. "</ui>\n";
  2311. static const GtkActionEntry packet_list_heading_menu_popup_action_entries[] = {
  2312. { "/Sort Ascending", GTK_STOCK_SORT_ASCENDING, "Sort Ascending", NULL, NULL, G_CALLBACK(sort_ascending_cb) },
  2313. { "/Sort Descending", GTK_STOCK_SORT_DESCENDING, "Sort Descending", NULL, NULL, G_CALLBACK(sort_descending_cb) },
  2314. { "/No Sorting", NULL, "No Sorting", NULL, NULL, G_CALLBACK(no_sorting_cb) },
  2315. { "/Align Left", GTK_STOCK_JUSTIFY_LEFT, "Align Left", NULL, NULL, G_CALLBACK(packet_list_heading_align_left_cb) },
  2316. { "/Align Center", GTK_STOCK_JUSTIFY_CENTER, "Align Center", NULL, NULL, G_CALLBACK(packet_list_heading_align_center_cb) },
  2317. { "/Align Right", GTK_STOCK_JUSTIFY_RIGHT, "Align Right", NULL, NULL, G_CALLBACK(packet_list_heading_align_right_cb) },
  2318. { "/Column Preferences", GTK_STOCK_PREFERENCES, "Column Preferences...", NULL, NULL, G_CALLBACK(packet_list_heading_col_pref_cb) },
  2319. { "/Edit Column Details", WIRESHARK_STOCK_EDIT, "Edit Column Details...", NULL, NULL, G_CALLBACK(packet_list_heading_change_col_cb) },
  2320. { "/Resize Column", WIRESHARK_STOCK_RESIZE_COLUMNS, "Resize Column", NULL, NULL, G_CALLBACK(packet_list_heading_resize_col_cb) },
  2321. { "/Displayed Columns", NULL, "Displayed Columns", NULL, NULL, NULL },
  2322. { "/Displayed Columns/Display All", NULL, "Display All", NULL, NULL, G_CALLBACK(packet_list_heading_activate_all_columns_cb) },
  2323. { "/Hide Column", NULL, "Hide Column", NULL, NULL, G_CALLBACK(packet_list_heading_hide_col_cb) },
  2324. { "/Remove Column", GTK_STOCK_DELETE, "Remove Column", NULL, NULL, G_CALLBACK(packet_list_heading_remove_col_cb) },
  2325. };
  2326. static const GtkToggleActionEntry packet_list_heading_menu_toggle_action_entries[] =
  2327. {
  2328. /* name, stock id, label, accel, tooltip, callback, is_active */
  2329. {"/Show Resolved", NULL, "Show Resolved", NULL, NULL, G_CALLBACK(packet_list_heading_show_resolved_cb), FALSE},
  2330. };
  2331. static const char *ui_desc_packet_list_menu_popup =
  2332. "<ui>\n"
  2333. " <popup name='PacketListMenuPopup' action='PopupAction'>\n"
  2334. " <menuitem name='MarkPacket' action='/MarkPacket'/>\n"
  2335. " <menuitem name='IgnorePacket' action='/IgnorePacket'/>\n"
  2336. " <menuitem name='SetTimeReference' action='/Set Time Reference'/>\n"
  2337. " <menuitem name='TimeShift' action='/TimeShift'/>\n"
  2338. " <menuitem name='AddEditPktComment' action='/Edit/AddEditPktComment'/>\n"
  2339. " <separator/>\n"
  2340. " <menuitem name='ManuallyResolveAddress' action='/ManuallyResolveAddress'/>\n"
  2341. " <separator/>\n"
  2342. " <menu name= 'ApplyAsFilter' action='/ApplyasFilter'>\n"
  2343. " <menuitem name='Selected' action='/ApplyasFilter/Selected'/>\n"
  2344. " <menuitem name='NotSelected' action='/ApplyasFilter/Not Selected'/>\n"
  2345. " <menuitem name='AndSelected' action='/ApplyasFilter/AndSelected'/>\n"
  2346. " <menuitem name='OrSelected' action='/ApplyasFilter/OrSelected'/>\n"
  2347. " <menuitem name='AndNotSelected' action='/ApplyasFilter/AndNotSelected'/>\n"
  2348. " <menuitem name='OrNotSelected' action='/ApplyasFilter/OrNotSelected'/>\n"
  2349. " </menu>\n"
  2350. " <menu name= 'PrepareaFilter' action='/PrepareaFilter'>\n"
  2351. " <menuitem name='Selected' action='/PrepareaFilter/Selected'/>\n"
  2352. " <menuitem name='NotSelected' action='/PrepareaFilter/Not Selected'/>\n"
  2353. " <menuitem name='AndSelected' action='/PrepareaFilter/AndSelected'/>\n"
  2354. " <menuitem name='OrSelected' action='/PrepareaFilter/OrSelected'/>\n"
  2355. " <menuitem name='AndNotSelected' action='/PrepareaFilter/AndNotSelected'/>\n"
  2356. " <menuitem name='OrNotSelected' action='/PrepareaFilter/OrNotSelected'/>\n"
  2357. " </menu>\n"
  2358. " <menu name= 'ConversationFilter' action='/Conversation Filter'>\n"
  2359. " <menuitem name='Ethernet' action='/Conversation Filter/Ethernet'/>\n"
  2360. " <menuitem name='IP' action='/Conversation Filter/IP'/>\n"
  2361. " <menuitem name='TCP' action='/Conversation Filter/TCP'/>\n"
  2362. " <menuitem name='UDP' action='/Conversation Filter/UDP'/>\n"
  2363. " <menuitem name='PN-CBA' action='/Conversation Filter/PN-CBA'/>\n"
  2364. " </menu>\n"
  2365. " <menu name= 'ColorizeConversation' action='/Colorize Conversation'>\n"
  2366. " <menu name= 'Ethernet' action='/Colorize Conversation/Ethernet'>\n"
  2367. " <menuitem name='Color1' action='/Colorize Conversation/Ethernet/Color 1'/>\n"
  2368. " <menuitem name='Color2' action='/Colorize Conversation/Ethernet/Color 2'/>\n"
  2369. " <menuitem name='Color3' action='/Colorize Conversation/Ethernet/Color 3'/>\n"
  2370. " <menuitem name='Color4' action='/Colorize Conversation/Ethernet/Color 4'/>\n"
  2371. " <menuitem name='Color5' action='/Colorize Conversation/Ethernet/Color 5'/>\n"
  2372. " <menuitem name='Color6' action='/Colorize Conversation/Ethernet/Color 6'/>\n"
  2373. " <menuitem name='Color7' action='/Colorize Conversation/Ethernet/Color 7'/>\n"
  2374. " <menuitem name='Color8' action='/Colorize Conversation/Ethernet/Color 8'/>\n"
  2375. " <menuitem name='Color9' action='/Colorize Conversation/Ethernet/Color 9'/>\n"
  2376. " <menuitem name='Color10' action='/Colorize Conversation/Ethernet/Color 10'/>\n"
  2377. " <menuitem name='NewColoringRule' action='/Colorize Conversation/Ethernet/New Coloring Rule'/>\n"
  2378. " </menu>\n"
  2379. " <menu name= 'IP' action='/Colorize Conversation/IP'>\n"
  2380. " <menuitem name='Color1' action='/Colorize Conversation/IP/Color 1'/>\n"
  2381. " <menuitem name='Color2' action='/Colorize Conversation/IP/Color 2'/>\n"
  2382. " <menuitem name='Color3' action='/Colorize Conversation/IP/Color 3'/>\n"
  2383. " <menuitem name='Color4' action='/Colorize Conversation/IP/Color 4'/>\n"
  2384. " <menuitem name='Color5' action='/Colorize Conversation/IP/Color 5'/>\n"
  2385. " <menuitem name='Color6' action='/Colorize Conversation/IP/Color 6'/>\n"
  2386. " <menuitem name='Color7' action='/Colorize Conversation/IP/Color 7'/>\n"
  2387. " <menuitem name='Color8' action='/Colorize Conversation/IP/Color 8'/>\n"
  2388. " <menuitem name='Color9' action='/Colorize Conversation/IP/Color 9'/>\n"
  2389. " <menuitem name='Color10' action='/Colorize Conversation/IP/Color 10'/>\n"
  2390. " <menuitem name='NewColoringRule' action='/Colorize Conversation/IP/New Coloring Rule'/>\n"
  2391. " </menu>\n"
  2392. " <menu name= 'TCP' action='/Colorize Conversation/TCP'>\n"
  2393. " <menuitem name='Color1' action='/Colorize Conversation/TCP/Color 1'/>\n"
  2394. " <menuitem name='Color2' action='/Colorize Conversation/TCP/Color 2'/>\n"
  2395. " <menuitem name='Color3' action='/Colorize Conversation/TCP/Color 3'/>\n"
  2396. " <menuitem name='Color4' action='/Colorize Conversation/TCP/Color 4'/>\n"
  2397. " <menuitem name='Color5' action='/Colorize Conversation/TCP/Color 5'/>\n"
  2398. " <menuitem name='Color6' action='/Colorize Conversation/TCP/Color 6'/>\n"
  2399. " <menuitem name='Color7' action='/Colorize Conversation/TCP/Color 7'/>\n"
  2400. " <menuitem name='Color8' action='/Colorize Conversation/TCP/Color 8'/>\n"
  2401. " <menuitem name='Color9' action='/Colorize Conversation/TCP/Color 9'/>\n"
  2402. " <menuitem name='Color10' action='/Colorize Conversation/TCP/Color 10'/>\n"
  2403. " <menuitem name='NewColoringRule' action='/Colorize Conversation/TCP/New Coloring Rule'/>\n"
  2404. " </menu>\n"
  2405. " <menu name= 'UDP' action='/Colorize Conversation/UDP'>\n"
  2406. " <menuitem name='Color1' action='/Colorize Conversation/UDP/Color 1'/>\n"
  2407. " <menuitem name='Color2' action='/Colorize Conversation/UDP/Color 2'/>\n"
  2408. " <menuitem name='Color3' action='/Colorize Conversation/UDP/Color 3'/>\n"
  2409. " <menuitem name='Color4' action='/Colorize Conversation/UDP/Color 4'/>\n"
  2410. " <menuitem name='Color5' action='/Colorize Conversation/UDP/Color 5'/>\n"
  2411. " <menuitem name='Color6' action='/Colorize Conversation/UDP/Color 6'/>\n"
  2412. " <menuitem name='Color7' action='/Colorize Conversation/UDP/Color 7'/>\n"
  2413. " <menuitem name='Color8' action='/Colorize Conversation/UDP/Color 8'/>\n"
  2414. " <menuitem name='Color9' action='/Colorize Conversation/UDP/Color 9'/>\n"
  2415. " <menuitem name='Color10' action='/Colorize Conversation/UDP/Color 10'/>\n"
  2416. " <menuitem name='NewColoringRule' action='/Colorize Conversation/UDP/New Coloring Rule'/>\n"
  2417. " </menu>\n"
  2418. " <menu name= 'PN-CBA' action='/Colorize Conversation/PN-CBA'>\n"
  2419. " <menuitem name='Color1' action='/Colorize Conversation/PN-CBA/Color 1'/>\n"
  2420. " <menuitem name='Color2' action='/Colorize Conversation/PN-CBA/Color 2'/>\n"
  2421. " <menuitem name='Color3' action='/Colorize Conversation/PN-CBA/Color 3'/>\n"
  2422. " <menuitem name='Color4' action='/Colorize Conversation/PN-CBA/Color 4'/>\n"
  2423. " <menuitem name='Color5' action='/Colorize Conversation/PN-CBA/Color 5'/>\n"
  2424. " <menuitem name='Color6' action='/Colorize Conversation/PN-CBA/Color 6'/>\n"
  2425. " <menuitem name='Color7' action='/Colorize Conversation/PN-CBA/Color 7'/>\n"
  2426. " <menuitem name='Color8' action='/Colorize Conversation/PN-CBA/Color 8'/>\n"
  2427. " <menuitem name='Color9' action='/Colorize Conversation/PN-CBA/Color 9'/>\n"
  2428. " <menuitem name='Color10' action='/Colorize Conversation/PN-CBA/Color 10'/>\n"
  2429. " <menuitem name='NewColoringRule' action='/Colorize Conversation/PN-CBA/New Coloring Rule'/>\n"
  2430. " </menu>\n"
  2431. " </menu>\n"
  2432. " <menu name= 'SCTP' action='/SCTP'>\n"
  2433. " <menuitem name='AnalysethisAssociation' action='/SCTP/Analyse this Association'/>\n"
  2434. " <menuitem name='PrepareFilterforthisAssociation' action='/SCTP/Prepare Filter for this Association'/>\n"
  2435. " </menu>\n"
  2436. " <menuitem name='FollowTCPStream' action='/Follow TCP Stream'/>\n"
  2437. " <menuitem name='FollowUDPStream' action='/Follow UDP Stream'/>\n"
  2438. " <menuitem name='FollowSSLStream' action='/Follow SSL Stream'/>\n"
  2439. " <separator/>\n"
  2440. " <menu name= 'Copy' action='/Copy'>\n"
  2441. " <menuitem name='SummaryTxt' action='/Copy/SummaryTxt'/>\n"
  2442. " <menuitem name='SummaryCSV' action='/Copy/SummaryCSV'/>\n"
  2443. " <menuitem name='AsFilter' action='/Copy/AsFilter'/>\n"
  2444. " <separator/>\n"
  2445. " <menu name= 'Bytes' action='/Copy/Bytes'>\n"
  2446. " <menuitem name='OffsetHexText' action='/Copy/Bytes/OffsetHexText'/>\n"
  2447. " <menuitem name='OffsetHex' action='/Copy/Bytes/OffsetHex'/>\n"
  2448. " <menuitem name='PrintableTextOnly' action='/Copy/Bytes/PrintableTextOnly'/>\n"
  2449. " <separator/>\n"
  2450. " <menuitem name='HexStream' action='/Copy/Bytes/HexStream'/>\n"
  2451. " <menuitem name='BinaryStream' action='/Copy/Bytes/BinaryStream'/>\n"
  2452. " </menu>\n"
  2453. " </menu>\n"
  2454. " <separator/>\n"
  2455. " <menuitem name='ProtocolPreferences' action='/ProtocolPreferences'/>\n"
  2456. " <menuitem name='DecodeAs' action='/DecodeAs'/>\n"
  2457. " <menuitem name='Print' action='/Print'/>\n"
  2458. " <menuitem name='ShowPacketinNewWindow' action='/ShowPacketinNewWindow'/>\n"
  2459. " </popup>\n"
  2460. "</ui>\n";
  2461. static const GtkActionEntry apply_prepare_filter_action_entries[] = {
  2462. { "/ApplyasFilter", NULL, "Apply as Filter", NULL, NULL, NULL },
  2463. { "/ApplyasFilter/Selected", NULL, "_Selected" , NULL, NULL, G_CALLBACK(apply_selected_filter_cb) },
  2464. { "/ApplyasFilter/Not Selected", NULL, "_Not Selected", NULL, NULL, G_CALLBACK(apply_not_selected_cb) },
  2465. { "/ApplyasFilter/AndSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _and Selected", NULL, NULL, G_CALLBACK(apply_and_selected_cb) },
  2466. { "/ApplyasFilter/OrSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _or Selected", NULL, NULL, G_CALLBACK(apply_or_selected_cb) },
  2467. { "/ApplyasFilter/AndNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " a_nd not Selected", NULL, NULL, G_CALLBACK(apply_and_not_selected_cb) },
  2468. { "/ApplyasFilter/OrNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " o_r not Selected", NULL, NULL, G_CALLBACK(apply_or_not_selected_cb) },
  2469. { "/PrepareaFilter", NULL, "Prepare a Filter", NULL, NULL, NULL },
  2470. { "/PrepareaFilter/Selected", NULL, "_Selected" , NULL, NULL, G_CALLBACK(prepare_selected_cb) },
  2471. { "/PrepareaFilter/Not Selected", NULL, "_Not Selected", NULL, NULL, G_CALLBACK(prepare_not_selected_cb) },
  2472. { "/PrepareaFilter/AndSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _and Selected", NULL, NULL, G_CALLBACK(prepare_and_selected_cb) },
  2473. { "/PrepareaFilter/OrSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " _or Selected", NULL, NULL, G_CALLBACK(prepare_or_selected_cb) },
  2474. { "/PrepareaFilter/AndNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " a_nd not Selected", NULL, NULL, G_CALLBACK(prepare_and_not_selected_cb) },
  2475. { "/PrepareaFilter/OrNotSelected", NULL, UTF8_HORIZONTAL_ELLIPSIS " o_r not Selected", NULL, NULL, G_CALLBACK(prepare_or_not_selected_cb) },
  2476. };
  2477. static const GtkActionEntry packet_list_menu_popup_action_entries[] = {
  2478. { "/MarkPacket", NULL, "Mark Packet (toggle)", NULL, NULL, G_CALLBACK(packet_list_mark_frame_cb) },
  2479. { "/IgnorePacket", NULL, "Ignore Packet (toggle)", NULL, NULL, G_CALLBACK(packet_list_ignore_frame_cb) },
  2480. { "/Set Time Reference", WIRESHARK_STOCK_TIME, "Set Time Reference (toggle)", NULL, NULL, G_CALLBACK(packet_list_menu_set_ref_time_cb) },
  2481. { "/TimeShift", WIRESHARK_STOCK_TIME, "Time Shift...", NULL, NULL, G_CALLBACK(time_shift_cb) },
  2482. { "/ManuallyResolveAddress", NULL, "Manually Resolve Address", NULL, NULL, G_CALLBACK(manual_addr_resolv_dlg) },
  2483. { "/Edit/AddEditPktComment", WIRESHARK_STOCK_EDIT, "Packet Comment...", NULL, NULL, G_CALLBACK(edit_packet_comment_dlg) },
  2484. { "/Conversation Filter", NULL, "Conversation Filter", NULL, NULL, NULL },
  2485. { "/Conversation Filter/Ethernet", NULL, "Ethernet", NULL, NULL, G_CALLBACK(packet_list_menu_conversation_ethernet_cb) },
  2486. { "/Conversation Filter/IP", NULL, "IP", NULL, NULL, G_CALLBACK(packet_list_menu_conversation_ip_cb) },
  2487. { "/Conversation Filter/TCP", NULL, "TCP", NULL, NULL, G_CALLBACK(packet_list_menu_conversation_tcp_cb) },
  2488. { "/Conversation Filter/UDP", NULL, "UDP", NULL, NULL, G_CALLBACK(packet_list_menu_conversation_udp_cb) },
  2489. { "/Conversation Filter/PN-CBA", NULL, "PN-CBA", NULL, NULL, G_CALLBACK(packet_list_menu_conversation_pn_cba_cb) },
  2490. { "/Colorize Conversation", NULL, "Colorize Conversation", NULL, NULL, NULL },
  2491. { "/Colorize Conversation/Ethernet", NULL, "Ethernet", NULL, NULL, NULL },
  2492. { "/Colorize Conversation/Ethernet/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color1_cb) },
  2493. { "/Colorize Conversation/Ethernet/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color2_cb) },
  2494. { "/Colorize Conversation/Ethernet/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color3_cb) },
  2495. { "/Colorize Conversation/Ethernet/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color4_cb) },
  2496. { "/Colorize Conversation/Ethernet/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color5_cb) },
  2497. { "/Colorize Conversation/Ethernet/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color6_cb) },
  2498. { "/Colorize Conversation/Ethernet/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color7_cb) },
  2499. { "/Colorize Conversation/Ethernet/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color8_cb) },
  2500. { "/Colorize Conversation/Ethernet/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color9_cb) },
  2501. { "/Colorize Conversation/Ethernet/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_color10_cb) },
  2502. { "/Colorize Conversation/Ethernet/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ethernet_new_rule_cb) },
  2503. { "/Colorize Conversation/IP", NULL, "IP", NULL, NULL, NULL },
  2504. { "/Colorize Conversation/IP/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color1_cb) },
  2505. { "/Colorize Conversation/IP/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color2_cb) },
  2506. { "/Colorize Conversation/IP/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color3_cb) },
  2507. { "/Colorize Conversation/IP/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color4_cb) },
  2508. { "/Colorize Conversation/IP/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color5_cb) },
  2509. { "/Colorize Conversation/IP/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color6_cb) },
  2510. { "/Colorize Conversation/IP/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color7_cb) },
  2511. { "/Colorize Conversation/IP/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color8_cb) },
  2512. { "/Colorize Conversation/IP/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color9_cb) },
  2513. { "/Colorize Conversation/IP/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_color10_cb) },
  2514. { "/Colorize Conversation/IP/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_ip_new_rule_cb) },
  2515. { "/Colorize Conversation/TCP", NULL, "TCP", NULL, NULL, NULL },
  2516. { "/Colorize Conversation/TCP/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color1_cb) },
  2517. { "/Colorize Conversation/TCP/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color2_cb) },
  2518. { "/Colorize Conversation/TCP/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color3_cb) },
  2519. { "/Colorize Conversation/TCP/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color4_cb) },
  2520. { "/Colorize Conversation/TCP/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color5_cb) },
  2521. { "/Colorize Conversation/TCP/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color6_cb) },
  2522. { "/Colorize Conversation/TCP/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color7_cb) },
  2523. { "/Colorize Conversation/TCP/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color8_cb) },
  2524. { "/Colorize Conversation/TCP/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color9_cb) },
  2525. { "/Colorize Conversation/TCP/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_color10_cb) },
  2526. { "/Colorize Conversation/TCP/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_tcp_new_rule_cb) },
  2527. { "/Colorize Conversation/UDP", NULL, "UDP", NULL, NULL, NULL },
  2528. { "/Colorize Conversation/UDP/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color1_cb) },
  2529. { "/Colorize Conversation/UDP/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color2_cb) },
  2530. { "/Colorize Conversation/UDP/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color3_cb) },
  2531. { "/Colorize Conversation/UDP/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color4_cb) },
  2532. { "/Colorize Conversation/UDP/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color5_cb) },
  2533. { "/Colorize Conversation/UDP/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color6_cb) },
  2534. { "/Colorize Conversation/UDP/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color7_cb) },
  2535. { "/Colorize Conversation/UDP/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color8_cb) },
  2536. { "/Colorize Conversation/UDP/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color9_cb) },
  2537. { "/Colorize Conversation/UDP/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_color10_cb) },
  2538. { "/Colorize Conversation/UDP/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_udp_new_rule_cb) },
  2539. { "/Colorize Conversation/PN-CBA", NULL, "PN-CBA Server", NULL, NULL, NULL },
  2540. { "/Colorize Conversation/PN-CBA/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color1_cb) },
  2541. { "/Colorize Conversation/PN-CBA/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color2_cb) },
  2542. { "/Colorize Conversation/PN-CBA/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color3_cb) },
  2543. { "/Colorize Conversation/PN-CBA/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color4_cb) },
  2544. { "/Colorize Conversation/PN-CBA/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color5_cb) },
  2545. { "/Colorize Conversation/PN-CBA/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color6_cb) },
  2546. { "/Colorize Conversation/PN-CBA/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color7_cb) },
  2547. { "/Colorize Conversation/PN-CBA/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color8_cb) },
  2548. { "/Colorize Conversation/PN-CBA/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color9_cb) },
  2549. { "/Colorize Conversation/PN-CBA/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_color10_cb) },
  2550. { "/Colorize Conversation/PN-CBA/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(packet_list_menu_color_conv_cba_new_rule_cb) },
  2551. { "/SCTP", NULL, "SCTP", NULL, NULL, NULL },
  2552. { "/SCTP/Analyse this Association", NULL, "Analyse this Association", NULL, NULL, G_CALLBACK(sctp_analyse_start) },
  2553. { "/SCTP/Prepare Filter for this Association", NULL, "Prepare Filter for this Association", NULL, NULL, G_CALLBACK(sctp_set_assoc_filter) },
  2554. { "/Follow TCP Stream", NULL, "Follow TCP Stream", NULL, NULL, G_CALLBACK(follow_tcp_stream_cb) },
  2555. { "/Follow UDP Stream", NULL, "Follow UDP Stream", NULL, NULL, G_CALLBACK(follow_udp_stream_cb) },
  2556. { "/Follow SSL Stream", NULL, "Follow SSL Stream", NULL, NULL, G_CALLBACK(follow_ssl_stream_cb) },
  2557. { "/Copy", NULL, "Copy", NULL, NULL, NULL },
  2558. { "/Copy/SummaryTxt", NULL, "Summary (Text)", NULL, NULL, G_CALLBACK(packet_list_menu_copy_sum_txt) },
  2559. { "/Copy/SummaryCSV", NULL, "Summary (CSV)", NULL, NULL, G_CALLBACK(packet_list_menu_copy_sum_csv) },
  2560. { "/Copy/AsFilter", NULL, "As Filter", NULL, NULL, G_CALLBACK(packet_list_menu_copy_as_flt) },
  2561. { "/Copy/Bytes", NULL, "Bytes", NULL, NULL, NULL },
  2562. { "/Copy/Bytes/OffsetHexText", NULL, "Offset Hex Text", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_oht_cb) },
  2563. { "/Copy/Bytes/OffsetHex", NULL, "Offset Hex", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_oh_cb) },
  2564. { "/Copy/Bytes/PrintableTextOnly", NULL, "Printable Text Only", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_text_cb) },
  2565. { "/Copy/Bytes/HexStream", NULL, "Hex Stream", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_hex_strm_cb) },
  2566. { "/Copy/Bytes/BinaryStream", NULL, "Binary Stream", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_bin_strm_cb) },
  2567. { "/ProtocolPreferences", NULL, "Protocol Preferences", NULL, NULL, NULL },
  2568. { "/DecodeAs", WIRESHARK_STOCK_DECODE_AS, "Decode As...", NULL, NULL, G_CALLBACK(decode_as_cb) },
  2569. { "/Print", GTK_STOCK_PRINT, "Print...", NULL, NULL, G_CALLBACK(file_print_selected_cmd_cb) },
  2570. { "/ShowPacketinNewWindow", NULL, "Show Packet in New Window", NULL, NULL, G_CALLBACK(new_window_cb) },
  2571. };
  2572. static const char *ui_desc_tree_view_menu_popup =
  2573. "<ui>\n"
  2574. " <popup name='TreeViewPopup' action='PopupAction'>\n"
  2575. " <menuitem name='ExpandSubtrees' action='/ExpandSubtrees'/>\n"
  2576. " <menuitem name='ExpandAll' action='/ExpandAll'/>\n"
  2577. " <menuitem name='CollapseAll' action='/CollapseAll'/>\n"
  2578. " <separator/>\n"
  2579. " <menuitem name='ApplyasColumn' action='/Apply as Column'/>\n"
  2580. " <separator/>\n"
  2581. " <menu name= 'ApplyAsFilter' action='/ApplyasFilter'>\n"
  2582. " <menuitem name='Selected' action='/ApplyasFilter/Selected'/>\n"
  2583. " <menuitem name='NotSelected' action='/ApplyasFilter/Not Selected'/>\n"
  2584. " <menuitem name='AndSelected' action='/ApplyasFilter/AndSelected'/>\n"
  2585. " <menuitem name='OrSelected' action='/ApplyasFilter/OrSelected'/>\n"
  2586. " <menuitem name='AndNotSelected' action='/ApplyasFilter/AndNotSelected'/>\n"
  2587. " <menuitem name='OrNotSelected' action='/ApplyasFilter/OrNotSelected'/>\n"
  2588. " </menu>\n"
  2589. " <menu name= 'PrepareaFilter' action='/PrepareaFilter'>\n"
  2590. " <menuitem name='Selected' action='/PrepareaFilter/Selected'/>\n"
  2591. " <menuitem name='NotSelected' action='/PrepareaFilter/Not Selected'/>\n"
  2592. " <menuitem name='AndSelected' action='/PrepareaFilter/AndSelected'/>\n"
  2593. " <menuitem name='OrSelected' action='/PrepareaFilter/OrSelected'/>\n"
  2594. " <menuitem name='AndNotSelected' action='/PrepareaFilter/AndNotSelected'/>\n"
  2595. " <menuitem name='OrNotSelected' action='/PrepareaFilter/OrNotSelected'/>\n"
  2596. " </menu>\n"
  2597. " <menu name= 'ColorizewithFilter' action='/Colorize with Filter'>\n"
  2598. " <menuitem name='Color1' action='/Colorize with Filter/Color 1'/>\n"
  2599. " <menuitem name='Color2' action='/Colorize with Filter/Color 2'/>\n"
  2600. " <menuitem name='Color3' action='/Colorize with Filter/Color 3'/>\n"
  2601. " <menuitem name='Color4' action='/Colorize with Filter/Color 4'/>\n"
  2602. " <menuitem name='Color5' action='/Colorize with Filter/Color 5'/>\n"
  2603. " <menuitem name='Color6' action='/Colorize with Filter/Color 6'/>\n"
  2604. " <menuitem name='Color7' action='/Colorize with Filter/Color 7'/>\n"
  2605. " <menuitem name='Color8' action='/Colorize with Filter/Color 8'/>\n"
  2606. " <menuitem name='Color9' action='/Colorize with Filter/Color 9'/>\n"
  2607. " <menuitem name='Color10' action='/Colorize with Filter/Color 10'/>\n"
  2608. " <menuitem name='NewColoringRule' action='/Colorize with Filter/New Coloring Rule'/>\n"
  2609. " </menu>\n"
  2610. " <menuitem name='FollowTCPStream' action='/Follow TCP Stream'/>\n"
  2611. " <menuitem name='FollowUDPStream' action='/Follow UDP Stream'/>\n"
  2612. " <menuitem name='FollowSSLStream' action='/Follow SSL Stream'/>\n"
  2613. " <separator/>\n"
  2614. " <menu name= 'Copy' action='/Copy'>\n"
  2615. " <menuitem name='Description' action='/Copy/Description'/>\n"
  2616. " <menuitem name='Fieldname' action='/Copy/Fieldname'/>\n"
  2617. " <menuitem name='Value' action='/Copy/Value'/>\n"
  2618. " <separator/>\n"
  2619. " <menuitem name='AsFilter' action='/Copy/AsFilter'/>\n"
  2620. " <separator/>\n"
  2621. " <menu name= 'Bytes' action='/Copy/Bytes'>\n"
  2622. " <menuitem name='OffsetHexText' action='/Copy/Bytes/OffsetHexText'/>\n"
  2623. " <menuitem name='OffsetHex' action='/Copy/Bytes/OffsetHex'/>\n"
  2624. " <menuitem name='PrintableTextOnly' action='/Copy/Bytes/PrintableTextOnly'/>\n"
  2625. " <separator/>\n"
  2626. " <menuitem name='HexStream' action='/Copy/Bytes/HexStream'/>\n"
  2627. " <menuitem name='BinaryStream' action='/Copy/Bytes/BinaryStream'/>\n"
  2628. " </menu>\n"
  2629. " </menu>\n"
  2630. " <menuitem name='ExportSelectedPacketBytes' action='/ExportSelectedPacketBytes'/>\n"
  2631. " <separator/>\n"
  2632. " <menuitem name='WikiProtocolPage' action='/WikiProtocolPage'/>\n"
  2633. " <menuitem name='FilterFieldReference' action='/FilterFieldReference'/>\n"
  2634. " <menuitem name='ProtocolHelp' action='/ProtocolHelp'/>\n"
  2635. " <menuitem name='ProtocolPreferences' action='/ProtocolPreferences'/>\n"
  2636. " <separator/>\n"
  2637. " <menuitem name='DecodeAs' action='/DecodeAs'/>\n"
  2638. " <menuitem name='DisableProtocol' action='/DisableProtocol'/>\n"
  2639. " <menuitem name='ResolveName' action='/ResolveName'/>\n"
  2640. " <menuitem name='GotoCorrespondingPacket' action='/GotoCorrespondingPacket'/>\n"
  2641. " <menuitem name='ShowPacketRefinNewWindow' action='/ShowPacketRefinNewWindow'/>\n"
  2642. " </popup>\n"
  2643. "</ui>\n";
  2644. static const GtkActionEntry tree_view_menu_popup_action_entries[] = {
  2645. { "/ExpandSubtrees", NULL, "Expand Subtrees", NULL, NULL, G_CALLBACK(expand_tree_cb) },
  2646. { "/ExpandAll", NULL, "Expand All", NULL, NULL, G_CALLBACK(expand_all_cb) },
  2647. { "/CollapseAll", NULL, "Collapse All", NULL, NULL, G_CALLBACK(collapse_all_cb) },
  2648. { "/Apply as Column", NULL, "Apply as Column", NULL, NULL, G_CALLBACK(apply_as_custom_column_cb) },
  2649. { "/Colorize with Filter", NULL, "Colorize with Filter", NULL, NULL, NULL },
  2650. { "/Colorize with Filter/Color 1", WIRESHARK_STOCK_COLOR1, "Color 1", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color1_cb) },
  2651. { "/Colorize with Filter/Color 2", WIRESHARK_STOCK_COLOR2, "Color 2", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color2_cb) },
  2652. { "/Colorize with Filter/Color 3", WIRESHARK_STOCK_COLOR3, "Color 3", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color3_cb) },
  2653. { "/Colorize with Filter/Color 4", WIRESHARK_STOCK_COLOR4, "Color 4", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color4_cb) },
  2654. { "/Colorize with Filter/Color 5", WIRESHARK_STOCK_COLOR5, "Color 5", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color5_cb) },
  2655. { "/Colorize with Filter/Color 6", WIRESHARK_STOCK_COLOR6, "Color 6", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color6_cb) },
  2656. { "/Colorize with Filter/Color 7", WIRESHARK_STOCK_COLOR7, "Color 7", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color7_cb) },
  2657. { "/Colorize with Filter/Color 8", WIRESHARK_STOCK_COLOR8, "Color 8", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color8_cb) },
  2658. { "/Colorize with Filter/Color 9", WIRESHARK_STOCK_COLOR9, "Color 9", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color9_cb) },
  2659. { "/Colorize with Filter/Color 10", WIRESHARK_STOCK_COLOR0, "Color 10", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_color10_cb) },
  2660. { "/Colorize with Filter/New Coloring Rule", NULL, "New Coloring Rule...", NULL, NULL, G_CALLBACK(tree_view_menu_color_with_flt_new_rule_cb) },
  2661. { "/Follow TCP Stream", NULL, "Follow TCP Stream", NULL, NULL, G_CALLBACK(follow_tcp_stream_cb) },
  2662. { "/Follow UDP Stream", NULL, "Follow UDP Stream", NULL, NULL, G_CALLBACK(follow_udp_stream_cb) },
  2663. { "/Follow SSL Stream", NULL, "Follow SSL Stream", NULL, NULL, G_CALLBACK(follow_ssl_stream_cb) },
  2664. { "/Copy", NULL, "Copy", NULL, NULL, NULL },
  2665. { "/Copy/Description", NULL, "Description", NULL, NULL, G_CALLBACK(tree_view_menu_copy_desc) },
  2666. { "/Copy/Fieldname", NULL, "Fieldname", NULL, NULL, G_CALLBACK(tree_view_menu_copy_field) },
  2667. { "/Copy/Value", NULL, "Value", NULL, NULL, G_CALLBACK(tree_view_menu_copy_value) },
  2668. { "/Copy/AsFilter", NULL, "As Filter", NULL, NULL, G_CALLBACK(tree_view_menu_copy_as_flt) },
  2669. { "/Copy/Bytes", NULL, "Bytes", NULL, NULL, NULL },
  2670. { "/Copy/Bytes/OffsetHexText", NULL, "Offset Hex Text", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_oht_cb) },
  2671. { "/Copy/Bytes/OffsetHex", NULL, "Offset Hex", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_oh_cb) },
  2672. { "/Copy/Bytes/PrintableTextOnly", NULL, "Printable Text Only", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_text_cb) },
  2673. { "/Copy/Bytes/HexStream", NULL, "Hex Stream", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_hex_strm_cb) },
  2674. { "/Copy/Bytes/BinaryStream", NULL, "Binary Stream", NULL, NULL, G_CALLBACK(packet_list_menu_copy_bytes_bin_strm_cb) },
  2675. { "/ExportSelectedPacketBytes", NULL, "Export Selected Packet Bytes...", NULL, NULL, G_CALLBACK(savehex_cb) },
  2676. { "/WikiProtocolPage", WIRESHARK_STOCK_WIKI, "Wiki Protocol Page", NULL, NULL, G_CALLBACK(selected_ptree_info_cb) },
  2677. { "/FilterFieldReference", WIRESHARK_STOCK_INTERNET, "Filter Field Reference", NULL, NULL, G_CALLBACK(selected_ptree_ref_cb) },
  2678. { "/ProtocolHelp", NULL, "Protocol Help", NULL, NULL, NULL },
  2679. { "/ProtocolPreferences", NULL, "Protocol Preferences", NULL, NULL, NULL },
  2680. { "/DecodeAs", WIRESHARK_STOCK_DECODE_AS, "Decode As...", NULL, NULL, G_CALLBACK(decode_as_cb) },
  2681. { "/DisableProtocol", WIRESHARK_STOCK_CHECKBOX, "Disable Protocol...", NULL, NULL, G_CALLBACK(proto_disable_cb) },
  2682. { "/ResolveName", NULL, "_Resolve Name", NULL, NULL, G_CALLBACK(resolve_name_cb) },
  2683. { "/GotoCorrespondingPacket", NULL, "_Go to Corresponding Packet", NULL, NULL, G_CALLBACK(goto_framenum_cb) },
  2684. { "/ShowPacketRefinNewWindow", NULL, "Show Packet Reference in New Window", NULL, NULL, G_CALLBACK(new_window_cb_ref) },
  2685. };
  2686. static const char *ui_desc_bytes_menu_popup =
  2687. "<ui>\n"
  2688. " <popup name='BytesMenuPopup' action='PopupAction'>\n"
  2689. " <menuitem name='HexView' action='/HexView'/>\n"
  2690. " <menuitem name='BitsView' action='/BitsView'/>\n"
  2691. " </popup>\n"
  2692. "</ui>\n";
  2693. static const GtkRadioActionEntry bytes_menu_radio_action_entries [] =
  2694. {
  2695. /* name, stock id, label, accel, tooltip, value */
  2696. { "/HexView", NULL, "Hex View", NULL, NULL, BYTES_HEX },
  2697. { "/BitsView", NULL, "Bits View", NULL, NULL, BYTES_BITS },
  2698. };
  2699. static const char *ui_statusbar_profiles_menu_popup =
  2700. "<ui>\n"
  2701. " <popup name='ProfilesMenuPopup' action='PopupAction'>\n"
  2702. " <menuitem name='Profiles' action='/Profiles'/>\n"
  2703. " <separator/>\n"
  2704. " <menuitem name='New' action='/New'/>\n"
  2705. " <menuitem name='Rename' action='/Rename'/>\n"
  2706. " <menuitem name='Delete' action='/Delete'/>\n"
  2707. " <separator/>\n"
  2708. " <menu name='Change' action='/Change'>\n"
  2709. " <menuitem name='Default' action='/Change/Default'/>\n"
  2710. " </menu>\n"
  2711. " </popup>\n"
  2712. "</ui>\n";
  2713. static const GtkActionEntry statusbar_profiles_menu_action_entries [] =
  2714. {
  2715. { "/Profiles", GTK_STOCK_INDEX, "Manage Profiles...", NULL, NULL, G_CALLBACK(profile_dialog_cb) },
  2716. { "/New", GTK_STOCK_NEW, "New...", NULL, NULL, G_CALLBACK(profile_new_cb) },
  2717. { "/Rename", GTK_STOCK_EDIT, "Rename...", NULL, NULL, G_CALLBACK(profile_rename_cb) },
  2718. { "/Delete", GTK_STOCK_DELETE, "Delete", NULL, NULL, G_CALLBACK(profile_delete_cb) },
  2719. { "/Change", GTK_STOCK_JUMP_TO, "Switch to", NULL, NULL, NULL },
  2720. { "/Change/Default", NULL, "Default", NULL, NULL, NULL },
  2721. };
  2722. GtkWidget *
  2723. main_menu_new(GtkAccelGroup ** table)
  2724. {
  2725. GtkWidget *menubar;
  2726. #ifdef HAVE_IGE_MAC_INTEGRATION
  2727. GtkWidget *quit_item, *about_item, *preferences_item;
  2728. IgeMacMenuGroup *group;
  2729. #endif
  2730. #ifdef HAVE_GTKOSXAPPLICATION
  2731. GtkosxApplication *theApp;
  2732. GtkWidget * item;
  2733. GtkWidget * dock_menu;
  2734. #endif
  2735. grp = gtk_accel_group_new();
  2736. if (initialize)
  2737. menus_init();
  2738. menubar = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar");
  2739. #ifdef HAVE_IGE_MAC_INTEGRATION
  2740. if(prefs.gui_macosx_style) {
  2741. ige_mac_menu_set_menu_bar(GTK_MENU_SHELL(menubar));
  2742. ige_mac_menu_set_global_key_handler_enabled(TRUE);
  2743. /* Create menu items to populate the application menu with. We have to
  2744. * do this because we are still using the old GtkItemFactory API for
  2745. * the main menu. */
  2746. group = ige_mac_menu_add_app_menu_group();
  2747. about_item = gtk_menu_item_new_with_label("About");
  2748. g_signal_connect(about_item, "activate", G_CALLBACK(about_wireshark_cb),
  2749. NULL);
  2750. ige_mac_menu_add_app_menu_item(group, GTK_MENU_ITEM(about_item), NULL);
  2751. group = ige_mac_menu_add_app_menu_group();
  2752. preferences_item = gtk_menu_item_new_with_label("Preferences");
  2753. g_signal_connect(preferences_item, "activate", G_CALLBACK(prefs_cb),
  2754. NULL);
  2755. ige_mac_menu_add_app_menu_item(group, GTK_MENU_ITEM(preferences_item),
  2756. NULL);
  2757. }
  2758. /* The quit item in the application menu shows up whenever ige mac
  2759. * integration is enabled, even if the OS X UI style in Wireshark isn't
  2760. * turned on. */
  2761. quit_item = gtk_menu_item_new_with_label("Quit");
  2762. g_signal_connect(quit_item, "activate", G_CALLBACK(file_quit_cmd_cb), NULL);
  2763. ige_mac_menu_set_quit_menu_item(GTK_MENU_ITEM(quit_item));
  2764. #endif
  2765. #ifdef HAVE_GTKOSXAPPLICATION
  2766. theApp = (GtkosxApplication *)g_object_new(GTKOSX_TYPE_APPLICATION, NULL);
  2767. if(prefs.gui_macosx_style) {
  2768. gtk_widget_hide(menubar);
  2769. gtkosx_application_set_menu_bar(theApp, GTK_MENU_SHELL(menubar));
  2770. gtkosx_application_set_use_quartz_accelerators(theApp, TRUE);
  2771. /* Construct a conventional looking OSX App menu */
  2772. item = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/HelpMenu/AboutWireshark");
  2773. gtkosx_application_insert_app_menu_item(theApp, item, 0);
  2774. gtkosx_application_insert_app_menu_item(theApp, gtk_separator_menu_item_new(), 1);
  2775. item = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/EditMenu/Preferences");
  2776. gtkosx_application_insert_app_menu_item(theApp, item, 2);
  2777. /* Set OSX help menu */
  2778. item = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/HelpMenu");
  2779. gtkosx_application_set_help_menu(theApp,GTK_MENU_ITEM(item));
  2780. /* Hide the File menu Quit item (a Quit item is automagically placed within the OSX App menu) */
  2781. item = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/FileMenu/Quit");
  2782. gtk_widget_hide(item);
  2783. }
  2784. /* generate dock menu */
  2785. dock_menu = gtk_menu_new();
  2786. item = gtk_menu_item_new_with_label("Start");
  2787. g_signal_connect(item, "activate", G_CALLBACK (capture_start_cb), NULL);
  2788. gtk_menu_shell_append(GTK_MENU_SHELL(dock_menu), item);
  2789. item = gtk_menu_item_new_with_label("Stop");
  2790. g_signal_connect(item, "activate", G_CALLBACK (capture_stop_cb), NULL);
  2791. gtk_menu_shell_append(GTK_MENU_SHELL(dock_menu), item);
  2792. item = gtk_menu_item_new_with_label("Restart");
  2793. g_signal_connect(item, "activate", G_CALLBACK (capture_restart_cb), NULL);
  2794. gtk_menu_shell_append(GTK_MENU_SHELL(dock_menu), item);
  2795. gtkosx_application_set_dock_menu(theApp, GTK_MENU_SHELL(dock_menu));
  2796. #endif
  2797. if (table)
  2798. *table = grp;
  2799. return menubar;
  2800. }
  2801. static void
  2802. menu_dissector_filter_cb(GtkAction *action _U_, gpointer callback_data)
  2803. {
  2804. dissector_filter_t *filter_entry = (dissector_filter_t *)callback_data;
  2805. GtkWidget *filter_te;
  2806. const char *buf;
  2807. filter_te = gtk_bin_get_child(GTK_BIN(g_object_get_data(G_OBJECT(top_level), E_DFILTER_CM_KEY)));
  2808. /* XXX - this gets the packet_info of the last dissected packet, */
  2809. /* which is not necessarily the last selected packet */
  2810. /* e.g. "Update list of packets in real time" won't work correct */
  2811. buf = filter_entry->build_filter_string(&cfile.edt->pi);
  2812. gtk_entry_set_text(GTK_ENTRY(filter_te), buf);
  2813. /* Run the display filter so it goes in effect - even if it's the
  2814. same as the previous display filter. */
  2815. main_filter_packets(&cfile, buf, TRUE);
  2816. g_free( (void *) buf);
  2817. }
  2818. static gboolean
  2819. menu_dissector_filter_spe_cb(frame_data *fd _U_, epan_dissect_t *edt, gpointer callback_data)
  2820. {
  2821. dissector_filter_t *filter_entry = (dissector_filter_t *)callback_data;
  2822. /* XXX - this gets the packet_info of the last dissected packet, */
  2823. /* which is not necessarily the last selected packet */
  2824. /* e.g. "Update list of packets in real time" won't work correct */
  2825. return (edt != NULL) ? filter_entry->is_filter_valid(&edt->pi) : FALSE;
  2826. }
  2827. static void
  2828. menu_dissector_filter(capture_file *cf)
  2829. {
  2830. GList *list_entry = dissector_filter_list;
  2831. dissector_filter_t *filter_entry;
  2832. guint merge_id;
  2833. GtkActionGroup *action_group;
  2834. GtkAction *action;
  2835. GtkWidget *submenu_dissector_filters;
  2836. gchar *action_name;
  2837. guint i = 0;
  2838. merge_id = gtk_ui_manager_new_merge_id (ui_manager_main_menubar);
  2839. action_group = gtk_action_group_new ("dissector-filters-group");
  2840. submenu_dissector_filters = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/ConversationFilterMenu");
  2841. if(!submenu_dissector_filters){
  2842. g_warning("add_recent_items: No submenu_dissector_filters found, path= /Menubar/AnalyzeMenu/ConversationFilterMenu");
  2843. }
  2844. gtk_ui_manager_insert_action_group (ui_manager_main_menubar, action_group, 0);
  2845. g_object_set_data (G_OBJECT (ui_manager_main_menubar),
  2846. "diessector-filters-merge-id", GUINT_TO_POINTER (merge_id));
  2847. /* no items */
  2848. if (!list_entry){
  2849. action = (GtkAction *)g_object_new (GTK_TYPE_ACTION,
  2850. "name", "filter-list-empty",
  2851. "label", "No filters",
  2852. "sensitive", FALSE,
  2853. NULL);
  2854. gtk_action_group_add_action (action_group, action);
  2855. gtk_action_set_sensitive(action, FALSE);
  2856. g_object_unref (action);
  2857. gtk_ui_manager_add_ui (ui_manager_main_menubar, merge_id,
  2858. "/Menubar/AnalyzeMenu/ConversationFilterMenu/Filters",
  2859. "filter-list-empty",
  2860. "filter-list-empty",
  2861. GTK_UI_MANAGER_MENUITEM,
  2862. FALSE);
  2863. return;
  2864. }
  2865. while (list_entry != NULL) {
  2866. filter_entry = (dissector_filter_t *)list_entry->data;
  2867. action_name = g_strdup_printf ("filter-%u", i);
  2868. /*g_warning("action_name %s, filter_entry->name %s",action_name,filter_entry->name);*/
  2869. action = (GtkAction *)g_object_new (GTK_TYPE_ACTION,
  2870. "name", action_name,
  2871. "label", filter_entry->name,
  2872. "sensitive", menu_dissector_filter_spe_cb(/* frame_data *fd _U_*/ NULL, cf->edt, filter_entry),
  2873. NULL);
  2874. g_signal_connect (action, "activate",
  2875. G_CALLBACK (menu_dissector_filter_cb), filter_entry);
  2876. gtk_action_group_add_action (action_group, action);
  2877. g_object_unref (action);
  2878. gtk_ui_manager_add_ui (ui_manager_main_menubar, merge_id,
  2879. "/Menubar/AnalyzeMenu/ConversationFilterMenu/Filters",
  2880. action_name,
  2881. action_name,
  2882. GTK_UI_MANAGER_MENUITEM,
  2883. FALSE);
  2884. g_free(action_name);
  2885. i++;
  2886. list_entry = g_list_next(list_entry);
  2887. }
  2888. }
  2889. static void
  2890. menus_init(void)
  2891. {
  2892. GtkActionGroup *packet_list_heading_action_group, *packet_list_action_group,
  2893. *packet_list_details_action_group, *packet_list_byte_menu_action_group,
  2894. *statusbar_profiles_action_group;
  2895. GtkAction *name_res_action;
  2896. GError *error = NULL;
  2897. guint merge_id;
  2898. if (initialize) {
  2899. initialize = FALSE;
  2900. popup_menu_object = gtk_menu_new();
  2901. /* packet list heading pop-up menu */
  2902. packet_list_heading_action_group = gtk_action_group_new ("PacketListHeadingPopUpMenuActionGroup");
  2903. gtk_action_group_add_actions (packet_list_heading_action_group, /* the action group */
  2904. packet_list_heading_menu_popup_action_entries, /* an array of action descriptions */
  2905. G_N_ELEMENTS(packet_list_heading_menu_popup_action_entries), /* the number of entries */
  2906. popup_menu_object); /* data to pass to the action callbacks */
  2907. gtk_action_group_add_toggle_actions(packet_list_heading_action_group, /* the action group */
  2908. (GtkToggleActionEntry *)packet_list_heading_menu_toggle_action_entries, /* an array of action descriptions */
  2909. G_N_ELEMENTS(packet_list_heading_menu_toggle_action_entries), /* the number of entries */
  2910. NULL); /* data to pass to the action callbacks */
  2911. ui_manager_packet_list_heading = gtk_ui_manager_new ();
  2912. gtk_ui_manager_insert_action_group (ui_manager_packet_list_heading,
  2913. packet_list_heading_action_group,
  2914. 0); /* the position at which the group will be inserted. */
  2915. gtk_ui_manager_add_ui_from_string (ui_manager_packet_list_heading,ui_desc_packet_list_heading_menu_popup, -1, &error);
  2916. if (error != NULL)
  2917. {
  2918. fprintf (stderr, "Warning: building Packet List Heading Pop-Up failed: %s\n",
  2919. error->message);
  2920. g_error_free (error);
  2921. error = NULL;
  2922. }
  2923. g_object_set_data(G_OBJECT(popup_menu_object), PM_PACKET_LIST_COL_KEY,
  2924. gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup"));
  2925. popup_menu_list = g_slist_append((GSList *)popup_menu_list, ui_manager_packet_list_heading);
  2926. /* packet list pop-up menu */
  2927. packet_list_action_group = gtk_action_group_new ("PacketListPopUpMenuActionGroup");
  2928. gtk_action_group_add_actions (packet_list_action_group, /* the action group */
  2929. (GtkActionEntry *)packet_list_menu_popup_action_entries, /* an array of action descriptions */
  2930. G_N_ELEMENTS(packet_list_menu_popup_action_entries), /* the number of entries */
  2931. popup_menu_object); /* data to pass to the action callbacks */
  2932. /* Add the filter menu items */
  2933. gtk_action_group_add_actions (packet_list_action_group, /* the action group */
  2934. (GtkActionEntry *)apply_prepare_filter_action_entries, /* an array of action descriptions */
  2935. G_N_ELEMENTS(apply_prepare_filter_action_entries), /* the number of entries */
  2936. popup_menu_object); /* data to pass to the action callbacks */
  2937. ui_manager_packet_list_menu = gtk_ui_manager_new ();
  2938. gtk_ui_manager_insert_action_group (ui_manager_packet_list_menu,
  2939. packet_list_action_group,
  2940. 0); /* the position at which the group will be inserted. */
  2941. gtk_ui_manager_add_ui_from_string (ui_manager_packet_list_menu, ui_desc_packet_list_menu_popup, -1, &error);
  2942. if (error != NULL)
  2943. {
  2944. fprintf (stderr, "Warning: building Packet List Pop-Up menu failed: %s\n",
  2945. error->message);
  2946. g_error_free (error);
  2947. error = NULL;
  2948. }
  2949. g_object_set_data(G_OBJECT(popup_menu_object), PM_PACKET_LIST_KEY,
  2950. gtk_ui_manager_get_widget(ui_manager_packet_list_menu, "/PacketListMenuPopup"));
  2951. popup_menu_list = g_slist_append((GSList *)popup_menu_list, ui_manager_packet_list_menu);
  2952. /* packet detail pop-up menu */
  2953. packet_list_details_action_group = gtk_action_group_new ("PacketListDetailsMenuPopUpActionGroup");
  2954. gtk_action_group_add_actions (packet_list_details_action_group, /* the action group */
  2955. (GtkActionEntry *)tree_view_menu_popup_action_entries, /* an array of action descriptions */
  2956. G_N_ELEMENTS(tree_view_menu_popup_action_entries), /* the number of entries */
  2957. popup_menu_object); /* data to pass to the action callbacks */
  2958. /* Add the filter menu items */
  2959. gtk_action_group_add_actions (packet_list_details_action_group, /* the action group */
  2960. (GtkActionEntry *)apply_prepare_filter_action_entries, /* an array of action descriptions */
  2961. G_N_ELEMENTS(apply_prepare_filter_action_entries), /* the number of entries */
  2962. popup_menu_object); /* data to pass to the action callbacks */
  2963. ui_manager_tree_view_menu = gtk_ui_manager_new ();
  2964. gtk_ui_manager_insert_action_group (ui_manager_tree_view_menu,
  2965. packet_list_details_action_group,
  2966. 0); /* the position at which the group will be inserted. */
  2967. gtk_ui_manager_add_ui_from_string (ui_manager_tree_view_menu, ui_desc_tree_view_menu_popup, -1, &error);
  2968. #if 0
  2969. /* If we want to load the treewiew popup UI description from file */
  2970. gui_desc_file_name_and_path = get_ui_file_path("tree-view-ui.xml");
  2971. gtk_ui_manager_add_ui_from_file ( ui_manager_tree_view_menu, gui_desc_file_name_and_path, &error);
  2972. g_free (gui_desc_file_name_and_path);
  2973. #endif
  2974. if (error != NULL)
  2975. {
  2976. fprintf (stderr, "Warning: building TreeView Pop-Up menu failed: %s\n",
  2977. error->message);
  2978. g_error_free (error);
  2979. error = NULL;
  2980. }
  2981. g_object_set_data(G_OBJECT(popup_menu_object), PM_TREE_VIEW_KEY,
  2982. gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup"));
  2983. popup_menu_list = g_slist_append((GSList *)popup_menu_list, ui_manager_tree_view_menu);
  2984. /*
  2985. * Hex dump pop-up menu.
  2986. * We provide our own empty menu to suppress the default pop-up menu
  2987. * for text widgets.
  2988. */
  2989. packet_list_byte_menu_action_group = gtk_action_group_new ("PacketListByteMenuPopUpActionGroup");
  2990. gtk_action_group_add_radio_actions (packet_list_byte_menu_action_group, /* the action group */
  2991. (GtkRadioActionEntry *)bytes_menu_radio_action_entries, /* an array of radio action descriptions */
  2992. G_N_ELEMENTS(bytes_menu_radio_action_entries), /* the number of entries */
  2993. recent.gui_bytes_view, /* the value of the action to activate initially, or -1 if no action should be activated */
  2994. G_CALLBACK(select_bytes_view_cb), /* the callback to connect to the changed signal */
  2995. popup_menu_object); /* data to pass to the action callbacks */
  2996. ui_manager_bytes_menu = gtk_ui_manager_new ();
  2997. gtk_ui_manager_insert_action_group (ui_manager_bytes_menu,
  2998. packet_list_byte_menu_action_group,
  2999. 0); /* the position at which the group will be inserted. */
  3000. gtk_ui_manager_add_ui_from_string (ui_manager_bytes_menu, ui_desc_bytes_menu_popup, -1, &error);
  3001. #if 0
  3002. /* If we want to load the bytesview poupup UI description from file */
  3003. gui_desc_file_name_and_path = get_ui_file_path("bytes-view-ui.xml");
  3004. gtk_ui_manager_add_ui_from_file ( ui_manager_bytes_menu, gui_desc_file_name_and_path, &error);
  3005. g_free (gui_desc_file_name_and_path);
  3006. #endif
  3007. if (error != NULL)
  3008. {
  3009. fprintf (stderr, "Warning: building Bytes Pop-Up menu failed: %s\n",
  3010. error->message);
  3011. g_error_free (error);
  3012. error = NULL;
  3013. }
  3014. g_object_unref(packet_list_byte_menu_action_group);
  3015. g_object_set_data(G_OBJECT(popup_menu_object), PM_BYTES_VIEW_KEY,
  3016. gtk_ui_manager_get_widget(ui_manager_bytes_menu, "/BytesMenuPopup"));
  3017. popup_menu_list = g_slist_append((GSList *)popup_menu_list, ui_manager_bytes_menu);
  3018. /* main */
  3019. main_menu_bar_action_group = gtk_action_group_new ("MenuActionGroup");
  3020. gtk_action_group_add_actions (main_menu_bar_action_group, /* the action group */
  3021. main_menu_bar_entries, /* an array of action descriptions */
  3022. G_N_ELEMENTS(main_menu_bar_entries), /* the number of entries */
  3023. NULL); /* data to pass to the action callbacks */
  3024. #ifdef HAVE_LIBPCAP
  3025. /* Add the capture menu actions */
  3026. gtk_action_group_add_actions (main_menu_bar_action_group, /* the action group */
  3027. capture_menu_entries, /* an array of action descriptions */
  3028. G_N_ELEMENTS(capture_menu_entries), /* the number of entries */
  3029. NULL); /* data to pass to the action callbacks */
  3030. #endif
  3031. /* Add the filter menu actions */
  3032. gtk_action_group_add_actions (main_menu_bar_action_group, /* the action group */
  3033. (GtkActionEntry *)apply_prepare_filter_action_entries, /* an array of action descriptions */
  3034. G_N_ELEMENTS(apply_prepare_filter_action_entries), /* the number of entries */
  3035. popup_menu_object); /* data to pass to the action callbacks */
  3036. gtk_action_group_add_toggle_actions(main_menu_bar_action_group, /* the action group */
  3037. main_menu_bar_toggle_action_entries, /* an array of action descriptions */
  3038. G_N_ELEMENTS(main_menu_bar_toggle_action_entries), /* the number of entries */
  3039. NULL); /* data to pass to the action callbacks */
  3040. gtk_action_group_add_radio_actions (main_menu_bar_action_group, /* the action group */
  3041. main_menu_bar_radio_view_time_entries, /* an array of radio action descriptions */
  3042. G_N_ELEMENTS(main_menu_bar_radio_view_time_entries), /* the number of entries */
  3043. recent.gui_time_format, /* the value of the action to activate initially, or -1 if no action should be activated */
  3044. G_CALLBACK(timestamp_format_new_cb), /* the callback to connect to the changed signal */
  3045. NULL); /* data to pass to the action callbacks */
  3046. gtk_action_group_add_radio_actions (main_menu_bar_action_group, /* the action group */
  3047. main_menu_bar_radio_view_time_fileformat_prec_entries, /* an array of radio action descriptions */
  3048. G_N_ELEMENTS(main_menu_bar_radio_view_time_fileformat_prec_entries), /* the number of entries */
  3049. recent.gui_time_precision, /* the value of the action to activate initially, or -1 if no action should be activated */
  3050. G_CALLBACK(timestamp_precision_new_cb), /* the callback to connect to the changed signal */
  3051. NULL); /* data to pass to the action callbacks */
  3052. ui_manager_main_menubar = gtk_ui_manager_new ();
  3053. gtk_ui_manager_insert_action_group (ui_manager_main_menubar, main_menu_bar_action_group, 0);
  3054. gtk_ui_manager_add_ui_from_string (ui_manager_main_menubar,ui_desc_menubar, -1, &error);
  3055. if (error != NULL)
  3056. {
  3057. fprintf (stderr, "Warning: building main menubar failed: %s\n",
  3058. error->message);
  3059. g_error_free (error);
  3060. error = NULL;
  3061. }
  3062. g_object_unref(main_menu_bar_action_group);
  3063. gtk_window_add_accel_group (GTK_WINDOW(top_level),
  3064. gtk_ui_manager_get_accel_group(ui_manager_main_menubar));
  3065. /* Add the recent files items to the menu
  3066. * use place holders and
  3067. * gtk_ui_manager_add_ui().
  3068. */
  3069. merge_id = gtk_ui_manager_new_merge_id (ui_manager_main_menubar);
  3070. add_recent_items (merge_id, ui_manager_main_menubar);
  3071. /* Add statistics tap plug-in to the menu
  3072. */
  3073. merge_id = gtk_ui_manager_new_merge_id (ui_manager_main_menubar);
  3074. add_tap_plugins (merge_id, ui_manager_main_menubar);
  3075. statusbar_profiles_action_group = gtk_action_group_new ("StatusBarProfilesPopUpMenuActionGroup");
  3076. gtk_action_group_add_actions (statusbar_profiles_action_group, /* the action group */
  3077. (GtkActionEntry *)statusbar_profiles_menu_action_entries, /* an array of action descriptions */
  3078. G_N_ELEMENTS(statusbar_profiles_menu_action_entries), /* the number of entries */
  3079. popup_menu_object); /* data to pass to the action callbacks */
  3080. ui_manager_statusbar_profiles_menu = gtk_ui_manager_new ();
  3081. gtk_ui_manager_insert_action_group (ui_manager_statusbar_profiles_menu,
  3082. statusbar_profiles_action_group,
  3083. 0); /* the position at which the group will be inserted. */
  3084. gtk_ui_manager_add_ui_from_string (ui_manager_statusbar_profiles_menu,ui_statusbar_profiles_menu_popup, -1, &error);
  3085. if (error != NULL)
  3086. {
  3087. fprintf (stderr, "Warning: building StatusBar Profiles Pop-Up failed: %s\n",
  3088. error->message);
  3089. g_error_free (error);
  3090. error = NULL;
  3091. }
  3092. g_object_unref(statusbar_profiles_action_group);
  3093. g_object_set_data(G_OBJECT(popup_menu_object), PM_STATUSBAR_PROFILES_KEY,
  3094. gtk_ui_manager_get_widget(ui_manager_statusbar_profiles_menu, "/ProfilesMenuPopup"));
  3095. popup_menu_list = g_slist_append((GSList *)popup_menu_list, ui_manager_statusbar_profiles_menu);
  3096. menu_dissector_filter(&cfile);
  3097. merge_menu_items(merge_menu_items_list);
  3098. /* Add external menus and items */
  3099. ws_menubar_build_external_menus();
  3100. /* Initialize enabled/disabled state of menu items */
  3101. set_menus_for_capture_file(NULL);
  3102. #if 0
  3103. /* Un-#if this when we actually implement Cut/Copy/Paste.
  3104. Then make sure you enable them when they can be done. */
  3105. set_menu_sensitivity_old("/Edit/Cut", FALSE);
  3106. set_menu_sensitivity_old("/Edit/Copy", FALSE);
  3107. set_menu_sensitivity_old("/Edit/Paste", FALSE);
  3108. #endif
  3109. /* Hide not usable menus */
  3110. set_menus_for_captured_packets(FALSE);
  3111. set_menus_for_selected_packet(&cfile);
  3112. set_menus_for_selected_tree_row(&cfile);
  3113. set_menus_for_capture_in_progress(FALSE);
  3114. set_menus_for_file_set(/* dialog */TRUE, /* previous file */ FALSE, /* next_file */ FALSE);
  3115. /* Set callback to update name resolution settings when activated */
  3116. name_res_action = gtk_action_group_get_action(main_menu_bar_action_group, "/View/NameResolution");
  3117. g_signal_connect (name_res_action, "activate", G_CALLBACK (menu_name_resolution_update_cb), NULL);
  3118. }
  3119. }
  3120. /* Get a merge id for the menubar */
  3121. void
  3122. ws_add_build_menubar_items_callback(gpointer callback)
  3123. {
  3124. build_menubar_items_callback_list = g_list_append(build_menubar_items_callback_list, callback);
  3125. }
  3126. static void
  3127. ws_menubar_build_external_menus(void)
  3128. {
  3129. void (*callback)(gpointer);
  3130. while (build_menubar_items_callback_list != NULL) {
  3131. callback = (void (*)(gpointer))build_menubar_items_callback_list->data;
  3132. callback(ui_manager_main_menubar);
  3133. build_menubar_items_callback_list = g_list_next(build_menubar_items_callback_list);
  3134. }
  3135. }
  3136. typedef struct _menu_item {
  3137. const char *gui_path;
  3138. const char *name;
  3139. const char *stock_id;
  3140. const char *label;
  3141. const char *accelerator;
  3142. const gchar *tooltip;
  3143. GCallback callback;
  3144. gpointer callback_data;
  3145. gboolean enabled;
  3146. gboolean (*selected_packet_enabled)(frame_data *, epan_dissect_t *, gpointer callback_data);
  3147. gboolean (*selected_tree_row_enabled)(field_info *, gpointer callback_data);
  3148. } menu_item_t;
  3149. static gint
  3150. insert_sorted_by_label(gconstpointer aparam, gconstpointer bparam)
  3151. {
  3152. const menu_item_t *a = (menu_item_t *)aparam;
  3153. const menu_item_t *b = (menu_item_t *)bparam;
  3154. return g_ascii_strcasecmp(a->label, b->label);
  3155. }
  3156. void register_menu_bar_menu_items(
  3157. const char *gui_path,
  3158. const char *name,
  3159. const gchar *stock_id,
  3160. const char *label,
  3161. const char *accelerator,
  3162. const gchar *tooltip,
  3163. gpointer callback,
  3164. gpointer callback_data,
  3165. gboolean enabled,
  3166. gboolean (*selected_packet_enabled)(frame_data *, epan_dissect_t *, gpointer callback_data),
  3167. gboolean (*selected_tree_row_enabled)(field_info *, gpointer callback_data))
  3168. {
  3169. menu_item_t *menu_item_data;
  3170. menu_item_data = g_new0(menu_item_t,1);
  3171. menu_item_data->gui_path = gui_path;
  3172. menu_item_data->name = name;
  3173. menu_item_data->label = label;
  3174. menu_item_data->stock_id = stock_id;
  3175. menu_item_data->accelerator = accelerator;
  3176. menu_item_data->tooltip = tooltip;
  3177. menu_item_data->callback = (GCallback)callback;
  3178. menu_item_data->callback_data = callback_data;
  3179. menu_item_data->enabled = enabled;
  3180. menu_item_data->selected_packet_enabled = selected_packet_enabled;
  3181. menu_item_data->selected_tree_row_enabled = selected_tree_row_enabled;
  3182. merge_menu_items_list = g_list_insert_sorted(merge_menu_items_list,
  3183. menu_item_data,
  3184. insert_sorted_by_label);
  3185. }
  3186. #define XMENU_MAX_DEPTH (1 + 32) /* max number of menus in an xpath (+1 for Menubar) */
  3187. #define XMENU_HEADER "<ui><menubar name='Menubar'>\n"
  3188. #define XMENU_FOOTER "</menubar></ui>\n"
  3189. /**
  3190. * Creates an XML string, containing a UI definition that can be merged
  3191. * with Wireshark's menu bar using gtk_ui_manager_add_ui_from_string().
  3192. * Free the returned string with g_free() when no longer needed.
  3193. *
  3194. * The last item in the path is treated as the menu item; all preceding path
  3195. * elements are the names of parent menus. Path elements are stripped of
  3196. * leading/trailing spaces.
  3197. *
  3198. * |'s separate an existing menu's name from its action.
  3199. * If the action has a / in it, it must have been "escaped" into a # before
  3200. * entering this function; this function will translate it back to a /.
  3201. * There must be an easier way!
  3202. *
  3203. * Examples:
  3204. * make_menu_xml("/Foo/Bar|/BarAction/I_tem");
  3205. * -->
  3206. * "<ui><menubar name='Menubar'>
  3207. * <menu action='Foo'>
  3208. * <menu name='Bar' action='/BarAction'>
  3209. * <menuitem action='I_tem'/> <!-- puts shortcut on 't' -->
  3210. * </menu>
  3211. * </menu>
  3212. * <menubar></ui>"
  3213. *
  3214. * make_menu_xml("/Foo/Bar|BarAction/-/Baz|BarAction#BazAction/Item");
  3215. * -->
  3216. * "<ui><menubar name='Menubar'>
  3217. * <menu action='Foo'>
  3218. * <menu name='Bar' action='/BarAction'>
  3219. * <separator/>
  3220. * <menu name='Baz' action='BarAction/BazAction'>
  3221. * <menuitem action='Item'/>
  3222. * </menu>
  3223. * </menu>
  3224. * </menu>
  3225. * <menubar></ui>"
  3226. *
  3227. * http://developer.gnome.org/gtk/2.24/GtkUIManager.html#XML-UI
  3228. * http://developer.gnome.org/gtk/2.24/GtkUIManager.html#gtk-ui-manager-add-ui-from-string
  3229. */
  3230. static const gchar*
  3231. make_menu_xml(const char *path)
  3232. {
  3233. GString *xml;
  3234. char **p;
  3235. char **tokens, **name_action_tokens;
  3236. const char *tok = path;
  3237. gchar *markup;
  3238. guint num_menus;
  3239. size_t len;
  3240. int i;
  3241. if (path == NULL) return NULL;
  3242. xml = g_string_new(XMENU_HEADER);
  3243. /* no need to specify menu bar...skip it */
  3244. len = strlen("/Menubar");
  3245. if (g_ascii_strncasecmp(path, "/Menubar", len) == 0) {
  3246. path += len;
  3247. }
  3248. /* open nested menu tag for each path token */
  3249. num_menus = 0;
  3250. tokens = g_strsplit(path, "/", XMENU_MAX_DEPTH);
  3251. for (p = tokens; (p != NULL) && (*p != NULL); p++) {
  3252. tok = g_strstrip(*p);
  3253. if (tok[0] == '\0') continue;
  3254. /* reserve last token for menu-item processing */
  3255. if (*(p+1) == NULL) break;
  3256. if (g_strcmp0(tok, "-") == 0) {
  3257. xml = g_string_append(xml, "<separator/>\n");
  3258. } else {
  3259. /* Split the name of the menu from its action (if any) */
  3260. name_action_tokens = g_strsplit(tok, "|", 2);
  3261. if (name_action_tokens[1]) {
  3262. i = -1;
  3263. /* Replace #'s with /'s.
  3264. * Necessary for menus whose action includes a "/".
  3265. * There MUST be an easier way...
  3266. */
  3267. while (name_action_tokens[1][++i])
  3268. if (name_action_tokens[1][i] == '#')
  3269. name_action_tokens[1][i] = '/';
  3270. }
  3271. if (name_action_tokens[1])
  3272. markup = g_markup_printf_escaped("<menu name='%s' action='/%s'>\n", name_action_tokens[0], name_action_tokens[1]);
  3273. else
  3274. markup = g_markup_printf_escaped("<menu action='%s'>\n", tok);
  3275. xml = g_string_append(xml, markup);
  3276. g_free(markup);
  3277. g_strfreev(name_action_tokens);
  3278. num_menus++;
  3279. }
  3280. }
  3281. /* Use the last path element as the name of the menu item. Allow blank
  3282. * menu name or else the menu is hidden (and thus useless). Showing a
  3283. * blank menu allows the developer to see the problem and fix it.
  3284. */
  3285. if ( (tok != NULL) /* && (tok[0] != '\0') */ ) {
  3286. if (g_strcmp0(tok, "-") == 0) {
  3287. xml = g_string_append(xml, "<separator/>\n");
  3288. } else {
  3289. /* append self-closing menu-item tag */
  3290. markup = g_markup_printf_escaped("<menuitem action='%s'/>\n", tok);
  3291. xml = g_string_append(xml, markup);
  3292. g_free(markup);
  3293. }
  3294. }
  3295. /* we just processed the last token, so free the list */
  3296. g_strfreev(tokens);
  3297. /* close all menu tags, and then append the footer */
  3298. for (; num_menus > 0; num_menus--) {
  3299. xml = g_string_append(xml, "</menu>");
  3300. }
  3301. xml = g_string_append(xml, XMENU_FOOTER);
  3302. /* free the GString object, return the allocated char buf which must be g_freed */
  3303. markup = g_string_free(xml, FALSE);
  3304. return markup;
  3305. }
  3306. /**
  3307. * Creates an action group for the menu items in xpath, and returns it. The caller should
  3308. * use g_object_unref() on the returned pointer if transferring scope.
  3309. */
  3310. static GtkActionGroup*
  3311. make_menu_actions(char *path, const menu_item_t *menu_item_data)
  3312. {
  3313. GtkActionGroup *action_group;
  3314. GtkAction *action;
  3315. char **p;
  3316. char **tokens;
  3317. char *tok = path, *lbl;
  3318. action_group = gtk_action_group_new (path);
  3319. tokens = g_strsplit(path, "/", XMENU_MAX_DEPTH);
  3320. for (p = tokens; (p != NULL) && (*p != NULL); p++) {
  3321. tok = g_strstrip(*p);
  3322. if (tok[0] == '\0') continue;
  3323. /* reserve last token for item name */
  3324. if ( *(p+1) == NULL ) break;
  3325. if (g_strcmp0(tok, "-") != 0) {
  3326. /* parse label from token */
  3327. lbl = strchr(tok, '|');
  3328. if (lbl != NULL) {
  3329. *lbl++ = '\0';
  3330. }
  3331. if ((lbl == NULL) || (*lbl == '\0')) {
  3332. lbl = tok;
  3333. }
  3334. action = (GtkAction *)g_object_new (
  3335. GTK_TYPE_ACTION,
  3336. "name", tok,
  3337. "label", lbl,
  3338. NULL
  3339. );
  3340. gtk_action_group_add_action (action_group, action);
  3341. g_object_unref (action);
  3342. }
  3343. }
  3344. /* handle menu item (blank names ok) */
  3345. if ( (tok != NULL) /* && (tok[0] != '\0') */ && (menu_item_data != NULL) ) {
  3346. action = (GtkAction *)g_object_new (
  3347. GTK_TYPE_ACTION,
  3348. "name", tok,
  3349. "label", menu_item_data->label,
  3350. "stock-id", menu_item_data->stock_id,
  3351. "tooltip", menu_item_data->tooltip,
  3352. "sensitive", menu_item_data->enabled,
  3353. NULL
  3354. );
  3355. if (menu_item_data->callback != NULL) {
  3356. g_signal_connect (
  3357. action,
  3358. "activate",
  3359. G_CALLBACK (menu_item_data->callback),
  3360. menu_item_data->callback_data
  3361. );
  3362. }
  3363. gtk_action_group_add_action (action_group, action);
  3364. g_object_unref (action);
  3365. }
  3366. /* we just processed the last token, so free the list */
  3367. g_strfreev(tokens);
  3368. return action_group;
  3369. }
  3370. static void
  3371. merge_menu_items(GList *lcl_merge_menu_items_list)
  3372. {
  3373. guint merge_id;
  3374. GtkActionGroup *action_group;
  3375. menu_item_t *menu_item_data;
  3376. GError *err;
  3377. const gchar *xml;
  3378. gchar *xpath;
  3379. while (lcl_merge_menu_items_list != NULL) {
  3380. menu_item_data = (menu_item_t *)lcl_merge_menu_items_list->data;
  3381. xpath = g_strdup_printf("%s/%s", menu_item_data->gui_path, menu_item_data->name);
  3382. xml = make_menu_xml(xpath);
  3383. if (xml != NULL) {
  3384. /* create action group for menu elements */
  3385. action_group = make_menu_actions(xpath, menu_item_data);
  3386. gtk_ui_manager_insert_action_group (ui_manager_main_menubar, action_group, 0);
  3387. /* add menu elements to menu bar */
  3388. err = NULL;
  3389. merge_id = gtk_ui_manager_add_ui_from_string (ui_manager_main_menubar, xml, -1, &err);
  3390. if (err != NULL) {
  3391. fprintf (stderr, "Warning: building menus failed: %s\n",
  3392. err->message);
  3393. g_error_free (err);
  3394. /* undo the mess */
  3395. gtk_ui_manager_remove_ui (ui_manager_main_menubar, merge_id);
  3396. gtk_ui_manager_remove_action_group (ui_manager_main_menubar, action_group);
  3397. }
  3398. g_free ((gchar*)xml);
  3399. g_object_unref (action_group);
  3400. }
  3401. g_free(xpath);
  3402. lcl_merge_menu_items_list = g_list_next(lcl_merge_menu_items_list);
  3403. }
  3404. }
  3405. const char *
  3406. stat_group_name(register_stat_group_t group)
  3407. {
  3408. /* See make_menu_xml() for an explanation of the string format */
  3409. static const value_string group_name_vals[] = {
  3410. {REGISTER_ANALYZE_GROUP_UNSORTED, "/Menubar/AnalyzeMenu|Analyze"}, /* unsorted analyze stuff */
  3411. {REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER, "/Menubar/AnalyzeMenu|Analyze/ConversationFilterMenu|Analyze#ConversationFilter"}, /* conversation filters */
  3412. {REGISTER_STAT_GROUP_UNSORTED, "/Menubar/StatisticsMenu|Statistics"}, /* unsorted statistic function */
  3413. {REGISTER_STAT_GROUP_GENERIC, "/Menubar/StatisticsMenu|Statistics"}, /* generic statistic function, not specific to a protocol */
  3414. {REGISTER_STAT_GROUP_CONVERSATION_LIST, "/Menubar/StatisticsMenu|Statistics/ConversationListMenu|Statistics#ConversationList"}, /* member of the conversation list */
  3415. {REGISTER_STAT_GROUP_ENDPOINT_LIST, "/Menubar/StatisticsMenu|Statistics/EndpointListMenu|Statistics#EndpointList"}, /* member of the endpoint list */
  3416. {REGISTER_STAT_GROUP_RESPONSE_TIME, "/Menubar/StatisticsMenu|Statistics/ServiceResponseTimeMenu|Statistics#ServiceResponseTime"}, /* member of the service response time list */
  3417. {REGISTER_STAT_GROUP_TELEPHONY, "/Menubar/TelephonyMenu|Telephony"}, /* telephony specific */
  3418. {REGISTER_STAT_GROUP_TELEPHONY_GSM, "/Menubar/TelephonyMenu|Telephony/GSM|Telephony#GSM"}, /* GSM-specific */
  3419. {REGISTER_STAT_GROUP_TELEPHONY_LTE, "/Menubar/TelephonyMenu|Telephony/LTEmenu|Telephony#LTE"}, /* LTE-specific */
  3420. {REGISTER_STAT_GROUP_TELEPHONY_SCTP, "/Menubar/TelephonyMenu|Telephony/SCTPmenu|Telephony#SCTP"}, /* SCTP-specific */
  3421. {REGISTER_TOOLS_GROUP_UNSORTED, "/Menubar/ToolsMenu|Tools"}, /* unsorted tools */
  3422. {0, NULL}
  3423. };
  3424. return val_to_str_const(group, group_name_vals, "/Menubar/ToolsMenu|Tools");
  3425. }
  3426. /*
  3427. * Enable/disable menu sensitivity.
  3428. */
  3429. static void
  3430. set_menu_sensitivity(GtkUIManager *ui_manager, const gchar *path, gint val)
  3431. {
  3432. GtkAction *action;
  3433. action = gtk_ui_manager_get_action(ui_manager, path);
  3434. if(!action){
  3435. fprintf (stderr, "Warning: set_menu_sensitivity couldn't find action path= %s\n",
  3436. path);
  3437. return;
  3438. }
  3439. gtk_action_set_sensitive (action, val); /* TRUE to make the action sensitive */
  3440. }
  3441. static void
  3442. set_menu_object_data_meat(GtkUIManager *ui_manager, const gchar *path, const gchar *key, gpointer data)
  3443. {
  3444. GtkWidget *menu = NULL;
  3445. if ((menu = gtk_ui_manager_get_widget(ui_manager, path)) != NULL){
  3446. g_object_set_data(G_OBJECT(menu), key, data);
  3447. }else{
  3448. #if 0
  3449. g_warning("set_menu_object_data_meat: no menu, path: %s",path);
  3450. #endif
  3451. }
  3452. }
  3453. void
  3454. set_menu_object_data (const gchar *path, const gchar *key, gpointer data)
  3455. {
  3456. if (strncmp (path,"/Menubar",8) == 0){
  3457. set_menu_object_data_meat(ui_manager_main_menubar, path, key, data);
  3458. }else if (strncmp (path,"/PacketListMenuPopup",20) == 0){
  3459. set_menu_object_data_meat(ui_manager_packet_list_menu, path, key, data);
  3460. }else if (strncmp (path,"/TreeViewPopup",14) == 0){
  3461. set_menu_object_data_meat(ui_manager_tree_view_menu, path, key, data);
  3462. }else if (strncmp (path,"/BytesMenuPopup",15) == 0){
  3463. set_menu_object_data_meat(ui_manager_bytes_menu, path, key, data);
  3464. }else if (strncmp (path,"/ProfilesMenuPopup",18) == 0){
  3465. set_menu_object_data_meat(ui_manager_statusbar_profiles_menu, path, key, data);
  3466. }
  3467. }
  3468. /* Recently used capture files submenu:
  3469. * Submenu containing the recently used capture files.
  3470. * The capture filenames are always kept with the absolute path to be independent
  3471. * of the current path.
  3472. * They are only stored inside the labels of the submenu (no separate list). */
  3473. #define MENU_RECENT_FILES_PATH "/Menubar/FileMenu/OpenRecent"
  3474. #define MENU_RECENT_FILES_KEY "Recent File Name"
  3475. /* Add a file name to the top of the list; if it's already present remove it first */
  3476. static GList *
  3477. remove_present_file_name(GList *recent_files_list, const gchar *cf_name)
  3478. {
  3479. GList *li;
  3480. gchar *widget_cf_name;
  3481. for (li = g_list_first(recent_files_list); li; li = li->next) {
  3482. widget_cf_name = (gchar *)li->data;
  3483. if (
  3484. #ifdef _WIN32
  3485. /* do a case insensitive compare on win32 */
  3486. g_ascii_strncasecmp(widget_cf_name, cf_name, 1000) == 0){
  3487. #else /* _WIN32 */
  3488. /* do a case sensitive compare on unix */
  3489. strncmp(widget_cf_name, cf_name, 1000) == 0 ){
  3490. #endif
  3491. recent_files_list = g_list_remove(recent_files_list,widget_cf_name);
  3492. }
  3493. }
  3494. return recent_files_list;
  3495. }
  3496. static void
  3497. recent_changed_cb (GtkUIManager *ui_manager,
  3498. gpointer user_data _U_)
  3499. {
  3500. guint merge_id;
  3501. GList *action_groups, *l;
  3502. merge_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (ui_manager),
  3503. "recent-files-merge-id"));
  3504. /* remove the UI */
  3505. gtk_ui_manager_remove_ui (ui_manager, merge_id);
  3506. /* remove the action group; gtk_ui_manager_remove_action_group()
  3507. * should really take the action group's name instead of its
  3508. * pointer.
  3509. */
  3510. action_groups = gtk_ui_manager_get_action_groups (ui_manager);
  3511. for (l = action_groups; l != NULL; l = l->next)
  3512. {
  3513. GtkActionGroup *group = (GtkActionGroup *)l->data;
  3514. if (strcmp (gtk_action_group_get_name (group), "recent-files-group") == 0){
  3515. /* this unrefs the action group and all of its actions */
  3516. gtk_ui_manager_remove_action_group (ui_manager, group);
  3517. break;
  3518. }
  3519. }
  3520. /* generate a new merge id and re-add everything */
  3521. merge_id = gtk_ui_manager_new_merge_id (ui_manager);
  3522. add_recent_items (merge_id, ui_manager);
  3523. }
  3524. static void
  3525. recent_clear_cb(GtkAction *action _U_, gpointer user_data _U_)
  3526. {
  3527. GtkWidget *submenu_recent_files;
  3528. GList *recent_files_list;
  3529. /* Get the list of recent files, free the list and store the empty list with the widget */
  3530. submenu_recent_files = gtk_ui_manager_get_widget(ui_manager_main_menubar, MENU_RECENT_FILES_PATH);
  3531. recent_files_list = (GList *)g_object_get_data(G_OBJECT(submenu_recent_files), "recent-files-list");
  3532. /* Free the name strings ?? */
  3533. g_list_free(recent_files_list);
  3534. recent_files_list = NULL;
  3535. g_object_set_data(G_OBJECT(submenu_recent_files), "recent-files-list", recent_files_list);
  3536. /* Calling recent_changed_cb will rebuild the GUI call add_recent_items which will in turn call
  3537. * main_welcome_reset_recent_capture_files
  3538. */
  3539. recent_changed_cb(ui_manager_main_menubar, NULL);
  3540. }
  3541. static void
  3542. add_recent_items (guint merge_id, GtkUIManager *ui_manager)
  3543. {
  3544. GtkActionGroup *action_group;
  3545. GtkAction *action;
  3546. GtkWidget *submenu_recent_files;
  3547. GList *items, *l;
  3548. gchar *action_name;
  3549. guint i;
  3550. /* Reset the recent files list in the welcome screen */
  3551. main_welcome_reset_recent_capture_files();
  3552. action_group = gtk_action_group_new ("recent-files-group");
  3553. submenu_recent_files = gtk_ui_manager_get_widget(ui_manager, MENU_RECENT_FILES_PATH);
  3554. if(!submenu_recent_files){
  3555. g_warning("add_recent_items: No submenu_recent_files found, path= MENU_RECENT_FILES_PATH");
  3556. }
  3557. items = (GList *)g_object_get_data(G_OBJECT(submenu_recent_files), "recent-files-list");
  3558. gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
  3559. g_object_set_data (G_OBJECT (ui_manager),
  3560. "recent-files-merge-id", GUINT_TO_POINTER (merge_id));
  3561. /* no items */
  3562. if (!items){
  3563. action = (GtkAction *)g_object_new (GTK_TYPE_ACTION,
  3564. "name", "recent-info-empty",
  3565. "label", "No recently used files",
  3566. "sensitive", FALSE,
  3567. NULL);
  3568. gtk_action_group_add_action (action_group, action);
  3569. gtk_action_set_sensitive(action, FALSE);
  3570. g_object_unref (action);
  3571. gtk_ui_manager_add_ui (ui_manager, merge_id,
  3572. "/Menubar/FileMenu/OpenRecent/RecentFiles",
  3573. "recent-info-empty",
  3574. "recent-info-empty",
  3575. GTK_UI_MANAGER_MENUITEM,
  3576. FALSE);
  3577. return;
  3578. }
  3579. for (i = 0, l = items;
  3580. i < prefs.gui_recent_files_count_max && l != NULL;
  3581. i +=1, l = l->next)
  3582. {
  3583. gchar *item_name = (gchar *)l->data;
  3584. action_name = g_strdup_printf ("recent-info-%u", i);
  3585. action = (GtkAction *)g_object_new (GTK_TYPE_ACTION,
  3586. "name", action_name,
  3587. "label", item_name,
  3588. "stock_id", WIRESHARK_STOCK_SAVE,
  3589. NULL);
  3590. g_signal_connect (action, "activate",
  3591. G_CALLBACK (menu_open_recent_file_cmd_cb), NULL);
  3592. #if !GTK_CHECK_VERSION(2,16,0)
  3593. g_object_set_data (G_OBJECT (action), "FileName", item_name);
  3594. #endif
  3595. gtk_action_group_add_action (action_group, action);
  3596. g_object_unref (action);
  3597. gtk_ui_manager_add_ui (ui_manager, merge_id,
  3598. "/Menubar/FileMenu/OpenRecent/RecentFiles",
  3599. action_name,
  3600. action_name,
  3601. GTK_UI_MANAGER_MENUITEM,
  3602. FALSE);
  3603. /* Add the file name to the recent files list on the Welcome screen */
  3604. main_welcome_add_recent_capture_file(item_name, G_OBJECT(action));
  3605. g_free (action_name);
  3606. }
  3607. /* Add a Separator */
  3608. gtk_ui_manager_add_ui (ui_manager, merge_id,
  3609. "/Menubar/FileMenu/OpenRecent/RecentFiles",
  3610. "separator-recent-info",
  3611. NULL,
  3612. GTK_UI_MANAGER_SEPARATOR,
  3613. FALSE);
  3614. /* Add a clear Icon */
  3615. action = (GtkAction *)g_object_new (GTK_TYPE_ACTION,
  3616. "name", "clear-recent-info",
  3617. "label", "Clear the recent files list",
  3618. "stock_id", GTK_STOCK_CLEAR,
  3619. NULL);
  3620. g_signal_connect (action, "activate",
  3621. G_CALLBACK (recent_clear_cb), NULL);
  3622. gtk_action_group_add_action (action_group, action);
  3623. g_object_unref (action);
  3624. gtk_ui_manager_add_ui (ui_manager, merge_id,
  3625. "/Menubar/FileMenu/OpenRecent/RecentFiles",
  3626. "clear-recent-info",
  3627. "clear-recent-info",
  3628. GTK_UI_MANAGER_MENUITEM,
  3629. FALSE);
  3630. }
  3631. #define MENU_STATISTICS_PATH "/Menubar/StatisticsMenu"
  3632. static void
  3633. add_tap_plugins (guint merge_id, GtkUIManager *ui_manager)
  3634. {
  3635. GtkActionGroup *action_group;
  3636. GtkAction *action;
  3637. GtkWidget *submenu_statistics;
  3638. GList *cfg_list;
  3639. GList *iter;
  3640. gchar *action_name;
  3641. action_group = gtk_action_group_new ("tap-plugins-group");
  3642. submenu_statistics = gtk_ui_manager_get_widget(ui_manager_main_menubar, MENU_STATISTICS_PATH);
  3643. if(!submenu_statistics){
  3644. g_warning("add_tap_plugins: No submenu_statistics found, path= MENU_STATISTICS_PATH");
  3645. return;
  3646. }
  3647. gtk_ui_manager_insert_action_group (ui_manager_main_menubar, action_group, 0);
  3648. g_object_set_data (G_OBJECT (ui_manager_main_menubar),
  3649. "tap-plugins-merge-id", GUINT_TO_POINTER (merge_id));
  3650. cfg_list = stats_tree_get_cfg_list();
  3651. iter = g_list_first(cfg_list);
  3652. while (iter) {
  3653. stats_tree_cfg *cfg = (stats_tree_cfg*)iter->data;
  3654. if (cfg->plugin) {
  3655. action_name = g_strdup_printf(MENU_STATISTICS_PATH "/%s", cfg->abbr);
  3656. action = (GtkAction *)g_object_new (GTK_TYPE_ACTION,
  3657. "name", action_name,
  3658. "label", cfg->name,
  3659. NULL);
  3660. g_signal_connect (action, "activate", G_CALLBACK (gtk_stats_tree_cb), NULL);
  3661. gtk_action_group_add_action (action_group, action);
  3662. g_object_unref (action);
  3663. gtk_ui_manager_add_ui (ui_manager, merge_id,
  3664. MENU_STATISTICS_PATH,
  3665. action_name,
  3666. action_name,
  3667. GTK_UI_MANAGER_MENUITEM,
  3668. FALSE);
  3669. g_free (action_name);
  3670. }
  3671. iter = g_list_next(iter);
  3672. }
  3673. g_list_free(cfg_list);
  3674. }
  3675. /* Open a file by its name
  3676. (Beware: will not ask to close existing capture file!) */
  3677. void
  3678. menu_open_filename(gchar *cf_name)
  3679. {
  3680. GtkWidget *submenu_recent_files;
  3681. int err;
  3682. GList *recent_files_list;
  3683. submenu_recent_files = gtk_ui_manager_get_widget(ui_manager_main_menubar, MENU_RECENT_FILES_PATH);
  3684. if(!submenu_recent_files){
  3685. g_warning("menu_open_filename: No submenu_recent_files found, path= MENU_RECENT_FILES_PATH");
  3686. }
  3687. recent_files_list = (GList *)g_object_get_data(G_OBJECT(submenu_recent_files), "recent-files-list");
  3688. /* XXX: ask user to remove item, it's maybe only a temporary problem */
  3689. /* open and read the capture file (this will close an existing file) */
  3690. if (cf_open(&cfile, cf_name, FALSE, &err) == CF_OK) {
  3691. cf_read(&cfile, FALSE);
  3692. }else{
  3693. recent_files_list = remove_present_file_name(recent_files_list, cf_name);
  3694. g_object_set_data(G_OBJECT(submenu_recent_files), "recent-files-list", recent_files_list);
  3695. /* Calling recent_changed_cb will rebuild the GUI call add_recent_items which will in turn call
  3696. * main_welcome_reset_recent_capture_files
  3697. */
  3698. recent_changed_cb(ui_manager_main_menubar, NULL);
  3699. }
  3700. }
  3701. /* callback, if the user pushed a recent file submenu item */
  3702. static void
  3703. menu_open_recent_file_cmd(GtkAction *action)
  3704. {
  3705. GtkWidget *submenu_recent_files;
  3706. GList *recent_files_list;
  3707. const gchar *cf_name;
  3708. int err;
  3709. #if GTK_CHECK_VERSION(2,16,0)
  3710. cf_name = gtk_action_get_label(action);
  3711. #else
  3712. cf_name = (const gchar *)g_object_get_data(G_OBJECT(action), "FileName");
  3713. #endif
  3714. /* open and read the capture file (this will close an existing file) */
  3715. if (cf_open(&cfile, cf_name, FALSE, &err) == CF_OK) {
  3716. cf_read(&cfile, FALSE);
  3717. } else {
  3718. submenu_recent_files = gtk_ui_manager_get_widget(ui_manager_main_menubar, MENU_RECENT_FILES_PATH);
  3719. recent_files_list = (GList *)g_object_get_data(G_OBJECT(submenu_recent_files), "recent-files-list");
  3720. recent_files_list = remove_present_file_name(recent_files_list, cf_name);
  3721. g_object_set_data(G_OBJECT(submenu_recent_files), "recent-files-list", recent_files_list);
  3722. /* Calling recent_changed_cb will rebuild the GUI call add_recent_items which will in turn call
  3723. * main_welcome_reset_recent_capture_files
  3724. */
  3725. recent_changed_cb(ui_manager_main_menubar, NULL);
  3726. }
  3727. }
  3728. static void
  3729. menu_open_recent_file_cmd_cb(GtkAction *action, gpointer data _U_)
  3730. {
  3731. /* If there's unsaved data, let the user save it first.
  3732. If they cancel out of it, don't open the file. */
  3733. if (do_file_close(&cfile, FALSE, " before opening a new capture file"))
  3734. menu_open_recent_file_cmd(action);
  3735. }
  3736. static void
  3737. add_menu_recent_capture_file_absolute(const gchar *cf_name)
  3738. {
  3739. GtkWidget *submenu_recent_files;
  3740. GList *li;
  3741. gchar *widget_cf_name;
  3742. gchar *normalized_cf_name;
  3743. guint cnt;
  3744. GList *recent_files_list;
  3745. normalized_cf_name = g_strdup(cf_name);
  3746. #ifdef _WIN32
  3747. /* replace all slashes by backslashes */
  3748. g_strdelimit(normalized_cf_name, "/", '\\');
  3749. #endif
  3750. /* get the submenu container item */
  3751. submenu_recent_files = gtk_ui_manager_get_widget(ui_manager_main_menubar, MENU_RECENT_FILES_PATH);
  3752. if(!submenu_recent_files){
  3753. g_warning("add_menu_recent_capture_file_absolute: No submenu_recent_files found, path= MENU_RECENT_FILES_PATH");
  3754. g_free(normalized_cf_name);
  3755. return;
  3756. }
  3757. recent_files_list = (GList *)g_object_get_data(G_OBJECT(submenu_recent_files), "recent-files-list");
  3758. cnt = 1;
  3759. for (li = g_list_first(recent_files_list); li; cnt++) {
  3760. widget_cf_name = (gchar *)li->data;
  3761. /* Find the next element BEFORE we (possibly) free the current one below */
  3762. li = li->next;
  3763. if (
  3764. #ifdef _WIN32
  3765. /* do a case insensitive compare on win32 */
  3766. g_ascii_strncasecmp(widget_cf_name, normalized_cf_name, 1000) == 0 ||
  3767. #else /* _WIN32 */
  3768. /* do a case sensitive compare on unix */
  3769. strncmp(widget_cf_name, normalized_cf_name, 1000) == 0 ||
  3770. #endif
  3771. cnt >= prefs.gui_recent_files_count_max) {
  3772. recent_files_list = g_list_remove(recent_files_list,widget_cf_name);
  3773. cnt--;
  3774. }
  3775. }
  3776. recent_files_list = g_list_prepend(recent_files_list, normalized_cf_name);
  3777. g_object_set_data(G_OBJECT(submenu_recent_files), "recent-files-list", recent_files_list);
  3778. recent_changed_cb( ui_manager_main_menubar, NULL);
  3779. }
  3780. /* add the capture filename to the "Recent Files" menu */
  3781. /* (will change nothing, if this filename is already in the menu) */
  3782. /*
  3783. * XXX - We might want to call SHAddToRecentDocs under Windows 7:
  3784. * http: //stackoverflow.com/questions/437212/how-do-you-register-a-most-recently-used-list-with-windows-in-preparation-for-win
  3785. */
  3786. void
  3787. add_menu_recent_capture_file(const gchar *cf_name)
  3788. {
  3789. gchar *curr;
  3790. gchar *absolute;
  3791. /* if this filename is an absolute path, we can use it directly */
  3792. if (g_path_is_absolute(cf_name)) {
  3793. add_menu_recent_capture_file_absolute(cf_name);
  3794. return;
  3795. }
  3796. /* this filename is not an absolute path, prepend the current dir */
  3797. curr = g_get_current_dir();
  3798. absolute = g_strdup_printf("%s%s%s", curr, G_DIR_SEPARATOR_S, cf_name);
  3799. add_menu_recent_capture_file_absolute(absolute);
  3800. g_free(curr);
  3801. g_free(absolute);
  3802. }
  3803. /* write all capture filenames of the menu to the user's recent file */
  3804. void
  3805. menu_recent_file_write_all(FILE *rf)
  3806. {
  3807. GtkWidget *submenu_recent_files;
  3808. GList *children;
  3809. GList *child;
  3810. gchar *cf_name;
  3811. GList *recent_files_list, *list;
  3812. submenu_recent_files = gtk_ui_manager_get_widget(ui_manager_main_menubar, MENU_RECENT_FILES_PATH);
  3813. if(!submenu_recent_files){
  3814. g_warning("menu_recent_file_write_all: No submenu_recent_files found, path= MENU_RECENT_FILES_PATH");
  3815. }
  3816. recent_files_list = (GList *)g_object_get_data(G_OBJECT(submenu_recent_files), "recent-files-list");
  3817. list = g_list_last(recent_files_list);
  3818. while (list != NULL) {
  3819. cf_name = (gchar *)list->data;
  3820. if (cf_name) {
  3821. if(u3_active())
  3822. fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", u3_contract_device_path(cf_name));
  3823. else
  3824. fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", cf_name);
  3825. }
  3826. list = g_list_previous(list);
  3827. }
  3828. g_list_free(recent_files_list);
  3829. return;
  3830. /* we have to iterate backwards through the children's list,
  3831. * so we get the latest item last in the file.
  3832. * (don't use gtk_container_foreach() here, it will return the wrong iteration order) */
  3833. children = gtk_container_get_children(GTK_CONTAINER(submenu_recent_files));
  3834. child = g_list_last(children);
  3835. while (child != NULL) {
  3836. /* get capture filename from the menu item label */
  3837. cf_name = (gchar *)g_object_get_data(G_OBJECT(child->data), MENU_RECENT_FILES_KEY);
  3838. if (cf_name) {
  3839. if(u3_active())
  3840. fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", u3_contract_device_path(cf_name));
  3841. else
  3842. fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", cf_name);
  3843. }
  3844. child = g_list_previous(child);
  3845. }
  3846. g_list_free(children);
  3847. }
  3848. void
  3849. menu_name_resolution_changed(void)
  3850. {
  3851. GtkWidget *menu;
  3852. menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/EnableforMACLayer");
  3853. if(!menu){
  3854. g_warning("menu_name_resolution_changed: No menu found, path= /Menubar/ViewMenu/NameResolution/EnableforMACLayer");
  3855. }
  3856. gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), gbl_resolv_flags.mac_name);
  3857. menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/EnableforNetworkLayer");
  3858. if(!menu){
  3859. g_warning("menu_name_resolution_changed: No menu found, path= /Menubar/ViewMenu/NameResolution/EnableforNetworkLayer");
  3860. }
  3861. gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), gbl_resolv_flags.network_name);
  3862. menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/EnableforTransportLayer");
  3863. if(!menu){
  3864. g_warning("menu_name_resolution_changed: No menu found, path= /Menubar/ViewMenu/NameResolution/EnableforTransportLayer");
  3865. }
  3866. gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), gbl_resolv_flags.transport_name);
  3867. menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/UseExternalNetworkNameResolver");
  3868. if(!menu){
  3869. g_warning("menu_name_resolution_changed: No menu found, path= /Menubar/ViewMenu/NameResolution/UseExternalNetworkNameResolver");
  3870. }
  3871. gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), gbl_resolv_flags.use_external_net_name_resolver);
  3872. }
  3873. static void
  3874. menu_name_resolution_update_cb(GtkAction *action _U_, gpointer data _U_)
  3875. {
  3876. menu_name_resolution_changed();
  3877. }
  3878. static void
  3879. name_resolution_cb(GtkWidget *w, gpointer d _U_, gboolean* res_flag)
  3880. {
  3881. if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w))) {
  3882. *res_flag = TRUE;
  3883. } else {
  3884. *res_flag = FALSE;
  3885. }
  3886. packet_list_recreate();
  3887. redraw_packet_bytes_all();
  3888. }
  3889. #ifdef HAVE_LIBPCAP
  3890. void
  3891. menu_auto_scroll_live_changed(gboolean auto_scroll_live_in)
  3892. {
  3893. GtkWidget *menu;
  3894. /* tell menu about it */
  3895. menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/AutoScrollinLiveCapture");
  3896. if(!menu){
  3897. g_warning("menu_auto_scroll_live_changed: No menu found, path= /Menubar/ViewMenu/AutoScrollinLiveCapture");
  3898. }
  3899. if( ((gboolean) gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menu)) != auto_scroll_live_in) ) {
  3900. gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), auto_scroll_live_in);
  3901. }
  3902. }
  3903. #endif /*HAVE_LIBPCAP */
  3904. void
  3905. menu_colorize_changed(gboolean packet_list_colorize)
  3906. {
  3907. GtkWidget *menu;
  3908. /* tell menu about it */
  3909. menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/ColorizePacketList");
  3910. if(!menu){
  3911. g_warning("menu_colorize_changed: No menu found, path= /Menubar/ViewMenu/ColorizePacketList");
  3912. }
  3913. if( (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menu)) != packet_list_colorize) ) {
  3914. gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), packet_list_colorize);
  3915. }
  3916. }
  3917. static void
  3918. colorize_cb(GtkWidget *w, gpointer d _U_)
  3919. {
  3920. main_colorize_changed(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w)));
  3921. }
  3922. /* the recent file read has finished, update the menu corresponding */
  3923. void
  3924. menu_recent_read_finished(void)
  3925. {
  3926. GtkWidget *menu;
  3927. menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/MainToolbar");
  3928. if(!menu){
  3929. g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/MainToolbar");
  3930. }else{
  3931. gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.main_toolbar_show);
  3932. }
  3933. menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/FilterToolbar");
  3934. if(!menu){
  3935. g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/FilterToolbar");
  3936. }else{
  3937. gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.filter_toolbar_show);
  3938. };
  3939. menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/WirelessToolbar");
  3940. if(!menu){
  3941. g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/WirelessToolbar");
  3942. }else{
  3943. gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.wireless_toolbar_show);
  3944. }
  3945. /* Fix me? */
  3946. menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/StatusBar");
  3947. if(!menu){
  3948. g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/StatusBar");
  3949. }else{
  3950. gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.statusbar_show);
  3951. }
  3952. menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/PacketList");
  3953. if(!menu){
  3954. g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/PacketList");
  3955. }else{
  3956. gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.packet_list_show);
  3957. }
  3958. menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/PacketDetails");
  3959. if(!menu){
  3960. g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/PacketDetails");
  3961. }else{
  3962. gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.tree_view_show);
  3963. }
  3964. menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/PacketBytes");
  3965. if(!menu){
  3966. g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/PacketBytes");
  3967. }else{
  3968. gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.byte_view_show);
  3969. }
  3970. menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/ColorizePacketList");
  3971. if(!menu){
  3972. g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/ColorizePacketList");
  3973. }else{
  3974. gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.packet_list_colorize);
  3975. }
  3976. menu_name_resolution_changed();
  3977. #ifdef HAVE_LIBPCAP
  3978. menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/AutoScrollinLiveCapture");
  3979. if(!menu){
  3980. g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/AutoScrollinLiveCapture");
  3981. }else{
  3982. gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), auto_scroll_live);
  3983. }
  3984. #endif
  3985. main_widgets_rearrange();
  3986. /* don't change the time format, if we had a command line value */
  3987. if (timestamp_get_type() != TS_NOT_SET) {
  3988. recent.gui_time_format = timestamp_get_type();
  3989. }
  3990. /* XXX Fix me */
  3991. timestamp_set_type(recent.gui_time_format);
  3992. /* This call adjusts column width */
  3993. cf_timestamp_auto_precision(&cfile);
  3994. packet_list_queue_draw();
  3995. /* the actual precision will be set in packet_list_queue_draw() below */
  3996. if (recent.gui_time_precision == TS_PREC_AUTO) {
  3997. timestamp_set_precision(TS_PREC_AUTO_SEC);
  3998. } else {
  3999. timestamp_set_precision(recent.gui_time_precision);
  4000. }
  4001. /* This call adjusts column width */
  4002. cf_timestamp_auto_precision(&cfile);
  4003. packet_list_queue_draw();
  4004. /* don't change the seconds format, if we had a command line value */
  4005. if (timestamp_get_seconds_type() != TS_SECONDS_NOT_SET) {
  4006. recent.gui_seconds_format = timestamp_get_seconds_type();
  4007. }
  4008. menu = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/TimeDisplayFormat/DisplaySecondsWithHoursAndMinutes");
  4009. if(!menu){
  4010. g_warning("menu_recent_read_finished: No menu found, path= /Menubar/ViewMenu/TimeDisplayFormat/DisplaySecondsWithHoursAndMinutes");
  4011. }
  4012. switch (recent.gui_seconds_format) {
  4013. case TS_SECONDS_DEFAULT:
  4014. recent.gui_seconds_format = (ts_seconds_type)-1;
  4015. /* set_active will not trigger the callback when deactivating an inactive item! */
  4016. gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
  4017. gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), FALSE);
  4018. break;
  4019. case TS_SECONDS_HOUR_MIN_SEC:
  4020. recent.gui_seconds_format = (ts_seconds_type)-1;
  4021. /* set_active will not trigger the callback when activating an active item! */
  4022. gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), FALSE);
  4023. gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
  4024. break;
  4025. default:
  4026. g_assert_not_reached();
  4027. }
  4028. main_colorize_changed(recent.packet_list_colorize);
  4029. }
  4030. gboolean
  4031. popup_menu_handler(GtkWidget *widget, GdkEvent *event, gpointer data)
  4032. {
  4033. GtkWidget *menu = (GtkWidget *)data;
  4034. GdkEventButton *event_button = NULL;
  4035. gint row, column;
  4036. if(widget == NULL || event == NULL || data == NULL) {
  4037. return FALSE;
  4038. }
  4039. /*
  4040. * If we ever want to make the menu differ based on what row
  4041. * and/or column we're above, we'd use "eth_clist_get_selection_info()"
  4042. * to find the row and column number for the coordinates; a CTree is,
  4043. * I guess, like a CList with one column(?) and the expander widget
  4044. * as a pixmap.
  4045. */
  4046. /* Check if we are on packet_list object */
  4047. if (widget == g_object_get_data(G_OBJECT(popup_menu_object), E_MPACKET_LIST_KEY) &&
  4048. ((GdkEventButton *)event)->button != 1) {
  4049. gint physical_row;
  4050. if (packet_list_get_event_row_column((GdkEventButton *)event, &physical_row, &row, &column)) {
  4051. g_object_set_data(G_OBJECT(popup_menu_object), E_MPACKET_LIST_ROW_KEY,
  4052. GINT_TO_POINTER(row));
  4053. g_object_set_data(G_OBJECT(popup_menu_object), E_MPACKET_LIST_COL_KEY,
  4054. GINT_TO_POINTER(column));
  4055. packet_list_set_selected_row(row);
  4056. }
  4057. }
  4058. /* Check if we are on tree_view object */
  4059. if (widget == tree_view_gbl) {
  4060. tree_view_select(widget, (GdkEventButton *) event);
  4061. }
  4062. /* context menu handler */
  4063. if(event->type == GDK_BUTTON_PRESS) {
  4064. event_button = (GdkEventButton *) event;
  4065. /* To quote the "Gdk Event Structures" doc:
  4066. * "Normally button 1 is the left mouse button, 2 is the middle button, and 3 is the right button" */
  4067. if(event_button->button == 3) {
  4068. gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
  4069. event_button->button,
  4070. event_button->time);
  4071. g_signal_stop_emission_by_name(widget, "button_press_event");
  4072. return TRUE;
  4073. }
  4074. }
  4075. /* Check if we are on byte_view object */
  4076. if(widget == get_notebook_bv_ptr(byte_nb_ptr_gbl)) {
  4077. byte_view_select(widget, (GdkEventButton *) event);
  4078. }
  4079. /* GDK_2BUTTON_PRESS is a doubleclick -> expand/collapse tree row */
  4080. /* GTK version 1 seems to be doing this automatically */
  4081. if (widget == tree_view_gbl && event->type == GDK_2BUTTON_PRESS) {
  4082. GtkTreePath *path;
  4083. if (gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(widget),
  4084. (gint) (((GdkEventButton *)event)->x),
  4085. (gint) (((GdkEventButton *)event)->y),
  4086. &path, NULL, NULL, NULL))
  4087. {
  4088. if (gtk_tree_view_row_expanded(GTK_TREE_VIEW(widget), path))
  4089. gtk_tree_view_collapse_row(GTK_TREE_VIEW(widget), path);
  4090. else
  4091. gtk_tree_view_expand_row(GTK_TREE_VIEW(widget), path,
  4092. FALSE);
  4093. gtk_tree_path_free(path);
  4094. }
  4095. }
  4096. return FALSE;
  4097. }
  4098. /* Enable or disable menu items based on whether you have a capture file
  4099. you've finished reading and, if you have one, whether it's been saved
  4100. and whether it could be saved except by copying the raw packet data. */
  4101. void
  4102. set_menus_for_capture_file(capture_file *cf)
  4103. {
  4104. if (cf == NULL || cf->state == FILE_READ_IN_PROGRESS) {
  4105. /* We have no capture file or we're currently reading a file */
  4106. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Merge", FALSE);
  4107. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Close", FALSE);
  4108. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Save", FALSE);
  4109. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/SaveAs", FALSE);
  4110. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportSpecifiedPackets", FALSE);
  4111. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportPacketDissections", FALSE);
  4112. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportSelectedPacketBytes", FALSE);
  4113. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportSSLSessionKeys", FALSE);
  4114. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportObjects", FALSE);
  4115. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportPDUs", FALSE);
  4116. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/Reload", FALSE);
  4117. } else {
  4118. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Merge", cf_can_write_with_wiretap(cf));
  4119. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Close", TRUE);
  4120. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Save",
  4121. cf_can_save(cf));
  4122. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/SaveAs",
  4123. cf_can_save_as(cf));
  4124. /*
  4125. * "Export Specified Packets..." should be available only if
  4126. * we can write the file out in at least one format.
  4127. */
  4128. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportSpecifiedPackets",
  4129. cf_can_write_with_wiretap(cf));
  4130. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportPacketDissections", TRUE);
  4131. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportSelectedPacketBytes", TRUE);
  4132. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportSSLSessionKeys", TRUE);
  4133. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportObjects", TRUE);
  4134. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportPDUs", TRUE);
  4135. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/Reload", TRUE);
  4136. }
  4137. }
  4138. /* Enable or disable menu items based on whether there's a capture in
  4139. progress. */
  4140. void
  4141. set_menus_for_capture_in_progress(gboolean capture_in_progress)
  4142. {
  4143. /* Either a capture was started or stopped; in either case, it's not
  4144. in the process of stopping, so allow quitting. */
  4145. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Quit",
  4146. TRUE);
  4147. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Open",
  4148. !capture_in_progress);
  4149. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/OpenRecent",
  4150. !capture_in_progress);
  4151. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportPacketDissections",
  4152. capture_in_progress);
  4153. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportSelectedPacketBytes",
  4154. capture_in_progress);
  4155. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportSSLSessionKeys",
  4156. capture_in_progress);
  4157. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportObjects",
  4158. capture_in_progress);
  4159. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Set",
  4160. !capture_in_progress);
  4161. set_menu_sensitivity(ui_manager_packet_list_heading, "/PacketListHeadingPopup/SortAscending",
  4162. !capture_in_progress);
  4163. set_menu_sensitivity(ui_manager_packet_list_heading, "/PacketListHeadingPopup/SortDescending",
  4164. !capture_in_progress);
  4165. set_menu_sensitivity(ui_manager_packet_list_heading, "/PacketListHeadingPopup/NoSorting",
  4166. !capture_in_progress);
  4167. #ifdef HAVE_LIBPCAP
  4168. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/CaptureMenu/Options",
  4169. !capture_in_progress);
  4170. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/CaptureMenu/Start",
  4171. !capture_in_progress && global_capture_opts.num_selected > 0);
  4172. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/CaptureMenu/Stop",
  4173. capture_in_progress);
  4174. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/CaptureMenu/Restart",
  4175. capture_in_progress);
  4176. #endif /* HAVE_LIBPCAP */
  4177. }
  4178. #ifdef HAVE_LIBPCAP
  4179. void
  4180. set_menus_capture_start_sensitivity(gboolean enable)
  4181. {
  4182. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/CaptureMenu/Start",
  4183. enable);
  4184. }
  4185. #endif
  4186. /* Disable menu items while we're waiting for the capture child to
  4187. finish. We disallow quitting until it finishes, and also disallow
  4188. stopping or restarting the capture. */
  4189. void
  4190. set_menus_for_capture_stopping(void)
  4191. {
  4192. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Quit",
  4193. FALSE);
  4194. #ifdef HAVE_LIBPCAP
  4195. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/CaptureMenu/Stop",
  4196. FALSE);
  4197. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/CaptureMenu/Restart",
  4198. FALSE);
  4199. #endif /* HAVE_LIBPCAP */
  4200. }
  4201. void
  4202. set_menus_for_captured_packets(gboolean have_captured_packets)
  4203. {
  4204. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Print",
  4205. have_captured_packets);
  4206. set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/Print",
  4207. have_captured_packets);
  4208. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/FindPacket",
  4209. have_captured_packets);
  4210. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/FindNext",
  4211. have_captured_packets);
  4212. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/FindPrevious",
  4213. have_captured_packets);
  4214. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ZoomIn",
  4215. have_captured_packets);
  4216. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ZoomOut",
  4217. have_captured_packets);
  4218. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/NormalSize",
  4219. have_captured_packets);
  4220. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/Goto",
  4221. have_captured_packets);
  4222. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/PreviousPacket",
  4223. have_captured_packets);
  4224. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/NextPacket",
  4225. have_captured_packets);
  4226. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/FirstPacket",
  4227. have_captured_packets);
  4228. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/LastPacket",
  4229. have_captured_packets);
  4230. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/PreviousPacketInConversation",
  4231. have_captured_packets);
  4232. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/NextPacketInConversation",
  4233. have_captured_packets);
  4234. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/StatisticsMenu/Summary",
  4235. have_captured_packets);
  4236. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/StatisticsMenu/ShowCommentsSummary",
  4237. have_captured_packets);
  4238. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/StatisticsMenu/ProtocolHierarchy",
  4239. have_captured_packets);
  4240. }
  4241. void
  4242. set_menus_for_selected_packet(capture_file *cf)
  4243. {
  4244. GList *list_entry = dissector_filter_list;
  4245. guint i = 0;
  4246. gboolean properties = FALSE;
  4247. const char *abbrev = NULL;
  4248. char *prev_abbrev;
  4249. /* Making the menu context-sensitive allows for easier selection of the
  4250. desired item and has the added benefit, with large captures, of
  4251. avoiding needless looping through huge lists for marked, ignored,
  4252. or time-referenced packets. */
  4253. gboolean is_ssl = epan_dissect_packet_contains_field(cf->edt, "ssl");
  4254. gboolean frame_selected = cf->current_frame != NULL;
  4255. /* A frame is selected */
  4256. gboolean have_marked = frame_selected && cf->marked_count > 0;
  4257. /* We have marked frames. (XXX - why check frame_selected?) */
  4258. gboolean another_is_marked = have_marked &&
  4259. !(cf->marked_count == 1 && cf->current_frame->flags.marked);
  4260. /* We have a marked frame other than the current frame (i.e.,
  4261. we have at least one marked frame, and either there's more
  4262. than one marked frame or the current frame isn't marked). */
  4263. gboolean have_time_ref = cf->ref_time_count > 0;
  4264. gboolean another_is_time_ref = frame_selected && have_time_ref &&
  4265. !(cf->ref_time_count == 1 && cf->current_frame->flags.ref_time);
  4266. /* We have a time reference frame other than the current frame (i.e.,
  4267. we have at least one time reference frame, and either there's more
  4268. than one time reference frame or the current frame isn't a
  4269. time reference frame). (XXX - why check frame_selected?) */
  4270. if (cfile.edt && cfile.edt->tree) {
  4271. GPtrArray *ga;
  4272. header_field_info *hfinfo;
  4273. field_info *v;
  4274. guint ii;
  4275. ga = proto_all_finfos(cfile.edt->tree);
  4276. for (ii = ga->len - 1; ii > 0 ; ii -= 1) {
  4277. v = (field_info *)g_ptr_array_index (ga, ii);
  4278. hfinfo = v->hfinfo;
  4279. if (!g_str_has_prefix(hfinfo->abbrev, "text") &&
  4280. !g_str_has_prefix(hfinfo->abbrev, "expert") &&
  4281. !g_str_has_prefix(hfinfo->abbrev, "malformed")) {
  4282. if (hfinfo->parent == -1) {
  4283. abbrev = hfinfo->abbrev;
  4284. } else {
  4285. abbrev = proto_registrar_get_abbrev(hfinfo->parent);
  4286. }
  4287. properties = prefs_is_registered_protocol(abbrev);
  4288. break;
  4289. }
  4290. }
  4291. }
  4292. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/MarkPacket",
  4293. frame_selected);
  4294. set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/MarkPacket",
  4295. frame_selected);
  4296. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/MarkAllDisplayedPackets",
  4297. cf->displayed_count > 0);
  4298. /* Unlike un-ignore, do not allow unmark of all frames when no frames are displayed */
  4299. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/UnmarkAllDisplayedPackets",
  4300. have_marked);
  4301. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/FindNextMark",
  4302. another_is_marked);
  4303. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/FindPreviousMark",
  4304. another_is_marked);
  4305. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/IgnorePacket",
  4306. frame_selected);
  4307. #ifdef WANT_PACKET_EDITOR
  4308. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/EditPacket",
  4309. frame_selected);
  4310. #endif /* WANT_PACKET_EDITOR */
  4311. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/AddEditPktComment",
  4312. frame_selected && wtap_dump_can_write(cf->linktypes, WTAP_COMMENT_PER_PACKET));
  4313. set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/IgnorePacket",
  4314. frame_selected);
  4315. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/IgnoreAllDisplayedPackets",
  4316. cf->displayed_count > 0 && cf->displayed_count != cf->count);
  4317. /* Allow un-ignore of all frames even with no frames currently displayed */
  4318. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Un-IgnoreAllPackets",
  4319. cf->ignored_count > 0);
  4320. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/SetTimeReference",
  4321. frame_selected);
  4322. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Un-TimeReferenceAllPackets",
  4323. have_time_ref);
  4324. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/TimeShift",
  4325. cf->count > 0);
  4326. set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/SetTimeReference",
  4327. frame_selected);
  4328. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/FindNextTimeReference",
  4329. another_is_time_ref);
  4330. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/FindPreviousTimeReference",
  4331. another_is_time_ref);
  4332. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ResizeAllColumns",
  4333. frame_selected);
  4334. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/CollapseAll",
  4335. frame_selected);
  4336. set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/CollapseAll",
  4337. frame_selected);
  4338. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ExpandAll",
  4339. frame_selected);
  4340. set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ExpandAll",
  4341. frame_selected);
  4342. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ColorizeConversation",
  4343. frame_selected);
  4344. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ResetColoring1-10",
  4345. tmp_color_filters_used());
  4346. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ShowPacketinNewWindow",
  4347. frame_selected);
  4348. set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ShowPacketinNewWindow",
  4349. frame_selected);
  4350. set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ManuallyResolveAddress",
  4351. frame_selected ? ((cf->edt->pi.ethertype == ETHERTYPE_IP)||(cf->edt->pi.ethertype == ETHERTYPE_IPv6)) : FALSE);
  4352. set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/SCTP",
  4353. frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_SCTP) : FALSE);
  4354. set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/FollowTCPStream",
  4355. frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
  4356. set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FollowTCPStream",
  4357. frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
  4358. set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/FollowUDPStream",
  4359. frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
  4360. set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/FollowSSLStream",
  4361. frame_selected ? is_ssl : FALSE);
  4362. set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FollowSSLStream",
  4363. frame_selected ? is_ssl : FALSE);
  4364. set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter",
  4365. frame_selected);
  4366. set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/Ethernet",
  4367. frame_selected ? (cf->edt->pi.dl_src.type == AT_ETHER) : FALSE);
  4368. set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/IP",
  4369. frame_selected ? ((cf->edt->pi.ethertype == ETHERTYPE_IP)||(cf->edt->pi.ethertype == ETHERTYPE_IPv6)) : FALSE);
  4370. set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/TCP",
  4371. frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
  4372. set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/UDP",
  4373. frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
  4374. set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FollowUDPStream",
  4375. frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
  4376. set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/PN-CBA",
  4377. frame_selected ? (cf->edt->pi.profinet_type != 0 && cf->edt->pi.profinet_type < 10) : FALSE);
  4378. set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation",
  4379. frame_selected);
  4380. set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/Ethernet",
  4381. frame_selected ? (cf->edt->pi.dl_src.type == AT_ETHER) : FALSE);
  4382. set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/IP",
  4383. frame_selected ? ((cf->edt->pi.ethertype == ETHERTYPE_IP)||(cf->edt->pi.ethertype == ETHERTYPE_IPv6)) : FALSE);
  4384. set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/TCP",
  4385. frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
  4386. set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/UDP",
  4387. frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
  4388. set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation/PN-CBA",
  4389. frame_selected ? (cf->edt->pi.profinet_type != 0 && cf->edt->pi.profinet_type < 10) : FALSE);
  4390. set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/DecodeAs",
  4391. frame_selected && decode_as_ok());
  4392. if (properties) {
  4393. prev_abbrev = (char *)g_object_get_data(G_OBJECT(ui_manager_packet_list_menu), "menu_abbrev");
  4394. if (!prev_abbrev || (strcmp(prev_abbrev, abbrev) != 0)) {
  4395. /*No previous protocol or protocol changed - update Protocol Preferences menu*/
  4396. module_t *prefs_module_p = prefs_find_module(abbrev);
  4397. rebuild_protocol_prefs_menu(prefs_module_p, properties, ui_manager_packet_list_menu, "/PacketListMenuPopup/ProtocolPreferences");
  4398. g_object_set_data(G_OBJECT(ui_manager_packet_list_menu), "menu_abbrev", g_strdup(abbrev));
  4399. g_free (prev_abbrev);
  4400. }
  4401. }
  4402. set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ProtocolPreferences",
  4403. properties);
  4404. set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/DecodeAs",
  4405. frame_selected && decode_as_ok());
  4406. set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/Copy",
  4407. frame_selected);
  4408. set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ApplyAsFilter",
  4409. frame_selected);
  4410. set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/PrepareaFilter",
  4411. frame_selected);
  4412. set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ResolveName",
  4413. frame_selected && (gbl_resolv_flags.mac_name || gbl_resolv_flags.network_name ||
  4414. gbl_resolv_flags.transport_name || gbl_resolv_flags.concurrent_dns));
  4415. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/FollowTCPStream",
  4416. frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE);
  4417. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/FollowUDPStream",
  4418. frame_selected ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE);
  4419. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/FollowSSLStream",
  4420. frame_selected ? is_ssl : FALSE);
  4421. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/DecodeAs",
  4422. frame_selected && decode_as_ok());
  4423. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/ResolveName",
  4424. frame_selected && (gbl_resolv_flags.mac_name || gbl_resolv_flags.network_name ||
  4425. gbl_resolv_flags.transport_name || gbl_resolv_flags.concurrent_dns));
  4426. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ToolsMenu/FirewallACLRules",
  4427. frame_selected);
  4428. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/StatisticsMenu/TCPStreamGraphMenu",
  4429. tcp_graph_selected_packet_enabled(cf->current_frame,cf->edt, NULL));
  4430. while (list_entry != NULL) {
  4431. dissector_filter_t *filter_entry;
  4432. gchar *path;
  4433. filter_entry = (dissector_filter_t *)list_entry->data;
  4434. path = g_strdup_printf("/Menubar/AnalyzeMenu/ConversationFilterMenu/Filters/filter-%u", i);
  4435. set_menu_sensitivity(ui_manager_main_menubar, path,
  4436. menu_dissector_filter_spe_cb(/* frame_data *fd _U_*/ NULL, cf->edt, filter_entry));
  4437. g_free(path);
  4438. i++;
  4439. list_entry = g_list_next(list_entry);
  4440. }
  4441. }
  4442. static void
  4443. menu_prefs_toggle_bool (GtkWidget *w, gpointer data)
  4444. {
  4445. gboolean *value = (gboolean *)data;
  4446. module_t *module = (module_t *)g_object_get_data (G_OBJECT(w), "module");
  4447. module->prefs_changed = TRUE;
  4448. *value = !(*value);
  4449. prefs_apply (module);
  4450. if (!prefs.gui_use_pref_save) {
  4451. prefs_main_write();
  4452. }
  4453. redissect_packets();
  4454. redissect_all_packet_windows();
  4455. }
  4456. static void
  4457. menu_prefs_change_enum (GtkWidget *w, gpointer data)
  4458. {
  4459. gint *value = (gint *)data;
  4460. module_t *module = (module_t *)g_object_get_data (G_OBJECT(w), "module");
  4461. gint new_value = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(w), "enumval"));
  4462. if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM(w)))
  4463. return;
  4464. if (*value != new_value) {
  4465. module->prefs_changed = TRUE;
  4466. *value = new_value;
  4467. prefs_apply (module);
  4468. if (!prefs.gui_use_pref_save) {
  4469. prefs_main_write();
  4470. }
  4471. redissect_packets();
  4472. redissect_all_packet_windows();
  4473. }
  4474. }
  4475. void
  4476. menu_prefs_reset(void)
  4477. {
  4478. g_free (g_object_get_data(G_OBJECT(ui_manager_tree_view_menu), "menu_abbrev"));
  4479. g_object_set_data(G_OBJECT(ui_manager_tree_view_menu), "menu_abbrev", NULL);
  4480. }
  4481. static void
  4482. menu_prefs_change_ok (GtkWidget *w, gpointer parent_w)
  4483. {
  4484. GtkWidget *entry = (GtkWidget *)g_object_get_data (G_OBJECT(w), "entry");
  4485. module_t *module = (module_t *)g_object_get_data (G_OBJECT(w), "module");
  4486. pref_t *pref = (pref_t *)g_object_get_data (G_OBJECT(w), "pref");
  4487. const gchar *new_value = gtk_entry_get_text(GTK_ENTRY(entry));
  4488. range_t *newrange;
  4489. gchar *p;
  4490. guint uval;
  4491. switch (pref->type) {
  4492. case PREF_UINT:
  4493. uval = (guint)strtoul(new_value, &p, pref->info.base);
  4494. if (p == new_value || *p != '\0') {
  4495. simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
  4496. "The value \"%s\" isn't a valid number.",
  4497. new_value);
  4498. return;
  4499. }
  4500. if (*pref->varp.uint != uval) {
  4501. module->prefs_changed = TRUE;
  4502. *pref->varp.uint = uval;
  4503. }
  4504. break;
  4505. case PREF_STRING:
  4506. if (strcmp (*pref->varp.string, new_value) != 0) {
  4507. module->prefs_changed = TRUE;
  4508. g_free((void*)*pref->varp.string);
  4509. *pref->varp.string = g_strdup(new_value);
  4510. }
  4511. break;
  4512. case PREF_RANGE:
  4513. if (range_convert_str(&newrange, new_value, pref->info.max_value) != CVT_NO_ERROR) {
  4514. simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
  4515. "The value \"%s\" isn't a valid range.",
  4516. new_value);
  4517. return;
  4518. }
  4519. if (!ranges_are_equal(*pref->varp.range, newrange)) {
  4520. module->prefs_changed = TRUE;
  4521. g_free(*pref->varp.range);
  4522. *pref->varp.range = newrange;
  4523. } else {
  4524. g_free (newrange);
  4525. }
  4526. break;
  4527. default:
  4528. g_assert_not_reached();
  4529. break;
  4530. }
  4531. if (module->prefs_changed) {
  4532. /* Ensure we reload the sub menu */
  4533. menu_prefs_reset();
  4534. prefs_apply (module);
  4535. if (!prefs.gui_use_pref_save) {
  4536. prefs_main_write();
  4537. }
  4538. redissect_packets();
  4539. redissect_all_packet_windows();
  4540. }
  4541. window_destroy(GTK_WIDGET(parent_w));
  4542. }
  4543. static void
  4544. menu_prefs_change_cancel (GtkWidget *w _U_, gpointer parent_w)
  4545. {
  4546. window_destroy(GTK_WIDGET(parent_w));
  4547. }
  4548. static void
  4549. menu_prefs_edit_dlg (GtkWidget *w, gpointer data)
  4550. {
  4551. pref_t *pref = (pref_t *)data;
  4552. module_t *module = (module_t *)g_object_get_data (G_OBJECT(w), "module");
  4553. gchar *value = NULL;
  4554. GtkWidget *win, *main_grid, *main_vb, *bbox, *cancel_bt, *ok_bt;
  4555. GtkWidget *entry, *label;
  4556. switch (pref->type) {
  4557. case PREF_UINT:
  4558. switch (pref->info.base) {
  4559. case 8:
  4560. value = g_strdup_printf("%o", *pref->varp.uint);
  4561. break;
  4562. case 10:
  4563. value = g_strdup_printf("%u", *pref->varp.uint);
  4564. break;
  4565. case 16:
  4566. value = g_strdup_printf("%x", *pref->varp.uint);
  4567. break;
  4568. default:
  4569. g_assert_not_reached();
  4570. break;
  4571. }
  4572. break;
  4573. case PREF_STRING:
  4574. value = g_strdup(*pref->varp.string);
  4575. break;
  4576. case PREF_RANGE:
  4577. value = g_strdup(range_convert_range (*pref->varp.range));
  4578. break;
  4579. default:
  4580. g_assert_not_reached();
  4581. break;
  4582. }
  4583. win = dlg_window_new(module->description);
  4584. gtk_window_set_resizable(GTK_WINDOW(win),FALSE);
  4585. gtk_window_resize(GTK_WINDOW(win), 400, 100);
  4586. main_vb = ws_gtk_box_new(GTK_ORIENTATION_VERTICAL, 5, FALSE);
  4587. gtk_container_add(GTK_CONTAINER(win), main_vb);
  4588. gtk_container_set_border_width(GTK_CONTAINER(main_vb), 6);
  4589. main_grid = ws_gtk_grid_new();
  4590. gtk_box_pack_start(GTK_BOX(main_vb), main_grid, FALSE, FALSE, 0);
  4591. ws_gtk_grid_set_column_spacing(GTK_GRID(main_grid), 10);
  4592. label = gtk_label_new(ep_strdup_printf("%s:", pref->title));
  4593. ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), label, 0, 1, 1, 1);
  4594. gtk_misc_set_alignment(GTK_MISC(label), 1.0f, 0.5f);
  4595. if (pref->description)
  4596. gtk_widget_set_tooltip_text(label, pref->description);
  4597. entry = gtk_entry_new();
  4598. ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), entry, 1, 1, 1, 1);
  4599. gtk_entry_set_text(GTK_ENTRY(entry), value);
  4600. if (pref->description)
  4601. gtk_widget_set_tooltip_text(entry, pref->description);
  4602. bbox = dlg_button_row_new(GTK_STOCK_CANCEL,GTK_STOCK_OK, NULL);
  4603. gtk_box_pack_end(GTK_BOX(main_vb), bbox, FALSE, FALSE, 0);
  4604. ok_bt = (GtkWidget *)g_object_get_data(G_OBJECT(bbox), GTK_STOCK_OK);
  4605. g_object_set_data (G_OBJECT(ok_bt), "module", module);
  4606. g_object_set_data (G_OBJECT(ok_bt), "entry", entry);
  4607. g_object_set_data (G_OBJECT(ok_bt), "pref", pref);
  4608. g_signal_connect(ok_bt, "clicked", G_CALLBACK(menu_prefs_change_ok), win);
  4609. dlg_set_activate(entry, ok_bt);
  4610. cancel_bt = (GtkWidget *)g_object_get_data(G_OBJECT(bbox), GTK_STOCK_CANCEL);
  4611. g_signal_connect(cancel_bt, "clicked", G_CALLBACK(menu_prefs_change_cancel), win);
  4612. window_set_cancel_button(win, cancel_bt, NULL);
  4613. gtk_widget_grab_default(ok_bt);
  4614. gtk_widget_show_all(win);
  4615. g_free(value);
  4616. }
  4617. static guint
  4618. add_protocol_prefs_generic_menu(pref_t *pref, gpointer data, GtkUIManager *ui_menu, const char *path)
  4619. {
  4620. GtkWidget *menu_preferences;
  4621. GtkWidget *menu_item, *menu_sub_item, *sub_menu;
  4622. GSList *group = NULL;
  4623. module_t *module = (module_t *)data;
  4624. const enum_val_t *enum_valp;
  4625. gchar *label = NULL;
  4626. switch (pref->type) {
  4627. case PREF_UINT:
  4628. switch (pref->info.base) {
  4629. case 8:
  4630. label = g_strdup_printf ("%s: %o", pref->title, *pref->varp.uint);
  4631. break;
  4632. case 10:
  4633. label = g_strdup_printf ("%s: %u", pref->title, *pref->varp.uint);
  4634. break;
  4635. case 16:
  4636. label = g_strdup_printf ("%s: %x", pref->title, *pref->varp.uint);
  4637. break;
  4638. default:
  4639. g_assert_not_reached();
  4640. break;
  4641. }
  4642. menu_item = gtk_menu_item_new_with_label(label);
  4643. g_object_set_data (G_OBJECT(menu_item), "module", module);
  4644. g_signal_connect(menu_item, "activate", G_CALLBACK(menu_prefs_edit_dlg), pref);
  4645. g_free (label);
  4646. break;
  4647. case PREF_BOOL:
  4648. menu_item = gtk_check_menu_item_new_with_label(pref->title);
  4649. gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menu_item), *pref->varp.boolp);
  4650. g_object_set_data (G_OBJECT(menu_item), "module", module);
  4651. g_signal_connect(menu_item, "activate", G_CALLBACK(menu_prefs_toggle_bool), pref->varp.boolp);
  4652. break;
  4653. case PREF_ENUM:
  4654. menu_item = gtk_menu_item_new_with_label(pref->title);
  4655. sub_menu = gtk_menu_new();
  4656. gtk_menu_item_set_submenu (GTK_MENU_ITEM(menu_item), sub_menu);
  4657. enum_valp = pref->info.enum_info.enumvals;
  4658. while (enum_valp->name != NULL) {
  4659. menu_sub_item = gtk_radio_menu_item_new_with_label(group, enum_valp->description);
  4660. group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_sub_item));
  4661. if (enum_valp->value == *pref->varp.enump) {
  4662. gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menu_sub_item), TRUE);
  4663. }
  4664. g_object_set_data (G_OBJECT(menu_sub_item), "module", module);
  4665. g_object_set_data (G_OBJECT(menu_sub_item), "enumval", GINT_TO_POINTER(enum_valp->value));
  4666. g_signal_connect(menu_sub_item, "activate", G_CALLBACK(menu_prefs_change_enum), pref->varp.enump);
  4667. gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_sub_item);
  4668. gtk_widget_show (menu_sub_item);
  4669. enum_valp++;
  4670. }
  4671. break;
  4672. case PREF_STRING:
  4673. label = g_strdup_printf ("%s: %s", pref->title, *pref->varp.string);
  4674. menu_item = gtk_menu_item_new_with_label(label);
  4675. g_object_set_data (G_OBJECT(menu_item), "module", module);
  4676. g_signal_connect(menu_item, "activate", G_CALLBACK(menu_prefs_edit_dlg), pref);
  4677. g_free (label);
  4678. break;
  4679. case PREF_RANGE:
  4680. label = g_strdup_printf ("%s: %s", pref->title, range_convert_range (*pref->varp.range));
  4681. menu_item = gtk_menu_item_new_with_label(label);
  4682. g_object_set_data (G_OBJECT(menu_item), "module", module);
  4683. g_signal_connect(menu_item, "activate", G_CALLBACK(menu_prefs_edit_dlg), pref);
  4684. g_free (label);
  4685. break;
  4686. case PREF_UAT:
  4687. label = g_strdup_printf ("%s...", pref->title);
  4688. menu_item = gtk_menu_item_new_with_label(label);
  4689. g_signal_connect (menu_item, "activate", G_CALLBACK(uat_window_cb), pref->varp.uat);
  4690. g_free (label);
  4691. break;
  4692. case PREF_COLOR:
  4693. case PREF_CUSTOM:
  4694. /* currently not supported */
  4695. case PREF_STATIC_TEXT:
  4696. case PREF_OBSOLETE:
  4697. default:
  4698. /* Nothing to add */
  4699. return 0;
  4700. }
  4701. menu_preferences = gtk_ui_manager_get_widget(ui_menu, path);
  4702. if(!menu_preferences)
  4703. g_warning("menu_preferences Not found path");
  4704. sub_menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM(menu_preferences));
  4705. gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
  4706. gtk_widget_show (menu_item);
  4707. return 0;
  4708. }
  4709. static guint
  4710. add_protocol_prefs_menu(pref_t *pref, gpointer data)
  4711. {
  4712. return add_protocol_prefs_generic_menu(pref, data, ui_manager_tree_view_menu, "/TreeViewPopup/ProtocolPreferences");
  4713. }
  4714. static guint
  4715. add_protocol_prefs_packet_list_menu(pref_t *pref, gpointer data)
  4716. {
  4717. return add_protocol_prefs_generic_menu(pref, data, ui_manager_packet_list_menu, "/PacketListMenuPopup/ProtocolPreferences");
  4718. }
  4719. static void
  4720. rebuild_protocol_prefs_menu(module_t *prefs_module_p, gboolean preferences,
  4721. GtkUIManager *ui_menu, const char *path)
  4722. {
  4723. GtkWidget *menu_preferences, *menu_item;
  4724. GtkWidget *sub_menu;
  4725. gchar *label;
  4726. menu_preferences = gtk_ui_manager_get_widget(ui_menu, path);
  4727. if (prefs_module_p && preferences) {
  4728. sub_menu = gtk_menu_new();
  4729. gtk_menu_item_set_submenu (GTK_MENU_ITEM(menu_preferences), sub_menu);
  4730. label = g_strdup_printf ("%s Preferences...", prefs_module_p->description);
  4731. menu_item = gtk_image_menu_item_new_with_label(label);
  4732. gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM(menu_item),
  4733. gtk_image_new_from_stock(GTK_STOCK_PREFERENCES, GTK_ICON_SIZE_MENU));
  4734. gtk_menu_shell_append(GTK_MENU_SHELL(sub_menu), menu_item);
  4735. g_signal_connect_swapped(G_OBJECT(menu_item), "activate",
  4736. G_CALLBACK(properties_cb), (GObject *) menu_item);
  4737. gtk_widget_show(menu_item);
  4738. g_free(label);
  4739. menu_item = gtk_menu_item_new();
  4740. gtk_menu_shell_append(GTK_MENU_SHELL(sub_menu), menu_item);
  4741. gtk_widget_show(menu_item);
  4742. if (ui_menu == ui_manager_tree_view_menu) {
  4743. prefs_pref_foreach(prefs_module_p, add_protocol_prefs_menu, prefs_module_p);
  4744. } else {
  4745. prefs_pref_foreach(prefs_module_p, add_protocol_prefs_packet_list_menu, prefs_module_p);
  4746. }
  4747. } else {
  4748. /* No preferences, remove sub menu */
  4749. gtk_menu_item_set_submenu (GTK_MENU_ITEM(menu_preferences), NULL);
  4750. }
  4751. }
  4752. static void
  4753. menu_visible_column_toggle (GtkWidget *w _U_, gpointer data)
  4754. {
  4755. packet_list_toggle_visible_column (GPOINTER_TO_INT(data));
  4756. }
  4757. void
  4758. rebuild_visible_columns_menu (void)
  4759. {
  4760. GtkWidget *menu_columns[2], *menu_item;
  4761. GtkWidget *sub_menu;
  4762. GList *clp;
  4763. fmt_data *cfmt;
  4764. gchar *title;
  4765. gint i, col_id;
  4766. menu_columns[0] = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/ViewMenu/DisplayedColumns");
  4767. if(! menu_columns[0]){
  4768. fprintf (stderr, "Warning: couldn't find menu_columns[0] path=/Menubar/ViewMenu/DisplayedColumns");
  4769. }
  4770. menu_columns[1] = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/DisplayedColumns");
  4771. /* Debug */
  4772. if(! menu_columns[1]){
  4773. fprintf (stderr, "Warning: couldn't find menu_columns[1] path=/PacketListHeadingPopup/DisplayedColumns");
  4774. }
  4775. for (i = 0; i < 2; i++) {
  4776. sub_menu = gtk_menu_new();
  4777. gtk_menu_item_set_submenu (GTK_MENU_ITEM(menu_columns[i]), sub_menu);
  4778. clp = g_list_first (prefs.col_list);
  4779. col_id = 0;
  4780. while (clp) {
  4781. cfmt = (fmt_data *) clp->data;
  4782. if (cfmt->title[0]) {
  4783. if (cfmt->fmt == COL_CUSTOM) {
  4784. title = g_strdup_printf ("%s (%s)", cfmt->title, cfmt->custom_field);
  4785. } else {
  4786. title = g_strdup_printf ("%s (%s)", cfmt->title, col_format_desc (cfmt->fmt));
  4787. }
  4788. } else {
  4789. if (cfmt->fmt == COL_CUSTOM) {
  4790. title = g_strdup_printf ("(%s)", cfmt->custom_field);
  4791. } else {
  4792. title = g_strdup_printf ("(%s)", col_format_desc (cfmt->fmt));
  4793. }
  4794. }
  4795. menu_item = gtk_check_menu_item_new_with_label(title);
  4796. g_free (title);
  4797. gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menu_item), cfmt->visible);
  4798. g_signal_connect(menu_item, "activate", G_CALLBACK(menu_visible_column_toggle), GINT_TO_POINTER(col_id));
  4799. gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
  4800. gtk_widget_show (menu_item);
  4801. clp = g_list_next (clp);
  4802. col_id++;
  4803. }
  4804. menu_item = gtk_separator_menu_item_new();
  4805. gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
  4806. gtk_widget_show (menu_item);
  4807. menu_item = gtk_menu_item_new_with_label ("Display All");
  4808. gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
  4809. g_signal_connect(menu_item, "activate", G_CALLBACK(packet_list_heading_activate_all_columns_cb), NULL);
  4810. gtk_widget_show (menu_item);
  4811. }
  4812. }
  4813. void
  4814. menus_set_column_resolved (gboolean resolved, gboolean can_resolve)
  4815. {
  4816. GtkWidget *menu;
  4817. menu = gtk_ui_manager_get_widget(ui_manager_packet_list_heading, "/PacketListHeadingPopup/ShowResolved");
  4818. if(!menu){
  4819. fprintf (stderr, "Warning: couldn't find menu path=/PacketListHeadingPopup/ShowResolved");
  4820. }
  4821. g_object_set_data(G_OBJECT(menu), "skip-update", (void *)1);
  4822. gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), resolved && can_resolve);
  4823. set_menu_sensitivity(ui_manager_packet_list_heading, "/PacketListHeadingPopup/ShowResolved", can_resolve);
  4824. g_object_set_data(G_OBJECT(menu), "skip-update", NULL);
  4825. }
  4826. void
  4827. menus_set_column_align_default (gboolean right_justify)
  4828. {
  4829. GtkWidget *submenu, *menu_item_child;
  4830. GList *child_list, *child_list_item;
  4831. const gchar *menu_item_name;
  4832. size_t menu_item_len;
  4833. /* get the submenu container item */
  4834. submenu = gtk_ui_manager_get_widget (ui_manager_packet_list_heading, "/PacketListHeadingPopup");
  4835. if(!submenu){
  4836. fprintf (stderr, "Warning: couldn't find submenu path=/PacketListHeadingPopup");
  4837. }
  4838. /* find the corresponding menu items to update */
  4839. child_list = gtk_container_get_children(GTK_CONTAINER(submenu));
  4840. child_list_item = child_list;
  4841. while (child_list_item) {
  4842. menu_item_child = gtk_bin_get_child(GTK_BIN(child_list_item->data));
  4843. if (menu_item_child != NULL) {
  4844. menu_item_name = gtk_label_get_text(GTK_LABEL(menu_item_child));
  4845. menu_item_len = strlen (menu_item_name);
  4846. if(strncmp(menu_item_name, "Align Left", 10) == 0) {
  4847. if (!right_justify && menu_item_len == 10) {
  4848. gtk_label_set_text(GTK_LABEL(menu_item_child), "Align Left\t(default)");
  4849. } else if (right_justify && menu_item_len > 10) {
  4850. gtk_label_set_text(GTK_LABEL(menu_item_child), "Align Left");
  4851. }
  4852. } else if (strncmp (menu_item_name, "Align Right", 11) == 0) {
  4853. if (right_justify && menu_item_len == 11) {
  4854. gtk_label_set_text(GTK_LABEL(menu_item_child), "Align Right\t(default)");
  4855. } else if (!right_justify && menu_item_len > 11) {
  4856. gtk_label_set_text(GTK_LABEL(menu_item_child), "Align Right");
  4857. }
  4858. }
  4859. }
  4860. child_list_item = g_list_next(child_list_item);
  4861. }
  4862. g_list_free(child_list);
  4863. }
  4864. void
  4865. set_menus_for_selected_tree_row(capture_file *cf)
  4866. {
  4867. gboolean properties;
  4868. gint id;
  4869. if (cf->finfo_selected != NULL) {
  4870. header_field_info *hfinfo = cf->finfo_selected->hfinfo;
  4871. const char *abbrev;
  4872. char *prev_abbrev;
  4873. if (hfinfo->parent == -1) {
  4874. abbrev = hfinfo->abbrev;
  4875. id = (hfinfo->type == FT_PROTOCOL) ? proto_get_id((protocol_t *)hfinfo->strings) : -1;
  4876. } else {
  4877. abbrev = proto_registrar_get_abbrev(hfinfo->parent);
  4878. id = hfinfo->parent;
  4879. }
  4880. properties = prefs_is_registered_protocol(abbrev);
  4881. set_menu_sensitivity(ui_manager_tree_view_menu,
  4882. "/TreeViewPopup/GotoCorrespondingPacket", hfinfo->type == FT_FRAMENUM);
  4883. set_menu_sensitivity(ui_manager_tree_view_menu,
  4884. "/TreeViewPopup/ShowPacketRefinNewWindow", hfinfo->type == FT_FRAMENUM);
  4885. set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/Copy",
  4886. TRUE);
  4887. set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/Copy/AsFilter",
  4888. proto_can_match_selected(cf->finfo_selected, cf->edt));
  4889. set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyasColumn",
  4890. hfinfo->type != FT_NONE);
  4891. set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter",
  4892. proto_can_match_selected(cf->finfo_selected, cf->edt));
  4893. set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter",
  4894. proto_can_match_selected(cf->finfo_selected, cf->edt));
  4895. set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ColorizewithFilter",
  4896. proto_can_match_selected(cf->finfo_selected, cf->edt));
  4897. set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ProtocolPreferences",
  4898. properties);
  4899. set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/DisableProtocol",
  4900. (id == -1) ? FALSE : proto_can_toggle_protocol(id));
  4901. set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ExpandSubtrees",
  4902. cf->finfo_selected->tree_type != -1);
  4903. set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/WikiProtocolPage",
  4904. (id == -1) ? FALSE : TRUE);
  4905. set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FilterFieldReference",
  4906. (id == -1) ? FALSE : TRUE);
  4907. set_menu_sensitivity(ui_manager_main_menubar,
  4908. "/Menubar/FileMenu/ExportSelectedPacketBytes", TRUE);
  4909. set_menu_sensitivity(ui_manager_main_menubar,
  4910. "/Menubar/GoMenu/GotoCorrespondingPacket", hfinfo->type == FT_FRAMENUM);
  4911. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Copy/Description",
  4912. proto_can_match_selected(cf->finfo_selected, cf->edt));
  4913. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Copy/Fieldname",
  4914. proto_can_match_selected(cf->finfo_selected, cf->edt));
  4915. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Copy/Value",
  4916. proto_can_match_selected(cf->finfo_selected, cf->edt));
  4917. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Copy/AsFilter",
  4918. proto_can_match_selected(cf->finfo_selected, cf->edt));
  4919. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/ApplyasColumn",
  4920. hfinfo->type != FT_NONE);
  4921. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/ApplyAsFilter",
  4922. proto_can_match_selected(cf->finfo_selected, cf->edt));
  4923. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/PrepareaFilter",
  4924. proto_can_match_selected(cf->finfo_selected, cf->edt));
  4925. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ExpandSubtrees",
  4926. cf->finfo_selected->tree_type != -1);
  4927. prev_abbrev = (char *)g_object_get_data(G_OBJECT(ui_manager_tree_view_menu), "menu_abbrev");
  4928. if (!prev_abbrev || (strcmp (prev_abbrev, abbrev) != 0)) {
  4929. /* No previous protocol or protocol changed - update Protocol Preferences menu */
  4930. module_t *prefs_module_p = prefs_find_module(abbrev);
  4931. rebuild_protocol_prefs_menu(prefs_module_p, properties, ui_manager_tree_view_menu, "/TreeViewPopup/ProtocolPreferences");
  4932. g_object_set_data(G_OBJECT(ui_manager_tree_view_menu), "menu_abbrev", g_strdup(abbrev));
  4933. g_free (prev_abbrev);
  4934. }
  4935. } else {
  4936. set_menu_sensitivity(ui_manager_tree_view_menu,
  4937. "/TreeViewPopup/GotoCorrespondingPacket", FALSE);
  4938. set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/Copy", FALSE);
  4939. set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyasColumn", FALSE);
  4940. set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter", FALSE);
  4941. set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter", FALSE);
  4942. set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ColorizewithFilter", FALSE);
  4943. set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ProtocolPreferences",
  4944. FALSE);
  4945. set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/DisableProtocol", FALSE);
  4946. set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ExpandSubtrees", FALSE);
  4947. set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/WikiProtocolPage",
  4948. FALSE);
  4949. set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FilterFieldReference",
  4950. FALSE);
  4951. set_menu_sensitivity(ui_manager_main_menubar,
  4952. "/Menubar/FileMenu/ExportSelectedPacketBytes", FALSE);
  4953. set_menu_sensitivity(ui_manager_main_menubar,
  4954. "/Menubar/GoMenu/GotoCorrespondingPacket", FALSE);
  4955. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Copy/Description", FALSE);
  4956. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Copy/Fieldname", FALSE);
  4957. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Copy/Value", FALSE);
  4958. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/Copy/AsFilter", FALSE);
  4959. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/ApplyasColumn", FALSE);
  4960. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/ApplyAsFilter", FALSE);
  4961. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/PrepareaFilter", FALSE);
  4962. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ExpandSubtrees", FALSE);
  4963. }
  4964. }
  4965. void set_menus_for_packet_history(gboolean back_history, gboolean forward_history)
  4966. {
  4967. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/Back", back_history);
  4968. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/Forward", forward_history);
  4969. }
  4970. void set_menus_for_file_set(gboolean file_set, gboolean previous_file, gboolean next_file)
  4971. {
  4972. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Set/ListFiles", file_set);
  4973. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Set/PreviousFile", previous_file);
  4974. set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Set/NextFile", next_file);
  4975. }
  4976. GtkWidget *menus_get_profiles_rename_menu (void)
  4977. {
  4978. return gtk_ui_manager_get_widget(ui_manager_statusbar_profiles_menu, "/ProfilesMenuPopup/Rename");
  4979. }
  4980. GtkWidget *menus_get_profiles_delete_menu (void)
  4981. {
  4982. return gtk_ui_manager_get_widget(ui_manager_statusbar_profiles_menu, "/ProfilesMenuPopup/Delete");
  4983. }
  4984. GtkWidget *menus_get_profiles_change_menu (void)
  4985. {
  4986. return gtk_ui_manager_get_widget(ui_manager_statusbar_profiles_menu, "/ProfilesMenuPopup/Change");
  4987. }
  4988. void set_menus_for_profiles(gboolean default_profile)
  4989. {
  4990. set_menu_sensitivity(ui_manager_statusbar_profiles_menu, "/ProfilesMenuPopup/Rename", !default_profile);
  4991. set_menu_sensitivity(ui_manager_statusbar_profiles_menu, "/ProfilesMenuPopup/Delete", !default_profile);
  4992. }
  4993. /*
  4994. * Editor modelines
  4995. *
  4996. * Local Variables:
  4997. * c-basic-offset: 4
  4998. * tab-width: 8
  4999. * indent-tabs-mode: nil
  5000. * End:
  5001. *
  5002. * ex: set shiftwidth=4 tabstop=8 expandtab:
  5003. * :indentSize=4:tabSize=8:noTabs=true:
  5004. */