class Gio::VolumeMonitor
- Gio::VolumeMonitor
- GObject::Object
- Reference
- Object
Overview
#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][g-main-context-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.
Direct Known Subclasses
Defined in:
lib/gi-crystal/src/auto/gio-2.0/volume_monitor.crConstructors
-
.new
Initialize a new
VolumeMonitor
.
Class Method Summary
-
.adopt_orphan_mount(mount : Gio::Mount) : Gio::Volume
This function should be called by any #GVolumeMonitor implementation when a new #GMount object is created that is not associated with a #GVolume object.
-
.g_type : UInt64
Returns the type id (GType) registered in GLib type system.
-
.get : Gio::VolumeMonitor
Gets the volume monitor used by gio.
Instance Method Summary
-
#connected_drives : GLib::List
Gets a list of drives connected to the system.
- #drive_changed_signal
- #drive_connected_signal
- #drive_disconnected_signal
- #drive_eject_button_signal
- #drive_stop_button_signal
- #mount_added_signal
- #mount_changed_signal
-
#mount_for_uuid(uuid : String) : Gio::Mount?
Finds a #GMount object by its UUID (see g_mount_get_uuid())
- #mount_pre_unmount_signal
- #mount_removed_signal
-
#mounts : GLib::List
Gets a list of the mounts on the system.
- #volume_added_signal
- #volume_changed_signal
-
#volume_for_uuid(uuid : String) : Gio::Volume?
Finds a #GVolume object by its UUID (see g_volume_get_uuid())
- #volume_removed_signal
-
#volumes : GLib::List
Gets a list of the volumes on the system.
Instance methods inherited from class GObject::Object
bind_property(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags) : GObject::Binding
bind_property,
bind_property_full(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags, transform_to : GObject::Closure, transform_from : GObject::Closure) : GObject::Binding
bind_property_full,
data(key : String) : Pointer(Void)?
data,
finalize
finalize,
freeze_notify : Nil
freeze_notify,
getv(names : Enumerable(String), values : Enumerable(_)) : Nil
getv,
notify(property_name : String) : Nil
notify,
notify_by_pspec(pspec : GObject::ParamSpec) : Nil
notify_by_pspec,
notify_signal
notify_signal,
property(property_name : String, value : _) : Nil
property,
qdata(quark : UInt32) : Pointer(Void)?
qdata,
ref_count : UInt32
ref_count,
run_dispose : Nil
run_dispose,
set_data(key : String, data : Pointer(Void)?) : Nil
set_data,
set_property(property_name : String, value : _) : Nil
set_property,
steal_data(key : String) : Pointer(Void)?
steal_data,
steal_qdata(quark : UInt32) : Pointer(Void)?
steal_qdata,
thaw_notify : Nil
thaw_notify,
to_unsafe : Pointer(Void)
to_unsafe,
watch_closure(closure : GObject::Closure) : Nil
watch_closure
Constructor methods inherited from class GObject::Object
cast(obj : GObject::Object) : self
cast,
cast?(obj : GObject::Object) : self?
cast?,
new(pointer : Pointer(Void), transfer : GICrystal::Transfer)new new, newv(object_type : UInt64, parameters : Enumerable(GObject::Parameter)) : self newv
Class methods inherited from class GObject::Object
compat_control(what : UInt64, data : Pointer(Void)?) : UInt64
compat_control,
g_type : UInt64
g_type,
interface_find_property(g_iface : GObject::TypeInterface, property_name : String) : GObject::ParamSpec
interface_find_property,
interface_list_properties(g_iface : GObject::TypeInterface) : Enumerable(GObject::ParamSpec)
interface_list_properties
Constructor Detail
Class Method Detail
This function should be called by any #GVolumeMonitor 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 #GVolumeMonitor whose sole purpose is to return #GVolume objects representing entries in the users "favorite servers" list or similar.
Instance Method Detail
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().
Finds a #GMount object by its UUID (see g_mount_get_uuid())
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().
Finds a #GVolume object by its UUID (see g_volume_get_uuid())
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().