Vfs.registerUriScheme

Registers uri_func and parse_name_func as the GFile URI and parse name lookup functions for URIs with a scheme matching scheme. Note that scheme is registered only within the running application, as opposed to desktop-wide as it happens with GVfs backends.

When a GFile is requested with an URI containing scheme (e.g. through g_file_new_for_uri()), uri_func will be called to allow a custom constructor. The implementation of uri_func should not be blocking, and must not call Vfs.registerUriScheme or Vfs.unregisterUriScheme.

When g_file_parse_name() is called with a parse name obtained from such file, parse_name_func will be called to allow the GFile to be created again. In that case, it's responsibility of parse_name_func to make sure the parse name matches what the custom GFile implementation returned when g_file_get_parse_name() was previously called. The implementation of parse_name_func should not be blocking, and must not call Vfs.registerUriScheme or Vfs.unregisterUriScheme.

It's an error to call this function twice with the same scheme. To unregister a custom URI scheme, use Vfs.unregisterUriScheme.

Parameters

scheme string

an URI scheme, e.g. "http"

uriFunc GVfsFileLookupFunc
uriData void*

custom data passed to be passed to uri_func, or NULL

uriDestroy GDestroyNotify

function to be called when unregistering the URI scheme, or when vfs is disposed, to free the resources used by the URI lookup function

parseNameFunc GVfsFileLookupFunc
parseNameData void*

custom data passed to be passed to parse_name_func, or NULL

parseNameDestroy GDestroyNotify

function to be called when unregistering the URI scheme, or when vfs is disposed, to free the resources used by the parse name lookup function

Return Value

Type: bool

TRUE if scheme was successfully registered, or FALSE if a handler for scheme already exists.

Meta

Since

2.50