2 * Copyright (C) 2009-2010 Andy Spencer <andy753421@gmail.com>
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #ifndef __GIS_PLUGIN_H__
19 #define __GIS_PLUGIN_H__
21 #include <glib-object.h>
27 #define GIS_TYPE_PLUGIN (gis_plugin_get_type())
28 #define GIS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIS_TYPE_PLUGIN, GisPlugin))
29 #define GIS_IS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIS_TYPE_PLUGIN))
30 #define GIS_PLUGIN_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), GIS_TYPE_PLUGIN, GisPluginInterface))
32 typedef struct _GisPlugin GisPlugin;
33 typedef struct _GisPluginInterface GisPluginInterface;
35 struct _GisPluginInterface
37 GTypeInterface parent_iface;
41 const gchar *description;
43 /* Virtual functions */
44 GtkWidget *(*get_config)(GisPlugin *plugin);
47 GType gis_plugin_get_type();
50 const gchar *gis_plugin_get_name(GisPlugin *plugin);
52 const gchar *gis_plugin_get_description(GisPlugin *plugin);
54 GtkWidget *gis_plugin_get_config(GisPlugin *plugin);
59 typedef struct _GisPlugins GisPlugins;
61 #include "gis-viewer.h"
62 #include "gis-prefs.h"
65 * GisPluginConstructor:
66 * @viewer: the viewer the plugin is associated with
67 * @prefs: preferences the plugin can use for storing informtion
69 * Create a new instance of a plugin. Each plugin should supply a constructor named
70 * gis_plugin_NAME_new in it's shared object.
72 * Returns: the new plugin
74 typedef GisPlugin *(*GisPluginConstructor)(GisViewer *viewer, GisPrefs *prefs);
82 GisPlugins *gis_plugins_new(const gchar *dir, GisPrefs *prefs);
84 void gis_plugins_free();
86 GList *gis_plugins_available(GisPlugins *plugins);
88 GisPlugin *gis_plugins_load(GisPlugins *plugins, const char *name,
89 GisViewer *viewer, GisPrefs *prefs);
91 GisPlugin *gis_plugins_enable(GisPlugins *plugins, const char *name,
92 GisViewer *viewer, GisPrefs *prefs);
94 GList *gis_plugins_load_enabled(GisPlugins *plugins,
95 GisViewer *viewer, GisPrefs *prefs);
97 gboolean gis_plugins_disable(GisPlugins *plugins, const char *name);
99 gboolean gis_plugins_unload(GisPlugins *plugins, const char *name);
101 void gis_plugins_foreach(GisPlugins *plugins, GCallback callback, gpointer user_data);