Accounts.Account

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

Subclasses:

None

Methods

Inherited:

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

Structs:

GObject.ObjectClass (5)

delete ()

get_display_name ()

get_enabled ()

get_manager ()

get_provider_name ()

get_selected_service ()

get_settings_iter (key_prefix)

get_value (key, value)

get_variant (key)

list_enabled_services ()

list_services ()

list_services_by_type (service_type)

remove_watch (watch)

select_service (service)

set_display_name (display_name)

set_enabled (enabled)

set_value (key, value)

set_variant (key, value)

settings_iter_init (iter, key_prefix)

sign (key, token)

store (callback, *user_data)

store_async (cancellable, callback, *user_data)

store_blocking ()

store_finish (res)

supports_service (service_type)

verify (key, token)

verify_with_tokens (key, tokens)

watch_dir (key_prefix, callback, *user_data)

watch_key (key, callback, *user_data)

Virtual Methods

Inherited:

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

Properties

Name

Type

Flags

Short Description

display-name

str

r

The display name of the account

enabled

bool

r

Whether the account is enabled

foreign

bool

w/co

foreign

id

int

r/w/co

The AgAccountId of the account

manager

Accounts.Manager

r/w/co

manager

provider

str

r/w/co

provider

Signals

Inherited:

GObject.Object (1)

Name

Short Description

deleted

Emitted when the account has been deleted.

display-name-changed

Emitted when the account display name has changed.

enabled

Emitted when the account “enabled” status was changed for one of its services, or for the account globally.

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

id

int

r

parent_instance

GObject.Object

r

Class Details

class Accounts.Account(**kwargs)
Bases:

GObject.Object, Gio.Initable

Abstract:

No

Structure:

Accounts.AccountClass

Opaque structure. Use related accessor functions.

delete()

Deletes the account. Call Accounts.Account.store() in order to record the change in the storage.

get_display_name()
Returns:

the display name.

Return type:

str

Get the display name of self.

get_enabled()
Returns:

True if the selected service for self is enabled, False otherwise.

Return type:

bool

Gets whether the selected service is enabled for self.

get_manager()
Returns:

the Accounts.Manager.

Return type:

Accounts.Manager

Get the Accounts.Manager for self.

get_provider_name()
Returns:

the name of the provider.

Return type:

str

Get the name of the provider of self.

get_selected_service()
Returns:

the selected service, or None if no service is selected.

Return type:

Accounts.Service

Gets the selected Accounts.Service for self.

get_settings_iter(key_prefix)
Parameters:

key_prefix (str or None) – enumerate only the settings whose key starts with key_prefix.

Returns:

an Accounts.AccountSettingIter.

Return type:

Accounts.AccountSettingIter

Creates a new iterator. This method is useful for language bindings only.

get_value(key, value)
Parameters:
Returns:

one of Accounts.SettingSource: Accounts.SettingSource.NONE if the setting is not present, Accounts.SettingSource.ACCOUNT if the setting comes from the account configuration, or Accounts.SettingSource.PROFILE if the value comes as predefined in the profile.

value:

an initialized GObject.Value to receive the setting’s value.

Return type:

(Accounts.SettingSource, value: GObject.Value)

Gets the value of the configuration setting key: value must be a GObject.Value initialized to the type of the setting.

Deprecated since version 1.4: Use Accounts.Account.get_variant() instead.

get_variant(key)
Parameters:

key (str) – the name of the setting to retrieve.

Returns:

a GLib.Variant holding the setting value, or None. The returned GLib.Variant is owned by the account, and no guarantees are made about its lifetime. If the client wishes to keep it, it should call GLib.Variant.ref() on it.

source:

a pointer to an Accounts.SettingSource variable which will tell whether the setting was retrieved from the accounts DB or from a service template.

Return type:

(GLib.Variant, source: Accounts.SettingSource)

Gets the value of the configuration setting key.

New in version 1.4.

list_enabled_services()
Returns:

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

Return type:

[Accounts.Service]

Gets a list of services that are enabled for self.

list_services()
Returns:

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

Return type:

[Accounts.Service]

Get the list of services for self. If the Accounts.Manager was created with specified service_type this will return only services with this service_type.

list_services_by_type(service_type)
Parameters:

service_type (str) – the service type which all the returned services should provide.

Returns:

a GLib.List of Accounts.Service items representing all the services supported by this account which provide service_type. Must be free’d with Accounts.Service.list_free().

Return type:

[Accounts.Service]

Get the list of services supported by self, filtered by service_type.

remove_watch(watch)
Parameters:

watch (Accounts.AccountWatch) – the watch to remove.

Removes the notification callback identified by watch.

select_service(service)
Parameters:

service (Accounts.Service or None) – the Accounts.Service to select.

Selects the configuration of service service: from now on, all the subsequent calls on the Accounts.Account configuration will act on the service. If service is None, the global account configuration is selected.

Note that if self is being shared with other code one must take special care to make sure the desired service is always selected.

set_display_name(display_name)
Parameters:

display_name (str) – the display name to set.

Changes the display name for self to display_name.

set_enabled(enabled)
Parameters:

enabled (bool) – whether self should be enabled.

Sets the “enabled” flag on the selected service for self.

set_value(key, value)
Parameters:

Sets the value of the configuration setting key to the value value. If value is None, then the setting is unset.

Deprecated since version 1.4: Use Accounts.Account.set_variant() instead.

set_variant(key, value)
Parameters:

Sets the value of the configuration setting key to the value value. If value has a floating reference, the self will take ownership of it. If value is None, then the setting is unset.

New in version 1.4.

settings_iter_init(iter, key_prefix)
Parameters:

Initializes iter to iterate over the account settings. If key_prefix is not None, only keys whose names start with key_prefix will be iterated over.

sign(key, token)
Parameters:
  • key (str) – the name of the key or prefix of the keys to be signed.

  • token (str) – a signing token (None-terminated string) for creating the signature. The application must possess (request) the token.

Creates signature of the key with given token. The account must be stored prior to calling this function.

store(callback, *user_data)
Parameters:
  • callback (Accounts.AccountStoreCb) – function to be called when the settings have been written.

  • user_data (object or None) – pointer to user data, to be passed to callback.

Commit the changed account settings to the account database, and invoke callback when the operation has been completed.

Deprecated since version 1.4: Use Accounts.Account.store_async() instead.

store_async(cancellable, callback, *user_data)
Parameters:

Commit the changed account settings to the account database, and invoke callback when the operation has been completed.

New in version 1.4.

store_blocking()
Raises:

GLib.Error

Returns:

True on success, False on failure.

Return type:

bool

Commit the changed account settings to the account database, and invoke callback when the operation has been completed.

store_finish(res)
Parameters:

res (Gio.AsyncResult) – A Gio.AsyncResult obtained from the Gio.AsyncReadyCallback passed to Accounts.Account.store_async().

Raises:

GLib.Error

Returns:

True on success, False otherwise.

Return type:

bool

Finishes the store operation started by Accounts.Account.store_async().

New in version 1.4.

supports_service(service_type)
Parameters:

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

Returns:

True if self supports the service type service_type, False otherwise.

Return type:

bool

Get whether service_type is supported on self.

verify(key, token)
Parameters:
  • key (str) – the name of the key or prefix of the keys to be verified.

  • token (str) – location to receive the pointer to aegis token.

Returns:

True if the key is signed and the signature matches the value, False otherwise.

Return type:

bool

Verify if the key is signed and the signature matches the value and provides the aegis token which was used for signing the key.

verify_with_tokens(key, tokens)
Parameters:
  • key (str) – the name of the key or prefix of the keys to be verified.

  • tokens (str) – array of aegis tokens.

Returns:

True if the key is signed with any of the given tokens and the signature is valid, False otherwise.

Return type:

bool

Verify if the key is signed with any of the tokens from the tokens and the signature is valid.

watch_dir(key_prefix, callback, *user_data)
Parameters:
Returns:

a Accounts.AccountWatch, which can then be used to remove this watch.

Return type:

Accounts.AccountWatch

Installs a watch on all the keys under key_prefix: callback will be invoked whenever the value of any of these keys changes (or a key is removed).

watch_key(key, callback, *user_data)
Parameters:
Returns:

a Accounts.AccountWatch, which can then be used to remove this watch.

Return type:

Accounts.AccountWatch

Installs a watch on key: callback will be invoked whenever the value of key changes (or the key is removed).

Signal Details

Accounts.Account.signals.deleted(account)
Signal Name:

deleted

Flags:

RUN_LAST

Parameters:

account (Accounts.Account) – The object which received the signal

Emitted when the account has been deleted.

Accounts.Account.signals.display_name_changed(account)
Signal Name:

display-name-changed

Flags:

RUN_LAST

Parameters:

account (Accounts.Account) – The object which received the signal

Emitted when the account display name has changed.

Accounts.Account.signals.enabled(account, service, enabled)
Signal Name:

enabled

Flags:

RUN_LAST

Parameters:
  • account (Accounts.Account) – The object which received the signal

  • service (str) – the service which was enabled/disabled, or None if the global enabledness of the account changed.

  • enabled (bool) – the new state of the account.

Emitted when the account “enabled” status was changed for one of its services, or for the account globally.

Property Details

Accounts.Account.props.display_name
Name:

display-name

Type:

str

Default Value:

None

Flags:

READABLE

The display name of the account.

New in version 1.4.

Accounts.Account.props.enabled
Name:

enabled

Type:

bool

Default Value:

False

Flags:

READABLE

Whether the account is currently enabled.

New in version 1.4.

Accounts.Account.props.foreign
Name:

foreign

Type:

bool

Default Value:

False

Flags:

WRITABLE, CONSTRUCT_ONLY

foreign

Accounts.Account.props.id
Name:

id

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The AgAccountId for the account.

Accounts.Account.props.manager
Name:

manager

Type:

Accounts.Manager

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The Accounts.Manager from which the account was instantiated.

New in version 1.4.

Accounts.Account.props.provider
Name:

provider

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The ID of the provider for the account.

New in version 1.4.