EBackend.SourceRegistryServer¶
| Subclasses: | None | 
|---|
Methods¶
| Inherited: | EBackend.DataFactory (12), EBackend.DBusServer (5), GObject.Object (37), EDataServer.Extensible (2), Gio.Initable (2) | 
|---|---|
| Structs: | GObject.ObjectClass (5) | 
| class | new() | 
| add_source(source) | |
| find_extension(source, extension_name) | |
| get_oauth2_services() | |
| list_sources(extension_name) | |
| load_directory(path, flags) | |
| load_error(file, error) | |
| load_file(file, flags) | |
| load_resource(resource, path, flags) | |
| ref_backend(source) | |
| ref_backend_factory(source) | |
| ref_credentials_provider() | |
| ref_source(uid) | |
| remove_source(source) | 
Virtual Methods¶
| Inherited: | EBackend.DataFactory (3), EBackend.DBusServer (5), GObject.Object (7), Gio.Initable (1) | 
|---|
| do_files_loaded() | |
| do_load_error(file, error) | |
| do_source_added(source) | |
| do_source_removed(source) | |
| do_tweak_key_file(key_file, uid) | 
Properties¶
| Inherited: | EBackend.DataFactory (3) | 
|---|
Signals¶
| Inherited: | EBackend.DBusServer (5), GObject.Object (1) | 
|---|
| Name | Short Description | 
|---|---|
| files-loaded | Emitted after all data source key files are loaded on startup. | 
| load-error | Emitted when an error occurs while loading or parsing a data source key file. | 
| source-added | Emitted when an EBackend.ServerSideSourceis added to server. | 
| source-removed | Emitted when an EBackend.ServerSideSourceis removed from server. | 
| tweak-key-file | Emitted from EBackend.SourceRegistryServer.load_file() just prior to instantiating anEBackend.ServerSideSource. | 
Fields¶
| Inherited: | EBackend.DBusServer (5), GObject.Object (1) | 
|---|
| Name | Type | Access | Description | 
|---|---|---|---|
| parent | EBackend.DataFactory | r | 
Class Details¶
- 
class EBackend.SourceRegistryServer(**kwargs)¶
- Bases: - EBackend.DataFactory- Abstract: - No - Structure: - EBackend.SourceRegistryServerClass- Contains only private data that should be read and manipulated using the functions below. - New in version 3.6. - 
classmethod new()¶
- Returns: - a new instance of - EBackend.SourceRegistryServer- Return type: - EBackend.DBusServer- Creates a new instance of - EBackend.SourceRegistryServer.- New in version 3.6. 
 - 
add_source(source)¶
- Parameters: - source ( - EDataServer.Source) – an- EDataServer.Source- Adds source to self. - New in version 3.6. 
 - 
find_extension(source, extension_name)¶
- Parameters: - source (EDataServer.Source) – anEDataServer.Source
- extension_name (str) – the extension name to find
 - Returns: - an - EDataServer.Source, or- Noneif no match was found- Return type: - Examines source and its ancestors and returns the “deepest” - EDataServer.Sourcehaving an- EDataServer.SourceExtensionwith the given extension_name. If neither source nor any of its ancestors have such an extension, the function returns- None.- This function is useful in cases when an - EDataServer.SourceExtensionis meant to apply to both the- EDataServer.Sourceit belongs to and the- EDataServer.Source’s descendants.- A common example is the - EDataServer.SourceCollectionextension, where descendants of an- EDataServer.Sourcehaving an- EDataServer.SourceCollectionextension are implied to be members of that collection. In that example, this function can be used to test whether source is a member of a collection.- The returned - EDataServer.Sourceis referenced for thread-safety and must be unreferenced with- GObject.Object.unref() when finished with it.- Note the function returns the - EDataServer.Sourcecontaining the- EDataServer.SourceExtensioninstead of the- EDataServer.SourceExtensionitself because extension instances are not to be referenced directly (see- EDataServer.Source.get_extension()).- New in version 3.8. 
- source (
 - 
get_oauth2_services()¶
- Returns: - an - EDataServer.OAuth2Servicesinstance owned by self- Return type: - EDataServer.OAuth2Services- New in version 3.28. 
 - 
list_sources(extension_name)¶
- Parameters: - extension_name ( - str) – an extension name, or- None- Returns: - a sorted list of sources - Return type: - [ - EDataServer.Source]- Returns a list of registered sources, sorted by display name. If extension_name is given, restrict the list to sources having that extension name. - 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 returned- GLib.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. 
 - 
load_directory(path, flags)¶
- Parameters: - path (str) – the path to the directory to load
- flags (EBackend.SourcePermissionFlags) – permission flags for files loaded from path
 - Raises: - Returns: - Trueif path was successfully opened, but this does not imply the key files were successfully loaded- Return type: - Loads data source key files in path. Because multiple errors can occur when loading multiple files, error is only set if path can not be opened. If a key file fails to load, the error is broadcast through the - EBackend.SourceRegistryServer- ::load-errorsignal.- If the - EBackend.SourcePermissionFlags.REMOVABLEflag is given, then the self will emit signals on the D-Bus interface when key files are created or deleted in path.- New in version 3.6. 
- path (
 - 
load_error(file, error)¶
- Parameters: - file (Gio.File) – theGio.Filethat failed to load
- error (GLib.Error) – aGLib.Errordescribing the load error
 - Emits the - EBackend.SourceRegistryServer- ::load-errorsignal.- New in version 3.6. 
- file (
 - 
load_file(file, flags)¶
- Parameters: - file (Gio.File) – the data source key file to load
- flags (EBackend.SourcePermissionFlags) – initial permission flags for the data source
 - Raises: - Returns: - the newly-added - EDataServer.Source, or- Noneon error- Return type: - Creates an - EDataServer.Sourcefor a native key file and adds it to self. If an error occurs, the function returns- Noneand sets error.- The returned - EDataServer.Sourceis referenced for thread-safety. Unreference the- EDataServer.Sourcewith- GObject.Object.unref() when finished with it.- New in version 3.6. 
- file (
 - 
load_resource(resource, path, flags)¶
- Parameters: - resource (Gio.Resource) – aGio.Resourcecontaining data source key files
- path (str) – the path to the data source key files inside resource
- flags (EBackend.SourcePermissionFlags) – permission flags for files loaded from path
 - Raises: - Returns: - Trueif path was successfully located, but this does not imply the key files were successfully loaded- Return type: - Loads data source key files from resource by enumerating the children at path and calling - EBackend.SourceRegistryServer.load_file() on each child. Because multiple errors can occur when loading multiple files, error is only set if path is invalid. If a key file fails to load, the error is broadcast through the- EBackend.SourceRegistryServer- ::load-errorsignal.- New in version 3.8. 
- resource (
 - 
ref_backend(source)¶
- Parameters: - source ( - EDataServer.Source) – an- EDataServer.Source- Returns: - the - EBackend.CollectionBackendfor source, or- None- Return type: - EBackend.CollectionBackendor- None- Returns the - EBackend.CollectionBackendassociated with source, or- Noneif there is no- EBackend.CollectionBackendassociated with source.- An - EDataServer.Sourceis associated with an- EBackend.CollectionBackendif the- EDataServer.Sourcehas an- EDataServer.SourceCollectionextension, or if it is a hierarchical descendant of another- EDataServer.Sourcewhich has an- EDataServer.SourceCollectionextension.- The returned - EBackend.CollectionBackendis referenced for thread-safety. Unreference the- EBackend.CollectionBackendwith- GObject.Object.unref() when finished with it.- New in version 3.6. 
 - 
ref_backend_factory(source)¶
- Parameters: - source ( - EDataServer.Source) – an- EDataServer.Source- Returns: - the - EBackend.CollectionBackendFactoryfor source, or- None- Return type: - EBackend.CollectionBackendFactoryor- None- Returns the - EBackend.CollectionBackendFactoryfor source, if available. If source does not have an- EDataServer.SourceCollectionextension, or if the- EDataServer.SourceCollectionextension names a- EDataServer.SourceBackend- :backend-namefor which there is no corresponding- EBackend.CollectionBackendFactory, the function returns- None.- The returned - EBackend.CollectionBackendFactoryis referenced for thread-safety. Unreference the- EBackend.CollectionBackendFactorywith- GObject.Object.unref() when finished with it.- New in version 3.6. 
 - 
ref_credentials_provider()¶
- Returns: - A referenced - EDataServer.SourceCredentialsProvider.- Return type: - EDataServer.SourceCredentialsProvider- Returns a referenced - EDataServer.SourceCredentialsProvider. Unref it with- GObject.Object.unref(), when no longer needed.- New in version 3.16. 
 - 
ref_source(uid)¶
- Parameters: - uid ( - str) – a unique identifier string- Returns: - an - EDataServer.Source, or- Noneif no match was found- Return type: - EDataServer.Sourceor- None- Looks up an - EDataServer.Sourcein self by its unique identifier string.- The returned - EDataServer.Sourceis referenced for thread-safety and must be unreferenced with- GObject.Object.unref() when finished with it.- New in version 3.6. 
 - 
remove_source(source)¶
- Parameters: - source ( - EDataServer.Source) – an- EDataServer.Source- Removes source and all of its descendants from self. - New in version 3.6. 
 - 
do_files_loaded() virtual¶
 - 
do_load_error(file, error) virtual¶
- Parameters: - file (Gio.File) – theGio.Filethat failed to load
- error (GLib.Error) – aGLib.Errordescribing the load error
 - Emits the - EBackend.SourceRegistryServer- ::load-errorsignal.- New in version 3.6. 
- file (
 - 
do_source_added(source) virtual¶
- Parameters: - source ( - EDataServer.Source) –
 - 
do_source_removed(source) virtual¶
- Parameters: - source ( - EDataServer.Source) –
 - 
do_tweak_key_file(key_file, uid) virtual¶
- Parameters: - key_file (GLib.KeyFile) –
- uid (str) –
 - Return type: 
- key_file (
 
- 
classmethod 
Signal Details¶
- 
EBackend.SourceRegistryServer.signals.files_loaded(source_registry_server)¶
- Signal Name: - files-loaded- Flags: - RUN_LAST- Parameters: - source_registry_server ( - EBackend.SourceRegistryServer) – The object which received the signal- Emitted after all data source key files are loaded on startup. Extensions can connect to this signal to perform any additional work prior to running the main loop. 
- 
EBackend.SourceRegistryServer.signals.load_error(source_registry_server, file, error)¶
- Signal Name: - load-error- Flags: - Parameters: - source_registry_server (EBackend.SourceRegistryServer) – The object which received the signal
- file (Gio.File) – theGio.Filebeing loaded
- error (GLib.Error) – aGLib.Errordescribing the error
 - Emitted when an error occurs while loading or parsing a data source key file. 
- source_registry_server (
- 
EBackend.SourceRegistryServer.signals.source_added(source_registry_server, source)¶
- Signal Name: - source-added- Flags: - Parameters: - source_registry_server (EBackend.SourceRegistryServer) – The object which received the signal
- source (EBackend.ServerSideSource) – the newly-addedEBackend.ServerSideSource
 - Emitted when an - EBackend.ServerSideSourceis added to server.
- source_registry_server (
- 
EBackend.SourceRegistryServer.signals.source_removed(source_registry_server, source)¶
- Signal Name: - source-removed- Flags: - Parameters: - source_registry_server (EBackend.SourceRegistryServer) – The object which received the signal
- source (EBackend.ServerSideSource) – theEBackend.ServerSideSourcethat got removed
 - Emitted when an - EBackend.ServerSideSourceis removed from server.
- source_registry_server (
- 
EBackend.SourceRegistryServer.signals.tweak_key_file(source_registry_server, key_file, uid)¶
- Signal Name: - tweak-key-file- Flags: - Parameters: - source_registry_server (EBackend.SourceRegistryServer) – The object which received the signal
- key_file (GLib.KeyFile) – aGLib.KeyFile
- uid (str) – a unique identifier string for key_file
 - Returns: - Return type: - Emitted from - EBackend.SourceRegistryServer.load_file() just prior to instantiating an- EBackend.ServerSideSource. Signal handlers can tweak the key_file content as necessary and return- Trueto write the modified content back to disk.- For the purposes of tweaking, it’s easier to deal with a plain - GLib.KeyFilethan an- EDataServer.Sourceinstance. An- EDataServer.Source, for example, does not allow key file groups to be removed.- The return value is cumulative. If any signal handler returns - True, the key_file content is written back to disk.- New in version 3.8. 
- source_registry_server (