grim/guifications3

moved guifications-gtk to cmake
cmake
2010-12-13, Gary Kramlich
36e02fafe588
moved guifications-gtk to cmake
/*
* Guifications - The end-all, be-all notification framework
* Copyright (C) 2003-2009 Gary Kramlich <grim@reaperworld.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#if HAVE_CONFIG_H
# include <config.h>
#endif /* HAVE_CONFIG_H */
#include <gflib/gf_plugin_loader.h>
#include <gflib/gf_core.h>
/******************************************************************************
* Interface Stuff
*****************************************************************************/
GType
gf_plugin_loader_get_type(void) {
static GType type = 0;
if(type == 0) {
static const GTypeInfo info = {
sizeof(GfPluginLoaderIface),
NULL,
NULL,
NULL,
NULL,
NULL,
0,
0,
NULL,
};
type = g_type_register_static(G_TYPE_INTERFACE,
"GfPluginLoader",
&info, 0);
}
return type;
}
/******************************************************************************
* API
*****************************************************************************/
/**
* gf_plugin_loader_get_supported_extensions:
* @loader : The instance of #GfPluginLoader.
*
* Gets a list of all extensions that @loader supports.
*
* Return Value: A list of all extensions that @loader supports.
*/
GList *
gf_plugin_loader_get_supported_extensions(GfPluginLoader *loader) {
GfPluginLoaderIface *iface = NULL;
g_return_val_if_fail(GF_IS_PLUGIN_LOADER(loader), NULL);
iface = GF_PLUGIN_LOADER_GET_IFACE(loader);
g_return_val_if_fail(iface, NULL);
g_return_val_if_fail(iface->supported_extensions, NULL);
return iface->supported_extensions(loader);
}
/**
* gf_plugin_loader_query_plugin:
* @loader : The instance of the #GfPluginLoader.
* @filename : The filename of the plugin to query.
* @error : Return address or @NULL for any error messages.
*
* Queries the #GfPluginInfo from @filename with @loader.
*
* Return Value: A new copy of the #GfPluginInfo on sucess or @NULL on failure.
*/
GfPluginInfo *
gf_plugin_loader_query_plugin(GfPluginLoader *loader, const gchar *filename,
GError **error)
{
GfPluginLoaderIface *iface = NULL;
g_return_val_if_fail(GF_IS_PLUGIN_LOADER(loader), NULL);
g_return_val_if_fail(filename, NULL);
g_return_val_if_fail(error != NULL, NULL);
iface = GF_PLUGIN_LOADER_GET_IFACE(loader);
g_return_val_if_fail(iface, NULL);
g_return_val_if_fail(iface->query, NULL);
return iface->query(loader, filename, error);
}
/**
* gf_plugin_loader_load_plugin:
* @loader : The instance of #GfPluginLoader.
* @filename : The filename of the plugin to load.
* @error : Return address or @NULL for any error messages.
*
* Loads a plugin from @filename.
*
* Return Value: The instance of the plugin on success, @NULL otherwise.
*/
GfPlugin *
gf_plugin_loader_load_plugin(GfPluginLoader *loader, const gchar *filename,
GError **error)
{
GfPluginLoaderIface *iface = NULL;
g_return_val_if_fail(GF_IS_PLUGIN_LOADER(loader), NULL);
g_return_val_if_fail(filename, NULL);
g_return_val_if_fail(error != NULL, NULL);
iface = GF_PLUGIN_LOADER_GET_IFACE(loader);
g_return_val_if_fail(iface, NULL);
g_return_val_if_fail(iface->load, NULL);
return iface->load(loader, filename, error);
}
/**
* gf_plugin_loader_unload_plugin:
* @loader : The #GfPluginLoader instance.
* @plugin : The #GfPlugin to unload.
* @error : Return address or @NULL for any error messages.
*
* Attempts to cleanly unload @plugin.
*
* Return Value: @TRUE on success, @FALSE otherwise.
*/
gboolean
gf_plugin_loader_unload_plugin(GfPluginLoader *loader, GfPlugin *plugin,
GError **error)
{
GfPluginLoaderIface *iface = NULL;
g_return_val_if_fail(GF_IS_PLUGIN_LOADER(loader), FALSE);
g_return_val_if_fail(GF_IS_PLUGIN(plugin), FALSE);
g_return_val_if_fail(error != NULL, FALSE);
iface = GF_PLUGIN_LOADER_GET_IFACE(loader);
g_return_val_if_fail(iface, FALSE);
g_return_val_if_fail(iface->unload, FALSE);
return iface->unload(loader, plugin, error);
}