AgManager

AgManager — The account manager object

Synopsis

                    AgManagerClass;
                    AgManagerPrivate;
                    AgManager;
typedef             AgAccountId;
AgManager *         ag_manager_new                      (void);
AgManager *         ag_manager_new_for_service_type     (const gchar *service_type);
GList *             ag_manager_list                     (AgManager *manager);
GList *             ag_manager_list_by_service_type     (AgManager *manager,
                                                         const gchar *service_type);
void                ag_manager_list_free                (GList *list);
AgAccount *         ag_manager_get_account              (AgManager *manager,
                                                         AgAccountId account_id);
AgAccount *         ag_manager_load_account             (AgManager *manager,
                                                         AgAccountId account_id,
                                                         GError **error);
AgAccount *         ag_manager_create_account           (AgManager *manager,
                                                         const gchar *provider_name);
AgService *         ag_manager_get_service              (AgManager *manager,
                                                         const gchar *service_name);
GList *             ag_manager_list_services            (AgManager *manager);
GList *             ag_manager_list_services_by_type    (AgManager *manager,
                                                         const gchar *service_type);
GList *             ag_manager_list_enabled             (AgManager *manager);
GList *             ag_manager_list_enabled_by_service_type
                                                        (AgManager *manager,
                                                         const gchar *service_type);
const gchar *       ag_manager_get_service_type         (AgManager *manager);
AgProvider *        ag_manager_get_provider             (AgManager *manager,
                                                         const gchar *provider_name);
GList *             ag_manager_list_providers           (AgManager *manager);
void                ag_manager_set_db_timeout           (AgManager *manager,
                                                         guint timeout_ms);
guint               ag_manager_get_db_timeout           (AgManager *manager);
void                ag_manager_set_abort_on_db_timeout  (AgManager *manager,
                                                         gboolean abort);
gboolean            ag_manager_get_abort_on_db_timeout  (AgManager *manager);
AgServiceType *     ag_manager_load_service_type        (AgManager *manager,
                                                         const gchar *service_type);

Object Hierarchy

  GObject
   +----AgManager

Properties

  "service-type"             gchar*                : Write / Construct Only

Signals

  "account-created"                                : Run Last
  "account-deleted"                                : Run Last
  "account-updated"                                : Run Last
  "enabled-event"                                  : Run Last

Description

The AgManager is the main object in this library.

Details

AgManagerClass

typedef struct {
    GObjectClass parent_class;
    void (*account_deleted) (AgManager *manager, AgAccountId id);
    void (*_ag_reserved2) (void);
    void (*_ag_reserved3) (void);
    void (*_ag_reserved4) (void);
    void (*_ag_reserved5) (void);
    void (*_ag_reserved6) (void);
    void (*_ag_reserved7) (void);
} AgManagerClass;


AgManagerPrivate

typedef struct _AgManagerPrivate AgManagerPrivate;


AgManager

typedef struct _AgManager AgManager;


AgAccountId

typedef guint AgAccountId;


ag_manager_new ()

AgManager *         ag_manager_new                      (void);

Returns :

an instance of an AgManager.

ag_manager_new_for_service_type ()

AgManager *         ag_manager_new_for_service_type     (const gchar *service_type);

service_type :

the name of a service type

Returns :

an instance of an AgManager with specified service type.

ag_manager_list ()

GList *             ag_manager_list                     (AgManager *manager);

Lists the accounts. If the AgManager is created with specified service_type it will return only the accounts supporting this service_type.

manager :

the AgManager.

Returns :

a GList of AgAccountId representing the accounts. Must be free'd with ag_manager_list_free().

ag_manager_list_by_service_type ()

GList *             ag_manager_list_by_service_type     (AgManager *manager,
                                                         const gchar *service_type);

Lists the accounts supporting the given service type.

manager :

the AgManager.

service_type :

Returns :

a GList of AgAccountId representing the accounts. Must be free'd with ag_manager_list_free().

ag_manager_list_free ()

void                ag_manager_list_free                (GList *list);

Frees the memory taken by a GList allocated by AgManager.

list :

a GList returned from some AgManager method.

ag_manager_get_account ()

AgAccount *         ag_manager_get_account              (AgManager *manager,
                                                         AgAccountId account_id);

Instantiates the object representing the account identified by account_id.

manager :

the AgManager.

account_id :

the AgAccountId of the account.

Returns :

an AgAccount, on which the client must call g_object_unref() when it's done with it, or NULL if an error occurs.

ag_manager_load_account ()

AgAccount *         ag_manager_load_account             (AgManager *manager,
                                                         AgAccountId account_id,
                                                         GError **error);

Instantiates the object representing the account identified by account_id.

manager :

the AgManager.

account_id :

the AgAccountId of the account.

error :

pointer to a GError, or NULL.

Returns :

an AgAccount, on which the client must call g_object_unref() when it's done with it, or NULL if an error occurs.

ag_manager_create_account ()

AgAccount *         ag_manager_create_account           (AgManager *manager,
                                                         const gchar *provider_name);

Create a new account. The account is not stored in the database until ag_account_store() has successfully returned; the id field in the AgAccount structure is also not meant to be valid till the account has been stored.

manager :

the AgManager.

provider_name :

name of the provider of the account.

Returns :

a new AgAccount.

ag_manager_get_service ()

AgService *         ag_manager_get_service              (AgManager *manager,
                                                         const gchar *service_name);

Loads the service identified by service_name.

manager :

the AgManager.

service_name :

the name of the service.

Returns :

an AgService, which must be then free'd with ag_service_unref().

ag_manager_list_services ()

GList *             ag_manager_list_services            (AgManager *manager);

Gets a list of all the installed services. If the AgManager is created with specified service_type it will return only the installed services supporting this service_type.

manager :

the AgManager.

Returns :

a list of AgService, which must be then free'd with ag_service_list_free().

ag_manager_list_services_by_type ()

GList *             ag_manager_list_services_by_type    (AgManager *manager,
                                                         const gchar *service_type);

Gets a list of all the installed services of type service_type.

manager :

the AgManager.

service_type :

the type of the service.

Returns :

a list of AgService, which must be then free'd with ag_service_list_free().

ag_manager_list_enabled ()

GList *             ag_manager_list_enabled             (AgManager *manager);

Lists the enabled accounts.

manager :

the AgManager.

Returns :

a GList of the enabled AgAccountId representing the accounts. Must be free'd with ag_manager_list_free().

ag_manager_list_enabled_by_service_type ()

GList *             ag_manager_list_enabled_by_service_type
                                                        (AgManager *manager,
                                                         const gchar *service_type);

Lists the enabled accounts supporting the given service type.

manager :

the AgManager.

service_type :

Returns :

a GList of the enabled AgAccountId representing the accounts. Must be free'd with ag_manager_list_free().

ag_manager_get_service_type ()

const gchar *       ag_manager_get_service_type         (AgManager *manager);

manager :

Returns :


ag_manager_get_provider ()

AgProvider *        ag_manager_get_provider             (AgManager *manager,
                                                         const gchar *provider_name);

Loads the provider identified by provider_name.

manager :

the AgManager.

provider_name :

the name of the provider.

Returns :

an AgProvider, which must be then free'd with ag_provider_unref().

ag_manager_list_providers ()

GList *             ag_manager_list_providers           (AgManager *manager);

Gets a list of all the installed providers.

manager :

the AgManager.

Returns :

a list of AgProvider, which must be then free'd with ag_provider_list_free().

ag_manager_set_db_timeout ()

void                ag_manager_set_db_timeout           (AgManager *manager,
                                                         guint timeout_ms);

Sets the timeout for database operations. This tells the library how long it is allowed to block while waiting for a locked DB to become accessible. Higher values mean a higher chance of successful reads, but also mean that the execution might be blocked for a longer time. The default is 5 seconds.

manager :

the AgManager.

timeout_ms :

the new timeout, in milliseconds.

ag_manager_get_db_timeout ()

guint               ag_manager_get_db_timeout           (AgManager *manager);

manager :

the AgManager.

Returns :

the timeout (in milliseconds) for database operations.

ag_manager_set_abort_on_db_timeout ()

void                ag_manager_set_abort_on_db_timeout  (AgManager *manager,
                                                         gboolean abort);

Tells libaccounts whether it should make the client application abort when a timeout error occurs. The default is FALSE.

manager :

the AgManager.

abort :

whether to abort when a DB timeout occurs.

ag_manager_get_abort_on_db_timeout ()

gboolean            ag_manager_get_abort_on_db_timeout  (AgManager *manager);

manager :

the AgManager.

Returns :

whether the library will abort when a timeout error occurs.

ag_manager_load_service_type ()

AgServiceType *     ag_manager_load_service_type        (AgManager *manager,
                                                         const gchar *service_type);

Instantiate the service type service_type.

manager :

the AgManager.

service_type :

the name of the service type.

Returns :

an AgServiceType, which must be then free'd with ag_service_type_unref().

Property Details

The "service-type" property

  "service-type"             gchar*                : Write / Construct Only

Set service type.

Default value: NULL

Signal Details

The "account-created" signal

void                user_function                      (AgManager *manager,
                                                        guint      account_id,
                                                        gpointer   user_data)       : Run Last

Emitted when a new account has been created; note that the account must have been stored in the database: the signal is not emitted just in response to ag_manager_create_account().

manager :

the AgManager.

account_id :

the AgAccountId of the account that has been created.

user_data :

user data set when the signal handler was connected.

The "account-deleted" signal

void                user_function                      (AgManager *manager,
                                                        guint      account_id,
                                                        gpointer   user_data)       : Run Last

Emitted when an account has been deleted. This signal is redundant with AgAccount::deleted, but it's convenient to provide full change notification to AgManager.

manager :

the AgManager.

account_id :

the AgAccountId of the account that has been deleted.

user_data :

user data set when the signal handler was connected.

The "account-updated" signal

void                user_function                      (AgManager *manager,
                                                        guint      account_id,
                                                        gpointer   user_data)       : Run Last

Emitted when particular service of an account has been updated. This signal is redundant with AgAccount::deleted, but it's convenient to provide full change notification to AgManager.

manager :

the AgManager.

account_id :

the AgAccountId of the account that has been update.

user_data :

user data set when the signal handler was connected.

The "enabled-event" signal

void                user_function                      (AgManager *agmanager,
                                                        guint      arg1,
                                                        gpointer   user_data)      : Run Last

agmanager :

the object which received the signal.

arg1 :

user_data :

user data set when the signal handler was connected.