Gio.VolumeMonitor¶
class — extends GObject.Object
GVolumeMonitor is for listing the user interesting devices and volumes
on the computer. In other words, what a file selector or file manager
would show in a sidebar.
GVolumeMonitor is not
thread-default-context aware (see
GLib.MainContext.push_thread_default), and so should not be used
other than from the main thread, with no thread-default-context active.
In order to receive updates about volumes and mounts monitored through GVFS, a main loop must be running.
Methods¶
get_connected_drives¶
Gets a list of drives connected to the system.
The returned list should be freed with g_list_free(), after
its elements have been unreffed with GObject.Object.unref.
get_mount_for_uuid¶
Finds a Mount object by its UUID (see Mount.get_uuid)
Parameters:
uuid— the UUID to look for
get_mounts¶
Gets a list of the mounts on the system.
The returned list should be freed with g_list_free(), after
its elements have been unreffed with GObject.Object.unref.
get_volume_for_uuid¶
Finds a Volume object by its UUID (see Volume.get_uuid)
Parameters:
uuid— the UUID to look for
get_volumes¶
Gets a list of the volumes on the system.
The returned list should be freed with g_list_free(), after
its elements have been unreffed with GObject.Object.unref.
Static functions¶
adopt_orphan_mount¶
:::warning Deprecated since 2.20 This API is deprecated. :::
This function should be called by any VolumeMonitor
implementation when a new Mount object is created that is not
associated with a Volume object. It must be called just before
emitting the mount_added signal.
If the return value is not None, the caller must associate the
returned Volume object with the Mount. This involves returning
it in its Mount.get_volume implementation. The caller must
also listen for the "removed" signal on the returned object
and give up its reference when handling that signal
Similarly, if implementing VolumeMonitor.adopt_orphan_mount,
the implementor must take a reference to mount and return it in
its Volume.get_mount implemented. Also, the implementor must
listen for the "unmounted" signal on mount and give up its
reference upon handling that signal.
There are two main use cases for this function.
One is when implementing a user space file system driver that reads
blocks of a block device that is already represented by the native
volume monitor (for example a CD Audio file system driver). Such
a driver will generate its own Mount object that needs to be
associated with the Volume object that represents the volume.
The other is for implementing a VolumeMonitor whose sole purpose
is to return Volume objects representing entries in the users
"favorite servers" list or similar.
Parameters:
mount— aMountobject to find a parent for
get¶
Gets the volume monitor used by gio.
Virtual methods¶
do_drive_changed¶
do_drive_connected¶
do_drive_disconnected¶
do_drive_eject_button¶
do_drive_stop_button¶
do_get_connected_drives¶
Gets a list of drives connected to the system.
The returned list should be freed with g_list_free(), after
its elements have been unreffed with GObject.Object.unref.
do_get_mount_for_uuid¶
Finds a Mount object by its UUID (see Mount.get_uuid)
Parameters:
uuid— the UUID to look for
do_get_mounts¶
Gets a list of the mounts on the system.
The returned list should be freed with g_list_free(), after
its elements have been unreffed with GObject.Object.unref.
do_get_volume_for_uuid¶
Finds a Volume object by its UUID (see Volume.get_uuid)
Parameters:
uuid— the UUID to look for
do_get_volumes¶
Gets a list of the volumes on the system.
The returned list should be freed with g_list_free(), after
its elements have been unreffed with GObject.Object.unref.
do_mount_added¶
do_mount_changed¶
do_mount_pre_unmount¶
do_mount_removed¶
do_volume_added¶
do_volume_changed¶
do_volume_removed¶
Signals¶
drive-changed¶
Emitted when a drive changes.
drive-connected¶
Emitted when a drive is connected to the system.
drive-disconnected¶
Emitted when a drive is disconnected from the system.
drive-eject-button¶
Emitted when the eject button is pressed on drive.
drive-stop-button¶
Emitted when the stop button is pressed on drive.
mount-added¶
Emitted when a mount is added.
mount-changed¶
Emitted when a mount changes.
mount-pre-unmount¶
May be emitted when a mount is about to be removed.
This signal depends on the backend and is only emitted if GIO was used to unmount.
mount-removed¶
Emitted when a mount is removed.
volume-added¶
Emitted when a mountable volume is added to the system.
volume-changed¶
Emitted when mountable volume is changed.
volume-removed¶
Emitted when a mountable volume is removed from the system.