2004-05-20 12:01:13 +00:00
|
|
|
/* about_dlg.c
|
|
|
|
*
|
2004-07-18 00:24:25 +00:00
|
|
|
* $Id$
|
2004-05-20 12:01:13 +00:00
|
|
|
*
|
|
|
|
* Ulf Lamping <ulf.lamping@web.de>
|
|
|
|
*
|
2006-05-21 05:12:17 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2009-10-23 17:52:18 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
2004-05-20 12:01:13 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2006-10-19 06:29:13 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2004-05-20 12:01:13 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
2009-08-26 22:45:07 +00:00
|
|
|
|
2007-05-07 19:02:27 +00:00
|
|
|
#include <string.h>
|
2004-05-20 12:01:13 +00:00
|
|
|
|
|
|
|
#include <epan/filesystem.h>
|
2004-05-20 13:48:25 +00:00
|
|
|
#include <epan/plugins.h>
|
2007-12-04 18:43:40 +00:00
|
|
|
#ifdef HAVE_LIBSMI
|
|
|
|
#include <epan/oids.h>
|
|
|
|
#endif
|
2008-10-27 20:35:52 +00:00
|
|
|
#ifdef HAVE_GEOIP
|
2008-12-19 23:49:03 +00:00
|
|
|
#include <epan/geoip_db.h>
|
2008-10-27 20:35:52 +00:00
|
|
|
#endif
|
2008-04-13 00:55:59 +00:00
|
|
|
|
|
|
|
#include "../globals.h"
|
|
|
|
#include "../log.h"
|
|
|
|
#include "../version_info.h"
|
|
|
|
|
|
|
|
#include "gtk/about_dlg.h"
|
|
|
|
#include "gtk/gui_utils.h"
|
|
|
|
#include "gtk/dlg_utils.h"
|
|
|
|
#include "gtk/file_dlg.h"
|
2008-04-13 12:24:57 +00:00
|
|
|
#include "gtk/text_page_utils.h"
|
2008-04-13 00:55:59 +00:00
|
|
|
#include "gtk/gtkglobals.h"
|
|
|
|
#include "gtk/main.h"
|
|
|
|
#include "gtk/plugins_dlg.h"
|
2004-05-20 12:01:13 +00:00
|
|
|
|
2008-06-24 22:53:52 +00:00
|
|
|
#include "../image/wssplash-dev.xpm"
|
2008-04-13 17:48:47 +00:00
|
|
|
#include "webbrowser.h"
|
2004-05-20 18:23:38 +00:00
|
|
|
|
2009-05-27 14:13:55 +00:00
|
|
|
/*
|
|
|
|
* Update frequence for the splash screen, given in milliseconds.
|
|
|
|
*/
|
2009-12-22 20:29:28 +00:00
|
|
|
int info_update_freq = 100;
|
2009-05-27 14:13:55 +00:00
|
|
|
|
2006-05-22 07:29:40 +00:00
|
|
|
static void about_wireshark_destroy_cb(GtkWidget *, gpointer);
|
2004-05-20 12:01:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
2006-05-22 07:29:40 +00:00
|
|
|
* Keep a static pointer to the current "About Wireshark" window, if any, so
|
|
|
|
* that if somebody tries to do "About Wireshark" while there's already an
|
|
|
|
* "About Wireshark" window up, we just pop up the existing one, rather than
|
2004-05-20 12:01:13 +00:00
|
|
|
* creating a new one.
|
|
|
|
*/
|
2006-05-22 07:29:40 +00:00
|
|
|
static GtkWidget *about_wireshark_w;
|
2004-05-20 12:01:13 +00:00
|
|
|
|
|
|
|
|
2004-07-04 20:49:38 +00:00
|
|
|
static void
|
2007-06-12 18:43:24 +00:00
|
|
|
about_wireshark(GtkWidget *parent, GtkWidget *main_vb)
|
2004-05-20 12:01:13 +00:00
|
|
|
{
|
2004-07-04 12:15:41 +00:00
|
|
|
GtkWidget *msg_label, *icon;
|
2004-05-20 12:01:13 +00:00
|
|
|
gchar *message;
|
2007-06-12 18:43:24 +00:00
|
|
|
const char *title = "Network Protocol Analyzer";
|
2004-05-20 12:01:13 +00:00
|
|
|
|
2006-05-31 22:51:38 +00:00
|
|
|
icon = xpm_to_widget_from_parent(parent, wssplash_xpm);
|
2004-05-20 18:23:38 +00:00
|
|
|
gtk_container_add(GTK_CONTAINER(main_vb), icon);
|
|
|
|
|
|
|
|
msg_label = gtk_label_new(title);
|
|
|
|
message = g_strdup_printf("<span size=\"x-large\" weight=\"bold\">%s</span>", title);
|
|
|
|
gtk_label_set_markup(GTK_LABEL(msg_label), message);
|
|
|
|
g_free(message);
|
|
|
|
gtk_container_add(GTK_CONTAINER(main_vb), msg_label);
|
2004-07-04 12:15:41 +00:00
|
|
|
}
|
|
|
|
|
2007-05-07 17:55:42 +00:00
|
|
|
static void
|
2007-05-25 19:13:49 +00:00
|
|
|
splash_update_label(GtkWidget *win, const char *message)
|
2007-05-07 17:55:42 +00:00
|
|
|
{
|
|
|
|
GtkWidget *main_lb;
|
|
|
|
|
|
|
|
if (win == NULL) return;
|
|
|
|
|
2008-04-09 05:37:53 +00:00
|
|
|
main_lb = g_object_get_data(G_OBJECT(win), "splash_label");
|
2007-05-07 17:55:42 +00:00
|
|
|
gtk_label_set_text(GTK_LABEL(main_lb), message);
|
|
|
|
|
|
|
|
/* Process all pending GUI events before continuing, so that
|
|
|
|
the splash screen window gets updated. */
|
|
|
|
while (gtk_events_pending()) gtk_main_iteration();
|
|
|
|
}
|
2004-07-04 12:15:41 +00:00
|
|
|
|
2006-10-30 06:34:31 +00:00
|
|
|
GtkWidget*
|
2007-05-25 19:13:49 +00:00
|
|
|
splash_new(const char *message)
|
2004-07-04 12:15:41 +00:00
|
|
|
{
|
|
|
|
GtkWidget *win;
|
|
|
|
GtkWidget *main_lb;
|
|
|
|
|
|
|
|
GtkWidget *main_vb;
|
2007-05-07 17:55:42 +00:00
|
|
|
GtkWidget *percentage_hb;
|
|
|
|
GtkWidget *prog_bar;
|
|
|
|
GtkWidget *percentage_lb;
|
2004-07-04 12:15:41 +00:00
|
|
|
|
2004-07-07 05:36:10 +00:00
|
|
|
win = splash_window_new();
|
2004-07-04 12:15:41 +00:00
|
|
|
|
2006-05-22 07:29:40 +00:00
|
|
|
/* When calling about_wireshark(), we must realize the top-level
|
2004-07-07 07:01:37 +00:00
|
|
|
widget for the window, otherwise GTK will throw a warning
|
|
|
|
because we don't have a colormap associated with that window and
|
|
|
|
can't handle the pixmap. */
|
|
|
|
gtk_widget_realize(win);
|
|
|
|
|
2004-07-04 12:15:41 +00:00
|
|
|
main_vb = gtk_vbox_new(FALSE, 6);
|
2008-06-29 15:51:43 +00:00
|
|
|
gtk_container_set_border_width(GTK_CONTAINER(main_vb), 24);
|
2004-07-04 12:15:41 +00:00
|
|
|
gtk_container_add(GTK_CONTAINER(win), main_vb);
|
|
|
|
|
2007-06-12 18:43:24 +00:00
|
|
|
about_wireshark(win, main_vb);
|
2004-07-04 12:15:41 +00:00
|
|
|
|
|
|
|
main_lb = gtk_label_new(message);
|
|
|
|
gtk_container_add(GTK_CONTAINER(main_vb), main_lb);
|
2008-04-09 05:37:53 +00:00
|
|
|
g_object_set_data(G_OBJECT(win), "splash_label", main_lb);
|
2007-01-20 02:05:49 +00:00
|
|
|
|
2007-05-07 17:55:42 +00:00
|
|
|
main_lb = gtk_label_new("");
|
|
|
|
gtk_container_add(GTK_CONTAINER(main_vb), main_lb);
|
2008-04-09 05:37:53 +00:00
|
|
|
g_object_set_data(G_OBJECT(win), "protocol_label", main_lb);
|
2007-05-07 17:55:42 +00:00
|
|
|
|
|
|
|
percentage_hb = gtk_hbox_new(FALSE, 1);
|
2007-09-11 16:54:27 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(main_vb), percentage_hb, TRUE, TRUE, 3);
|
2007-05-07 17:55:42 +00:00
|
|
|
|
|
|
|
prog_bar = gtk_progress_bar_new();
|
2007-09-11 16:54:27 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(percentage_hb), prog_bar, TRUE, TRUE, 3);
|
2008-04-09 05:37:53 +00:00
|
|
|
g_object_set_data(G_OBJECT(win), "progress_bar", prog_bar);
|
2007-05-07 17:55:42 +00:00
|
|
|
|
|
|
|
percentage_lb = gtk_label_new(" 0%");
|
2009-04-21 16:57:52 +00:00
|
|
|
gtk_misc_set_alignment(GTK_MISC(percentage_lb), 0.0f, 0.0f);
|
2007-05-07 17:55:42 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(percentage_hb), percentage_lb, FALSE, TRUE, 3);
|
2008-04-09 05:37:53 +00:00
|
|
|
g_object_set_data(G_OBJECT(win), "percentage_label", percentage_lb);
|
2007-05-07 17:55:42 +00:00
|
|
|
|
2004-07-04 12:15:41 +00:00
|
|
|
gtk_widget_show_all(win);
|
|
|
|
|
2007-05-07 17:55:42 +00:00
|
|
|
splash_update_label(win, message);
|
2004-07-04 12:15:41 +00:00
|
|
|
|
|
|
|
return win;
|
|
|
|
}
|
|
|
|
|
2004-07-06 19:16:04 +00:00
|
|
|
void
|
2007-05-25 19:13:49 +00:00
|
|
|
splash_update(register_action_e action, const char *message, gpointer client_data)
|
2004-07-04 12:15:41 +00:00
|
|
|
{
|
2007-05-25 19:13:49 +00:00
|
|
|
GtkWidget *win;
|
|
|
|
GtkWidget *main_lb;
|
|
|
|
GtkWidget *prog_bar;
|
|
|
|
GtkWidget *percentage_lb;
|
|
|
|
gfloat percentage;
|
|
|
|
gulong ul_percentage;
|
|
|
|
gchar tmp[100];
|
|
|
|
const char *action_msg;
|
2007-05-07 17:55:42 +00:00
|
|
|
|
|
|
|
static gulong ul_sofar = 0;
|
|
|
|
static gulong ul_count = 0;
|
|
|
|
|
|
|
|
static register_action_e last_action = RA_NONE;
|
|
|
|
|
2007-05-15 23:06:48 +00:00
|
|
|
static GTimeVal cur_tv;
|
|
|
|
static GTimeVal next_tv = {0, 0};
|
|
|
|
|
2007-05-07 17:55:42 +00:00
|
|
|
win = (GtkWidget *)client_data;
|
2004-07-04 12:15:41 +00:00
|
|
|
|
2004-07-06 19:16:04 +00:00
|
|
|
if (win == NULL) return;
|
|
|
|
|
2007-05-15 23:06:48 +00:00
|
|
|
g_get_current_time(&cur_tv);
|
|
|
|
if (cur_tv.tv_sec <= next_tv.tv_sec && cur_tv.tv_usec <= next_tv.tv_usec && ul_sofar < ul_count - 1) {
|
2009-05-27 14:13:55 +00:00
|
|
|
/* Only update every splash_register_freq milliseconds */
|
2007-05-15 23:06:48 +00:00
|
|
|
ul_sofar++;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
memcpy(&next_tv, &cur_tv, sizeof(next_tv));
|
2009-12-22 20:29:28 +00:00
|
|
|
next_tv.tv_usec += info_update_freq * 1000;
|
2007-05-16 00:55:47 +00:00
|
|
|
if (next_tv.tv_usec >= 1000000) {
|
|
|
|
next_tv.tv_sec++;
|
|
|
|
next_tv.tv_usec -= 1000000;
|
|
|
|
}
|
2007-05-15 23:06:48 +00:00
|
|
|
|
2007-05-07 17:55:42 +00:00
|
|
|
if(last_action != action) {
|
|
|
|
/* the action has changed */
|
|
|
|
switch(action) {
|
|
|
|
case RA_DISSECTORS:
|
|
|
|
action_msg = "Initializing dissectors ...";
|
|
|
|
break;
|
|
|
|
case RA_LISTENERS:
|
|
|
|
action_msg = "Initializing tap listeners ...";
|
|
|
|
break;
|
|
|
|
case RA_REGISTER:
|
|
|
|
action_msg = "Registering dissector ...";
|
|
|
|
break;
|
|
|
|
case RA_PLUGIN_REGISTER:
|
|
|
|
action_msg = "Registering plugins ...";
|
|
|
|
break;
|
|
|
|
case RA_HANDOFF:
|
|
|
|
action_msg = "Handing off dissector ...";
|
|
|
|
break;
|
|
|
|
case RA_PLUGIN_HANDOFF:
|
|
|
|
action_msg = "Handing off plugins ...";
|
|
|
|
break;
|
|
|
|
case RA_PREFERENCES:
|
|
|
|
action_msg = "Loading module preferences ...";
|
|
|
|
break;
|
|
|
|
case RA_CONFIGURATION:
|
|
|
|
action_msg = "Loading configuration files ...";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
action_msg = "(Unknown action)";;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
splash_update_label(win, action_msg);
|
|
|
|
last_action = action;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(ul_count == 0) /* get the count of dissectors */
|
|
|
|
ul_count = register_count() + 6; /* additional 6 for:
|
2007-05-15 23:06:48 +00:00
|
|
|
dissectors, listeners,
|
2007-05-07 17:55:42 +00:00
|
|
|
registering plugins, handingoff plugins,
|
|
|
|
preferences and configuration */
|
2007-05-15 23:06:48 +00:00
|
|
|
|
2008-04-09 05:37:53 +00:00
|
|
|
main_lb = g_object_get_data(G_OBJECT(win), "protocol_label");
|
2007-05-15 23:06:48 +00:00
|
|
|
/* make_dissector_reg.py changed -
|
2007-05-07 17:55:42 +00:00
|
|
|
so we need to strip off the leading elements to get back to the protocol */
|
|
|
|
if(message) {
|
|
|
|
if(!strncmp(message, "proto_register_", 15))
|
|
|
|
message += 15;
|
|
|
|
else if(!strncmp(message, "proto_reg_handoff_", 18))
|
|
|
|
message += 18;
|
|
|
|
}
|
|
|
|
gtk_label_set_text(GTK_LABEL(main_lb), message ? message : "");
|
|
|
|
|
|
|
|
ul_sofar++;
|
|
|
|
|
|
|
|
g_assert (ul_sofar <= ul_count);
|
|
|
|
|
|
|
|
percentage = (gfloat)ul_sofar/(gfloat)ul_count;
|
|
|
|
ul_percentage = (gulong)(percentage * 100);
|
|
|
|
|
|
|
|
/* update progress bar */
|
2008-04-09 05:37:53 +00:00
|
|
|
prog_bar = g_object_get_data(G_OBJECT(win), "progress_bar");
|
2007-05-07 17:55:42 +00:00
|
|
|
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(prog_bar), percentage);
|
|
|
|
|
2008-04-09 05:37:53 +00:00
|
|
|
percentage_lb = g_object_get_data(G_OBJECT(win), "percentage_label");
|
2007-05-07 17:55:42 +00:00
|
|
|
g_snprintf(tmp, sizeof(tmp), "%lu%%", ul_percentage);
|
|
|
|
gtk_label_set_text((GtkLabel*)percentage_lb, tmp);
|
2004-07-04 12:15:41 +00:00
|
|
|
|
2004-07-07 07:01:37 +00:00
|
|
|
/* Process all pending GUI events before continuing, so that
|
|
|
|
the splash screen window gets updated. */
|
2004-07-04 12:15:41 +00:00
|
|
|
while (gtk_events_pending()) gtk_main_iteration();
|
2007-05-07 17:55:42 +00:00
|
|
|
|
2004-07-04 12:15:41 +00:00
|
|
|
}
|
|
|
|
|
2009-10-06 13:54:32 +00:00
|
|
|
gboolean
|
2004-07-06 19:16:04 +00:00
|
|
|
splash_destroy(GtkWidget *win)
|
2004-07-04 12:15:41 +00:00
|
|
|
{
|
2009-10-06 13:54:32 +00:00
|
|
|
if (win == NULL)
|
|
|
|
return FALSE;
|
2004-07-06 19:16:04 +00:00
|
|
|
|
2004-07-04 12:15:41 +00:00
|
|
|
gtk_widget_destroy(win);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GtkWidget *
|
2006-05-22 07:29:40 +00:00
|
|
|
about_wireshark_page_new(void)
|
2004-07-04 12:15:41 +00:00
|
|
|
{
|
|
|
|
GtkWidget *main_vb, *msg_label /*, *icon*/;
|
|
|
|
gchar *message;
|
|
|
|
|
|
|
|
main_vb = gtk_vbox_new(FALSE, 6);
|
2008-06-29 15:51:43 +00:00
|
|
|
gtk_container_set_border_width(GTK_CONTAINER(main_vb), 12);
|
2004-07-04 12:15:41 +00:00
|
|
|
|
2008-09-22 21:28:55 +00:00
|
|
|
#if GTK_CHECK_VERSION(2,9,0)
|
|
|
|
g_object_set(gtk_widget_get_settings(main_vb),
|
|
|
|
"gtk-label-select-on-focus", FALSE, NULL);
|
|
|
|
#endif
|
|
|
|
|
2007-06-12 18:43:24 +00:00
|
|
|
about_wireshark(top_level, main_vb);
|
2004-05-20 18:23:38 +00:00
|
|
|
|
|
|
|
/* Construct the message string */
|
|
|
|
message = g_strdup_printf(
|
2005-12-21 08:59:52 +00:00
|
|
|
"Version " VERSION "%s\n"
|
|
|
|
"\n"
|
|
|
|
"%s"
|
|
|
|
"\n"
|
|
|
|
"%s"
|
|
|
|
"\n"
|
|
|
|
"%s"
|
|
|
|
"\n"
|
2006-05-22 07:29:40 +00:00
|
|
|
"Wireshark is Open Source Software released under the GNU General Public License.\n"
|
2005-12-21 08:59:52 +00:00
|
|
|
"\n"
|
2006-05-28 17:19:08 +00:00
|
|
|
"Check the man page and http://www.wireshark.org for more information.",
|
2007-02-06 02:27:59 +00:00
|
|
|
wireshark_svnversion, get_copyright_info(), comp_info_str->str,
|
2005-12-21 08:59:52 +00:00
|
|
|
runtime_info_str->str);
|
2004-05-20 12:01:13 +00:00
|
|
|
|
|
|
|
msg_label = gtk_label_new(message);
|
|
|
|
g_free(message);
|
|
|
|
gtk_label_set_justify(GTK_LABEL(msg_label), GTK_JUSTIFY_FILL);
|
2005-01-03 19:58:04 +00:00
|
|
|
gtk_label_set_selectable(GTK_LABEL(msg_label), TRUE);
|
2004-05-20 18:23:38 +00:00
|
|
|
gtk_container_add(GTK_CONTAINER(main_vb), msg_label);
|
2004-05-20 12:01:13 +00:00
|
|
|
|
|
|
|
return main_vb;
|
|
|
|
}
|
|
|
|
|
2004-05-21 08:55:07 +00:00
|
|
|
static GtkWidget *
|
|
|
|
about_authors_page_new(void)
|
|
|
|
{
|
|
|
|
GtkWidget *page;
|
|
|
|
char *absolute_path;
|
|
|
|
|
2004-05-21 17:35:43 +00:00
|
|
|
absolute_path = get_datafile_path("AUTHORS-SHORT");
|
2004-05-21 08:55:07 +00:00
|
|
|
page = text_page_new(absolute_path);
|
|
|
|
|
|
|
|
return page;
|
|
|
|
}
|
2004-05-20 12:01:13 +00:00
|
|
|
|
2008-04-13 20:11:16 +00:00
|
|
|
static gint about_folders_callback(GtkWidget *widget, GdkEventButton *event, gint id _U_)
|
2008-04-13 17:48:47 +00:00
|
|
|
{
|
|
|
|
GtkTreeSelection *tree_selection;
|
|
|
|
GtkTreeModel *model;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
gchar *path;
|
|
|
|
|
|
|
|
tree_selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(widget));
|
|
|
|
|
|
|
|
if(gtk_tree_selection_count_selected_rows(tree_selection) == 0)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if(event->type != GDK_2BUTTON_PRESS)
|
|
|
|
/* not a double click */
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if(gtk_tree_selection_get_selected (tree_selection, &model, &iter)) {
|
|
|
|
gtk_tree_model_get(model, &iter, 1, &path, -1);
|
If we have xdg-open, define HAVE_XDG_OPEN.
Add a routine "filemanager_open_directory()", which takes a pathname
(presumed to be UTF-8 in Windows and Mac OS X; this might need work for
other UN*Xes) and attempts to open a file manager window for it, using
ShellExecute on Windows, Launch Services on OS X, and, for now, running
xdg-open on other OSes if we have it (should we have a preference for
the file manaager, just as we have one for the Web browser?).
(For that matter, if we have xdg-open, do we need a preference for the
Web browser, or should we just have xdg-open open the Web browser?)
svn path=/trunk/; revision=25097
2008-04-17 16:14:22 +00:00
|
|
|
filemanager_open_directory(path);
|
2009-06-01 17:08:46 +00:00
|
|
|
g_free(path);
|
2008-04-13 17:48:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2004-05-20 12:01:13 +00:00
|
|
|
static void
|
2004-05-20 18:23:38 +00:00
|
|
|
about_folders_row(GtkWidget *table, const char *label, const char *dir, const char *tip)
|
2004-05-20 12:01:13 +00:00
|
|
|
{
|
2004-05-20 18:23:38 +00:00
|
|
|
simple_list_append(table, 0, label, 1, dir, 2, tip, -1);
|
2004-05-20 12:01:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static GtkWidget *
|
2004-05-20 18:23:38 +00:00
|
|
|
about_folders_page_new(void)
|
2004-05-20 12:01:13 +00:00
|
|
|
{
|
|
|
|
GtkWidget *table;
|
"gtk_entry_get_text()" returns a "const char *" - assign the result to
one.
"get_basename()" doesn't modify its argument, and its callers don't
modify the substring pointed to by the result, so make it take a "const
char *" as an argument and return a "const char *".
"find_last_pathname_separator()" doesn't modify its argument, so make it
a "const char *" - but some of its callers pass a non-"const" "char *"
and modify the result, so don't make its return value a "const char *".
And, as none of its callers are outside "filesystem.c", make it static.
In "about_folders_page_new()", have separate variables for pathnames
returned as "const char *" (which are cached by the routine that returns
them, so you can't modify them - and can't free them, so get rid of the
commented-out "g_free()" calls for them) and pathnames returned as "char
*" (which are allocated anew for each call, and can be modified, but
have to be freed).
Clean up white space.
svn path=/trunk/; revision=12881
2004-12-31 00:26:36 +00:00
|
|
|
const char *constpath;
|
|
|
|
char *path;
|
2005-08-05 20:59:08 +00:00
|
|
|
const gchar *titles[] = { "Name", "Folder", "Typical Files"};
|
2004-05-20 18:23:38 +00:00
|
|
|
GtkWidget *scrolledwindow;
|
2008-10-27 20:35:52 +00:00
|
|
|
#if defined (HAVE_LIBSMI) || defined (HAVE_GEOIP)
|
2008-06-24 22:53:52 +00:00
|
|
|
gint i;
|
2008-04-13 17:48:47 +00:00
|
|
|
gchar **resultArray;
|
2008-06-24 22:53:52 +00:00
|
|
|
#endif
|
2004-05-20 12:01:13 +00:00
|
|
|
|
2004-05-20 18:23:38 +00:00
|
|
|
scrolledwindow = scrolled_window_new(NULL, NULL);
|
2007-01-20 02:05:49 +00:00
|
|
|
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwindow),
|
2004-05-20 18:23:38 +00:00
|
|
|
GTK_SHADOW_IN);
|
|
|
|
|
|
|
|
/* Container for our data */
|
|
|
|
table = simple_list_new(3, titles);
|
2004-05-20 13:48:25 +00:00
|
|
|
|
2008-04-13 17:48:47 +00:00
|
|
|
/* connect a callback so we can spot a double-click */
|
2008-06-29 15:51:43 +00:00
|
|
|
g_signal_connect(table, "button_press_event",
|
|
|
|
G_CALLBACK(about_folders_callback), NULL);
|
2008-04-13 17:48:47 +00:00
|
|
|
|
|
|
|
simple_list_url_col(table, 1);
|
|
|
|
|
2004-05-20 13:48:25 +00:00
|
|
|
/* "file open" */
|
2004-06-01 17:33:37 +00:00
|
|
|
about_folders_row(table, "\"File\" dialogs", get_last_open_dir(),
|
2004-05-20 13:48:25 +00:00
|
|
|
"capture files");
|
|
|
|
|
|
|
|
/* temp */
|
|
|
|
path = get_tempfile_path("");
|
2004-05-20 18:23:38 +00:00
|
|
|
about_folders_row(table, "Temp", path,
|
2004-05-20 13:48:25 +00:00
|
|
|
"untitled capture files");
|
2009-10-06 14:02:01 +00:00
|
|
|
g_free(path);
|
2004-05-20 13:48:25 +00:00
|
|
|
|
|
|
|
/* pers conf */
|
2008-01-14 16:40:23 +00:00
|
|
|
path = get_persconffile_path("", FALSE, FALSE);
|
2007-01-20 02:05:49 +00:00
|
|
|
about_folders_row(table, "Personal configuration", path,
|
2004-05-20 13:48:25 +00:00
|
|
|
"\"dfilters\", \"preferences\", \"ethers\", ...");
|
2009-10-06 14:02:01 +00:00
|
|
|
g_free(path);
|
2004-05-20 12:01:13 +00:00
|
|
|
|
2004-05-20 13:48:25 +00:00
|
|
|
/* global conf */
|
"gtk_entry_get_text()" returns a "const char *" - assign the result to
one.
"get_basename()" doesn't modify its argument, and its callers don't
modify the substring pointed to by the result, so make it take a "const
char *" as an argument and return a "const char *".
"find_last_pathname_separator()" doesn't modify its argument, so make it
a "const char *" - but some of its callers pass a non-"const" "char *"
and modify the result, so don't make its return value a "const char *".
And, as none of its callers are outside "filesystem.c", make it static.
In "about_folders_page_new()", have separate variables for pathnames
returned as "const char *" (which are cached by the routine that returns
them, so you can't modify them - and can't free them, so get rid of the
commented-out "g_free()" calls for them) and pathnames returned as "char
*" (which are allocated anew for each call, and can be modified, but
have to be freed).
Clean up white space.
svn path=/trunk/; revision=12881
2004-12-31 00:26:36 +00:00
|
|
|
constpath = get_datafile_dir();
|
2006-05-01 06:51:14 +00:00
|
|
|
if (constpath != NULL) {
|
|
|
|
about_folders_row(table, "Global configuration", constpath,
|
|
|
|
"\"dfilters\", \"preferences\", \"manuf\", ...");
|
|
|
|
}
|
2004-05-20 12:01:13 +00:00
|
|
|
|
2004-05-20 13:48:25 +00:00
|
|
|
/* system */
|
"gtk_entry_get_text()" returns a "const char *" - assign the result to
one.
"get_basename()" doesn't modify its argument, and its callers don't
modify the substring pointed to by the result, so make it take a "const
char *" as an argument and return a "const char *".
"find_last_pathname_separator()" doesn't modify its argument, so make it
a "const char *" - but some of its callers pass a non-"const" "char *"
and modify the result, so don't make its return value a "const char *".
And, as none of its callers are outside "filesystem.c", make it static.
In "about_folders_page_new()", have separate variables for pathnames
returned as "const char *" (which are cached by the routine that returns
them, so you can't modify them - and can't free them, so get rid of the
commented-out "g_free()" calls for them) and pathnames returned as "char
*" (which are allocated anew for each call, and can be modified, but
have to be freed).
Clean up white space.
svn path=/trunk/; revision=12881
2004-12-31 00:26:36 +00:00
|
|
|
constpath = get_systemfile_dir();
|
|
|
|
about_folders_row(table, "System", constpath,
|
2004-05-20 13:48:25 +00:00
|
|
|
"\"ethers\", \"ipxnets\"");
|
2004-05-20 12:01:13 +00:00
|
|
|
|
2004-05-20 13:48:25 +00:00
|
|
|
/* program */
|
Add a routine to attempt to get the absolute pathname of the executable
file, strip off the last component to get the pathname of the directory
containing the executable file, and save it for future use. On Windows,
you can get that from the OS, but, on UN*X, you have to look at argv[0]
and derive the absolute path from that (argv[0] is not guaranteed to be
an absolute path, or even a path at all). (In addition, if you're
running from the build directory, you might have to strip off a ".libs/"
added to argv[0] as an artifact of the libtoolizing script.)
Use that in the About dialog, and use it to construct the path of
dumpcap.
Don't put quotes into the path of dumpcap; you don't have to quote
strings with spaces in them when handing them to execvp and, in fact,
you *mustn't* quote them, as the quotes will be treated as part of the
pathname.
svn path=/trunk/; revision=17267
2006-02-12 03:15:29 +00:00
|
|
|
constpath = get_progfile_dir();
|
|
|
|
about_folders_row(table, "Program", constpath,
|
2004-05-20 13:48:25 +00:00
|
|
|
"program files");
|
|
|
|
|
2009-10-23 17:52:18 +00:00
|
|
|
#if defined(HAVE_PLUGINS) || defined(HAVE_LUA_5_1)
|
2004-05-20 13:48:25 +00:00
|
|
|
/* pers plugins */
|
|
|
|
path = get_plugins_pers_dir();
|
2004-05-20 18:23:38 +00:00
|
|
|
about_folders_row(table, "Personal Plugins", path,
|
2004-05-20 13:48:25 +00:00
|
|
|
"dissector plugins");
|
2009-10-06 14:02:01 +00:00
|
|
|
g_free(path);
|
2004-05-20 13:48:25 +00:00
|
|
|
|
|
|
|
/* global plugins */
|
Add a WIRESHARK_RUN_FROM_BUILD_DIRECTORY environment variable on UN*X;
if set, and if the program isn't running with additional privileges,
it'll treat the directory in which the program is found as the data
directory.
If, on Windows, the version-number subdirectory of {data
directory}\plugins doesn't exist (which is assumed to mean that the
program is being run from the build directory), or if, on UN*X,
WIRESHARK_RUN_FROM_BUILD_DIRECTORY is set, the plugin directory is the
"plugins" subdirectory of the data directory, and all subdirectories of
that directory are scanned for plugins, as the "plugins" subdirectory of
the build directory contains subdirectories for the plugins; this means
that if we're running from the build directory, we'll find the plugins
we built in the build tree.
When generating the wireshark-filter man page, run tshark with
WIRESHARK_RUN_FROM_BUILD_DIRECTORY set, so it uses the plugins from the
build to generate the list of filters.
svn path=/trunk/; revision=20261
2007-01-02 06:49:40 +00:00
|
|
|
about_folders_row(table, "Global Plugins", get_plugin_dir(),
|
2004-05-20 13:48:25 +00:00
|
|
|
"dissector plugins");
|
2004-05-20 18:23:38 +00:00
|
|
|
#endif
|
|
|
|
|
2009-05-31 18:30:07 +00:00
|
|
|
#ifdef HAVE_PYTHON
|
|
|
|
/* global python bindings */
|
|
|
|
about_folders_row(table, "Python Bindings", get_wspython_dir(),
|
|
|
|
"python bindings");
|
|
|
|
#endif
|
|
|
|
|
2008-10-27 20:35:52 +00:00
|
|
|
#ifdef HAVE_GEOIP
|
|
|
|
/* GeoIP */
|
2008-12-19 23:49:03 +00:00
|
|
|
path = geoip_db_get_paths();
|
2008-10-27 20:35:52 +00:00
|
|
|
|
2009-10-06 13:58:17 +00:00
|
|
|
resultArray = g_strsplit(path, G_SEARCHPATH_SEPARATOR_S, 10);
|
2008-10-27 20:35:52 +00:00
|
|
|
|
|
|
|
for(i = 0; resultArray[i]; i++)
|
|
|
|
about_folders_row(table, "GeoIP path", g_strstrip(resultArray[i]),
|
|
|
|
"GeoIP database search path");
|
|
|
|
g_strfreev(resultArray);
|
2009-10-06 14:02:01 +00:00
|
|
|
g_free(path);
|
2008-10-27 20:35:52 +00:00
|
|
|
#endif
|
|
|
|
|
2007-12-04 18:43:40 +00:00
|
|
|
#ifdef HAVE_LIBSMI
|
|
|
|
/* SMI MIBs/PIBs */
|
|
|
|
path = oid_get_default_mib_path();
|
2008-04-13 17:48:47 +00:00
|
|
|
|
2009-10-06 13:58:17 +00:00
|
|
|
resultArray = g_strsplit(path, G_SEARCHPATH_SEPARATOR_S, 10);
|
2008-04-13 17:48:47 +00:00
|
|
|
|
2008-06-24 22:53:52 +00:00
|
|
|
for(i = 0; resultArray[i]; i++)
|
2008-04-13 17:48:47 +00:00
|
|
|
about_folders_row(table, "MIB/PIB path", g_strstrip(resultArray[i]),
|
|
|
|
"SMI MIB/PIB search path");
|
|
|
|
g_strfreev(resultArray);
|
2009-10-06 14:02:01 +00:00
|
|
|
g_free(path);
|
2007-12-04 18:43:40 +00:00
|
|
|
#endif
|
|
|
|
|
2004-05-20 18:23:38 +00:00
|
|
|
gtk_container_add(GTK_CONTAINER(scrolledwindow), table);
|
2004-05-20 12:01:13 +00:00
|
|
|
|
2004-05-20 18:23:38 +00:00
|
|
|
return scrolledwindow;
|
2004-05-20 12:01:13 +00:00
|
|
|
}
|
|
|
|
|
2006-10-19 06:29:13 +00:00
|
|
|
static GtkWidget *
|
|
|
|
about_license_page_new(void)
|
|
|
|
{
|
|
|
|
GtkWidget *page;
|
|
|
|
char *absolute_path;
|
|
|
|
|
|
|
|
absolute_path = get_datafile_path("COPYING");
|
|
|
|
page = text_page_new(absolute_path);
|
|
|
|
|
|
|
|
return page;
|
|
|
|
}
|
2004-05-20 12:01:13 +00:00
|
|
|
|
|
|
|
void
|
2006-05-22 07:29:40 +00:00
|
|
|
about_wireshark_cb( GtkWidget *w _U_, gpointer data _U_ )
|
2004-05-20 12:01:13 +00:00
|
|
|
{
|
|
|
|
GtkWidget *main_vb, *main_nb, *bbox, *ok_btn;
|
2007-08-31 14:14:17 +00:00
|
|
|
GtkWidget *page_lb, *about_page, *folders_page;
|
|
|
|
|
2009-10-23 17:52:18 +00:00
|
|
|
#if defined(HAVE_PLUGINS) || defined(HAVE_LUA_5_1)
|
2007-08-31 14:14:17 +00:00
|
|
|
GtkWidget *plugins_page;
|
|
|
|
#endif
|
2004-05-20 12:01:13 +00:00
|
|
|
|
2006-10-19 06:29:13 +00:00
|
|
|
GtkWidget *authors_page, *license_page;
|
2004-05-20 12:01:13 +00:00
|
|
|
|
2006-05-22 07:29:40 +00:00
|
|
|
if (about_wireshark_w != NULL) {
|
|
|
|
/* There's already an "About Wireshark" dialog box; reactivate it. */
|
|
|
|
reactivate_window(about_wireshark_w);
|
2004-05-20 12:01:13 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* XXX - use GtkDialog? The GNOME 2.x GnomeAbout widget does.
|
|
|
|
* Should we use GtkDialog for simple_dialog() as well? Or
|
|
|
|
* is the GTK+ 2.x GtkDialog appropriate but the 1.2[.x] one
|
|
|
|
* not? (The GNOME 1.x GnomeAbout widget uses GnomeDialog.)
|
|
|
|
*/
|
2006-05-22 07:29:40 +00:00
|
|
|
about_wireshark_w = dlg_window_new("About Wireshark");
|
2004-05-23 17:37:36 +00:00
|
|
|
/* set the initial position (must be done, before show is called!) */
|
|
|
|
/* default position is not appropriate for the about dialog */
|
2006-05-22 07:29:40 +00:00
|
|
|
gtk_window_set_position(GTK_WINDOW(about_wireshark_w), GTK_WIN_POS_CENTER_ON_PARENT);
|
2008-04-09 23:06:01 +00:00
|
|
|
gtk_window_set_default_size(GTK_WINDOW(about_wireshark_w), 600, 400);
|
2008-06-29 15:51:43 +00:00
|
|
|
gtk_container_set_border_width(GTK_CONTAINER(about_wireshark_w), 6);
|
2004-05-20 12:01:13 +00:00
|
|
|
|
2004-05-20 18:23:38 +00:00
|
|
|
main_vb = gtk_vbox_new(FALSE, 12);
|
2008-06-29 15:51:43 +00:00
|
|
|
gtk_container_set_border_width(GTK_CONTAINER(main_vb), 6);
|
2006-05-22 07:29:40 +00:00
|
|
|
gtk_container_add(GTK_CONTAINER(about_wireshark_w), main_vb);
|
2004-05-20 12:01:13 +00:00
|
|
|
|
|
|
|
main_nb = gtk_notebook_new();
|
2004-05-20 18:23:38 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(main_vb), main_nb, TRUE, TRUE, 0);
|
2004-05-20 12:01:13 +00:00
|
|
|
|
2006-05-22 07:29:40 +00:00
|
|
|
about_page = about_wireshark_page_new();
|
|
|
|
page_lb = gtk_label_new("Wireshark");
|
2004-05-20 18:23:38 +00:00
|
|
|
gtk_notebook_append_page(GTK_NOTEBOOK(main_nb), about_page, page_lb);
|
2004-05-20 12:01:13 +00:00
|
|
|
|
2004-05-21 08:55:07 +00:00
|
|
|
authors_page = about_authors_page_new();
|
|
|
|
page_lb = gtk_label_new("Authors");
|
|
|
|
gtk_notebook_append_page(GTK_NOTEBOOK(main_nb), authors_page, page_lb);
|
|
|
|
|
2004-05-20 18:23:38 +00:00
|
|
|
folders_page = about_folders_page_new();
|
|
|
|
page_lb = gtk_label_new("Folders");
|
|
|
|
gtk_notebook_append_page(GTK_NOTEBOOK(main_nb), folders_page, page_lb);
|
|
|
|
|
2009-10-23 17:52:18 +00:00
|
|
|
#if defined(HAVE_PLUGINS) || defined(HAVE_LUA_5_1)
|
2004-05-20 18:23:38 +00:00
|
|
|
plugins_page = about_plugins_page_new();
|
|
|
|
page_lb = gtk_label_new("Plugins");
|
|
|
|
gtk_notebook_append_page(GTK_NOTEBOOK(main_nb), plugins_page, page_lb);
|
|
|
|
#endif
|
2004-05-20 12:01:13 +00:00
|
|
|
|
2006-10-19 06:29:13 +00:00
|
|
|
license_page = about_license_page_new();
|
|
|
|
page_lb = gtk_label_new("License");
|
2006-10-21 12:06:26 +00:00
|
|
|
/* set a minmum width to avoid a lot of line breaks at the wrong places */
|
2008-04-09 05:37:53 +00:00
|
|
|
gtk_widget_set_size_request(license_page, 600, -1);
|
2006-10-19 06:29:13 +00:00
|
|
|
gtk_notebook_append_page(GTK_NOTEBOOK(main_nb), license_page, page_lb);
|
|
|
|
|
2004-05-20 12:01:13 +00:00
|
|
|
/* Button row */
|
|
|
|
bbox = dlg_button_row_new(GTK_STOCK_OK, NULL);
|
2004-05-20 18:23:38 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(main_vb), bbox, FALSE, FALSE, 0);
|
2004-05-20 12:01:13 +00:00
|
|
|
|
2008-04-09 05:37:53 +00:00
|
|
|
ok_btn = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_OK);
|
2007-01-20 02:05:49 +00:00
|
|
|
gtk_widget_grab_focus(ok_btn);
|
|
|
|
gtk_widget_grab_default(ok_btn);
|
2006-05-22 07:29:40 +00:00
|
|
|
window_set_cancel_button(about_wireshark_w, ok_btn, window_cancel_button_cb);
|
2004-05-20 12:01:13 +00:00
|
|
|
|
2008-04-09 05:37:53 +00:00
|
|
|
g_signal_connect(about_wireshark_w, "delete_event", G_CALLBACK(window_delete_event_cb), NULL);
|
|
|
|
g_signal_connect(about_wireshark_w, "destroy", G_CALLBACK(about_wireshark_destroy_cb), NULL);
|
2004-05-20 12:01:13 +00:00
|
|
|
|
2006-05-22 07:29:40 +00:00
|
|
|
gtk_widget_show_all(about_wireshark_w);
|
|
|
|
window_present(about_wireshark_w);
|
2004-05-20 12:01:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-05-22 07:29:40 +00:00
|
|
|
about_wireshark_destroy_cb(GtkWidget *win _U_, gpointer user_data _U_)
|
2004-05-20 12:01:13 +00:00
|
|
|
{
|
2006-05-22 07:29:40 +00:00
|
|
|
/* Note that we no longer have an "About Wireshark" dialog box. */
|
|
|
|
about_wireshark_w = NULL;
|
2004-05-20 12:01:13 +00:00
|
|
|
}
|
|
|
|
|