Accounts.Manager

g Accounts.Manager Accounts.Manager GObject.GInterface GObject.GInterface Gio.Initable Gio.Initable GObject.GInterface->Gio.Initable GObject.Object GObject.Object GObject.Object->Accounts.Manager Gio.Initable->Accounts.Manager

Subclasses:

None

Methods

Inherited:

GObject.Object (37), Gio.Initable (2)

Structs:

GObject.ObjectClass (5)

class

list_free (list)

class

new ()

class

new_for_service_type (service_type)

create_account (provider_name)

get_abort_on_db_timeout ()

get_account (account_id)

get_account_services ()

get_application (application_name)

get_db_timeout ()

get_enabled_account_services ()

get_provider (provider_name)

get_service (service_name)

get_service_type ()

list ()

list_applications_by_service (service)

list_by_service_type (service_type)

list_enabled ()

list_enabled_by_service_type (service_type)

list_providers ()

list_service_types ()

list_services ()

list_services_by_application (application)

list_services_by_type (service_type)

load_account (account_id)

load_service_type (service_type)

set_abort_on_db_timeout (abort)

set_db_timeout (timeout_ms)

Virtual Methods

Inherited:

GObject.Object (7), Gio.Initable (1)

do_account_deleted (id)

Properties

Name

Type

Flags

Short Description

abort-on-db-timeout

bool

r/w

Whether to abort the application on DB timeout

db-timeout

int

r/w

Timeout for DB operations (ms)

service-type

str

r/w/co

Set service type

use-dbus

bool

r/w/co

Whether to use D-Bus for IPC

Signals

Inherited:

GObject.Object (1)

Name

Short Description

account-created

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 Accounts.Manager.create_account().

account-deleted

Emitted when an account has been deleted.

account-updated

Emitted when particular service of an account has been updated.

enabled-event

If the manager has been created with Accounts.Manager.new_for_service_type(), this signal will be emitted when an account (identified by account_id) has been modified in such a way that the application might be interested to start or stop using it: the “enabled” flag on the account or in some service supported by the account and matching the Accounts.Manager :service-type have changed.

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent_instance

GObject.Object

r

Class Details

class Accounts.Manager(**kwargs)
Bases:

GObject.Object, Gio.Initable

Abstract:

No

Structure:

Accounts.ManagerClass

Opaque structure. Use related accessor functions.

classmethod list_free(list)
Parameters:

list ([int]) – a GLib.List returned from a Accounts.Manager method which returns account IDs.

Frees the memory taken by a GLib.List of #AgAccountId allocated by Accounts.Manager, such as by Accounts.Manager.list(), Accounts.Manager.list_enabled() or Accounts.Manager.list_enabled_by_service_type().

classmethod new()
Returns:

an instance of an Accounts.Manager.

Return type:

Accounts.Manager

Create a new Accounts.Manager.

classmethod new_for_service_type(service_type)
Parameters:

service_type (str) – the name of a service type

Returns:

an Accounts.Manager instance with the specified service type.

Return type:

Accounts.Manager

Create a new Accounts.Manager with the service type with the name service_type.

create_account(provider_name)
Parameters:

provider_name (str) – name of the provider of the account.

Returns:

a new Accounts.Account, or None.

Return type:

Accounts.Account

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

get_abort_on_db_timeout()
Returns:

True is the library will abort when a timeout error occurs, False otherwise.

Return type:

bool

Get whether the library will abort when a timeout error occurs.

get_account(account_id)
Parameters:

account_id (int) – the #AgAccountId of the account.

Returns:

an Accounts.Account, on which the client must call GObject.Object.unref() when it is no longer required, or None if an error occurs.

Return type:

Accounts.Account

Instantiates the object representing the account identified by account_id.

get_account_services()
Returns:

a list of Accounts.AccountService objects. When done with it, call GObject.Object.unref() on the list elements, and g_list_free() on the container.

Return type:

[Accounts.AccountService]

Gets all the account services. If the self was created for a specific service type, only services with that type will be returned.

This method causes the loading of all the service settings for all the returned accounts (unless they have been loaded previously). If you are interested in a specific account/service, consider using Accounts.Manager.load_account() to first load the the account, and then create the Accounts.AccountService for that account only.

get_application(application_name)
Parameters:

application_name (str) – the name of an application to search for

Returns:

a new Accounts.Application if one was found, None otherwise

Return type:

Accounts.Application

Search for application_name in the list of applications, and return a new Accounts.Application if a matching application was found.

get_db_timeout()
Returns:

the timeout (in milliseconds) for database operations.

Return type:

int

Get the timeout of database operations for self, in milliseconds.

get_enabled_account_services()
Returns:

a list of Accounts.AccountService objects. When done with it, call GObject.Object.unref() on the list elements, and g_list_free() on the container.

Return type:

[Accounts.AccountService]

Gets all the enabled account services. If the self was created for a specific service type, only services with that type will be returned.

This method causes the loading of all the service settings for all the returned accounts (unless they have been loaded previously). If you are interested in a specific account/service, consider using Accounts.Manager.load_account() to first load the the account, and then create the Accounts.AccountService for that account only.

get_provider(provider_name)
Parameters:

provider_name (str) – the name of the provider.

Returns:

an Accounts.Provider, which must be free’d with Accounts.Provider.unref() when no longer required.

Return type:

Accounts.Provider

Loads the provider identified by provider_name.

get_service(service_name)
Parameters:

service_name (str) – the name of the service.

Returns:

an Accounts.Service, which must be free’d with Accounts.Service.unref() when no longer required.

Return type:

Accounts.Service

Loads the service identified by service_name.

get_service_type()
Returns:

the name of the service type for the supplied self.

Return type:

str

Get the service type for self.

list()
Returns:

a GLib.List of #AgAccountId representing the accounts. Must be free’d with Accounts.Manager.list_free() when no longer required.

Return type:

[int]

Lists the accounts. If the Accounts.Manager is created with a specified Accounts.Manager :service-type, it will return only the accounts supporting this service type.

list_applications_by_service(service)
Parameters:

service (Accounts.Service) – the Accounts.Service for which we want to get the applications list.

Returns:

a GLib.List of all the applications which have declared support for the given service or for its service type.

Return type:

[Accounts.Application]

Lists the registered applications which support the given service.

list_by_service_type(service_type)
Parameters:

service_type (str) – the name of the service type to check for.

Returns:

a GLib.List of #AgAccountId representing the accounts. Must be free’d with Accounts.Manager.list_free() when no longer required.

Return type:

[int]

Lists the accounts supporting the given service type.

list_enabled()
Returns:

a GLib.List of the enabled #AgAccountId representing the accounts. Must be free’d with Accounts.Manager.list_free() when no longer required.

Return type:

[int]

Lists the enabled accounts.

list_enabled_by_service_type(service_type)
Parameters:

service_type (str) – the name of the service type to check for.

Returns:

a GLib.List of the enabled #AgAccountId representing the accounts. Must be free’d with Accounts.Manager.list_free() when no longer required.

Return type:

[int]

Lists the enabled accounts supporting the given service type.

list_providers()
Returns:

a list of Accounts.Provider, which must be then free’d with Accounts.Provider.list_free().

Return type:

[Accounts.Provider]

Gets a list of all the installed providers.

list_service_types()
Returns:

a list of Accounts.ServiceType, which must be free’d with Accounts.ServiceType.list_free() when no longer required.

Return type:

[Accounts.ServiceType]

Gets a list of all the installed service types.

list_services()
Returns:

a list of Accounts.Service, which must be free’d with Accounts.Service.list_free() when no longer required.

Return type:

[Accounts.Service]

Gets a list of all the installed services. If the Accounts.Manager was created with a specified #AgManager:service_type it will return only the installed services supporting that service type.

list_services_by_application(application)
Parameters:

application (Accounts.Application) – a Accounts.Application.

Returns:

a GLib.List of Accounts.Service items representing all the services which are supported. Must be free’d with Accounts.Service.list_free().

Return type:

[Accounts.Service]

Get the list of services that are supported by application.

list_services_by_type(service_type)
Parameters:

service_type (str) – the type of the service.

Returns:

a list of Accounts.Service, which must be free’d with Accounts.Service.list_free() when no longer required.

Return type:

[Accounts.Service]

Gets a list of all the installed services where the service type name is service_type.

load_account(account_id)
Parameters:

account_id (int) – the #AgAccountId of the account.

Raises:

GLib.Error

Returns:

an Accounts.Account, on which the client must call GObject.Object.unref() when it is no longer required, or None if an error occurs.

Return type:

Accounts.Account

Instantiates the object representing the account identified by account_id.

load_service_type(service_type)
Parameters:

service_type (str) – the name of the service type.

Returns:

an Accounts.ServiceType, which must be free’d with Accounts.ServiceType.unref() when no longer required.

Return type:

Accounts.ServiceType

Instantiate the service type with the name service_type.

set_abort_on_db_timeout(abort)
Parameters:

abort (bool) – whether to abort when a DB timeout occurs.

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

set_db_timeout(timeout_ms)
Parameters:

timeout_ms (int) – the new timeout, in milliseconds.

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.

do_account_deleted(id) virtual
Parameters:

id (int) –

Signal Details

Accounts.Manager.signals.account_created(manager, account_id)
Signal Name:

account-created

Flags:

RUN_LAST

Parameters:
  • manager (Accounts.Manager) – The object which received the signal

  • account_id (int) – the #AgAccountId of the account that has been created.

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 Accounts.Manager.create_account().

Accounts.Manager.signals.account_deleted(manager, account_id)
Signal Name:

account-deleted

Flags:

RUN_LAST

Parameters:
  • manager (Accounts.Manager) – The object which received the signal

  • account_id (int) – the #AgAccountId of the account that has been deleted.

Emitted when an account has been deleted. This signal is redundant with Accounts.Account ::deleted, but it is convenient to provide full change notification with Accounts.Manager.

Accounts.Manager.signals.account_updated(manager, account_id)
Signal Name:

account-updated

Flags:

RUN_LAST

Parameters:
  • manager (Accounts.Manager) – The object which received the signal

  • account_id (int) – the #AgAccountId of the account that has been update.

Emitted when particular service of an account has been updated. This signal is redundant with Accounts.Account ::deleted, but it is convenient to provide full change notification with Accounts.Manager.

Accounts.Manager.signals.enabled_event(manager, account_id)
Signal Name:

enabled-event

Flags:

RUN_LAST

Parameters:
  • manager (Accounts.Manager) – The object which received the signal

  • account_id (int) – the #AgAccountId of the account that has been enabled.

If the manager has been created with Accounts.Manager.new_for_service_type(), this signal will be emitted when an account (identified by account_id) has been modified in such a way that the application might be interested to start or stop using it: the “enabled” flag on the account or in some service supported by the account and matching the Accounts.Manager :service-type have changed. In practice, this signal might be emitted more often than when strictly needed; applications must call Accounts.Account.list_enabled_services() or Accounts.Manager.list_enabled() to get the current state.

Property Details

Accounts.Manager.props.abort_on_db_timeout
Name:

abort-on-db-timeout

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether to abort the application when a database timeout occurs.

Accounts.Manager.props.db_timeout
Name:

db-timeout

Type:

int

Default Value:

5000

Flags:

READABLE, WRITABLE

Timeout for database operations, in milliseconds.

Accounts.Manager.props.service_type
Name:

service-type

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

If the service type is set, certain operations on the Accounts.Manager, such as Accounts.Manager.list() and Accounts.Manager.list_services(), will be restricted to only affect accounts or services with that service type.

Accounts.Manager.props.use_dbus
Name:

use-dbus

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

Whether to use D-Bus for inter-process change notification. Setting this property to False causes libaccounts not to emit the change notification signals, and also not react to changes made by other processes. Disabling D-Bus is only meant to be used for specific cases, such as maintenance programs.