AnjutaPluginManager

## AnjutaPluginManager AnjutaPluginManager — Plugins management and activation |

## Stability Level

Unstable, unless otherwise indicated

## Synopsis

    #include <libanjuta/anjuta-plugin-manager.h>

    #define             ANJUTA_PLUGIN_MANAGER_ERROR
    enum                AnjutaPluginManagerError;
    struct              AnjutaPluginManagerClass;
    GQuark              anjuta_plugin_manager_error_quark   (void);
    AnjutaPluginManager * anjuta_plugin_manager_new         (GObject *shell,
                                                             AnjutaStatus *status,
                                                             GList *plugin_search_paths);
    gboolean            anjuta_plugin_manager_is_active_plugin
                                                            (AnjutaPluginManager *plugin_manager,
                                                             const gchar *iface_name);
    GObject *           anjuta_plugin_manager_get_plugin    (AnjutaPluginManager *plugin_manager,
                                                             const gchar *iface_name);
    GObject *           anjuta_plugin_manager_get_plugin_by_handle
                                                            (AnjutaPluginManager *plugin_manager,
                                                             AnjutaPluginHandle *handle);
    gboolean            anjuta_plugin_manager_unload_plugin (AnjutaPluginManager *plugin_manager,
                                                             GObject *plugin_object);
    gboolean            anjuta_plugin_manager_unload_plugin_by_handle
                                                            (AnjutaPluginManager *plugin_manager,
                                                             AnjutaPluginHandle *handle);
    GList *             anjuta_plugin_manager_get_active_plugins
                                                            (AnjutaPluginManager *plugin_manager);
    GList *             anjuta_plugin_manager_get_active_plugin_objects
                                                            (AnjutaPluginManager *plugin_manager);
    GtkWidget *         anjuta_plugin_manager_get_plugins_page
                                                            (AnjutaPluginManager *plugin_manager);
    GtkWidget *         anjuta_plugin_manager_get_remembered_plugins_page
                                                            (AnjutaPluginManager *plugin_manager);
    GList *             anjuta_plugin_manager_query         (AnjutaPluginManager *plugin_manager,
                                                             const gchar *section_names,
                                                             const gchar *attribute_names,
                                                             const gchar *attribute_values,
                                                             ...);
    GList *             anjuta_plugin_manager_list_query    (AnjutaPluginManager *plugin_manager,
                                                             GList *section_names,
                                                             GList *attribute_names,
                                                             GList *attribute_values);
    AnjutaPluginHandle * anjuta_plugin_manager_select       (AnjutaPluginManager *plugin_manager,
                                                             gchar *title,
                                                             gchar *description,
                                                             GList *plugin_handles);
    GObject *           anjuta_plugin_manager_select_and_activate
                                                            (AnjutaPluginManager *plugin_manager,
                                                             gchar *title,
                                                             gchar *description,
                                                             GList *plugin_handles);
    AnjutaPluginHandle * anjuta_plugin_manager_get_plugin_handle
                                                            (AnjutaPluginManager *plugin_manager,
                                                             GObject *plugin);
    void                anjuta_plugin_manager_activate_plugins
                                                            (AnjutaPluginManager *plugin_manager,
                                                             GList *plugin_handles);
    void                anjuta_plugin_manager_unload_all_plugins
                                                            (AnjutaPluginManager *plugin_manager);
    gchar *             anjuta_plugin_manager_get_remembered_plugins
                                                            (AnjutaPluginManager *plugin_manager);
    void                anjuta_plugin_manager_set_remembered_plugins
                                                            (AnjutaPluginManager *plugin_manager,
                                                             const gchar *remembered_plugins);
    void                anjuta_plugin_manager_set_disable_plugins
                                                            (AnjutaPluginManager *plugin_manager,
                                                             GList *plugin_handles,
                                                             gboolean disable);
    #define             anjuta_plugin_manager_get_interface (plugin_manager,
                                                             iface_type,
                                                             error)
                        AnjutaPluginManagerPriv;

## Description

## Details

### ANJUTA_PLUGIN_MANAGER_ERROR

    #define ANJUTA_PLUGIN_MANAGER_ERROR            (anjuta_plugin_manager_error_quark())

### enum AnjutaPluginManagerError

    typedef enum {
    	ANJUTA_PLUGIN_MANAGER_MISSING_FACTORY,
    	ANJUTA_PLUGIN_MANAGER_ERROR_UNKNOWN
    } AnjutaPluginManagerError;

`ANJUTA_PLUGIN_MANAGER_MISSING_FACTORY` | The factory for the plugin couldn't be found
`ANJUTA_PLUGIN_MANAGER_ERROR_UNKNOWN` | Unknown error

### struct AnjutaPluginManagerClass

    struct AnjutaPluginManagerClass {
    	GObjectClass parent_class;

    	/* Signals */
    	void(* plugin_activated) (AnjutaPluginManager *self,
    							  AnjutaPluginHandle* handle,
    							  GObject *plugin);
    	void(* plugin_deactivated) (AnjutaPluginManager *self,
    								AnjutaPluginHandle* handle,
    								GObject *plugin);
    };

### anjuta_plugin_manager_error_quark ()

    GQuark              anjuta_plugin_manager_error_quark   (void);

### anjuta_plugin_manager_new ()

    AnjutaPluginManager * anjuta_plugin_manager_new         (GObject *shell,
                                                             AnjutaStatus *status,
                                                             GList *plugin_search_paths);

### anjuta_plugin_manager_is_active_plugin ()

    gboolean            anjuta_plugin_manager_is_active_plugin
                                                            (AnjutaPluginManager *plugin_manager,
                                                             const gchar *iface_name);

Searches if a currently loaded plugins implements the given interface.

`plugin_manager` : | A AnjutaPluginManager object
`iface_name` : | The interface implemented by the object to be found
Returns : | `TRUE` is the plugin is currently loaded.

### anjuta_plugin_manager_get_plugin ()

    GObject *           anjuta_plugin_manager_get_plugin    (AnjutaPluginManager *plugin_manager,
                                                             const gchar *iface_name);

Searches the currently available plugins to find the one which implements the given interface as primary interface and returns it. If the plugin is not yet loaded, it will be loaded and activated. It only searches from the pool of plugin objects loaded in this shell and can only search by primary interface. If there are more objects implementing this primary interface, user might be prompted to select one from them (and might give the option to use it as default for future queries). A typical usage of this function is:

    GObject *docman =
        anjuta_plugin_manager_get_plugin (plugin_manager, "IAnjutaDocumentManager", error);

Notice that this function takes the interface name string as string, unlike `anjuta_plugins_get_interface()` which takes the type directly. If no plugin implementing this interface can be found, returns `NULL`.

`plugin_manager` : | A AnjutaPluginManager object
`iface_name` : | The interface implemented by the object to be found
Returns : | The plugin object (subclass of AnjutaPlugin) which implements the given interface or `NULL`. See AnjutaPlugin for more detail on interfaces implemented by plugins.

### anjuta_plugin_manager_get_plugin_by_handle ()

    GObject *           anjuta_plugin_manager_get_plugin_by_handle
                                                            (AnjutaPluginManager *plugin_manager,
                                                             AnjutaPluginHandle *handle);

Searches the currently available plugins to find the one with the specified handle. If the plugin is not yet loaded, it will be loaded and activated.

`plugin_manager` : | A AnjutaPluginManager object
`handle` : | A AnjutaPluginHandle
Returns : | The plugin object (subclass of AnjutaPlugin)

### anjuta_plugin_manager_unload_plugin ()

    gboolean            anjuta_plugin_manager_unload_plugin (AnjutaPluginManager *plugin_manager,
                                                             GObject *plugin_object);

Unload the corresponding plugin. The plugin has to be loaded.

`plugin_manager` : | A AnjutaPluginManager object
`plugin_object` : | A AnjutaPlugin object
Returns : | `TRUE` if the plugin has been unloaded. `FALSE` if the plugin is already or cannot be unloaded.

### anjuta_plugin_manager_unload_plugin_by_handle ()

    gboolean            anjuta_plugin_manager_unload_plugin_by_handle
                                                            (AnjutaPluginManager *plugin_manager,
                                                             AnjutaPluginHandle *handle);

Unload the plugin corresponding to the given handle. If the plugin is already unloaded, nothing will be done.

`plugin_manager` : | A AnjutaPluginManager object
`handle` : | A AnjutaPluginHandle
Returns : | `TRUE` is the plugin is unloaded. `FALSE` if a corresponding plugin does not exist or if the plugin cannot be unloaded.

### anjuta_plugin_manager_get_active_plugins ()

    GList *             anjuta_plugin_manager_get_active_plugins
                                                            (AnjutaPluginManager *plugin_manager);

### anjuta_plugin_manager_get_active_plugin_objects ()

    GList *             anjuta_plugin_manager_get_active_plugin_objects
                                                            (AnjutaPluginManager *plugin_manager);

### anjuta_plugin_manager_get_plugins_page ()

    GtkWidget *         anjuta_plugin_manager_get_plugins_page
                                                            (AnjutaPluginManager *plugin_manager);

### anjuta_plugin_manager_get_remembered_plugins_page ()

    GtkWidget *         anjuta_plugin_manager_get_remembered_plugins_page
                                                            (AnjutaPluginManager *plugin_manager);

### anjuta_plugin_manager_query ()

    GList *             anjuta_plugin_manager_query         (AnjutaPluginManager *plugin_manager,
                                                             const gchar *section_names,
                                                             const gchar *attribute_names,
                                                             const gchar *attribute_values,
                                                             ...);

### anjuta_plugin_manager_list_query ()

    GList *             anjuta_plugin_manager_list_query    (AnjutaPluginManager *plugin_manager,
                                                             GList *section_names,
                                                             GList *attribute_names,
                                                             GList *attribute_values);

### anjuta_plugin_manager_select ()

    AnjutaPluginHandle * anjuta_plugin_manager_select       (AnjutaPluginManager *plugin_manager,
                                                             gchar *title,
                                                             gchar *description,
                                                             GList *plugin_handles);

### anjuta_plugin_manager_select_and_activate ()

    GObject *           anjuta_plugin_manager_select_and_activate
                                                            (AnjutaPluginManager *plugin_manager,
                                                             gchar *title,
                                                             gchar *description,
                                                             GList *plugin_handles);

### anjuta_plugin_manager_get_plugin_handle ()

    AnjutaPluginHandle * anjuta_plugin_manager_get_plugin_handle
                                                            (AnjutaPluginManager *plugin_manager,
                                                             GObject *plugin);

### anjuta_plugin_manager_activate_plugins ()

    void                anjuta_plugin_manager_activate_plugins
                                                            (AnjutaPluginManager *plugin_manager,
                                                             GList *plugin_handles);

### anjuta_plugin_manager_unload_all_plugins ()

    void                anjuta_plugin_manager_unload_all_plugins
                                                            (AnjutaPluginManager *plugin_manager);

Unload all plugins. Do not take care of the dependencies because all plugins are unloaded anyway.

`plugin_manager` : | A AnjutaPluginManager object

### anjuta_plugin_manager_get_remembered_plugins ()

    gchar *             anjuta_plugin_manager_get_remembered_plugins
                                                            (AnjutaPluginManager *plugin_manager);

Get the list of plugins loaded when there is a choice between several ones without asking the user.

The list format is returned as a string with the format detailed in `anjuta_plugin_manager_set_remembered_plugins()`.

`plugin_manager` : | A AnjutaPluginManager object
Returns : | a newly-allocated string that must be freed with `g_free()`. [transfer full]

### anjuta_plugin_manager_set_remembered_plugins ()

    void                anjuta_plugin_manager_set_remembered_plugins
                                                            (AnjutaPluginManager *plugin_manager,
                                                             const gchar *remembered_plugins);

Set the list of plugins loaded when there is a choice between several ones without asking the user. The list is a string composed of elements separated by ';'. Each element is defined with "key=value", where key is the list of possible plugins and the value is the choosen plugin.

By the example the following element

      anjuta-symbol-browser:SymbolBrowserPlugin,anjuta-symbol-db:SymbolDBPlugin,=anjuta-symbol-db:SymbolDBPlugin;

means if Anjuta has to choose between SymbolBrowserPlugin and SymbolDBPlugin, it will choose SymbolDBPlugin.

`plugin_manager` : | A AnjutaPluginManager object
`remembered_plugins` : | A list of prefered plugins

### anjuta_plugin_manager_set_disable_plugins ()

    void                anjuta_plugin_manager_set_disable_plugins
                                                            (AnjutaPluginManager *plugin_manager,
                                                             GList *plugin_handles,
                                                             gboolean disable);

Disable or re-enable plugins. By default, all plugins are enabled but they can be disabled and they will not be proposed when a plugin is requested.

`plugin_manager` : | A AnjutaPluginManager object

### anjuta_plugin_manager_get_interface()

    #define             anjuta_plugin_manager_get_interface(plugin_manager, iface_type, error)

Equivalent to `anjuta_plugin_manager_get_object()`, but additionally typecasts returned object to the interface type. It also takes interface type directly. A usage of this function is:

    IAnjutaDocumentManager *docman =
        anjuta_plugin_manager_get_interface (plugin_manager, IAnjutaDocumentManager, error);

`plugin_manager` : | A AnjutaPluginManager object
`iface_type` : | The interface type implemented by the object to be found
`error` : | Error propagation object.

### AnjutaPluginManagerPriv

    typedef struct _AnjutaPluginManagerPriv AnjutaPluginManagerPriv;

## See Also

AnjutaPlugin, AnjutaProfileManager