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.ObjectAbstract: No Structure: Gio.VolumeMonitorClassGio.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 notthread-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) – aGio.Mountobject to find a parent forReturns: the Gio.Volumeobject that is the parent for mount orNoneif no wants to adopt theGio.Mount.Return type: Gio.VolumeThis function should be called by any
Gio.VolumeMonitorimplementation when a newGio.Mountobject is created that is not associated with aGio.Volumeobject. It must be called just before emitting the mount_added signal.If the return value is not
None, the caller must associate the returnedGio.Volumeobject with theGio.Mount. This involves returning it in itsGio.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 signalSimilarly, if implementing
Gio.VolumeMonitor.adopt_orphan_mount(), the implementor must take a reference to mount and return it in itsGio.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 theGio.Volumeobject that represents the volume.The other is for implementing a
Gio.VolumeMonitorwhose sole purpose is to returnGio.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 seeGio.Mount.is_shadowed(),Gio.Mount.shadow() andGio.Mount.unshadow() functions.
-
classmethod
get()[source]¶ Returns: a reference to the Gio.VolumeMonitorused by gio. CallGObject.Object.unref() when done with it.Return type: Gio.VolumeMonitorGets the volume monitor used by gio.
-
get_connected_drives()[source]¶ Returns: a GLib.Listof connectedGio.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 forReturns: a Gio.MountorNoneif no such mount is available. Free the returned object withGObject.Object.unref().Return type: Gio.MountFinds a
Gio.Mountobject by its UUID (seeGio.Mount.get_uuid())
-
get_mounts()[source]¶ Returns: a GLib.ListofGio.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 forReturns: a Gio.VolumeorNoneif no such volume is available. Free the returned object withGObject.Object.unref().Return type: Gio.VolumeFinds a
Gio.Volumeobject by its UUID (seeGio.Volume.get_uuid())
-
get_volumes()[source]¶ Returns: a GLib.ListofGio.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 connectedGio.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 forReturns: a Gio.MountorNoneif no such mount is available. Free the returned object withGObject.Object.unref().Return type: Gio.MountFinds a
Gio.Mountobject by its UUID (seeGio.Mount.get_uuid())
-
do_get_mounts() virtual¶ Returns: a GLib.ListofGio.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 forReturns: a Gio.VolumeorNoneif no such volume is available. Free the returned object withGObject.Object.unref().Return type: Gio.VolumeFinds a
Gio.Volumeobject by its UUID (seeGio.Volume.get_uuid())
-
do_get_volumes() virtual¶ Returns: a GLib.ListofGio.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-changedFlags: 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-connectedFlags: 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-disconnectedFlags: 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-buttonFlags: 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-buttonFlags: 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-addedFlags: 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-changedFlags: 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-unmountFlags: 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-removedFlags: 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-addedFlags: 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-changedFlags: 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-removedFlags: 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 (