TotemPlugin

TotemPlugin — base plugin class and loading/unloading functions

Stability Level

Unstable, unless otherwise indicated

Synopsis

#include <totem-plugin.h>

#define             TOTEM_PLUGIN_REGISTER               (TYPE_NAME,
                                                         TypeName,
                                                         type_name)
#define             TOTEM_PLUGIN_REGISTER_CONFIGURABLE  (TYPE_NAME,
                                                         TypeName,
                                                         type_name)
char *              totem_plugin_find_file              (const char *plugin_name,
                                                         const char *file);
GtkBuilder *        totem_plugin_load_interface         (const char *plugin_name,
                                                         const char *name,
                                                         gboolean fatal,
                                                         GtkWindow *parent,
                                                         gpointer user_data);
char **             totem_get_plugin_paths              (void);

Description

TotemPlugin is a general-purpose architecture for adding plugins to Totem, with derived support for different programming languages.

Details

TOTEM_PLUGIN_REGISTER()

#define             TOTEM_PLUGIN_REGISTER(TYPE_NAME, TypeName, type_name)

Registers a plugin with the Totem plugin system, including registering the type specified in the parameters and declaring its activate and deactivate functions.

TYPE_NAME :

the name of the plugin type, in UPPER_CASE

TypeName :

the name of the plugin type, in CamelCase

type_name :

the name of the plugin type, in lower_case

TOTEM_PLUGIN_REGISTER_CONFIGURABLE()

#define             TOTEM_PLUGIN_REGISTER_CONFIGURABLE(TYPE_NAME, TypeName, type_name)

Registers a configurable plugin with the Totem plugin system, including registering the type specified in the parameters and declaring its activate and deactivate and widget creation functions.

TYPE_NAME :

the name of the plugin type, in UPPER_CASE

TypeName :

the name of the plugin type, in CamelCase

type_name :

the name of the plugin type, in lower_case

totem_plugin_find_file ()

char *              totem_plugin_find_file              (const char *plugin_name,
                                                         const char *file);

Finds the specified file by looking in the plugin paths listed by totem_get_plugin_paths() and then in the system Totem data directory.

This should be used by plugins to find plugin-specific resource files.

plugin_name :

the plugin name

file :

the file to find

Returns :

a newly-allocated absolute path for the file, or NULL

totem_plugin_load_interface ()

GtkBuilder *        totem_plugin_load_interface         (const char *plugin_name,
                                                         const char *name,
                                                         gboolean fatal,
                                                         GtkWindow *parent,
                                                         gpointer user_data);

Loads an interface file (GtkBuilder UI file) for a plugin, given its filename and assuming it's installed in the plugin's data directory.

This should be used instead of attempting to load interfaces manually in plugins.

plugin_name :

the plugin name

name :

interface filename

fatal :

TRUE if it's a fatal error if the interface can't be loaded

parent :

the interface's parent GtkWindow. [allow-none]

user_data :

a pointer to be passed to each signal handler in the interface when they're called. [allow-none]

Returns :

the GtkBuilder instance for the interface. [transfer full]

totem_get_plugin_paths ()

char **             totem_get_plugin_paths              (void);

Return a NULL-terminated array of paths to directories which can contain Totem plugins. This respects the GSettings disable_user_plugins setting.

Returns :

a NULL-terminated array of paths to plugin directories. [transfer full]

Since 2.90.0