3 * $Id: about_dlg.c,v 1.2 2004/05/20 13:48:25 ulfl Exp $
5 * Ulf Lamping <ulf.lamping@web.de>
7 * Ethereal - Network traffic analyzer
8 * By Gerald Combs <gerald@ethereal.com>
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.
32 #include <epan/filesystem.h>
33 #include <epan/plugins.h>
35 #include "dlg_utils.h"
36 #include "compat_macros.h"
39 extern GString *comp_info_str, *runtime_info_str;
41 static void about_ethereal_destroy_cb(GtkWidget *, gpointer);
45 * Keep a static pointer to the current "About Ethereal" window, if any, so
46 * that if somebody tries to do "About Ethereal" while there's already an
47 * "About Ethereal" window up, we just pop up the existing one, rather than
50 static GtkWidget *about_ethereal_w;
54 about_ethereal_new(void)
56 GtkWidget *main_vb, *top_hb, *msg_label;
59 /* Container for our rows */
60 main_vb = gtk_vbox_new(FALSE, 5);
61 gtk_container_border_width(GTK_CONTAINER(main_vb), 5);
63 /* Top row: Message text */
64 top_hb = gtk_hbox_new(FALSE, 10);
65 gtk_container_add(GTK_CONTAINER(main_vb), top_hb);
67 /* Construct the message string */
68 message = g_strdup_printf(
69 "Ethereal - Network Protocol Analyzer\n\n"
75 " (C) 1998-2004 Gerald Combs <gerald@ethereal.com>\n\n"
80 "Ethereal is Open Source software released under the GNU General Public License.\n\n"
82 "Check the man page for complete documentation and\n"
83 "for the list of contributors.\n\n"
85 "See http://www.ethereal.com for more information.",
86 comp_info_str->str, runtime_info_str->str);
88 msg_label = gtk_label_new(message);
90 gtk_label_set_justify(GTK_LABEL(msg_label), GTK_JUSTIFY_FILL);
91 gtk_container_add(GTK_CONTAINER(top_hb), msg_label);
98 about_dirs_row(GtkWidget *table, guint row, const char *label, const char *dir, const char *tip)
102 prefs_lb = gtk_label_new(label);
103 gtk_table_attach_defaults(GTK_TABLE(table), prefs_lb, 0, 1, row, row+1);
104 gtk_misc_set_alignment(GTK_MISC(prefs_lb), 1.0, 0.5);
106 prefs_lb = gtk_label_new(dir);
107 gtk_table_attach_defaults(GTK_TABLE(table), prefs_lb, 1, 2, row, row+1);
108 gtk_misc_set_alignment(GTK_MISC(prefs_lb), 0.0, 0.5);
110 prefs_lb = gtk_label_new(tip);
111 gtk_table_attach_defaults(GTK_TABLE(table), prefs_lb, 2, 3, row, row+1);
112 gtk_misc_set_alignment(GTK_MISC(prefs_lb), 0.0, 0.5);
123 /* Container for our rows */
124 table = gtk_table_new(4, 3, FALSE);
125 gtk_table_set_col_spacings(GTK_TABLE(table), 6);
130 about_dirs_row(table, row, "\"File\" dialogs:", last_open_dir,
135 path = get_tempfile_path("");
136 about_dirs_row(table, row, "Temp:", path,
137 "untitled capture files");
138 g_free((void *) path);
142 path = get_persconffile_path("", FALSE);
143 about_dirs_row(table, row, "Personal configuration:", path,
144 "\"dfilters\", \"preferences\", \"ethers\", ...");
145 g_free((void *) path);
149 path = get_datafile_dir();
150 about_dirs_row(table, row, "Global configuration:", path,
151 "\"dfilters\", \"preferences\", \"manuf\", ...");
156 path = get_systemfile_dir();
157 about_dirs_row(table, row, "System:", path,
158 "\"ethers\", \"ipxnets\"");
163 path = strdup(ethereal_path);
164 path = get_dirname((char *) path);
165 about_dirs_row(table, row, "Program:", path,
167 g_free((void *) path);
171 path = get_plugins_pers_dir();
172 about_dirs_row(table, row, "Personal Plugins:", path,
173 "dissector plugins");
174 g_free((void *) path);
178 path = get_plugins_global_dir(PLUGIN_DIR);
179 about_dirs_row(table, row, "Global Plugins:", path,
180 "dissector plugins");
181 g_free((void *) path);
189 about_ethereal_cb( GtkWidget *w _U_, gpointer data _U_ )
191 GtkWidget *main_vb, *main_nb, *bbox, *ok_btn;
193 GtkWidget *about, *about_lb, *dirs, *dirs_lb;
195 if (about_ethereal_w != NULL) {
196 /* There's already an "About Ethereal" dialog box; reactivate it. */
197 reactivate_window(about_ethereal_w);
202 * XXX - use GtkDialog? The GNOME 2.x GnomeAbout widget does.
203 * Should we use GtkDialog for simple_dialog() as well? Or
204 * is the GTK+ 2.x GtkDialog appropriate but the 1.2[.x] one
205 * not? (The GNOME 1.x GnomeAbout widget uses GnomeDialog.)
207 about_ethereal_w = dlg_window_new("About Ethereal");
208 SIGNAL_CONNECT(about_ethereal_w, "destroy", about_ethereal_destroy_cb, NULL);
209 gtk_container_border_width(GTK_CONTAINER(about_ethereal_w), 7);
211 main_vb = gtk_vbox_new(FALSE, 5);
212 gtk_container_border_width(GTK_CONTAINER(main_vb), 5);
213 gtk_container_add(GTK_CONTAINER(about_ethereal_w), main_vb);
215 main_nb = gtk_notebook_new();
216 gtk_container_add(GTK_CONTAINER(main_vb), main_nb);
218 about = about_ethereal_new();
219 about_lb = gtk_label_new("Ethereal");
220 gtk_notebook_append_page(GTK_NOTEBOOK(main_nb), about, about_lb);
222 dirs = about_dirs_new();
223 dirs_lb = gtk_label_new("Directories");
224 gtk_notebook_append_page(GTK_NOTEBOOK(main_nb), dirs, dirs_lb);
227 bbox = dlg_button_row_new(GTK_STOCK_OK, NULL);
228 gtk_container_add(GTK_CONTAINER(main_vb), bbox);
230 ok_btn = OBJECT_GET_DATA(bbox, GTK_STOCK_OK);
231 SIGNAL_CONNECT_OBJECT(ok_btn, "clicked", gtk_widget_destroy,
233 gtk_widget_grab_default(ok_btn);
235 /* Catch the "key_press_event" signal in the window, so that we can catch
236 the ESC key being pressed and act as if the "Cancel" button had
238 dlg_set_cancel(about_ethereal_w, ok_btn);
240 gtk_widget_show_all(about_ethereal_w);
244 about_ethereal_destroy_cb(GtkWidget *win _U_, gpointer user_data _U_)
246 /* Note that we no longer have an "About Ethereal" dialog box. */
247 about_ethereal_w = NULL;