## RBPlugin RBPlugin — Base class for plugins |

## Synopsis

                        RBPlugin;
                        RBPluginClass;
    void                (*RBPluginActivationFunc)           (RBPlugin *plugin,
                                                             RBShell *shell);
    GtkWidget *         (*RBPluginWidgetFunc)               (RBPlugin *plugin);
    gboolean            (*RBPluginBooleanFunc)              (RBPlugin *plugin);
    void                rb_plugin_activate                  (RBPlugin *plugin,
                                                             RBShell *shell);
    void                rb_plugin_deactivate                (RBPlugin *plugin,
                                                             RBShell *shell);
    gboolean            rb_plugin_is_configurable           (RBPlugin *plugin);
    GtkWidget *         rb_plugin_create_configure_dialog   (RBPlugin *plugin);
    char *              rb_plugin_find_file                 (RBPlugin *plugin,
                                                             const char *file);
    GList *             rb_get_plugin_paths                 (void);
    #define             RB_PLUGIN_REGISTER                  (PluginName, plugin_name)
    #define             RB_PLUGIN_REGISTER_TYPE             (type_name)
    #define             RB_PLUGIN_DEFINE_TYPE               (TypeName, type_name, TYPE_PARENT)

## Object Hierarchy

      GObject
       +----RBPlugin

## Properties

      "name"                     gchar*                : Read / Write

## Description

This is the base class for all plugins. It provides methods called when activating, deactivating, and configuring plugins.

## Details

### RBPlugin

    typedef struct _RBPlugin RBPlugin;

### RBPluginClass

    typedef struct {
    	GObjectClass parent_class;

    	/* Virtual public methods */

    	RBPluginActivationFunc		activate;
    	RBPluginActivationFunc		deactivate;
    	RBPluginWidgetFunc		create_configure_dialog;

    	/* Plugins should not override this, it's handled automatically by
    	   the RbPluginClass */
    	RBPluginBooleanFunc		is_configurable;
    } RBPluginClass;

### RBPluginActivationFunc ()

    void                (*RBPluginActivationFunc)           (RBPlugin *plugin,
                                                             RBShell *shell);

Typedef for plugin activation and deactivation functions. These functions include the RBShell as an argument to allow the plugin to locate other parts of Rhythmbox.

`plugin` : | the RBPlugin
`shell` : | the RBShell

### RBPluginWidgetFunc ()

    GtkWidget *         (*RBPluginWidgetFunc)               (RBPlugin *plugin);

Typedef for plugin configuration functions.

`plugin` : | the RBPlugin
Returns : | a GtkWidget for the plugin

### RBPluginBooleanFunc ()

    gboolean            (*RBPluginBooleanFunc)              (RBPlugin *plugin);

Typedef for plugin functions that return a gboolean.

`plugin` : | the RBPlugin
Returns : | something

### rb_plugin_activate ()

    void                rb_plugin_activate                  (RBPlugin *plugin,
                                                             RBShell *shell);

Called when a plugin is being activated, either on startup or when enabled in the plugin configuration dialog.

`plugin` : | the RBPlugin being activated
`shell` : | the RBShell

### rb_plugin_deactivate ()

    void                rb_plugin_deactivate                (RBPlugin *plugin,
                                                             RBShell *shell);

Called when a plugin is being deactivated, either on shutdown or when disabled in the plugin configuration dialog.

Note that plugin instances are never destroyed, so the same plugin instance can be deactivated and then reactivated. After deactivation, the plugin must be in a state where it can be reactivated.

`plugin` : | the RBPlugin being deactivated
`shell` : | the RBShell

### rb_plugin_is_configurable ()

    gboolean            rb_plugin_is_configurable           (RBPlugin *plugin);

Determines whether the plugin is configurable.

`plugin` : | the RBPlugin
Returns : | `TRUE` if configurable

### rb_plugin_create_configure_dialog ()

    GtkWidget *         rb_plugin_create_configure_dialog   (RBPlugin *plugin);

Creates a configuration dialog for `plugin`. The plugin can store the dialog instance the first time it is created and just return it thereafter.

`plugin` : | the RBPlugin
Returns : | configuration widget for `plugin`

### rb_plugin_find_file ()

    char *              rb_plugin_find_file                 (RBPlugin *plugin,
                                                             const char *file);

Searches for `file` in the install directory for `plugin`. Plugins should use this to locate any data files they install.

`plugin` : | the RBPlugin
`file` : | file to search for
Returns : | path to the file, must be freed by caller.

### rb_get_plugin_paths ()

    GList *             rb_get_plugin_paths                 (void);

Returns a list containing the paths to search for plugins.

Returns : | GList of paths, must be freed by caller

### RB_PLUGIN_REGISTER()

    #define             RB_PLUGIN_REGISTER(PluginName, plugin_name)

Registers a Rhythmbox plugin type. Use this instead of G_DEFINE_TYPE (or similar) for RBPlugin implementations.

`PluginName` : | plugin name in CamelCase
`plugin_name` : | plugin name in lowercase with words separated by '_'

### RB_PLUGIN_REGISTER_TYPE()

    #define             RB_PLUGIN_REGISTER_TYPE(type_name)

Registers additional types for the plugin. This should be called in the plugin class_init function for types besides the plugin itself that need to be registered with the GObject type system.

`type_name` : | CamelCase name of the type to register

### RB_PLUGIN_DEFINE_TYPE()

    #define             RB_PLUGIN_DEFINE_TYPE(TypeName, type_name, TYPE_PARENT)

Defines additional types for the plugin. This should be used instead of G_DEFINE_TYPE for additional object types that need to be registered with the GObject type system.

`TypeName` : | type name in CamelCase
`type_name` : | type name in lowercase with words separated by '_'
`TYPE_PARENT` : | GType macro for the parent type

## Property Details

### The `"name"` property

      "name"                     gchar*                : Read / Write

name.

Default value: NULL