Class: Gio::VolumeMonitor

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Direct Known Subclasses

NativeVolumeMonitor

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.adopt_orphan_mount(mount) ⇒ Gio::Volume

This function should be called by any GVolume::Monitor implementation when a new #GMount object is created that is not associated with a #GVolume object. It must be called just before emitting the mount_added signal.

If the return value is not nil, the caller must associate the returned #GVolume object with the #GMount. This involves returning it in its g_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 g_volume_monitor_adopt_orphan_mount(), the implementor must take a reference to mount and return it in its g_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 #GMount object that needs to be associated with the #GVolume object that represents the volume.

The other is for implementing a GVolume::Monitor whose sole purpose is to return #GVolume objects representing entries in the users "favorite servers" list or similar. if no wants to adopt the #GMount.

Parameters:

  • mount (Gio::Mount)

    a #GMount object to find a parent for

Returns:

  • (Gio::Volume)

    the #GVolume object that is the parent for mount or nil

.getGio::VolumeMonitor

Gets the volume monitor used by gio.

Returns:

  • (Gio::VolumeMonitor)

    a reference to the GVolume::Monitor used by gio. Call g_object_unref() when done with it.

Instance Method Details

#connected_drivesGLib::List<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 g_object_unref().

Returns:

  • (GLib::List<Gio::Drive>)

    a #GList of connected #GDrive objects.

#get_mount_for_uuid(uuid) ⇒ Gio::Mount

Finds a #GMount object by its UUID (see g_mount_get_uuid())

Parameters:

  • uuid (String)

    the UUID to look for

Returns:

  • (Gio::Mount)

    a #GMount or nil if no such mount is available. Free the returned object with g_object_unref().

#get_volume_for_uuid(uuid) ⇒ Gio::Volume

Finds a #GVolume object by its UUID (see g_volume_get_uuid())

Parameters:

  • uuid (String)

    the UUID to look for

Returns:

  • (Gio::Volume)

    a #GVolume or nil if no such volume is available. Free the returned object with g_object_unref().

#mountsGLib::List<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 g_object_unref().

Returns:

  • (GLib::List<Gio::Mount>)

    a #GList of #GMount objects.

#volumesGLib::List<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 g_object_unref().

Returns:

  • (GLib::List<Gio::Volume>)

    a #GList of #GVolume objects.