AgProvider

## AgProvider AgProvider — A representation of a provider. |

## Synopsis

    #include <libaccounts-glib/ag-provider.h>

                        AgProvider;
    const gchar *       ag_provider_get_display_name        (AgProvider *provider);
    const gchar *       ag_provider_get_description         (AgProvider *provider);
    void                ag_provider_get_file_contents       (AgProvider *provider,
                                                             const gchar **contents);
    const gchar *       ag_provider_get_i18n_domain         (AgProvider *provider);
    const gchar *       ag_provider_get_icon_name           (AgProvider *provider);
    const gchar *       ag_provider_get_name                (AgProvider *provider);
    const gchar *       ag_provider_get_domains_regex       (AgProvider *provider);
    gboolean            ag_provider_match_domain            (AgProvider *provider,
                                                             const gchar *domain);
    const gchar *       ag_provider_get_plugin_name         (AgProvider *provider);
    void                ag_provider_list_free               (GList *list);
    AgProvider *        ag_provider_ref                     (AgProvider *provider);
    void                ag_provider_unref                   (AgProvider *provider);

## Object Hierarchy

      GBoxed
       +----AgProvider

## Description

The AgProvider structure represents an account provider. The structure is not directly exposed to applications, but its fields are accessible via getter methods. It can be instantiated by AgManager with `ag_manager_get_provider()` or `ag_manager_list_providers()`. The structure is reference counted. One must use `ag_provider_unref()` when done with it.

See the example of creating a new AgAccount to see how AgProvider can be used.

## Details

### AgProvider

    typedef struct _AgProvider AgProvider;

Opaque structure. Use related accessor functions.

### ag_provider_get_display_name ()

    const gchar *       ag_provider_get_display_name        (AgProvider *provider);

Get the display name of the AgProvider.

`provider` : | the AgProvider.
Returns : | the display name of `provider`.

### ag_provider_get_description ()

    const gchar *       ag_provider_get_description         (AgProvider *provider);

Get the description of the AgProvider.

`provider` : | the AgProvider.
Returns : | the description of `provider`, or `NULL` upon failure.

Since 1.2

### ag_provider_get_file_contents ()

    void                ag_provider_get_file_contents       (AgProvider *provider,
                                                             const gchar **contents);

Gets the contents of the XML provider file. The buffer returned in `contents` should not be modified or freed, and is guaranteed to be valid as long as `provider` is referenced. If some error occurs, `contents` is set to `NULL`.

`provider` : | the AgProvider.
`contents` : | location to receive the pointer to the file contents.

### ag_provider_get_i18n_domain ()

    const gchar *       ag_provider_get_i18n_domain         (AgProvider *provider);

Get the translation domain of the AgProvider.

`provider` : | the AgProvider.
Returns : | the translation domain.

### ag_provider_get_icon_name ()

    const gchar *       ag_provider_get_icon_name           (AgProvider *provider);

Get the icon name of the AgProvider.

`provider` : | the AgProvider.
Returns : | the icon_name.

### ag_provider_get_name ()

    const gchar *       ag_provider_get_name                (AgProvider *provider);

Get the name of the AgProvider.

`provider` : | the AgProvider.
Returns : | the name of `provider`.

### ag_provider_get_domains_regex ()

    const gchar *       ag_provider_get_domains_regex       (AgProvider *provider);

Get a regular expression matching all domains where this provider's accounts can be used.

`provider` : | the AgProvider.
Returns : | a regular expression matching the domain names.

Since 1.1

### ag_provider_match_domain ()

    gboolean            ag_provider_match_domain            (AgProvider *provider,
                                                             const gchar *domain);

Check whether `domain` is supported by this provider, by matching it with the regex returned by `ag_provider_get_domains_regex()`. If the provider does not define a regular expression to match the supported domains, this function will return `FALSE`.

`provider` : | the AgProvider.
`domain` : | a domain name.
Returns : | `TRUE` if the given domain is supported, `FALSE` otherwise.

Since 1.2

### ag_provider_get_plugin_name ()

    const gchar *       ag_provider_get_plugin_name         (AgProvider *provider);

Get the name of the account plugin which manages all accounts created from this AgProvider. Some platforms might find it useful to store plugin names in the provider XML files, especially when the same plugin can work for different providers.

`provider` : | the AgProvider.
Returns : | the plugin name for `provider`, or `NULL` if a plugin name is not defined.

Since 1.5

### ag_provider_list_free ()

    void                ag_provider_list_free               (GList *list);

Frees the list `list`.

`list` : | a GList of providers returned by some function of this library. [element-type AgProvider]

### ag_provider_ref ()

    AgProvider *        ag_provider_ref                     (AgProvider *provider);

Adds a reference to `provider`.

`provider` : | the AgProvider.
Returns : | `provider`.

### ag_provider_unref ()

    void                ag_provider_unref                   (AgProvider *provider);

Used to unreference the AgProvider structure.

`provider` : | the AgProvider.