Gio.VolumeMonitor¶
- Subclasses:
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Properties¶
None
Signals¶
- Inherited:
Name |
Short Description |
---|---|
Emitted when a drive changes. |
|
Emitted when a drive is connected to the system. |
|
Emitted when a drive is disconnected from the system. |
|
Emitted when the eject button is pressed on drive. |
|
Emitted when the stop button is pressed on drive. |
|
Emitted when a mount is added. |
|
Emitted when a mount changes. |
|
May be emitted when a mount is about to be removed. |
|
Emitted when a mount is removed. |
|
Emitted when a mountable volume is added to the system. |
|
Emitted when mountable volume is changed. |
|
Emitted when a mountable volume is removed from the system. |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent_instance |
r |
||
priv |
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:
- Returns:
the
Gio.Volume
object that is the parent for mount orNone
if no wants to adopt theGio.Mount
.- Return type:
This function should be called by any
Gio.VolumeMonitor
implementation when a newGio.Mount
object is created that is not associated with aGio.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 returnedGio.Volume
object 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.Mount
object that needs to be associated with theGio.Volume
object that represents the volume.The other is for implementing a
Gio.VolumeMonitor
whose sole purpose is to returnGio.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 seeGio.Mount.is_shadowed
(),Gio.Mount.shadow
() andGio.Mount.unshadow
() functions.
- classmethod get()[source]¶
- Returns:
a reference to the
Gio.VolumeMonitor
used by gio. CallGObject.Object.unref
() when done with it.- Return type:
Gets the volume monitor used by gio.
- get_connected_drives()[source]¶
-
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
orNone
if no such mount is available. Free the returned object withGObject.Object.unref
().- Return type:
Finds a
Gio.Mount
object by its UUID (seeGio.Mount.get_uuid
())
- get_mounts()[source]¶
-
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
orNone
if no such volume is available. Free the returned object withGObject.Object.unref
().- Return type:
Gio.Volume
orNone
Finds a
Gio.Volume
object by its UUID (seeGio.Volume.get_uuid
())
- get_volumes()[source]¶
- Returns:
a
GLib.List
ofGio.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_get_connected_drives() virtual¶
-
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
orNone
if no such mount is available. Free the returned object withGObject.Object.unref
().- Return type:
Finds a
Gio.Mount
object by its UUID (seeGio.Mount.get_uuid
())
- do_get_mounts() virtual¶
-
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
orNone
if no such volume is available. Free the returned object withGObject.Object.unref
().- Return type:
Gio.Volume
orNone
Finds a
Gio.Volume
object by its UUID (seeGio.Volume.get_uuid
())
- do_get_volumes() virtual¶
- Returns:
a
GLib.List
ofGio.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_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 signaldrive (
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
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
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 signaldrive (
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 signaldrive (
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
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
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
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
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 signalvolume (
Gio.Volume
) – aGio.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 signalvolume (
Gio.Volume
) – aGio.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 signalvolume (
Gio.Volume
) – aGio.Volume
that was removed.
Emitted when a mountable volume is removed from the system.