Witness: enum witness_notifyResponse_type
[wireshark-wip.git] / ui / gtk / help_dlg.c
blob88743c2d441ef9688760f1eccb069af4467bc7a5
1 /* help_dlg.c
3 * $Id$
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 #include "config.h"
27 #include <stdio.h>
28 #include <errno.h>
30 #include <gtk/gtk.h>
32 #include <epan/prefs.h>
34 #include "ui/gtk/help_dlg.h"
35 #include "ui/gtk/text_page_utils.h"
36 #include "ui/gtk/gtkglobals.h"
37 #include "ui/gtk/gui_utils.h"
38 #include "ui/gtk/dlg_utils.h"
39 #include "ui/gtk/webbrowser.h"
42 #define HELP_DIR "help"
43 #define NOTEBOOK_KEY "notebook_key"
46 * Keep a static pointer to the current "Help" window, if any, so that
47 * if somebody tries to do "Help->Help" while there's already a
48 * "Help" window up, we just pop up the existing one, rather than
49 * creating a new one.
51 static GtkWidget *help_w = NULL;
54 * Keep a list of text widgets and corresponding file names as well
55 * (for text format changes).
57 typedef struct {
58 char *topic;
59 char *pathname;
60 GtkWidget *page;
61 } help_page_t;
63 static GSList *help_text_pages = NULL;
66 /**
67 * Redraw all help pages, to use a new font.
69 void help_redraw(void)
71 GSList *help_page_ent;
72 help_page_t *help_page;
74 if (help_w != NULL) {
75 for (help_page_ent = help_text_pages; help_page_ent != NULL;
76 help_page_ent = g_slist_next(help_page_ent))
78 help_page = (help_page_t *)help_page_ent->data;
79 text_page_redraw(help_page->page, help_page->pathname);
84 void
85 topic_action(topic_action_e action)
87 char *url;
89 url = topic_action_url(action);
91 if(url != NULL) {
92 browser_open_url(url);
93 g_free(url);
97 void
98 topic_cb(GtkWidget *w _U_, topic_action_e action)
100 topic_action(action);
103 gboolean
104 topic_menu_cb(GtkWidget *w _U_, GdkEventButton *event _U_, gpointer user_data)
106 topic_action((topic_action_e)GPOINTER_TO_INT(user_data));
107 return TRUE;