aboutsummaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
authorUlf Lamping <ulf.lamping@web.de>2004-05-20 18:23:38 +0000
committerUlf Lamping <ulf.lamping@web.de>2004-05-20 18:23:38 +0000
commit5719e84c96ad460dc0053f1a505d9e047dfe9b3e (patch)
tree1473def0adb48695bd14d94313c903f3eaa6b27b /gtk
parent15ca5af040f192db00ca5682962c522b3b9b5e66 (diff)
beautify the "About Ethereal" page, put plugin list into the dialog
svn path=/trunk/; revision=10930
Diffstat (limited to 'gtk')
-rw-r--r--gtk/about_dlg.c145
-rw-r--r--gtk/menu.c6
-rw-r--r--gtk/plugins_dlg.c136
3 files changed, 127 insertions, 160 deletions
diff --git a/gtk/about_dlg.c b/gtk/about_dlg.c
index a5b4c43b1f..6c72703dbe 100644
--- a/gtk/about_dlg.c
+++ b/gtk/about_dlg.c
@@ -1,6 +1,6 @@
/* about_dlg.c
*
- * $Id: about_dlg.c,v 1.2 2004/05/20 13:48:25 ulfl Exp $
+ * $Id: about_dlg.c,v 1.3 2004/05/20 18:23:38 ulfl Exp $
*
* Ulf Lamping <ulf.lamping@web.de>
*
@@ -36,8 +36,14 @@
#include "compat_macros.h"
#include "globals.h"
+#include "../image/eicon3d64.xpm"
+
extern GString *comp_info_str, *runtime_info_str;
+#ifdef HAVE_PLUGINS
+extern GtkWidget *about_plugins_page_new(void);
+#endif
+
static void about_ethereal_destroy_cb(GtkWidget *, gpointer);
@@ -51,33 +57,40 @@ static GtkWidget *about_ethereal_w;
static GtkWidget *
-about_ethereal_new(void)
+about_ethereal_page_new(void)
{
- GtkWidget *main_vb, *top_hb, *msg_label;
+ GtkWidget *main_vb, *msg_label, *icon;
gchar *message;
+ const char title[] = "Ethereal - Network Protocol Analyzer";
- /* Container for our rows */
- main_vb = gtk_vbox_new(FALSE, 5);
- gtk_container_border_width(GTK_CONTAINER(main_vb), 5);
- /* Top row: Message text */
- top_hb = gtk_hbox_new(FALSE, 10);
- gtk_container_add(GTK_CONTAINER(main_vb), top_hb);
+ main_vb = gtk_vbox_new(FALSE, 6);
+ gtk_container_border_width(GTK_CONTAINER(main_vb), 12);
- /* Construct the message string */
- message = g_strdup_printf(
- "Ethereal - Network Protocol Analyzer\n\n"
-
- "Version " VERSION
+ icon = xpm_to_widget(eicon3d64_xpm);
+ gtk_container_add(GTK_CONTAINER(main_vb), icon);
+
+ msg_label = gtk_label_new(title);
+#if GTK_MAJOR_VERSION >= 2
+ 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);
+#endif
+ gtk_container_add(GTK_CONTAINER(main_vb), msg_label);
+
+ msg_label = gtk_label_new("Version " VERSION
#ifdef CVSVERSION
" (" CVSVERSION ")"
#endif
- " (C) 1998-2004 Gerald Combs <gerald@ethereal.com>\n\n"
-
- "%s\n"
+ " (C) 1998-2004 Gerald Combs <gerald@ethereal.com>\n\n");
+ gtk_container_add(GTK_CONTAINER(main_vb), msg_label);
+
+ /* Construct the message string */
+ message = g_strdup_printf(
+ "%s\n\n"
"%s\n\n"
- "Ethereal is Open Source software released under the GNU General Public License.\n\n"
+ "Ethereal is Open Source Software released under the GNU General Public License.\n\n"
"Check the man page for complete documentation and\n"
"for the list of contributors.\n\n"
@@ -88,100 +101,89 @@ about_ethereal_new(void)
msg_label = gtk_label_new(message);
g_free(message);
gtk_label_set_justify(GTK_LABEL(msg_label), GTK_JUSTIFY_FILL);
- gtk_container_add(GTK_CONTAINER(top_hb), msg_label);
+ gtk_container_add(GTK_CONTAINER(main_vb), msg_label);
return main_vb;
}
static void
-about_dirs_row(GtkWidget *table, guint row, const char *label, const char *dir, const char *tip)
+about_folders_row(GtkWidget *table, const char *label, const char *dir, const char *tip)
{
- GtkWidget *prefs_lb;
-
- prefs_lb = gtk_label_new(label);
- gtk_table_attach_defaults(GTK_TABLE(table), prefs_lb, 0, 1, row, row+1);
- gtk_misc_set_alignment(GTK_MISC(prefs_lb), 1.0, 0.5);
-
- prefs_lb = gtk_label_new(dir);
- gtk_table_attach_defaults(GTK_TABLE(table), prefs_lb, 1, 2, row, row+1);
- gtk_misc_set_alignment(GTK_MISC(prefs_lb), 0.0, 0.5);
-
- prefs_lb = gtk_label_new(tip);
- gtk_table_attach_defaults(GTK_TABLE(table), prefs_lb, 2, 3, row, row+1);
- gtk_misc_set_alignment(GTK_MISC(prefs_lb), 0.0, 0.5);
+ simple_list_append(table, 0, label, 1, dir, 2, tip, -1);
}
static GtkWidget *
-about_dirs_new(void)
+about_folders_page_new(void)
{
GtkWidget *table;
- guint row;
const char *path;
+ gchar *titles[] = { "Name", "Folder", "Typical Files"};
+ GtkWidget *scrolledwindow;
- /* Container for our rows */
- table = gtk_table_new(4, 3, FALSE);
- gtk_table_set_col_spacings(GTK_TABLE(table), 6);
- row = 0;
+ scrolledwindow = scrolled_window_new(NULL, NULL);
+#if GTK_MAJOR_VERSION >= 2
+ gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwindow),
+ GTK_SHADOW_IN);
+#endif
+
+ /* Container for our data */
+ table = simple_list_new(3, titles);
/* "file open" */
- about_dirs_row(table, row, "\"File\" dialogs:", last_open_dir,
+ about_folders_row(table, "\"File\" dialogs", last_open_dir,
"capture files");
- row++;
/* temp */
path = get_tempfile_path("");
- about_dirs_row(table, row, "Temp:", path,
+ about_folders_row(table, "Temp", path,
"untitled capture files");
g_free((void *) path);
- row++;
/* pers conf */
path = get_persconffile_path("", FALSE);
- about_dirs_row(table, row, "Personal configuration:", path,
+ about_folders_row(table, "Personal configuration", path,
"\"dfilters\", \"preferences\", \"ethers\", ...");
g_free((void *) path);
- row++;
/* global conf */
path = get_datafile_dir();
- about_dirs_row(table, row, "Global configuration:", path,
+ about_folders_row(table, "Global configuration", path,
"\"dfilters\", \"preferences\", \"manuf\", ...");
/*g_free(path);*/
- row++;
/* system */
path = get_systemfile_dir();
- about_dirs_row(table, row, "System:", path,
+ about_folders_row(table, "System", path,
"\"ethers\", \"ipxnets\"");
/*g_free(path);*/
- row++;
/* program */
path = strdup(ethereal_path);
path = get_dirname((char *) path);
- about_dirs_row(table, row, "Program:", path,
+ about_folders_row(table, "Program", path,
"program files");
g_free((void *) path);
- row++;
+#ifdef HAVE_PLUGINS
/* pers plugins */
path = get_plugins_pers_dir();
- about_dirs_row(table, row, "Personal Plugins:", path,
+ about_folders_row(table, "Personal Plugins", path,
"dissector plugins");
g_free((void *) path);
- row++;
/* global plugins */
path = get_plugins_global_dir(PLUGIN_DIR);
- about_dirs_row(table, row, "Global Plugins:", path,
+ about_folders_row(table, "Global Plugins", path,
"dissector plugins");
g_free((void *) path);
- row++;
+#endif
+
+ gtk_container_add(GTK_CONTAINER(scrolledwindow), table);
- return table;
+ return scrolledwindow;
}
@@ -190,7 +192,7 @@ about_ethereal_cb( GtkWidget *w _U_, gpointer data _U_ )
{
GtkWidget *main_vb, *main_nb, *bbox, *ok_btn;
- GtkWidget *about, *about_lb, *dirs, *dirs_lb;
+ GtkWidget *page_lb, *about_page, *folders_page, *plugins_page;
if (about_ethereal_w != NULL) {
/* There's already an "About Ethereal" dialog box; reactivate it. */
@@ -206,26 +208,33 @@ about_ethereal_cb( GtkWidget *w _U_, gpointer data _U_ )
*/
about_ethereal_w = dlg_window_new("About Ethereal");
SIGNAL_CONNECT(about_ethereal_w, "destroy", about_ethereal_destroy_cb, NULL);
- gtk_container_border_width(GTK_CONTAINER(about_ethereal_w), 7);
+ gtk_container_border_width(GTK_CONTAINER(about_ethereal_w), 6);
- main_vb = gtk_vbox_new(FALSE, 5);
- gtk_container_border_width(GTK_CONTAINER(main_vb), 5);
+ main_vb = gtk_vbox_new(FALSE, 12);
+ gtk_container_border_width(GTK_CONTAINER(main_vb), 6);
gtk_container_add(GTK_CONTAINER(about_ethereal_w), main_vb);
main_nb = gtk_notebook_new();
- gtk_container_add(GTK_CONTAINER(main_vb), main_nb);
+ gtk_box_pack_start(GTK_BOX(main_vb), main_nb, TRUE, TRUE, 0);
- about = about_ethereal_new();
- about_lb = gtk_label_new("Ethereal");
- gtk_notebook_append_page(GTK_NOTEBOOK(main_nb), about, about_lb);
+ about_page = about_ethereal_page_new();
+ page_lb = gtk_label_new("Ethereal");
+ gtk_notebook_append_page(GTK_NOTEBOOK(main_nb), about_page, page_lb);
- dirs = about_dirs_new();
- dirs_lb = gtk_label_new("Directories");
- gtk_notebook_append_page(GTK_NOTEBOOK(main_nb), dirs, dirs_lb);
+ folders_page = about_folders_page_new();
+ WIDGET_SET_SIZE(folders_page, 500, 200);
+ page_lb = gtk_label_new("Folders");
+ gtk_notebook_append_page(GTK_NOTEBOOK(main_nb), folders_page, page_lb);
+
+#ifdef HAVE_PLUGINS
+ 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
/* Button row */
bbox = dlg_button_row_new(GTK_STOCK_OK, NULL);
- gtk_container_add(GTK_CONTAINER(main_vb), bbox);
+ gtk_box_pack_start(GTK_BOX(main_vb), bbox, FALSE, FALSE, 0);
ok_btn = OBJECT_GET_DATA(bbox, GTK_STOCK_OK);
SIGNAL_CONNECT_OBJECT(ok_btn, "clicked", gtk_widget_destroy,
diff --git a/gtk/menu.c b/gtk/menu.c
index 2638ff7389..1c5f260c1c 100644
--- a/gtk/menu.c
+++ b/gtk/menu.c
@@ -1,7 +1,7 @@
/* menu.c
* Menu routines
*
- * $Id: menu.c,v 1.195 2004/05/20 12:01:13 ulfl Exp $
+ * $Id: menu.c,v 1.196 2004/05/20 18:23:38 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -323,8 +323,8 @@ static GtkItemFactoryEntry menu_items[] =
ITEM_FACTORY_ENTRY("/Help/_Supported Protocols", NULL, supported_cb, 0, NULL, NULL),
ITEM_FACTORY_ENTRY("/Help/<separator>", NULL, NULL, 0, "<Separator>", NULL),
#ifdef HAVE_PLUGINS
- ITEM_FACTORY_ENTRY("/Help/About _Plugins", NULL, tools_plugins_cmd_cb,
- 0, NULL, NULL),
+/* ITEM_FACTORY_ENTRY("/Help/About _Plugins", NULL, tools_plugins_cmd_cb,
+ 0, NULL, NULL),*/
#endif /* HAVE_PLUGINS */
ITEM_FACTORY_ENTRY("/Help/_About Ethereal", NULL, about_ethereal_cb,
0, NULL, NULL)
diff --git a/gtk/plugins_dlg.c b/gtk/plugins_dlg.c
index f89e6ba984..42431bdf66 100644
--- a/gtk/plugins_dlg.c
+++ b/gtk/plugins_dlg.c
@@ -1,7 +1,7 @@
/* plugins_dlg.c
* Dialog boxes for plugins
*
- * $Id: plugins_dlg.c,v 1.35 2004/02/13 00:00:56 guy Exp $
+ * $Id: plugins_dlg.c,v 1.36 2004/05/20 18:23:38 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -38,11 +38,6 @@
static void plugins_close_cb(GtkWidget *, gpointer);
static void plugins_destroy_cb(GtkWidget *, gpointer);
-#if GTK_MAJOR_VERSION < 2
-static void plugins_scan(GtkWidget *);
-#else
-static void plugins_scan(GtkListStore *);
-#endif
/*
* Keep a static pointer to the current "Plugins" window, if any, so that
@@ -52,22 +47,56 @@ static void plugins_scan(GtkListStore *);
*/
static GtkWidget *plugins_window = NULL;
+
+
+/*
+ * Fill the list widget with a list of the plugin modules.
+ */
+static void
+plugins_scan(GtkWidget *list)
+{
+ plugin *pt_plug;
+
+ pt_plug = plugin_list;
+ while (pt_plug)
+ {
+ simple_list_append(list, 0, pt_plug->name, 1, pt_plug->version, -1);
+ pt_plug = pt_plug->next;
+ }
+}
+
+
+GtkWidget *
+about_plugins_page_new(void)
+{
+ GtkWidget *scrolledwindow;
+ GtkWidget *plugins_list;
+ gchar *titles[] = {"Name", "Version"};
+
+
+ scrolledwindow = scrolled_window_new(NULL, NULL);
+#if GTK_MAJOR_VERSION >= 2
+ gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwindow),
+ GTK_SHADOW_IN);
+#endif
+
+ plugins_list = simple_list_new(2, titles);
+ plugins_scan(plugins_list);
+
+ gtk_container_add(GTK_CONTAINER(scrolledwindow), plugins_list);
+
+ return scrolledwindow;
+}
+
void
tools_plugins_cmd_cb(GtkWidget *widget _U_, gpointer data _U_)
{
GtkWidget *main_vbox;
GtkWidget *main_frame;
GtkWidget *frame_hbox;
- GtkWidget *scrolledwindow;
- GtkWidget *plugins_list;
+ GtkWidget *page;
GtkWidget *bbox;
GtkWidget *ok_bt;
- gchar *titles[] = {"Name", "Version"};
-#if GTK_MAJOR_VERSION >= 2
- GtkListStore *store;
- GtkCellRenderer *renderer;
- GtkTreeViewColumn *column;
-#endif
if (plugins_window != NULL) {
/* There's already a "Plugins" dialog box; reactivate it. */
@@ -80,58 +109,21 @@ tools_plugins_cmd_cb(GtkWidget *widget _U_, gpointer data _U_)
main_vbox = gtk_vbox_new(FALSE, 0);
gtk_container_add(GTK_CONTAINER(plugins_window), main_vbox);
- gtk_widget_show(main_vbox);
main_frame = gtk_frame_new("Plugins List");
gtk_box_pack_start(GTK_BOX(main_vbox), main_frame, TRUE, TRUE, 0);
gtk_container_set_border_width(GTK_CONTAINER(main_frame), 5);
- gtk_widget_show(main_frame);
frame_hbox = gtk_hbox_new(FALSE,0);
gtk_container_add(GTK_CONTAINER(main_frame), frame_hbox);
gtk_container_set_border_width(GTK_CONTAINER(frame_hbox), 5);
- gtk_widget_show(frame_hbox);
-
- scrolledwindow = scrolled_window_new(NULL, NULL);
-#if GTK_MAJOR_VERSION >= 2
- gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwindow),
- GTK_SHADOW_IN);
-#endif
- gtk_box_pack_start(GTK_BOX(frame_hbox), scrolledwindow, TRUE, TRUE, 0);
- WIDGET_SET_SIZE(scrolledwindow, 250, 200);
- gtk_widget_show(scrolledwindow);
-#if GTK_MAJOR_VERSION < 2
- plugins_list = gtk_clist_new_with_titles(2, titles);
- gtk_container_add(GTK_CONTAINER(scrolledwindow), plugins_list);
- gtk_clist_set_selection_mode(GTK_CLIST(plugins_list), GTK_SELECTION_SINGLE);
- gtk_clist_column_titles_passive(GTK_CLIST(plugins_list));
- gtk_clist_column_titles_show(GTK_CLIST(plugins_list));
- gtk_clist_set_column_auto_resize(GTK_CLIST(plugins_list), 0, TRUE);
- gtk_clist_set_column_auto_resize(GTK_CLIST(plugins_list), 1, TRUE);
- plugins_scan(plugins_list);
-#else
- store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING);
- plugins_scan(store);
- plugins_list = tree_view_new(GTK_TREE_MODEL(store));
- g_object_unref(G_OBJECT(store));
- gtk_container_add(GTK_CONTAINER(scrolledwindow), plugins_list);
- renderer = gtk_cell_renderer_text_new();
- column = gtk_tree_view_column_new_with_attributes(titles[0], renderer,
- "text", 0, NULL);
- gtk_tree_view_column_set_sort_column_id(column, 0);
- gtk_tree_view_append_column(GTK_TREE_VIEW(plugins_list), column);
- renderer = gtk_cell_renderer_text_new();
- column = gtk_tree_view_column_new_with_attributes(titles[1], renderer,
- "text", 1, NULL);
- gtk_tree_view_column_set_sort_column_id(column, 1);
- gtk_tree_view_append_column(GTK_TREE_VIEW(plugins_list), column);
-#endif
- gtk_widget_show(plugins_list);
+ page = about_plugins_page_new();
+ WIDGET_SET_SIZE(page, 250, 200);
+ gtk_box_pack_start(GTK_BOX(frame_hbox), page, TRUE, TRUE, 0);
bbox = dlg_button_row_new(GTK_STOCK_OK, NULL);
gtk_box_pack_end(GTK_BOX(main_vbox), bbox, FALSE, FALSE, 3);
- gtk_widget_show(bbox);
ok_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_OK);
SIGNAL_CONNECT(ok_bt, "clicked", plugins_close_cb, plugins_window);
@@ -142,42 +134,8 @@ tools_plugins_cmd_cb(GtkWidget *widget _U_, gpointer data _U_)
been selected. */
dlg_set_cancel(plugins_window, ok_bt);
- gtk_widget_show(plugins_window);
-
-}
+ gtk_widget_show_all(plugins_window);
-/*
- * Fill the list widget with a list of the plugin modules.
- */
-#if GTK_MAJOR_VERSION < 2
-static void
-plugins_scan(GtkWidget *list)
-#else
-static void
-plugins_scan(GtkListStore *store)
-#endif
-{
- plugin *pt_plug;
-#if GTK_MAJOR_VERSION < 2
- gchar *plugent[2]; /* new entry added in clist */
-#else
- GtkTreeIter iter;
-#endif
-
- pt_plug = plugin_list;
- while (pt_plug)
- {
-#if GTK_MAJOR_VERSION < 2
- plugent[0] = pt_plug->name;
- plugent[1] = pt_plug->version;
- gtk_clist_append(GTK_CLIST(list), plugent);
-#else
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter, 0, pt_plug->name, 1, pt_plug->version,
- -1);
-#endif
- pt_plug = pt_plug->next;
- }
}
static void