Gio.VolumeMonitor¶
| Subclasses: | Gio.NativeVolumeMonitor | 
|---|
Methods¶
| Inherited: | GObject.Object (37) | 
|---|---|
| Structs: | GObject.ObjectClass (5) | 
| 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: | GObject.Object (7) | 
|---|
| 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: | GObject.Object (1) | 
|---|
| 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: | GObject.Object (1) | 
|---|
| Name | Type | Access | Description | 
|---|---|---|---|
| parent_instance | GObject.Object | r | |
| priv | object | r | 
Class Details¶
- 
class Gio.VolumeMonitor(**kwargs)¶
- Bases: - GObject.Object- Abstract: - No - Structure: - Gio.VolumeMonitorClass- Gio.VolumeMonitoris 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.- Gio.VolumeMonitoris not- thread-default-context aware, 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.Mountobject to find a parent for- Returns: - the - Gio.Volumeobject that is the parent for mount or- Noneif no wants to adopt the- Gio.Mount.- Return type: - Gio.Volume- This function should be called by any - Gio.VolumeMonitorimplementation when a new- Gio.Mountobject is created that is not associated with a- Gio.Volumeobject. 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.Volumeobject 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.Mountobject that needs to be associated with the- Gio.Volumeobject that represents the volume.- The other is for implementing a - Gio.VolumeMonitorwhose sole purpose is to return- Gio.Volumeobjects representing entries in the users “favorite servers” list or similar.- Deprecated since version 2.20: Instead of using this function, - Gio.VolumeMonitorimplementations 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.
 - 
classmethod get()[source]¶
- Returns: - a reference to the - Gio.VolumeMonitorused by gio. Call- GObject.Object.unref() when done with it.- Return type: - Gio.VolumeMonitor- Gets the volume monitor used by gio. 
 - 
get_connected_drives()[source]¶
- Returns: - a - GLib.Listof connected- Gio.Driveobjects.- Return type: - [ - Gio.Drive]- 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.Mountor- Noneif no such mount is available. Free the returned object with- GObject.Object.unref().- Return type: - Gio.Mount- Finds a - Gio.Mountobject by its UUID (see- Gio.Mount.get_uuid())
 - 
get_mounts()[source]¶
- Returns: - a - GLib.Listof- Gio.Mountobjects.- Return type: - [ - Gio.Mount]- 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.Volumeor- Noneif no such volume is available. Free the returned object with- GObject.Object.unref().- Return type: - Gio.Volume- Finds a - Gio.Volumeobject by its UUID (see- Gio.Volume.get_uuid())
 - 
get_volumes()[source]¶
- Returns: - a - GLib.Listof- Gio.Volumeobjects.- Return type: - [ - Gio.Volume]- 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().
 - Parameters: - drive ( - Gio.Drive) –
 - Parameters: - drive ( - Gio.Drive) –
 - 
do_get_connected_drives() virtual¶
- Returns: - a - GLib.Listof connected- Gio.Driveobjects.- Return type: - [ - Gio.Drive]- 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.Mountor- Noneif no such mount is available. Free the returned object with- GObject.Object.unref().- Return type: - Gio.Mount- Finds a - Gio.Mountobject by its UUID (see- Gio.Mount.get_uuid())
 - 
do_get_mounts() virtual¶
- Returns: - a - GLib.Listof- Gio.Mountobjects.- Return type: - [ - Gio.Mount]- 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.Volumeor- Noneif no such volume is available. Free the returned object with- GObject.Object.unref().- Return type: - Gio.Volume- Finds a - Gio.Volumeobject by its UUID (see- Gio.Volume.get_uuid())
 - 
do_get_volumes() virtual¶
- Returns: - a - GLib.Listof- Gio.Volumeobjects.- Return type: - [ - Gio.Volume]- 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_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) –
 
- 
classmethod 
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. 
- volume_monitor (
- 
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) – aGio.Drivethat was connected.
 - Emitted when a drive is connected to the system. 
- volume_monitor (
- 
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) – aGio.Drivethat was disconnected.
 - Emitted when a drive is disconnected from the system. 
- volume_monitor (
- 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. 
- volume_monitor (
- 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. 
- volume_monitor (
- 
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) – aGio.Mountthat was added.
 - Emitted when a mount is added. 
- volume_monitor (
- 
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) – aGio.Mountthat changed.
 - Emitted when a mount changes. 
- volume_monitor (
- 
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) – aGio.Mountthat 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. 
- volume_monitor (
- 
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) – aGio.Mountthat was removed.
 - Emitted when a mount is removed. 
- volume_monitor (
- 
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) – aGio.Volumethat was added.
 - Emitted when a mountable volume is added to the system. 
- volume_monitor (
- 
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) – aGio.Volumethat changed.
 - Emitted when mountable volume is changed. 
- volume_monitor (
- 
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) – aGio.Volumethat was removed.
 - Emitted when a mountable volume is removed from the system. 
- volume_monitor (