#define TOTEM_TYPE_FOOBAR_PLUGIN (totem_foobar_plugin_get_type ())
#define TOTEM_FOOBAR_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TOTEM_TYPE_FOOBAR_PLUGIN, TotemFoobarPlugin))
#define TOTEM_FOOBAR_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), TOTEM_TYPE_FOOBAR_PLUGIN, TotemFoobarPluginClass))
#define TOTEM_IS_FOOBAR_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TOTEM_TYPE_FOOBAR_PLUGIN))
#define TOTEM_IS_FOOBAR_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TOTEM_TYPE_FOOBAR_PLUGIN))
#define TOTEM_FOOBAR_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TOTEM_TYPE_FOOBAR_PLUGIN, TotemFoobarPluginClass))
typedef struct {
TotemPlugin parent;
/* plugin object members */
} TotemFoobarPlugin;
typedef struct {
TotemPluginClass parent_class;
} TotemFoobarPluginClass;
G_MODULE_EXPORT GType register_totem_plugin (GTypeModule *module);
GType totem_foobar_plugin_get_type (void) G_GNUC_CONST;
static gboolean impl_activate (TotemPlugin *plugin, TotemObject *totem, GError **error);
static void impl_deactivate (TotemPlugin *plugin, TotemObject *totem);
TOTEM_PLUGIN_REGISTER (TotemFoobarPlugin, totem_foobar_plugin)
static void
totem_foobar_plugin_class_init (TotemFoobarPluginClass *klass)
{
TotemPluginClass *plugin_class = TOTEM_PLUGIN_CLASS (klass);
plugin_class->activate = impl_activate;
plugin_class->deactivate = impl_deactivate;
}
static void
totem_foobar_plugin_init (TotemFoobarPlugin *plugin)
{
/* Initialise resources, but only ones which should exist for the entire lifetime of Totem;
* those which should only exist for the lifetime of the plugin (which may be short, and may
* occur several times during one Totem session) should be created in impl_activate, and destroyed
* in impl_deactivate. */
}
static gboolean
impl_activate (TotemPlugin *plugin, TotemObject *totem, GError **error)
{
TotemFoobarPlugin *self = TOTEM_FOOBAR_PLUGIN (plugin);
/* Initialise resources, connect to events, create menu items and UI, etc., here.
* Note that impl_activate and impl_deactivate can be called multiple times in one
* Totem instance, though impl_activate will always be followed by impl_deactivate before
* it is called again. Similarly, impl_deactivate cannot be called twice in succession. */
return TRUE;
}
static void
impl_deactivate (TotemPlugin *plugin, TotemObject *totem)
{
TotemFoobarPlugin *self = TOTEM_FOOBAR_PLUGIN (plugin);
/* Destroy resources created in impl_activate here. e.g. Disconnect from signals
* and remove menu entries and UI. */
}