## ag-provider

ag-provider — A representation of a provider.

## Functions

const gchar * | ag_provider_get_name ()
const gchar * | ag_provider_get_display_name ()
const gchar * | ag_provider_get_description ()
const gchar * | ag_provider_get_i18n_domain ()
const gchar * | ag_provider_get_icon_name ()
const gchar * | ag_provider_get_domains_regex ()
gboolean | ag_provider_match_domain ()
const gchar * | ag_provider_get_plugin_name ()
gboolean | ag_provider_get_single_account ()
GList * | ag_provider_get_tags ()
void | ag_provider_get_file_contents ()
AgProvider * | ag_provider_ref ()
void | ag_provider_unref ()
void | ag_provider_list_free ()

## Includes

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

## 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.

## Functions

### ag_provider_get_name ()

    const gchar *
    ag_provider_get_name (AgProvider *provider);

Get the name of the AgProvider.

#### Parameters

provider | the AgProvider. |

#### Returns

the name of `provider` .

### ag_provider_get_display_name ()

    const gchar *
    ag_provider_get_display_name (AgProvider *provider);

Get the display name of the AgProvider.

#### Parameters

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.

#### Parameters

provider | the AgProvider. |

#### Returns

the description of `provider` , or `NULL` upon failure.

Since: 1.2

### ag_provider_get_i18n_domain ()

    const gchar *
    ag_provider_get_i18n_domain (AgProvider *provider);

Get the translation domain of the AgProvider.

#### Parameters

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.

#### Parameters

provider | the AgProvider. |

#### Returns

the icon_name.

### 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.

#### Parameters

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`.

#### Parameters

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.

#### Parameters

provider | the AgProvider. |

#### Returns

the plugin name for `provider` , or `NULL` if a plugin name is not defined.

Since: 1.5

### ag_provider_get_single_account ()

    gboolean
    ag_provider_get_single_account (AgProvider *provider);

Tell whether the provider doesn't support creating more than one account. Note that libaccounts itself does not enforce preventing the creation of multiple accounts when this flag is set: the flag is only informative, and its implementation is left to the client.

#### Parameters

provider | the AgProvider. |

#### Returns

`FALSE` if multiple accounts can be created from this provider, `TRUE` otherwise.

Since: 1.14

### ag_provider_get_tags ()

    GList *
    ag_provider_get_tags (AgProvider *provider);

Get list of tags specified for the AgProvider.

#### Parameters

provider | the AgProvider. |

#### Returns

GList of tags for `provider` . The list must be freed with `g_list_free()`. Entries are owned by the AgProvider type and must not be free'd.

[transfer container][element-type utf8]

Since: 1.25

### 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`.

#### Parameters

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

### ag_provider_ref ()

    AgProvider *
    ag_provider_ref (AgProvider *provider);

Adds a reference to `provider` .

#### Parameters

provider | the AgProvider. |

#### Returns

`provider` .

### ag_provider_unref ()

    void
    ag_provider_unref (AgProvider *provider);

Used to unreference the AgProvider structure.

#### Parameters

provider | the AgProvider. |

### ag_provider_list_free ()

    void
    ag_provider_list_free (GList *list);

Frees the list `list` .

#### Parameters

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