EBackend.SourceRegistryServer¶
- Subclasses:
None
Methods¶
- Inherited:
EBackend.DataFactory (12), EBackend.DBusServer (5), GObject.Object (37), EDataServer.Extensible (3), Gio.Initable (2), EBackend.OAuth2Support (3)
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
EBackend.DataFactory (3), EBackend.DBusServer (5), GObject.Object (7), Gio.Initable (1), EBackend.OAuth2Support (3)
|
|
|
|
|
|
|
Properties¶
- Inherited:
Signals¶
- Inherited:
Name |
Short Description |
|---|---|
Emitted after all data source key files are loaded on startup. |
|
Emitted when an error occurs while loading or parsing a data source key file. |
|
Emitted when an |
|
Emitted when an |
|
Emitted from |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
|---|---|---|---|
parent |
r |
Class Details¶
- class EBackend.SourceRegistryServer(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
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:
Creates a new instance of
EBackend.SourceRegistryServer.New in version 3.6.
- add_source(source)¶
- Parameters:
source (
EDataServer.Source) – anEDataServer.Source
Adds source to self.
New in version 3.6.
- find_extension(source, extension_name)¶
- Parameters:
source (
EDataServer.Source) – anEDataServer.Sourceextension_name (
str) – the extension name to find
- Returns:
an
EDataServer.Source, orNoneif no match was found- Return type:
Examines source and its ancestors and returns the “deepest”
EDataServer.Sourcehaving anEDataServer.SourceExtensionwith the given extension_name. If neither source nor any of its ancestors have such an extension, the function returnsNone.This function is useful in cases when an
EDataServer.SourceExtensionis meant to apply to both theEDataServer.Sourceit belongs to and theEDataServer.Source's descendants.A common example is the
EDataServer.SourceCollectionextension, where descendants of anEDataServer.Sourcehaving anEDataServer.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 withGObject.Object.unref() when finished with it.Note the function returns the
EDataServer.Sourcecontaining theEDataServer.SourceExtensioninstead of theEDataServer.SourceExtensionitself because extension instances are not to be referenced directly (seeEDataServer.Source.get_extension()).New in version 3.8.
- get_oauth2_services()¶
- Returns:
an
EDataServer.OAuth2Servicesinstance owned by self- Return type:
New in version 3.28.
- list_sources(extension_name)¶
- Parameters:
- Returns:
a sorted list of sources
- Return type:
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 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.
- load_directory(path, flags)¶
- Parameters:
path (
str) – the path to the directory to loadflags (
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.
- load_error(file, error)¶
- Parameters:
error (
GLib.Error) – aGLib.Errordescribing the load error
Emits the
EBackend.SourceRegistryServer::load-errorsignal.New in version 3.6.
- load_file(file, flags)¶
- Parameters:
file (
Gio.File) – the data source key file to loadflags (
EBackend.SourcePermissionFlags) – initial permission flags for the data source
- Raises:
- Returns:
the newly-added
EDataServer.Source, orNoneon error- Return type:
Creates an
EDataServer.Sourcefor a native key file and adds it to self. If an error occurs, the function returnsNoneand sets error.The returned
EDataServer.Sourceis referenced for thread-safety. Unreference theEDataServer.SourcewithGObject.Object.unref() when finished with it.New in version 3.6.
- load_resource(resource, path, flags)¶
- Parameters:
resource (
Gio.Resource) – aGio.Resourcecontaining data source key filespath (
str) – the path to the data source key files inside resourceflags (
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 theEBackend.SourceRegistryServer::load-errorsignal.New in version 3.8.
- ref_backend(source)¶
- Parameters:
source (
EDataServer.Source) – anEDataServer.Source- Returns:
the
EBackend.CollectionBackendfor source, orNone- Return type:
Returns the
EBackend.CollectionBackendassociated with source, orNoneif there is noEBackend.CollectionBackendassociated with source.An
EDataServer.Sourceis associated with anEBackend.CollectionBackendif theEDataServer.Sourcehas anEDataServer.SourceCollectionextension, or if it is a hierarchical descendant of anotherEDataServer.Sourcewhich has anEDataServer.SourceCollectionextension.The returned
EBackend.CollectionBackendis referenced for thread-safety. Unreference theEBackend.CollectionBackendwithGObject.Object.unref() when finished with it.New in version 3.6.
- ref_backend_factory(source)¶
- Parameters:
source (
EDataServer.Source) – anEDataServer.Source- Returns:
the
EBackend.CollectionBackendFactoryfor source, orNone- Return type:
Returns the
EBackend.CollectionBackendFactoryfor source, if available. If source does not have anEDataServer.SourceCollectionextension, or if theEDataServer.SourceCollectionextension names anEDataServer.SourceBackend:backend-namefor which there is no correspondingEBackend.CollectionBackendFactory, the function returnsNone.The returned
EBackend.CollectionBackendFactoryis referenced for thread-safety. Unreference theEBackend.CollectionBackendFactorywithGObject.Object.unref() when finished with it.New in version 3.6.
- ref_credentials_provider()¶
- Returns:
A referenced
EDataServer.SourceCredentialsProvider.- Return type:
Returns a referenced
EDataServer.SourceCredentialsProvider. Unref it withGObject.Object.unref(), when no longer needed.New in version 3.16.
- ref_oauth2_support()¶
- Returns:
the default
EBackend.OAuth2Support, orNone, when none exists- Return type:
Returns the default
EBackend.OAuth2Supportimplementation, which can be used when the source doesn’t have it overwritten.Free the returned object with
GObject.Object.unref(), when no longer needed.New in version 3.40.
- ref_source(uid)¶
- Parameters:
uid (
str) – a unique identifier string- Returns:
an
EDataServer.Source, orNoneif no match was found- Return type:
Looks up an
EDataServer.Sourcein self by its unique identifier string.The returned
EDataServer.Sourceis referenced for thread-safety and must be unreferenced withGObject.Object.unref() when finished with it.New in version 3.6.
- remove_source(source)¶
- Parameters:
source (
EDataServer.Source) – anEDataServer.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:
error (
GLib.Error) – aGLib.Errordescribing the load error
Emits the
EBackend.SourceRegistryServer::load-errorsignal.New in version 3.6.
- 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:
Signal Details¶
- EBackend.SourceRegistryServer.signals.files_loaded(source_registry_server)¶
- Signal Name:
files-loaded- Flags:
- 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 signalerror (
GLib.Error) – aGLib.Errordescribing the error
Emitted when an error occurs while loading or parsing a data source key file.
- 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 signalsource (
EBackend.ServerSideSource) – the newly-addedEBackend.ServerSideSource
Emitted when an
EBackend.ServerSideSourceis added to 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 signalsource (
EBackend.ServerSideSource) – theEBackend.ServerSideSourcethat got removed
Emitted when an
EBackend.ServerSideSourceis removed from 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 signalkey_file (
GLib.KeyFile) – aGLib.KeyFileuid (
str) – a unique identifier string for key_file
- Returns:
- Return type:
Emitted from
EBackend.SourceRegistryServer.load_file() just prior to instantiating anEBackend.ServerSideSource. Signal handlers can tweak the key_file content as necessary and returnTrueto write the modified content back to disk.For the purposes of tweaking, it’s easier to deal with a plain
GLib.KeyFilethan anEDataServer.Sourceinstance. AnEDataServer.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.