Commit 1caf572b authored by Jonh Wendell's avatar Jonh Wendell
Browse files

Removed vinagre-plugin-loader.[ch]

parent 05297a86
......@@ -21,7 +21,6 @@ NOINST_H_FILES = \
vinagre-object-module.h \
vinagre-plugin-info.h \
vinagre-plugin-info-priv.h \
vinagre-plugin-loader.h \
vinagre-plugin-manager.h \
vinagre-plugin-dialog.h \
vinagre-plugins-engine.h \
......@@ -43,7 +42,6 @@ INST_H_FILES = \
vinagre-fav.h \
vinagre-notebook.h \
vinagre-plugin.h \
vinagre-plugin-loader.h \
vinagre-prefs.h \
vinagre-tab.h \
vinagre-ui.h \
......@@ -80,7 +78,6 @@ handwritten_sources = \
vinagre-plugin.c \
vinagre-plugin-info.c \
vinagre-plugin-dialog.c \
vinagre-plugin-loader.c \
vinagre-plugin-manager.c \
vinagre-plugins-engine.c \
vinagre-prefs.c \
......@@ -171,7 +168,6 @@ vinagre_applet_SOURCES = \
vinagre-bookmarks-migration.h vinagre-bookmarks-migration.c \
vinagre-plugins-engine.h vinagre-plugins-engine.c \
vinagre-plugin.h vinagre-plugin.c \
vinagre-plugin-loader.h vinagre-plugin-loader.c \
vinagre-plugin-manager.h vinagre-plugin-manager.c \
vinagre-plugin-dialog.h vinagre-plugin-dialog.c \
vinagre-debug.h vinagre-debug.c \
......
/*
* vinagre-plugin-loader.c
* This file is part of vinagre
*
* Based on gedit plugin system
* Copyright (C) 2008 - Jesse van den Kieboom
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "vinagre-plugin-loader.h"
static void
vinagre_plugin_loader_base_init (gpointer g_class)
{
static gboolean initialized = FALSE;
if (G_UNLIKELY (!initialized))
{
/* create interface signals here. */
initialized = TRUE;
}
}
GType
vinagre_plugin_loader_get_type (void)
{
static GType type = 0;
if (G_UNLIKELY (type == 0))
{
static const GTypeInfo info =
{
sizeof (VinagrePluginLoaderInterface),
vinagre_plugin_loader_base_init, /* base_init */
NULL, /* base_finalize */
NULL, /* class_init */
NULL, /* class_finalize */
NULL, /* class_data */
0,
0, /* n_preallocs */
NULL /* instance_init */
};
type = g_type_register_static (G_TYPE_INTERFACE, "VinagrePluginLoader", &info, 0);
}
return type;
}
const gchar *
vinagre_plugin_loader_type_get_id (GType type)
{
GTypeClass *klass;
VinagrePluginLoaderInterface *iface;
klass = g_type_class_ref (type);
if (klass == NULL)
{
g_warning ("Could not get class info for plugin loader");
return NULL;
}
iface = g_type_interface_peek (klass, VINAGRE_TYPE_PLUGIN_LOADER);
if (iface == NULL)
{
g_warning ("Could not get plugin loader interface");
g_type_class_unref (klass);
return NULL;
}
g_return_val_if_fail (iface->get_id != NULL, NULL);
return iface->get_id ();
}
VinagrePlugin *
vinagre_plugin_loader_load (VinagrePluginLoader *loader,
VinagrePluginInfo *info,
const gchar *path)
{
VinagrePluginLoaderInterface *iface;
g_return_val_if_fail (VINAGRE_IS_PLUGIN_LOADER (loader), NULL);
iface = VINAGRE_PLUGIN_LOADER_GET_INTERFACE (loader);
g_return_val_if_fail (iface->load != NULL, NULL);
return iface->load (loader, info, path);
}
void
vinagre_plugin_loader_unload (VinagrePluginLoader *loader,
VinagrePluginInfo *info)
{
VinagrePluginLoaderInterface *iface;
g_return_if_fail (VINAGRE_IS_PLUGIN_LOADER (loader));
iface = VINAGRE_PLUGIN_LOADER_GET_INTERFACE (loader);
g_return_if_fail (iface->unload != NULL);
iface->unload (loader, info);
}
void
vinagre_plugin_loader_garbage_collect (VinagrePluginLoader *loader)
{
VinagrePluginLoaderInterface *iface;
g_return_if_fail (VINAGRE_IS_PLUGIN_LOADER (loader));
iface = VINAGRE_PLUGIN_LOADER_GET_INTERFACE (loader);
if (iface->garbage_collect != NULL)
iface->garbage_collect (loader);
}
/*
* vinagre-plugin-loader.h
* This file is part of vinagre
*
* Based on gedit plugin system
* Copyright (C) 2008 - Jesse van den Kieboom
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __VINAGRE_PLUGIN_LOADER_H__
#define __VINAGRE_PLUGIN_LOADER_H__
#include <glib-object.h>
#include "vinagre-plugin.h"
#include "vinagre-plugin-info.h"
G_BEGIN_DECLS
#define VINAGRE_TYPE_PLUGIN_LOADER (vinagre_plugin_loader_get_type ())
#define VINAGRE_PLUGIN_LOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VINAGRE_TYPE_PLUGIN_LOADER, VinagrePluginLoader))
#define VINAGRE_IS_PLUGIN_LOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VINAGRE_TYPE_PLUGIN_LOADER))
#define VINAGRE_PLUGIN_LOADER_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), VINAGRE_TYPE_PLUGIN_LOADER, VinagrePluginLoaderInterface))
typedef struct _VinagrePluginLoader VinagrePluginLoader; /* dummy object */
typedef struct _VinagrePluginLoaderInterface VinagrePluginLoaderInterface;
struct _VinagrePluginLoaderInterface {
GTypeInterface parent;
const gchar *(*get_id) (void);
VinagrePlugin *(*load) (VinagrePluginLoader *loader,
VinagrePluginInfo *info,
const gchar *path);
void (*unload) (VinagrePluginLoader *loader,
VinagrePluginInfo *info);
void (*garbage_collect) (VinagrePluginLoader *loader);
};
GType vinagre_plugin_loader_get_type (void);
const gchar *vinagre_plugin_loader_type_get_id (GType type);
VinagrePlugin *vinagre_plugin_loader_load (VinagrePluginLoader *loader,
VinagrePluginInfo *info,
const gchar *path);
void vinagre_plugin_loader_unload (VinagrePluginLoader *loader,
VinagrePluginInfo *info);
void vinagre_plugin_loader_garbage_collect (VinagrePluginLoader *loader);
/**
* VINAGRE_PLUGIN_LOADER_IMPLEMENT_INTERFACE(TYPE_IFACE, iface_init):
*
* Utility macro used to register interfaces for gobject types in plugin loaders.
*/
#define VINAGRE_PLUGIN_LOADER_IMPLEMENT_INTERFACE(TYPE_IFACE, iface_init) \
const GInterfaceInfo g_implement_interface_info = \
{ \
(GInterfaceInitFunc) iface_init, \
NULL, \
NULL \
}; \
\
g_type_module_add_interface (type_module, \
g_define_type_id, \
TYPE_IFACE, \
&g_implement_interface_info);
/**
* VINAGRE_PLUGIN_LOADER_REGISTER_TYPE(PluginLoaderName, plugin_loader_name, PARENT_TYPE, loader_interface_init):
*
* Utility macro used to register plugin loaders.
*/
#define VINAGRE_PLUGIN_LOADER_REGISTER_TYPE(PluginLoaderName, plugin_loader_name, PARENT_TYPE, loader_iface_init) \
G_DEFINE_DYNAMIC_TYPE_EXTENDED (PluginLoaderName, \
plugin_loader_name, \
PARENT_TYPE, \
0, \
VINAGRE_PLUGIN_LOADER_IMPLEMENT_INTERFACE(VINAGRE_TYPE_PLUGIN_LOADER, loader_iface_init)); \
\
\
G_MODULE_EXPORT GType \
register_vinagre_plugin_loader (GTypeModule *type_module) \
{ \
plugin_loader_name##_register_type (type_module); \
\
return plugin_loader_name##_get_type(); \
}
G_END_DECLS
#endif /* __VINAGRE_PLUGIN_LOADER_H__ */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment