## AnjutaProfile

AnjutaProfile — Profile is a collection of plugins

## Stability Level

Unstable, unless otherwise indicated

## Synopsis

    #include <libanjuta/anjuta-profile.h>

    #define             ANJUTA_PROFILE_ERROR
    enum                AnjutaProfileError;
                        AnjutaProfileClass;
                        AnjutaProfile;
                        AnjutaProfilePriv;
    GQuark              anjuta_profile_error_quark          (void);
    AnjutaProfile*      anjuta_profile_new                  (const gchar *name,
                                                             AnjutaPluginManager *plugin_manager);
    const gchar *       anjuta_profile_get_name             (AnjutaProfile *profile);
    void                anjuta_profile_add_plugin           (AnjutaProfile *profile,
                                                             AnjutaPluginDescription *plugin);
    void                anjuta_profile_remove_plugin        (AnjutaProfile *profile,
                                                             AnjutaPluginDescription *plugin);
    gboolean            anjuta_profile_add_plugins_from_xml (AnjutaProfile *profile,
                                                             GFile *profile_xml_file,
                                                             gboolean exclude_from_sync,
                                                             GError **error);
    gboolean            anjuta_profile_has_plugin           (AnjutaProfile *profile,
                                                             AnjutaPluginDescription *plugin);
    GList*              anjuta_profile_get_plugins          (AnjutaProfile *profile);
    void                anjuta_profile_set_sync_file        (AnjutaProfile *profile,
                                                             GFile *sync_file);
    gboolean            anjuta_profile_sync                 (AnjutaProfile *profile,
                                                             GError **error);

## Object Hierarchy

      GObject
       +----AnjutaProfile

## Properties

      "plugin-manager"           AnjutaPluginManager*  : Read / Write / Construct
      "plugins"                  gpointer              : Read / Write / Construct
      "profile-name"             gchar*                : Read / Write / Construct
      "sync-file"                GFile*                : Read / Write / Construct

## Signals

      "changed"                                        : Run First
      "plugin-added"                                   : Run First
      "plugin-removed"                                 : Run First

## Description

A anjuta profile contains the list of all plugins used in one Anjuta session. It is possible to add and remove plugins, check if one is included or get the whole list. The plugins list can be saved into a xml file and loaded from it.

A profile in an Anjuta session includes plugins from up to 3 different xml sources:

$prefix/share/anjuta/profiles/default.profile | This contains the system plugins. It is loaded in every profile and contains mandatory plugins for Anjuta. These plugins cannot be unloaded.
$project_dir/$project_name.anjuta | This contains the project plugins. It lists mandatory plugins for the project. This file is version controlled and distributed with the source code. Every user working on the project uses the same one. If there is no project loaded, no project plugins are loaded.
$project_dir/.anjuta/default.profile | This contains the user plugins. This is the only list of plugins which is updated when the user add or remove one plugin. If there is no project loaded, the user home directory is used instead of the project directory but this list is used only in this case. There is no global user plugins list.

## Details

### ANJUTA_PROFILE_ERROR

    #define ANJUTA_PROFILE_ERROR            (anjuta_profile_error_quark())

Error domain for Anjuta profile. Errors in this domain will be from the AnjutaProfileError enumeration. See GError for more information on error domains.

### enum AnjutaProfileError

    typedef enum
    {
    	ANJUTA_PROFILE_ERROR_URI_READ_FAILED,
    	ANJUTA_PROFILE_ERROR_URI_WRITE_FAILED
    } AnjutaProfileError;

Error codes returned by anjuta profile functions.

`ANJUTA_PROFILE_ERROR_URI_READ_FAILED` | Fail to read xml plugins list file.
`ANJUTA_PROFILE_ERROR_URI_WRITE_FAILED` | Fail to write xml plugins list file.

### AnjutaProfileClass

    typedef struct {
    	GObjectClass parent_class;

    	/* Signals */
    	void(* plugin_added) (AnjutaProfile *self,
    						  AnjutaPluginDescription *plugin);
    	void(* plugin_removed) (AnjutaProfile *self,
    							AnjutaPluginDescription *plugin);
    	void(* changed) (AnjutaProfile *self, GList *plugins);
    } AnjutaProfileClass;

### AnjutaProfile

    typedef struct _AnjutaProfile AnjutaProfile;

Stores a plugin list.

### AnjutaProfilePriv

    typedef struct _AnjutaProfilePriv AnjutaProfilePriv;

### anjuta_profile_error_quark ()

    GQuark              anjuta_profile_error_quark          (void);

Returns : |

### anjuta_profile_new ()

    AnjutaProfile*      anjuta_profile_new                  (const gchar *name,
                                                             AnjutaPluginManager *plugin_manager);

Create a new profile.

`name` : | the new profile name.
`plugin_manager` : | the AnjutaPluginManager used by this profile.
Returns : | the new AnjutaProfile object.

### anjuta_profile_get_name ()

    const gchar *       anjuta_profile_get_name             (AnjutaProfile *profile);

Get the profile name.

`profile` : | a AnjutaProfile object.
Returns : | the profile name.

### anjuta_profile_add_plugin ()

    void                anjuta_profile_add_plugin           (AnjutaProfile *profile,
                                                             AnjutaPluginDescription *plugin);

Add one plugin into the profile plugin list.

`profile` : | a AnjutaProfile object.
`plugin` : | a AnjutaPluginDescription.

### anjuta_profile_remove_plugin ()

    void                anjuta_profile_remove_plugin        (AnjutaProfile *profile,
                                                             AnjutaPluginDescription *plugin);

Remove one plugin from the profile plugin list.

`profile` : | a AnjutaProfile object.
`plugin` : | a AnjutaPluginDescription.

### anjuta_profile_add_plugins_from_xml ()

    gboolean            anjuta_profile_add_plugins_from_xml (AnjutaProfile *profile,
                                                             GFile *profile_xml_file,
                                                             gboolean exclude_from_sync,
                                                             GError **error);

Add all plugins inscribed in the xml file into the profile plugin list.

`profile` : | a AnjutaProfile object.
`profile_xml_file` : | xml file containing plugin list.
`exclude_from_sync` : | TRUE if these plugins shouldn't be saved in user session.
`error` : | error propagation and reporting.
Returns : | TRUE on success, FALSE otherwise.

### anjuta_profile_has_plugin ()

    gboolean            anjuta_profile_has_plugin           (AnjutaProfile *profile,
                                                             AnjutaPluginDescription *plugin);

Check if a plugin is included in the profile plugin list.

`profile` : | a AnjutaProfile object
`plugin` : | a AnjutaPluginDescription
Returns : | TRUE if the plugin is included in the list.

### anjuta_profile_get_plugins ()

    GList*              anjuta_profile_get_plugins          (AnjutaProfile *profile);

Get the profile current plugins list.

`profile` : | a AnjutaProfile object.
Returns : | the plugins list.

### anjuta_profile_set_sync_file ()

    void                anjuta_profile_set_sync_file        (AnjutaProfile *profile,
                                                             GFile *sync_file);

Define the file used to save plugins list.

`profile` : | a AnjutaProfile object.
`sync_file` : | file used to save profile.

### anjuta_profile_sync ()

    gboolean            anjuta_profile_sync                 (AnjutaProfile *profile,
                                                             GError **error);

Save the current plugins list in the xml file set with `anjuta_profile_set_sync_file()`.

`profile` : | a AnjutaProfile object.
`error` : | error propagation and reporting.
Returns : | TRUE on success, FALSE otherwise.

## Property Details

### The `"plugin-manager"` property

      "plugin-manager"           AnjutaPluginManager*  : Read / Write / Construct

The plugin manager to use for resolving plugins.

### The `"plugins"` property

      "plugins"                  gpointer              : Read / Write / Construct

List of plugins for this profile.

### The `"profile-name"` property

      "profile-name"             gchar*                : Read / Write / Construct

Name of the plugin profile.

Default value: NULL

### The `"sync-file"` property

      "sync-file"                GFile*                : Read / Write / Construct

File to syncronize the profile XML.

## Signal Details

### The `"changed"` signal

    void                user_function                      (AnjutaProfile *profile,
                                                            gpointer       plugin_list,
                                                            gpointer       user_data)        : Run First

Emitted when a plugin is added or removed from the list.

`profile` : | a AnjutaProfile object.
`plugin_list` : | the new plugins list.
`user_data` : | user data set when the signal handler was connected.

### The `"plugin-added"` signal

    void                user_function                      (AnjutaProfile *profile,
                                                            gpointer       plugin,
                                                            gpointer       user_data)      : Run First

Emitted when a plugin is added in the list.

`profile` : | a AnjutaProfile object.
`plugin` : | the new plugin as a AnjutaPluginDescription.
`user_data` : | user data set when the signal handler was connected.

### The `"plugin-removed"` signal

    void                user_function                      (AnjutaProfile *profile,
                                                            gpointer       plugin,
                                                            gpointer       user_data)      : Run First

Emitted when a plugin is removed from the list.

`profile` : | a AnjutaProfile object.
`plugin` : | the removed plugin as a AnjutaPluginDescription.
`user_data` : | user data set when the signal handler was connected.

## See Also

AnjutaProfileManager, AnjutaPlugin