Gio.VolumeMonitor - Classes - Gio 2.0 (original) (raw)
g GObject.Object GObject.Object Gio.VolumeMonitor Gio.VolumeMonitor GObject.Object->Gio.VolumeMonitor
Subclasses:
Methods¶
Inherited:
Structs:
class | adopt_orphan_mount (mount) |
---|---|
class | get () |
get_connected_drives () | |
get_mount_for_uuid (uuid) | |
get_mounts () | |
get_volume_for_uuid (uuid) | |
get_volumes () |
Virtual Methods¶
Inherited:
do_drive_changed (drive) |
---|
do_drive_connected (drive) |
do_drive_disconnected (drive) |
do_drive_eject_button (drive) |
do_drive_stop_button (drive) |
do_get_connected_drives () |
do_get_mount_for_uuid (uuid) |
do_get_mounts () |
do_get_volume_for_uuid (uuid) |
do_get_volumes () |
do_mount_added (mount) |
do_mount_changed (mount) |
do_mount_pre_unmount (mount) |
do_mount_removed (mount) |
do_volume_added (volume) |
do_volume_changed (volume) |
do_volume_removed (volume) |
Properties¶
None
Signals¶
Inherited:
Name | Short Description |
---|---|
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. |
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. |
Fields¶
Inherited:
Name | Type | Access | Description |
---|---|---|---|
parent_instance | GObject.Object | r | |
priv | object | r |
Class Details¶
class Gio.VolumeMonitor(**kwargs)¶
Bases:
Abstract:
No
Structure:
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 [method`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.
classmethod adopt_orphan_mount(mount)[source]¶
Parameters:
mount (Gio.Mount) – a Gio.Mount object to find a parent for
Returns:
the Gio.Volume object that is the parent for mount or Noneif no wants to adopt the Gio.Mount.
Return type:
This function should be called by any Gio.VolumeMonitorimplementation when a new Gio.Mount object is created that is not associated with a Gio.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 Gio.Volume object with the Gio.Mount. This involves returning it in its Gio.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 Gio.VolumeMonitor.adopt_orphan_mount(), the implementor must take a reference to mount and return it in its Gio.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 Gio.Mount object that needs to be associated with the Gio.Volume object that represents the volume.
The other is for implementing a Gio.VolumeMonitor whose sole purpose is to return Gio.Volume objects representing entries in the users “favorite servers” list or similar.
Deprecated since version 2.20: Instead of using this function, Gio.VolumeMonitor implementations should instead create shadow mounts with the URI of the mount they intend to adopt. See the proxy volume monitor in gvfs for an example of this. Also see Gio.Mount.is_shadowed(), Gio.Mount.shadow() and Gio.Mount.unshadow() functions.
Returns:
a reference to the Gio.VolumeMonitor used by gio. CallGObject.Object.unref() when done with it, after disconnecting any signal handlers.
Return type:
Gets the volume monitor used by gio.
get_connected_drives()[source]¶
Returns:
a GLib.List of connected Gio.Drive objects.
Return type:
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(uuid)[source]¶
Parameters:
uuid (str) – the UUID to look for
Returns:
a Gio.Mount or None if no such mount is available. Free the returned object with GObject.Object.unref().
Return type:
Finds a Gio.Mount object by its UUID (see Gio.Mount.get_uuid())
Returns:
a GLib.List of Gio.Mount objects.
Return type:
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(uuid)[source]¶
Parameters:
uuid (str) – the UUID to look for
Returns:
a Gio.Volume or None if no such volume is available. Free the returned object with GObject.Object.unref().
Return type:
Gio.Volume or None
Finds a Gio.Volume object by its UUID (see Gio.Volume.get_uuid())
Returns:
a GLib.List of Gio.Volume objects.
Return type:
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_drive_changed(drive) virtual¶
Parameters:
drive (Gio.Drive) –
do_drive_connected(drive) virtual¶
Parameters:
drive (Gio.Drive) –
do_drive_disconnected(drive) virtual¶
Parameters:
drive (Gio.Drive) –
do_drive_eject_button(drive) virtual¶
Parameters:
drive (Gio.Drive) –
do_drive_stop_button(drive) virtual¶
Parameters:
drive (Gio.Drive) –
do_get_connected_drives() virtual¶
Returns:
a GLib.List of connected Gio.Drive objects.
Return type:
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(uuid) virtual¶
Parameters:
uuid (str) – the UUID to look for
Returns:
a Gio.Mount or None if no such mount is available. Free the returned object with GObject.Object.unref().
Return type:
Finds a Gio.Mount object by its UUID (see Gio.Mount.get_uuid())
do_get_mounts() virtual¶
Returns:
a GLib.List of Gio.Mount objects.
Return type:
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(uuid) virtual¶
Parameters:
uuid (str) – the UUID to look for
Returns:
a Gio.Volume or None if no such volume is available. Free the returned object with GObject.Object.unref().
Return type:
Gio.Volume or None
Finds a Gio.Volume object by its UUID (see Gio.Volume.get_uuid())
do_get_volumes() virtual¶
Returns:
a GLib.List of Gio.Volume objects.
Return type:
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(mount) virtual¶
Parameters:
mount (Gio.Mount) –
do_mount_changed(mount) virtual¶
Parameters:
mount (Gio.Mount) –
do_mount_pre_unmount(mount) virtual¶
Parameters:
mount (Gio.Mount) –
do_mount_removed(mount) virtual¶
Parameters:
mount (Gio.Mount) –
do_volume_added(volume) virtual¶
Parameters:
volume (Gio.Volume) –
do_volume_changed(volume) virtual¶
Parameters:
volume (Gio.Volume) –
do_volume_removed(volume) virtual¶
Parameters:
volume (Gio.Volume) –
Signal Details¶
Gio.VolumeMonitor.signals.drive_changed(volume_monitor, drive)¶
Signal Name:
drive-changed
Flags:
Parameters:
- volume_monitor (Gio.VolumeMonitor) – The object which received the signal
- drive (Gio.Drive) – the drive that changed
Emitted when a drive changes.
Gio.VolumeMonitor.signals.drive_connected(volume_monitor, drive)¶
Signal Name:
drive-connected
Flags:
Parameters:
- volume_monitor (Gio.VolumeMonitor) – The object which received the signal
- drive (Gio.Drive) – a Gio.Drive that was connected.
Emitted when a drive is connected to the system.
Gio.VolumeMonitor.signals.drive_disconnected(volume_monitor, drive)¶
Signal Name:
drive-disconnected
Flags:
Parameters:
- volume_monitor (Gio.VolumeMonitor) – The object which received the signal
- drive (Gio.Drive) – a Gio.Drive that was disconnected.
Emitted when a drive is disconnected from the system.
Gio.VolumeMonitor.signals.drive_eject_button(volume_monitor, drive)¶
Signal Name:
drive-eject-button
Flags:
Parameters:
- volume_monitor (Gio.VolumeMonitor) – The object which received the signal
- drive (Gio.Drive) – the drive where the eject button was pressed
Emitted when the eject button is pressed on drive.
New in version 2.18.
Gio.VolumeMonitor.signals.drive_stop_button(volume_monitor, drive)¶
Signal Name:
drive-stop-button
Flags:
Parameters:
- volume_monitor (Gio.VolumeMonitor) – The object which received the signal
- drive (Gio.Drive) – the drive where the stop button was pressed
Emitted when the stop button is pressed on drive.
New in version 2.22.
Gio.VolumeMonitor.signals.mount_added(volume_monitor, mount)¶
Signal Name:
mount-added
Flags:
Parameters:
- volume_monitor (Gio.VolumeMonitor) – The object which received the signal
- mount (Gio.Mount) – a Gio.Mount that was added.
Emitted when a mount is added.
Gio.VolumeMonitor.signals.mount_changed(volume_monitor, mount)¶
Signal Name:
mount-changed
Flags:
Parameters:
- volume_monitor (Gio.VolumeMonitor) – The object which received the signal
- mount (Gio.Mount) – a Gio.Mount that changed.
Emitted when a mount changes.
Gio.VolumeMonitor.signals.mount_pre_unmount(volume_monitor, mount)¶
Signal Name:
mount-pre-unmount
Flags:
Parameters:
- volume_monitor (Gio.VolumeMonitor) – The object which received the signal
- mount (Gio.Mount) – a Gio.Mount that is being unmounted.
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.
Gio.VolumeMonitor.signals.mount_removed(volume_monitor, mount)¶
Signal Name:
mount-removed
Flags:
Parameters:
- volume_monitor (Gio.VolumeMonitor) – The object which received the signal
- mount (Gio.Mount) – a Gio.Mount that was removed.
Emitted when a mount is removed.
Gio.VolumeMonitor.signals.volume_added(volume_monitor, volume)¶
Signal Name:
volume-added
Flags:
Parameters:
- volume_monitor (Gio.VolumeMonitor) – The object which received the signal
- volume (Gio.Volume) – a Gio.Volume that was added.
Emitted when a mountable volume is added to the system.
Gio.VolumeMonitor.signals.volume_changed(volume_monitor, volume)¶
Signal Name:
volume-changed
Flags:
Parameters:
- volume_monitor (Gio.VolumeMonitor) – The object which received the signal
- volume (Gio.Volume) – a Gio.Volume that changed.
Emitted when mountable volume is changed.
Gio.VolumeMonitor.signals.volume_removed(volume_monitor, volume)¶
Signal Name:
volume-removed
Flags:
Parameters:
- volume_monitor (Gio.VolumeMonitor) – The object which received the signal
- volume (Gio.Volume) – a Gio.Volume that was removed.
Emitted when a mountable volume is removed from the system.