carve out the (currently disabled) welcome page into it's own file to slightly reduce...
[obnox/wireshark/wip.git] / gtk / plugins_dlg.c
1 /* plugins_dlg.c
2  * Dialog boxes for plugins
3  *
4  * $Id$
5  *
6  * Wireshark - Network traffic analyzer
7  * By Gerald Combs <gerald@wireshark.org>
8  * Copyright 1999 Gerald Combs
9  *
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.
14  *
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.
19  *
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.
23  */
24
25 #ifdef HAVE_CONFIG_H
26 #include "config.h"
27 #endif
28
29 #include <gtk/gtk.h>
30
31 #include "globals.h"
32 #include <epan/plugins.h>
33 #include "dlg_utils.h"
34 #include "gui_utils.h"
35 #include "compat_macros.h"
36 #include "plugins_dlg.h"
37
38 #ifdef HAVE_PLUGINS
39
40 /*
41  * Fill the list widget with a list of the plugin modules.
42  */
43 static void
44 plugins_scan(GtkWidget *list)
45 {
46     plugin     *pt_plug;
47     GString    *type;
48     const char       *sep;
49
50     for (pt_plug = plugin_list; pt_plug != NULL; pt_plug = pt_plug->next)
51     {
52         type = g_string_new("");
53         sep = "";
54         if (pt_plug->register_protoinfo)
55         {
56             type = g_string_append(type, "dissector");
57             sep = ", ";
58         }
59         if (pt_plug->register_tap_listener)
60         {
61             type = g_string_append(type, sep);
62             type = g_string_append(type, "tap");
63             sep = ", ";
64         }
65         if (pt_plug->register_wtap_module)
66         {
67             type = g_string_append(type, sep);
68             type = g_string_append(type, "file_format");
69             sep = ", ";
70         }
71         if (pt_plug->register_codec_module)
72         {
73             type = g_string_append(type, sep);
74             type = g_string_append(type, "codec");
75         }
76         simple_list_append(list, 0, pt_plug->name, 1, pt_plug->version,
77                            2, type->str, -1);
78         g_string_free(type, TRUE);
79     }
80 }
81
82
83 GtkWidget *
84 about_plugins_page_new(void)
85 {
86     GtkWidget *scrolledwindow;
87     GtkWidget *plugins_list;
88     const gchar     *titles[] = {"Name", "Version", "Type"};
89
90     
91     scrolledwindow = scrolled_window_new(NULL, NULL);
92 #if GTK_MAJOR_VERSION >= 2
93     gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwindow), 
94                                    GTK_SHADOW_IN);
95 #endif
96
97     plugins_list = simple_list_new(3 , titles);
98     plugins_scan(plugins_list);
99
100     gtk_container_add(GTK_CONTAINER(scrolledwindow), plugins_list);
101
102     return scrolledwindow;
103 }
104
105 #endif /* HAVE_PLUGINS */