Gio.Vfs

g GObject.Object GObject.Object Gio.Vfs Gio.Vfs GObject.Object->Gio.Vfs

Subclasses:None

Methods

Inherited:GObject.Object (37)
Structs:GObject.ObjectClass (5)
class get_default ()
class get_local ()
  get_file_for_path (path)
  get_file_for_uri (uri)
  get_supported_uri_schemes ()
  is_active ()
  parse_name (parse_name)
  register_uri_scheme (scheme, uri_func, uri_data, parse_name_func, *parse_name_data)
  unregister_uri_scheme (scheme)

Virtual Methods

Inherited:GObject.Object (7)
  do_add_writable_namespaces (list)
  do_get_file_for_path (path)
  do_get_file_for_uri (uri)
  do_get_supported_uri_schemes ()
  do_is_active ()
  do_local_file_add_info (filename, device, attribute_matcher, info, cancellable, extra_data, free_extra_data)
  do_local_file_moved (source, dest)
  do_local_file_removed (filename)
  do_local_file_set_attributes (filename, info, flags, cancellable)
  do_parse_name (parse_name)

Properties

None

Signals

Inherited:GObject.Object (1)

Fields

Inherited:GObject.Object (1)
Name Type Access Description
parent_instance GObject.Object r  

Class Details

class Gio.Vfs(**kwargs)
Bases:GObject.Object
Abstract:No
Structure:Gio.VfsClass

Entry point for using GIO functionality.

classmethod get_default()[source]
Returns:a Gio.Vfs.
Return type:Gio.Vfs

Gets the default Gio.Vfs for the system.

classmethod get_local()[source]
Returns:a Gio.Vfs.
Return type:Gio.Vfs

Gets the local Gio.Vfs for the system.

get_file_for_path(path)[source]
Parameters:path (str) – a string containing a VFS path.
Returns:a Gio.File. Free the returned object with GObject.Object.unref().
Return type:Gio.File

Gets a Gio.File for path.

get_file_for_uri(uri)[source]
Parameters:uri (str) – a string containing a URI
Returns:a Gio.File. Free the returned object with GObject.Object.unref().
Return type:Gio.File

Gets a Gio.File for uri.

This operation never fails, but the returned object might not support any I/O operation if the URI is malformed or if the URI scheme is not supported.

get_supported_uri_schemes()[source]
Returns:a None-terminated array of strings. The returned array belongs to GIO and must not be freed or modified.
Return type:[str]

Gets a list of URI schemes supported by self.

is_active()[source]
Returns:True if construction of the self was successful and it is now active.
Return type:bool

Checks if the VFS is active.

parse_name(parse_name)[source]
Parameters:parse_name (str) – a string to be parsed by the VFS module.
Returns:a Gio.File for the given parse_name. Free the returned object with GObject.Object.unref().
Return type:Gio.File

This operation never fails, but the returned object might not support any I/O operations if the parse_name cannot be parsed by the Gio.Vfs module.

register_uri_scheme(scheme, uri_func, uri_data, parse_name_func, *parse_name_data)[source]
Parameters:
Returns:

True if scheme was successfully registered, or False if a handler for scheme already exists.

Return type:

bool

Registers uri_func and parse_name_func as the Gio.File 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 Gio.Vfs backends.

When a Gio.File is requested with an URI containing scheme (e.g. through Gio.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 Gio.Vfs.register_uri_scheme() or Gio.Vfs.unregister_uri_scheme().

When Gio.File.parse_name() is called with a parse name obtained from such file, parse_name_func will be called to allow the Gio.File to be created again. In that case, it’s responsibility of parse_name_func to make sure the parse name matches what the custom Gio.File implementation returned when Gio.File.get_parse_name() was previously called. The implementation of parse_name_func should not be blocking, and must not call Gio.Vfs.register_uri_scheme() or Gio.Vfs.unregister_uri_scheme().

It’s an error to call this function twice with the same scheme. To unregister a custom URI scheme, use Gio.Vfs.unregister_uri_scheme().

New in version 2.50.

unregister_uri_scheme(scheme)[source]
Parameters:scheme (str) – an URI scheme, e.g. “http”
Returns:True if scheme was successfully unregistered, or False if a handler for scheme does not exist.
Return type:bool

Unregisters the URI handler for scheme previously registered with Gio.Vfs.register_uri_scheme().

New in version 2.50.

do_add_writable_namespaces(list) virtual
Parameters:list (Gio.FileAttributeInfoList) –
do_get_file_for_path(path) virtual
Parameters:path (str) – a string containing a VFS path.
Returns:a Gio.File. Free the returned object with GObject.Object.unref().
Return type:Gio.File

Gets a Gio.File for path.

do_get_file_for_uri(uri) virtual
Parameters:uri (str) – a string containing a URI
Returns:a Gio.File. Free the returned object with GObject.Object.unref().
Return type:Gio.File

Gets a Gio.File for uri.

This operation never fails, but the returned object might not support any I/O operation if the URI is malformed or if the URI scheme is not supported.

do_get_supported_uri_schemes() virtual
Returns:a None-terminated array of strings. The returned array belongs to GIO and must not be freed or modified.
Return type:[str]

Gets a list of URI schemes supported by vfs.

do_is_active() virtual
Returns:True if construction of the vfs was successful and it is now active.
Return type:bool

Checks if the VFS is active.

do_local_file_add_info(filename, device, attribute_matcher, info, cancellable, extra_data, free_extra_data) virtual
Parameters:
do_local_file_moved(source, dest) virtual
Parameters:
  • source (str) –
  • dest (str) –
do_local_file_removed(filename) virtual
Parameters:filename (str) –
do_local_file_set_attributes(filename, info, flags, cancellable) virtual
Parameters:
Return type:

bool

do_parse_name(parse_name) virtual
Parameters:parse_name (str) – a string to be parsed by the VFS module.
Returns:a Gio.File for the given parse_name. Free the returned object with GObject.Object.unref().
Return type:Gio.File

This operation never fails, but the returned object might not support any I/O operations if the parse_name cannot be parsed by the Gio.Vfs module.