Handle -I in the options processing.
[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 1998 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 "epan/plugins.h"
32 #ifdef HAVE_LUA_5_1
33 #include "epan/wslua/init_wslua.h"
34 #endif
35
36 #include "../globals.h"
37
38 #include "gtk/dlg_utils.h"
39 #include "gtk/gui_utils.h"
40 #include "gtk/plugins_dlg.h"
41
42
43 #if defined(HAVE_PLUGINS) || defined(HAVE_LUA_5_1)
44
45 /*
46  * Fill the list widget with a list of the plugin modules.
47  */
48 static void
49 plugins_scan(GtkWidget *list)
50 {
51 #ifdef HAVE_PLUGINS
52     plugin     *pt_plug;
53     const char *sep;
54 #endif
55 #ifdef HAVE_LUA_5_1
56     wslua_plugin  *lua_plug;
57 #endif
58     GString    *type;
59
60 #ifdef HAVE_PLUGINS
61     for (pt_plug = plugin_list; pt_plug != NULL; pt_plug = pt_plug->next)
62     {
63         type = g_string_new("");
64         sep = "";
65         if (pt_plug->register_protoinfo)
66         {
67             type = g_string_append(type, "dissector");
68             sep = ", ";
69         }
70         if (pt_plug->register_tap_listener)
71         {
72             type = g_string_append(type, sep);
73             type = g_string_append(type, "tap");
74             sep = ", ";
75         }
76         if (pt_plug->register_wtap_module)
77         {
78             type = g_string_append(type, sep);
79             type = g_string_append(type, "file format");
80             sep = ", ";
81         }
82         if (pt_plug->register_codec_module)
83         {
84             type = g_string_append(type, sep);
85             type = g_string_append(type, "codec");
86         }
87         simple_list_append(list, 0, pt_plug->name, 1, pt_plug->version,
88                            2, type->str, -1);
89         g_string_free(type, TRUE);
90     }
91 #endif
92
93 #ifdef HAVE_LUA_5_1
94     for (lua_plug = wslua_plugin_list; lua_plug != NULL; lua_plug = lua_plug->next)
95     {
96         type = g_string_new("");
97         type = g_string_append(type, "lua script");
98
99         simple_list_append(list, 0, lua_plug->name, 1, lua_plug->version, 2, type->str, -1);
100         g_string_free(type, TRUE);
101     }
102 #endif
103 }
104
105
106 GtkWidget *
107 about_plugins_page_new(void)
108 {
109     GtkWidget *scrolledwindow;
110     GtkWidget *plugins_list;
111     const gchar     *titles[] = {"Name", "Version", "Type"};
112
113     
114     scrolledwindow = scrolled_window_new(NULL, NULL);
115     gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwindow), 
116                                    GTK_SHADOW_IN);
117
118     plugins_list = simple_list_new(3 , titles);
119     plugins_scan(plugins_list);
120
121     gtk_container_add(GTK_CONTAINER(scrolledwindow), plugins_list);
122
123     return scrolledwindow;
124 }
125
126 #endif /* HAVE_PLUGINS || HAVE_LUA_5_1 */