EBackend.CollectionBackend¶
- Subclasses:
Methods¶
- Inherited:
- Structs:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
|---|---|---|---|
r |
The proxy resolver for this backend |
||
r/w/co |
The server to which the backend belongs |
Signals¶
- Inherited:
Name |
Short Description |
|---|---|
Emitted when an |
|
Emitted when an |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
|---|---|---|---|
parent |
r |
Class Details¶
- class EBackend.CollectionBackend(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Contains only private data that should be read and manipulated using the functions below.
New in version 3.6.
- authenticate_children(credentials)¶
- Parameters:
credentials (
EDataServer.NamedParameters) – credentials to authenticate with
Authenticates all enabled children sources with the given crendetials. This is usually called when the collection source successfully used the credentials to connect to the (possibly) remote data store, to open the childern too. Already connected child sources are skipped.
New in version 3.16.
- claim_all_resources()¶
- Returns:
a list of previously used sources
- Return type:
[
EDataServer.Source] orNone
Claims all previously used sources that have not yet been claimed by
EBackend.CollectionBackend.new_child() and returns them in aGLib.List. Note that previously used sources can only be claimed once, so subsequent calls to this function for self will returnNone.The self is then expected to compare the returned list with a current list of resources from a remote server, create new
EDataServer.Sourceinstances as needed withEBackend.CollectionBackend.new_child(), discard unneededEDataServer.Sourceinstances withEDataServer.Source.remove(), and export the remaining instances withEBackend.SourceRegistryServer.add_source().The sources returned in the list are referenced for thread-safety. They must each be unreferenced with
GObject.Object.unref() when finished with them. Free the returnedGLib.Listitself with g_list_free().An easy way to free the list properly in one step is as follows:
g_list_free_full (list, g_object_unref);New in version 3.6.
- create_resource(source, cancellable, callback, *user_data)¶
- Parameters:
source (
EDataServer.Source) – anEDataServer.Sourcecancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject, orNonecallback (
Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfieduser_data (
objectorNone) – data to pass to the callback function
Asynchronously creates a server-side resource described by source. For example, if source describes a new calendar, an equivalent calendar is created on the server.
It is the implementor’s responsibility to examine source and determine what the equivalent server-side resource would be. If this cannot be determined without ambiguity, the function must return an error.
After the server-side resource is successfully created, the implementor must also add an
EDataServer.Sourceto self'sEBackend.CollectionBackend:server. This can either be done immediately or in response to some “resource created” notification from the server. The addedEDataServer.Sourcecan be source itself or a differentEDataServer.Sourceinstance that describes the new resource.When the operation is finished, callback will be called. You can then call
EBackend.CollectionBackend.create_resource_finish() to get the result of the operation.New in version 3.6.
- create_resource_finish(result)¶
- Parameters:
result (
Gio.AsyncResult) – aGio.AsyncResult- Raises:
- Returns:
- Return type:
Finishes the operation started with
EBackend.CollectionBackend.create_resource().If an error occurred, the function will set error and return
False.New in version 3.6.
- create_resource_sync(source, cancellable)¶
- Parameters:
source (
EDataServer.Source) – anEDataServer.Sourcecancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject, orNone
- Raises:
- Returns:
- Return type:
Creates a server-side resource described by source. For example, if source describes a new calendar, an equivalent calendar is created on the server.
It is the implementor’s responsibility to examine source and determine what the equivalent server-side resource would be. If this cannot be determined without ambiguity, the function must return an error.
After the server-side resource is successfully created, the implementor must also add an
EDataServer.Sourceto self'sEBackend.CollectionBackend:server. This can either be done immediately or in response to some “resource created” notification from the server. The addedEDataServer.Sourcecan be source itself or a differentEDataServer.Sourceinstance that describes the new resource.If an error occurs, the function will set error and return
False.New in version 3.6.
- delete_resource(source, cancellable, callback, *user_data)¶
- Parameters:
source (
EDataServer.Source) – anEDataServer.Sourcecancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject, orNonecallback (
Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfieduser_data (
objectorNone) – data to pass to the callback function
Asynchronously deletes a server-side resource described by source. The source must be a child of self's collection
EBackend.Backend:source.After the server-side resource is successfully deleted, the implementor must also remove source from the self's
EBackend.CollectionBackend:server. This can either be done immediately or in response to some “resource deleted” notification from the server.When the operation is finished, callback will be called. You can then call
EBackend.CollectionBackend.delete_resource_finish() to get the result of the operation.New in version 3.6.
- delete_resource_finish(result)¶
- Parameters:
result (
Gio.AsyncResult) – aGio.AsyncResult- Raises:
- Returns:
- Return type:
Finishes the operation started with
EBackend.CollectionBackend.delete_resource().If an error occurred, the function will set error and return
False.New in version 3.6.
- delete_resource_sync(source, cancellable)¶
- Parameters:
source (
EDataServer.Source) – anEDataServer.Sourcecancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject, orNone
- Raises:
- Returns:
- Return type:
Deletes a server-side resource described by source. The source must be a child of self's collection
EBackend.Backend:source.After the server-side resource is successfully deleted, the implementor must also remove source from the self's
EBackend.CollectionBackend:server. This can either be done immediately or in response to some “resource deleted” notification from the server.If an error occurs, the function will set error and return
False.New in version 3.6.
- dup_resource_id(child_source)¶
- Parameters:
child_source (
EDataServer.Source) – anEDataServer.Sourcemanaged by self- Returns:
a newly-allocated resource ID for child_source, or
None- Return type:
Extracts the resource ID for child_source, which is supposed to be a stable and unique server-assigned identifier for the remote resource described by child_source. If child_source is not actually a child of the collection
EBackend.Backend:sourceowned by self, the function returnsNone.The returned string should be freed with
GLib.free() when no longer needed.New in version 3.6.
- freeze_populate()¶
-
Freezes populate of the backend’s content. This is used to avoid calling populate multiple times in parallel. Every call to this function should be followed by the call of
EBackend.CollectionBackend.thaw_populate() to reverse the effect of this function, regardless of the return value of this function.New in version 3.38.
- get_cache_dir()¶
- Returns:
the cache directory for self
- Return type:
Returns the private cache directory path for self, which is named after the
EDataServer.Source:uidof self's collectionEBackend.Backend:source.The cache directory is meant to store key files for backend-created data sources. See also:
EBackend.ServerSideSource.set_write_directory()New in version 3.6.
- get_part_enabled(parts)¶
- Parameters:
parts (
EBackend.CollectionBackendParts) – a bit-or ofEBackend.CollectionBackendPartswith parts to be checked- Returns:
True, when at least one of the parts is enabled and the backend’sEDataServer.Sourceis enabled as well.- Return type:
Checks whether the self has enabled at least of the parts.
New in version 3.40.
- get_populate_frozen()¶
- Returns:
Whether the backend has currently frozen (disabled) populate of its content.
- Return type:
New in version 3.38.
- is_new_source(source)¶
- Parameters:
source (
EDataServer.Source) – a childEDataServer.Source- Returns:
True, when the source is a new child;Falsewhen it had been known before.- Return type:
Returns whether the source is a newly created child or not. New sources are remembered between two populate calls only.
New in version 3.32.
- list_calendar_sources()¶
- Returns:
a list of calendar sources
- Return type:
Returns a list of calendar sources belonging to the data source collection managed by self.
The sources returned in the list are referenced for thread-safety. They must each be unreferenced with
GObject.Object.unref() when finished with them. Free the returnedGLib.Listitself with g_list_free().An easy way to free the list properly in one step is as follows:
g_list_free_full (list, g_object_unref);New in version 3.6.
- list_contacts_sources()¶
- Returns:
a list of address book sources
- Return type:
Returns a list of address book sources belonging to the data source collection managed by self.
The sources returned in the list are referenced for thread-safety. They must each be unreferenced with
GObject.Object.unref() when finished with them. Free the returnedGLib.Listitself with g_list_free().An easy way to free the list properly in one step is as follows:
g_list_free_full (list, g_object_unref);New in version 3.6.
- list_mail_sources()¶
- Returns:
a list of mail sources
- Return type:
Returns a list of mail sources belonging to the data source collection managed by self.
The sources returned in the list are referenced for thread-safety. They must each be unreferenced with
GObject.Object.unref() when finished with them. Free the returnedGLib.Listitself with g_list_free().An easy way to free the list properly in one step is as follows:
g_list_free_full (list, g_object_unref);New in version 3.6.
- new_child(resource_id)¶
- Parameters:
resource_id (
str) – a stable and unique resource ID- Returns:
a newly-created data source
- Return type:
Creates a new
EBackend.ServerSideSourceas a child of the collectionEBackend.Backend:sourceowned by self. If possible, theEBackend.ServerSideSourceis drawn from a cache of previously used sources indexed by resource_id so that locally cached data from previous sessions can be reused.The returned data source should be passed to
EBackend.SourceRegistryServer.add_source() to export it over D-Bus.New in version 3.6.
- ref_proxy_resolver()¶
- Returns:
a
Gio.ProxyResolver, orNone- Return type:
Returns the
Gio.ProxyResolverfor self (if applicable), as indicated by theEDataServer.SourceAuthentication:proxy-uidof self'sEBackend.Backend:sourceor one of its ancestors.The returned
Gio.ProxyResolveris referenced for thread-safety and must be unreferenced withGObject.Object.unref() when finished with it.New in version 3.12.
- ref_server()¶
- Returns:
the
EBackend.SourceRegistryServerfor self- Return type:
Returns the
EBackend.SourceRegistryServerto which self belongs.The returned
EBackend.SourceRegistryServeris referenced for thread-safety. Unreference theEBackend.SourceRegistryServerwithGObject.Object.unref() when finished with it.New in version 3.6.
- schedule_populate()¶
Schedules a call to populate() of the self on idle. The function does nothing in case the self is offline.
New in version 3.30.
- thaw_populate()¶
Thaws populate of the backend’s content. This is a pair function for
EBackend.CollectionBackend.freeze_populate().New in version 3.38.
- do_child_added(child_source) virtual¶
- Parameters:
child_source (
EDataServer.Source) –
- do_child_removed(child_source) virtual¶
- Parameters:
child_source (
EDataServer.Source) –
- do_create_resource(source, cancellable, callback, *user_data) virtual¶
- Parameters:
source (
EDataServer.Source) – anEDataServer.Sourcecancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject, orNonecallback (
Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfieduser_data (
objectorNone) – data to pass to the callback function
Asynchronously creates a server-side resource described by source. For example, if source describes a new calendar, an equivalent calendar is created on the server.
It is the implementor’s responsibility to examine source and determine what the equivalent server-side resource would be. If this cannot be determined without ambiguity, the function must return an error.
After the server-side resource is successfully created, the implementor must also add an
EDataServer.Sourceto backend'sEBackend.CollectionBackend:server. This can either be done immediately or in response to some “resource created” notification from the server. The addedEDataServer.Sourcecan be source itself or a differentEDataServer.Sourceinstance that describes the new resource.When the operation is finished, callback will be called. You can then call
EBackend.CollectionBackend.create_resource_finish() to get the result of the operation.New in version 3.6.
- do_create_resource_finish(result) virtual¶
- Parameters:
result (
Gio.AsyncResult) – aGio.AsyncResult- Returns:
- Return type:
Finishes the operation started with
EBackend.CollectionBackend.create_resource().If an error occurred, the function will set error and return
False.New in version 3.6.
- do_create_resource_sync(source, cancellable) virtual¶
- Parameters:
source (
EDataServer.Source) – anEDataServer.Sourcecancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject, orNone
- Returns:
- Return type:
Creates a server-side resource described by source. For example, if source describes a new calendar, an equivalent calendar is created on the server.
It is the implementor’s responsibility to examine source and determine what the equivalent server-side resource would be. If this cannot be determined without ambiguity, the function must return an error.
After the server-side resource is successfully created, the implementor must also add an
EDataServer.Sourceto backend'sEBackend.CollectionBackend:server. This can either be done immediately or in response to some “resource created” notification from the server. The addedEDataServer.Sourcecan be source itself or a differentEDataServer.Sourceinstance that describes the new resource.If an error occurs, the function will set error and return
False.New in version 3.6.
- do_delete_resource(source, cancellable, callback, *user_data) virtual¶
- Parameters:
source (
EDataServer.Source) – anEDataServer.Sourcecancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject, orNonecallback (
Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfieduser_data (
objectorNone) – data to pass to the callback function
Asynchronously deletes a server-side resource described by source. The source must be a child of backend's collection
EBackend.Backend:source.After the server-side resource is successfully deleted, the implementor must also remove source from the backend's
EBackend.CollectionBackend:server. This can either be done immediately or in response to some “resource deleted” notification from the server.When the operation is finished, callback will be called. You can then call
EBackend.CollectionBackend.delete_resource_finish() to get the result of the operation.New in version 3.6.
- do_delete_resource_finish(result) virtual¶
- Parameters:
result (
Gio.AsyncResult) – aGio.AsyncResult- Returns:
- Return type:
Finishes the operation started with
EBackend.CollectionBackend.delete_resource().If an error occurred, the function will set error and return
False.New in version 3.6.
- do_delete_resource_sync(source, cancellable) virtual¶
- Parameters:
source (
EDataServer.Source) – anEDataServer.Sourcecancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject, orNone
- Returns:
- Return type:
Deletes a server-side resource described by source. The source must be a child of backend's collection
EBackend.Backend:source.After the server-side resource is successfully deleted, the implementor must also remove source from the backend's
EBackend.CollectionBackend:server. This can either be done immediately or in response to some “resource deleted” notification from the server.If an error occurs, the function will set error and return
False.New in version 3.6.
- do_dup_resource_id(child_source) virtual¶
- Parameters:
child_source (
EDataServer.Source) – anEDataServer.Sourcemanaged by backend- Returns:
a newly-allocated resource ID for child_source, or
None- Return type:
Extracts the resource ID for child_source, which is supposed to be a stable and unique server-assigned identifier for the remote resource described by child_source. If child_source is not actually a child of the collection
EBackend.Backend:sourceowned by backend, the function returnsNone.The returned string should be freed with
GLib.free() when no longer needed.New in version 3.6.
- do_populate() virtual¶
Signal Details¶
- EBackend.CollectionBackend.signals.child_added(collection_backend, child_source)¶
- Signal Name:
child-added- Flags:
- Parameters:
collection_backend (
EBackend.CollectionBackend) – The object which received the signalchild_source (
EBackend.ServerSideSource) – the newly-added childEBackend.ServerSideSource
Emitted when an
EBackend.ServerSideSourceis added to backend'sEBackend.CollectionBackend:serveras a child of backend's collectionEBackend.Backend:source.You can think of this as a filtered version of
EBackend.SourceRegistryServer'sEBackend.SourceRegistryServer::source-addedsignal which only lets through sources relevant to backend.
- EBackend.CollectionBackend.signals.child_removed(collection_backend, child_source)¶
- Signal Name:
child-removed- Flags:
- Parameters:
collection_backend (
EBackend.CollectionBackend) – The object which received the signalchild_source (
EBackend.ServerSideSource) – the childEBackend.ServerSideSourcethat got removed
Emitted when an
EBackend.ServerSideSourcethat is a child of backend's collectionEBackend.Backend:sourceis removed from backend'sEBackend.CollectionBackend:server.You can think of this as a filtered version of
EBackend.SourceRegistryServer'sEBackend.SourceRegistryServer::source-removedsignal which only lets through sources relevant to backend.
Property Details¶
- EBackend.CollectionBackend.props.proxy_resolver¶
- Name:
proxy-resolver- Type:
- Default Value:
- Flags:
The proxy resolver for this backend
- EBackend.CollectionBackend.props.server¶
- Name:
server- Type:
- Default Value:
- Flags:
The server to which the backend belongs