2 * Dialog boxes for plugins
6 * Ethereal - Network traffic analyzer
7 * By Gerald Combs <gerald@ethereal.com>
8 * Copyright 1999 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
32 #include <epan/plugins.h>
33 #include "dlg_utils.h"
35 #include "compat_macros.h"
39 static void plugins_destroy_cb(GtkWidget *, gpointer);
42 * Keep a static pointer to the current "Plugins" window, if any, so that
43 * if somebody tries to do "Help->About Plugins" while there's already a
44 * "Plugins" window up, we just pop up the existing one, rather than
47 static GtkWidget *plugins_window = NULL;
52 * Fill the list widget with a list of the plugin modules.
55 plugins_scan(GtkWidget *list)
59 pt_plug = plugin_list;
62 simple_list_append(list, 0, pt_plug->name, 1, pt_plug->version, -1);
63 pt_plug = pt_plug->next;
69 about_plugins_page_new(void)
71 GtkWidget *scrolledwindow;
72 GtkWidget *plugins_list;
73 gchar *titles[] = {"Name", "Version"};
76 scrolledwindow = scrolled_window_new(NULL, NULL);
77 #if GTK_MAJOR_VERSION >= 2
78 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwindow),
82 plugins_list = simple_list_new(2, titles);
83 plugins_scan(plugins_list);
85 gtk_container_add(GTK_CONTAINER(scrolledwindow), plugins_list);
87 return scrolledwindow;
91 tools_plugins_cmd_cb(GtkWidget *widget _U_, gpointer data _U_)
94 GtkWidget *main_frame;
95 GtkWidget *frame_hbox;
100 if (plugins_window != NULL) {
101 /* There's already a "Plugins" dialog box; reactivate it. */
102 reactivate_window(plugins_window);
106 plugins_window = dlg_window_new("Ethereal: Plugins");
107 gtk_window_set_default_size(GTK_WINDOW(plugins_window), 250, 200);
109 main_vbox = gtk_vbox_new(FALSE, 0);
110 gtk_container_add(GTK_CONTAINER(plugins_window), main_vbox);
112 main_frame = gtk_frame_new("Plugins List");
113 gtk_box_pack_start(GTK_BOX(main_vbox), main_frame, TRUE, TRUE, 0);
114 gtk_container_set_border_width(GTK_CONTAINER(main_frame), 5);
116 frame_hbox = gtk_hbox_new(FALSE,0);
117 gtk_container_add(GTK_CONTAINER(main_frame), frame_hbox);
118 gtk_container_set_border_width(GTK_CONTAINER(frame_hbox), 5);
120 page = about_plugins_page_new();
121 gtk_box_pack_start(GTK_BOX(frame_hbox), page, TRUE, TRUE, 0);
124 bbox = dlg_button_row_new(GTK_STOCK_OK, NULL);
125 gtk_box_pack_end(GTK_BOX(main_vbox), bbox, FALSE, FALSE, 3);
127 ok_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_OK);
128 window_set_cancel_button(plugins_window, ok_bt, window_cancel_button_cb);
130 SIGNAL_CONNECT(plugins_window, "delete_event", window_delete_event_cb, NULL);
131 SIGNAL_CONNECT(plugins_window, "destroy", plugins_destroy_cb, NULL);
133 gtk_widget_show_all(plugins_window);
134 window_present(plugins_window);
138 plugins_destroy_cb(GtkWidget *w _U_, gpointer data _U_)
140 /* Note that we no longer have a Plugins window. */
141 plugins_window = NULL;
145 #endif /* HAVE_PLUGINS */