(GUIManager) Make opening a recent file work from the recent files menu.
[obnox/wireshark/wip.git] / gtk / menus.h
1 /* menus.h
2  * Menu definitions
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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
23  */
24
25 #ifndef __MENUS_H__
26 #define __MENUS_H__
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif /* __cplusplus */
31
32 /*#define MAIN_MENU_USE_UIMANAGER 1 */
33
34         /* Add a new recent capture filename to the "Recent Files" submenu
35    (duplicates will be ignored) */
36 extern void add_menu_recent_capture_file(gchar *cf_name);
37
38 /* Open a file(name)
39    (will not ask to close existing capture file!) */
40 extern void menu_open_filename(gchar *cf_name);
41
42 /** @file
43  *  Menubar and context menus.
44  *  @ingroup main_window_group
45  */
46
47 /** Write all recent capture filenames to the user's recent file.
48  * @param rf recent file
49  */
50 extern void menu_recent_file_write_all(FILE *rf);
51
52 /** User pushed a recent file submenu item.
53  *
54  * @param widget parent widget
55  */
56 #ifdef MAIN_MENU_USE_UIMANAGER
57 extern void menu_open_recent_file_cmd(GtkAction *action);
58 #else
59 extern void menu_open_recent_file_cmd(GtkWidget *widget);
60 #endif
61
62 /** The recent file read has finished, update the menu corresponding. */
63 extern void menu_recent_read_finished(void);
64
65 /** One of the name resolution menu items changed. */
66 extern void menu_name_resolution_changed(void);
67
68 /** The "Colorize Packet List" option changed. */
69 extern void menu_colorize_changed(gboolean packet_list_colorize);
70
71 /* Reset preferences menu on profile or preference change. */
72 extern void menu_prefs_reset(void);
73
74 extern void rebuild_visible_columns_menu (void);
75
76 #ifdef HAVE_LIBPCAP
77 /** The "Auto Scroll Packet List in Live Capture" option changed. */
78 extern void menu_auto_scroll_live_changed(gboolean auto_scroll_in);
79 #endif
80
81 /** Create a new menu.
82  *
83  * @param accel the created accelerator group
84  * @return the new menu
85  */
86 extern GtkWidget *main_menu_new(GtkAccelGroup **accel);
87
88 /** Set object data of menu, like g_object_set_data().
89  *
90  * @param path the path of the menu item
91  * @param key the key to set
92  * @param data the data to set
93  */
94 extern void set_menu_object_data(const gchar *path, const gchar *key, gpointer data);
95 #ifndef MAIN_MENU_USE_UIMANAGER
96 extern void set_menu_object_data_old(const gchar *path, const gchar *key, gpointer data);
97 #endif /* MAIN_MENU_USE_UIMANAGER */
98
99 /** The popup menu handler.
100  *
101  * @param widget the parent widget
102  * @param event the GdkEvent
103  * @param data the corresponding menu 
104  */
105 extern gboolean popup_menu_handler(GtkWidget *widget, GdkEvent *event, gpointer data);
106
107 /** The packet history has changed, we need to update the menu.
108  *
109  * @param back_history some back history entries available
110  * @param forward_history some forward history entries available
111  */
112 extern void set_menus_for_packet_history(gboolean back_history, gboolean forward_history);
113
114 /** The current file has changed, we need to update the file set menu items.
115  *
116  * @param file_set the current file is part of a file set
117  * @param previous_file the previous file set (or NULL)
118  * @param next_file the next file set (or NULL)
119  */
120 extern void set_menus_for_file_set(gboolean file_set, gboolean previous_file, gboolean next_file);
121
122 /** The popup menu. */
123 extern GtkWidget           *popup_menu_object;
124
125 /* Update the packet list heading menu to indicate default
126    column justification. */
127 void menus_set_column_align_default (gboolean right_justify);
128
129 /* Update the packet list heading menu to indicate if column can be resolved. */
130 void menus_set_column_resolved (gboolean resolved, gboolean can_resolve);
131
132 /* Fetch the statusbar profiles submenu */
133 extern GtkWidget *menus_get_profiles_menu (void);
134
135 /* Enable or disable menu items based on whether a tree row is selected
136    and and on whether a "Match Selected" can be done. */
137 void set_menus_for_selected_tree_row(capture_file *cf);
138
139
140 /* Enable or disable menu items based on whether you have a capture file
141    you've finished reading and, if you have one, whether it's been saved
142    and whether it could be saved except by copying the raw packet data. */
143 void set_menus_for_capture_file(capture_file *);
144
145
146 /* Enable or disable menu items based on whether there's a capture in
147    progress. */
148 void set_menus_for_capture_in_progress(gboolean);
149
150 /* Enable or disable menu items based on whether you have some captured
151    packets. */
152 void set_menus_for_captured_packets(gboolean);
153
154 /* Enable or disable menu items based on whether a packet is selected. */
155 void set_menus_for_selected_packet(capture_file *cf);
156
157 /* Enable or disable menu items based on configuration profile */
158 void set_menus_for_profiles(gboolean default_profile);
159
160 #ifdef MAIN_MENU_USE_UIMANAGER
161 #define MENU_BAR_PATH_FILE_OPEN                                                 "/Menubar/FileMenu/Open"
162 #define MENU_BAR_PATH_EDIT_COPY_AS_FLT                                  "/Menubar/EditMenu/Copy/AsFilter"
163 #define MENU_BAR_PATH_ANALYZE_DISPLAY_FLT                               "/Menubar/AnalyzeMenu/DisplayFilters"
164 #define MENU_BAR_PATH_ANALYZE_FOLLOW_TCP_STREAM                 "/Menubar/AnalyzeMenu/FollowTCPStream"
165 #define MENU_BAR_PATH_ANALYZE_FOLLOW_UDP_STREAM                 "/Menubar/AnalyzeMenu/FollowUDPStream"
166 #define MENU_BAR_PATH_ANALYZE_FOLLOW_SSL_STREAM                 "/Menubar/AnalyzeMenu/FollowSSLStream"
167 #define MENU_BAR_PATH_ANALYZE_APL_AS_FLT_SEL                    "/Menubar/AnalyzeMenu/ApplyAsFilter/Selected"
168 #define MENU_BAR_PATH_ANALYZE_APL_AS_FLT_NOT_SEL                "/Menubar/AnalyzeMenu/ApplyAsFilter/NotSelected"
169 #define MENU_BAR_PATH_ANALYZE_APL_AS_FLT_AND_SEL                "/Menubar/AnalyzeMenu/ApplyAsFilter/AndSelected"
170 #define MENU_BAR_PATH_ANALYZE_APL_AS_FLT_OR_SEL                 "/Menubar/AnalyzeMenu/ApplyAsFilter/OrSelected"
171 #define MENU_BAR_PATH_ANALYZE_APL_AS_FLT_AND_NOT_SEL    "/Menubar/AnalyzeMenu/ApplyAsFilter/AndNotSelected"
172 #define MENU_BAR_PATH_ANALYZE_APL_AS_FLT_OR_NOT_SEL             "/Menubar/AnalyzeMenu/ApplyAsFilter/OrNotSelected"
173
174 #define MENU_BAR_PATH_ANALYZE_PREP_A_FLT_SEL                    "/Menubar/AnalyzeMenu/PrepareaFilter/Selected"
175 #define MENU_BAR_PATH_ANALYZE_PREP_A_FLT_NOT_SEL                "/Menubar/AnalyzeMenu/PrepareaFilter/NotSelected"
176 #define MENU_BAR_PATH_ANALYZE_PREP_A_FLT_AND_SEL                "/Menubar/AnalyzeMenu/PrepareaFilter/AndSelected"
177 #define MENU_BAR_PATH_ANALYZE_PREP_A_FLT_OR_SEL                 "/Menubar/AnalyzeMenu/PrepareaFilter/OrSelected"
178 #define MENU_BAR_PATH_ANALYZE_PREP_A_FLT_AND_NOT_SEL    "/Menubar/AnalyzeMenu/PrepareaFilter/AndNotSelected"
179 #define MENU_BAR_PATH_ANALYZE_PREP_A_FLT_OR_NOT_SEL             "/Menubar/AnalyzeMenu/PrepareaFilter/OrNotSelected"
180
181 #else
182 #define MENU_BAR_PATH_FILE_OPEN                                                 "/File/Open..."
183 #define MENU_BAR_PATH_EDIT_COPY_AS_FLT                                  "/Edit/Copy/As Filter"
184 #define MENU_BAR_PATH_ANALYZE_DISPLAY_FLT                               "/Analyze/Display Filters..."
185 #define MENU_BAR_PATH_ANALYZE_FOLLOW_TCP_STREAM                 "/Analyze/Follow TCP Stream"
186 #define MENU_BAR_PATH_ANALYZE_FOLLOW_UDP_STREAM                 "/Analyze/Follow UDP Stream"
187 #define MENU_BAR_PATH_ANALYZE_FOLLOW_SSL_STREAM                 "/Analyze/Follow SSL Stream"
188 #define MENU_BAR_PATH_ANALYZE_APL_AS_FLT_SEL                    "/Analyze/Apply as Filter/Selected"
189 #define MENU_BAR_PATH_ANALYZE_APL_AS_FLT_NOT_SEL                "/Analyze/Apply as Filter/Not Selected"
190 #define MENU_BAR_PATH_ANALYZE_APL_AS_FLT_AND_SEL                "/Analyze/Apply as Filter/... and Selected"
191 #define MENU_BAR_PATH_ANALYZE_APL_AS_FLT_OR_SEL                 "/Analyze/Apply as Filter/... or Selected"
192 #define MENU_BAR_PATH_ANALYZE_APL_AS_FLT_AND_NOT_SEL    "/Analyze/Apply as Filter/... and not Selected"
193 #define MENU_BAR_PATH_ANALYZE_APL_AS_FLT_OR_NOT_SEL             "/Analyze/Apply as Filter/... or not Selected"
194
195 #define MENU_BAR_PATH_ANALYZE_PREP_A_FLT_SEL                    "/Analyze/Prepare a Filter/Selected"
196 #define MENU_BAR_PATH_ANALYZE_PREP_A_FLT_NOT_SEL                "/Analyze/Prepare a Filter/Not Selected"
197 #define MENU_BAR_PATH_ANALYZE_PREP_A_FLT_AND_SEL                "/Analyze/Prepare a Filter/... and Selected"
198 #define MENU_BAR_PATH_ANALYZE_PREP_A_FLT_OR_SEL                 "/Analyze/Prepare a Filter/... or Selected"
199 #define MENU_BAR_PATH_ANALYZE_PREP_A_FLT_AND_NOT_SEL    "/Analyze/Prepare a Filter/... and not Selected"
200 #define MENU_BAR_PATH_ANALYZE_PREP_A_FLT_OR_NOT_SEL             "/Analyze/Prepare a Filter/... or not Selected"
201 #endif /* MAIN_MENU_USE_UIMANAGER */
202
203 #define PACKET_LIST_POPUP_PATH_ANALYZE_FOLLOW_TCP_STREAM        "/PacketListMenuPopup/FollowTCPStream"
204 #define PACKET_LIST_POPUP_PATH_ANALYZE_FOLLOW_UDP_STREAM        "/PacketListMenuPopup/FollowUDPStream"
205 #define PACKET_LIST_POPUP_PATH_ANALYZE_FOLLOW_SSL_STREAM        "/PacketListMenuPopup/FollowSSLStream"
206 #define PACKET_LIST_POPUP_PATH_CONV_FLT_ETH                                     "/PacketListMenuPopup/ConversationFilter/Ethernet" 
207 #define PACKET_LIST_POPUP_PATH_CONV_FLT_IP                                      "/PacketListMenuPopup/ConversationFilter/IP"
208 #define PACKET_LIST_POPUP_PATH_CONV_FLT_TCP                                     "/PacketListMenuPopup/ConversationFilter/TCP"
209 #define PACKET_LIST_POPUP_PATH_CONV_FLT_UDP                                     "/PacketListMenuPopup/ConversationFilter/UDP"
210 #define PACKET_LIST_POPUP_PATH_CONV_FLT_PN_CBA_SERV                     "/PacketListMenuPopup/ConversationFilter/PN-CBA"
211
212
213 #ifdef __cplusplus
214 }
215 #endif /* __cplusplus */
216
217 #endif /* __MENUS_H__ */