5 * Laurent Deniel <laurent.deniel@free.fr>
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 2000 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 #include "epan/filesystem.h"
36 #include <epan/prefs.h>
38 #include "../simple_dialog.h"
40 #include "gtk/help_dlg.h"
41 #include "gtk/text_page_utils.h"
42 #include "gtk/gtkglobals.h"
43 #include "gtk/gui_utils.h"
44 #include "gtk/dlg_utils.h"
45 #include "gtk/webbrowser.h"
50 #include <wsutil/unicode-utils.h>
54 #define HELP_DIR "help"
57 #define NOTEBOOK_KEY "notebook_key"
60 * Keep a static pointer to the current "Help" window, if any, so that
61 * if somebody tries to do "Help->Help" while there's already a
62 * "Help" window up, we just pop up the existing one, rather than
65 static GtkWidget *help_w = NULL;
68 * Keep a list of text widgets and corresponding file names as well
69 * (for text format changes).
77 static GSList *help_text_pages = NULL;
81 * Open the help dialog and show a specific HTML help page.
83 void help_topic_html(const gchar *topic) {
87 /* try to open local .chm file */
91 url = g_string_new("");
93 g_string_append_printf(url, "%s\\user-guide.chm::/wsug_chm/%s>Wireshark Help",
94 get_datafile_dir(), topic);
100 g_string_free(url, TRUE /* free_segment */);
102 /* if the .chm file could be opened, stop here */
108 url = g_string_new("");
110 /* try to open the HTML page from wireshark.org instead */
111 g_string_append_printf(url, "http://www.wireshark.org/docs/wsug_html_chunked/%s", topic);
113 browser_open_url(url->str);
115 g_string_free(url, TRUE /* free_segment */);
121 * Redraw all help pages, to use a new font.
123 void help_redraw(void)
125 GSList *help_page_ent;
126 help_page_t *help_page;
128 if (help_w != NULL) {
129 for (help_page_ent = help_text_pages; help_page_ent != NULL;
130 help_page_ent = g_slist_next(help_page_ent))
132 help_page = (help_page_t *)help_page_ent->data;
133 text_page_redraw(help_page->page, help_page->pathname);
140 topic_online_url(topic_action_e action)
143 case(ONLINEPAGE_HOME):
144 return "http://www.wireshark.org";
146 case(ONLINEPAGE_WIKI):
147 return "http://wiki.wireshark.org";
149 case(ONLINEPAGE_DOWNLOAD):
150 return "http://www.wireshark.org/download.html";
152 case(ONLINEPAGE_USERGUIDE):
153 return "http://www.wireshark.org/docs/wsug_html_chunked/";
155 case(ONLINEPAGE_FAQ):
156 return "http://www.wireshark.org/faq.html";
158 case(ONLINEPAGE_SAMPLE_FILES):
159 return "http://wiki.wireshark.org/SampleCaptures";
161 case(ONLINEPAGE_CAPTURE_SETUP):
162 return "http://wiki.wireshark.org/CaptureSetup";
164 case(ONLINEPAGE_NETWORK_MEDIA):
165 return "http://wiki.wireshark.org/CaptureSetup/NetworkMedia";
167 case(ONLINEPAGE_SAMPLE_CAPTURES):
168 return "http://wiki.wireshark.org/SampleCaptures";
170 case(ONLINEPAGE_SECURITY):
171 return "http://wiki.wireshark.org/Security";
173 case(ONLINEPAGE_CHIMNEY):
174 return "http://wiki.wireshark.org/CaptureSetup/Offloading#chimney";
183 topic_action(topic_action_e action)
185 const char *online_url;
188 /* pages online at www.wireshark.org */
189 online_url = topic_online_url(action);
190 if(online_url != NULL) {
191 browser_open_url (online_url);
196 /* local manual pages */
197 case(LOCALPAGE_MAN_WIRESHARK):
198 browser_open_data_file("wireshark.html");
200 case(LOCALPAGE_MAN_WIRESHARK_FILTER):
201 browser_open_data_file("wireshark-filter.html");
203 case(LOCALPAGE_MAN_TSHARK):
204 browser_open_data_file("tshark.html");
206 case(LOCALPAGE_MAN_RAWSHARK):
207 browser_open_data_file("rawshark.html");
209 case(LOCALPAGE_MAN_DUMPCAP):
210 browser_open_data_file("dumpcap.html");
212 case(LOCALPAGE_MAN_MERGECAP):
213 browser_open_data_file("mergecap.html");
215 case(LOCALPAGE_MAN_EDITCAP):
216 browser_open_data_file("editcap.html");
218 case(LOCALPAGE_MAN_TEXT2PCAP):
219 browser_open_data_file("text2pcap.html");
222 /* local help pages (User's Guide) */
224 help_topic_html( "index.html");
226 case(HELP_CAPTURE_OPTIONS_DIALOG):
227 help_topic_html("ChCapCaptureOptions.html");
229 case(HELP_CAPTURE_FILTERS_DIALOG):
230 help_topic_html("ChWorkDefineFilterSection.html");
232 case(HELP_DISPLAY_FILTERS_DIALOG):
233 help_topic_html("ChWorkDefineFilterSection.html");
235 case(HELP_COLORING_RULES_DIALOG):
236 help_topic_html("ChCustColorizationSection.html");
238 case(HELP_CONFIG_PROFILES_DIALOG):
239 help_topic_html("ChCustConfigProfilesSection.html");
241 case (HELP_MANUAL_ADDR_RESOLVE_DIALOG):
242 help_topic_html("ChManualAddressResolveSection.html");
244 case(HELP_PRINT_DIALOG):
245 help_topic_html("ChIOPrintSection.html");
247 case(HELP_FIND_DIALOG):
248 help_topic_html("ChWorkFindPacketSection.html");
250 case(HELP_FIREWALL_DIALOG):
251 help_topic_html("ChUseToolsMenuSection.html");
253 case(HELP_GOTO_DIALOG):
254 help_topic_html("ChWorkGoToPacketSection.html");
256 case(HELP_CAPTURE_INTERFACES_DIALOG):
257 help_topic_html("ChCapInterfaceSection.html");
259 case(HELP_CAPTURE_INFO_DIALOG):
260 help_topic_html("ChCapRunningSection.html");
262 case(HELP_ENABLED_PROTOCOLS_DIALOG):
263 help_topic_html("ChCustProtocolDissectionSection.html");
265 case(HELP_DECODE_AS_DIALOG):
266 help_topic_html("ChCustProtocolDissectionSection.html");
268 case(HELP_DECODE_AS_SHOW_DIALOG):
269 help_topic_html("ChCustProtocolDissectionSection.html");
271 case(HELP_FOLLOW_STREAM_DIALOG):
272 help_topic_html("ChAdvFollowTCPSection.html");
274 case(HELP_EXPERT_INFO_DIALOG):
275 help_topic_html("ChAdvExpert.html");
277 case(HELP_STATS_SUMMARY_DIALOG):
278 help_topic_html("ChStatSummary.html");
280 case(HELP_STATS_PROTO_HIERARCHY_DIALOG):
281 help_topic_html("ChStatHierarchy.html");
283 case(HELP_STATS_ENDPOINTS_DIALOG):
284 help_topic_html("ChStatEndpoints.html");
286 case(HELP_STATS_CONVERSATIONS_DIALOG):
287 help_topic_html("ChStatConversations.html");
289 case(HELP_STATS_IO_GRAPH_DIALOG):
290 help_topic_html("ChStatIOGraphs.html");
292 case(HELP_STATS_COMPARE_FILES_DIALOG):
293 help_topic_html("ChStatCompareCaptureFiles.html");
295 case(HELP_STATS_LTE_MAC_TRAFFIC_DIALOG):
296 help_topic_html("ChTelLTEMACTraffic.html");
298 case(HELP_STATS_LTE_RLC_TRAFFIC_DIALOG):
299 help_topic_html("ChTelLTERLCTraffic.html");
301 case(HELP_STATS_WLAN_TRAFFIC_DIALOG):
302 help_topic_html("ChStatWLANTraffic.html");
304 case(HELP_FILESET_DIALOG):
305 help_topic_html("ChIOFileSetSection.html");
307 case(HELP_CAPTURE_INTERFACE_OPTIONS_DIALOG):
308 help_topic_html("ChCustInterfaceOptionsSection.html");
310 case(HELP_CAPTURE_INTERFACES_DETAILS_DIALOG):
311 help_topic_html("ChCapInterfaceDetailsSection.html");
313 case(HELP_PREFERENCES_DIALOG):
314 help_topic_html("ChCustPreferencesSection.html");
316 case(HELP_EXPORT_FILE_DIALOG):
317 case(HELP_EXPORT_FILE_WIN32_DIALOG):
318 help_topic_html("ChIOExportSection.html");
320 case(HELP_EXPORT_BYTES_DIALOG):
321 case(HELP_EXPORT_BYTES_WIN32_DIALOG):
322 help_topic_html("ChIOExportSection.html#ChIOExportSelectedDialog");
324 case(HELP_EXPORT_OBJECT_LIST):
325 help_topic_html("ChIOExportSection.html#ChIOExportObjectsDialog");
327 case(HELP_OPEN_DIALOG):
328 case(HELP_OPEN_WIN32_DIALOG):
329 help_topic_html("ChIOOpenSection.html");
331 case(HELP_MERGE_DIALOG):
332 case(HELP_MERGE_WIN32_DIALOG):
333 help_topic_html("ChIOMergeSection.html");
335 case(HELP_SAVE_DIALOG):
336 case(HELP_SAVE_WIN32_DIALOG):
337 help_topic_html("ChIOSaveSection.html");
341 g_assert_not_reached();
347 topic_cb(GtkWidget *w _U_, topic_action_e action)
349 topic_action(action);
353 topic_menu_cb(GtkWidget *w _U_, gpointer data _U_, topic_action_e action)
355 topic_action(action);