X-Git-Url: http://pileus.org/git/?p=grits;a=blobdiff_plain;f=src%2Fgis-plugin.h;h=fc85f444dc481781d955957198be2ad692f1f41b;hp=a667fba8919dcf5ca1dcb0ede0896e6d8513686f;hb=b87064909e6d20e1ee2995adae0c1ce5cb692d7e;hpb=14cdbb4a9c369576a5485315260fad5285935e80 diff --git a/src/gis-plugin.h b/src/gis-plugin.h index a667fba..fc85f44 100644 --- a/src/gis-plugin.h +++ b/src/gis-plugin.h @@ -1,16 +1,16 @@ /* - * Copyright (C) 2009 Andy Spencer - * + * Copyright (C) 2009-2010 Andy Spencer + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ @@ -28,37 +28,61 @@ typedef struct _GisPlugin GisPlugin; typedef struct _GisPluginInterface GisPluginInterface; -typedef GPtrArray GisPlugins; struct _GisPluginInterface { GTypeInterface parent_iface; + /* Virtual data */ + const gchar *name; + const gchar *description; + /* Virtual functions */ - void (*expose )(GisPlugin *self); - GtkWidget *(*get_config)(GisPlugin *self); + GtkWidget *(*get_config)(GisPlugin *plugin); }; GType gis_plugin_get_type(); /* Methods */ -void gis_plugin_expose(GisPlugin *self); -GtkWidget *gis_plugin_get_config(GisPlugin *self); +const gchar *gis_plugin_get_name(GisPlugin *plugin); + +const gchar *gis_plugin_get_description(GisPlugin *plugin); + +GtkWidget *gis_plugin_get_config(GisPlugin *plugin); /* Plugins API */ -#include "gis-world.h" -#include "gis-view.h" -#include "gis-opengl.h" +typedef struct _GisPlugins GisPlugins; + +#include "gis-viewer.h" #include "gis-prefs.h" -typedef GisPlugin *(*GisPluginConstructor)(GisWorld *world, GisView *view, GisOpenGL *opengl, GisPrefs *prefs); +typedef GisPlugin *(*GisPluginConstructor)(GisViewer *viewer, GisPrefs *prefs); + +struct _GisPlugins { + gchar *dir; + GList *plugins; + GisPrefs *prefs; +}; + +GisPlugins *gis_plugins_new(const gchar *dir, GisPrefs *prefs); + +void gis_plugins_free(); + +GList *gis_plugins_available(GisPlugins *plugins); + +GisPlugin *gis_plugins_load(GisPlugins *plugins, const char *name, + GisViewer *viewer, GisPrefs *prefs); + +GisPlugin *gis_plugins_enable(GisPlugins *plugins, const char *name, + GisViewer *viewer, GisPrefs *prefs); + +GList *gis_plugins_load_enabled(GisPlugins *plugins, + GisViewer *viewer, GisPrefs *prefs); + +gboolean gis_plugins_disable(GisPlugins *plugins, const char *name); + +gboolean gis_plugins_unload(GisPlugins *plugins, const char *name); -GisPlugins *gis_plugins_new(); -void gis_plugins_free(); -GList *gis_plugins_available(); -GisPlugin *gis_plugins_load(GisPlugins *self, const char *name, - GisWorld *world, GisView *view, GisOpenGL *opengl, GisPrefs *prefs); -gboolean gis_plugins_unload(GisPlugins *self, const char *name); -void gis_plugins_foreach(GisPlugins *self, GCallback callback, gpointer user_data); +void gis_plugins_foreach(GisPlugins *plugins, GCallback callback, gpointer user_data); #endif