Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: VolumeMeta

[535:14] static extends: object

Generated metadata helpers for Volume interface surfaces.

Methods

  • signals ()

    Returns signal metadata for Volume.

    • @r A list.

class: Volume

[47:7] extends: object

The GVolume interface represents user-visible objects that can be mounted. For example, a file system partition on a USB flash drive, or an optical disc inserted into a disc drive. If a GVolume is currently mounted, the corresponding [iface@Gio.Mount] can be retrieved using [method@Gio.Volume.get_mount]. Mounting a GVolume instance is an asynchronous operation. For more information about asynchronous operations, see [iface@Gio.AsyncResult] and [class@Gio.Task]. To mount a GVolume, first call [method@Gio.Volume.mount] with (at least) the GVolume instance, optionally a [class@Gio.MountOperation] object and a [type@Gio.AsyncReadyCallback]. Typically, one will only want to pass NULL for the [class@Gio.MountOperation] if automounting all volumes when a desktop session starts since it’s not desirable to put up a lot of dialogs asking for credentials. The callback will be fired when the operation has resolved (either with success or failure), and a [iface@Gio.AsyncResult] instance will be passed to the callback. That callback should then call [method@Gio.Volume.mount_finish] with the GVolume instance and the [iface@Gio.AsyncResult] data to see if the operation was completed successfully. If a [type@GLib.Error] is present when [method@Gio.Volume.mount_finish] is called, then it will be filled with any error information. Note, when porting from GnomeVFS, GVolume is the moral equivalent of GnomeVFSDrive. ## Volume Identifiers It is sometimes necessary to directly access the underlying operating system object behind a volume (e.g. for passing a volume to an application via the command line). For this purpose, GIO allows to obtain an ‘identifier’ for the volume. There can be different kinds of identifiers, such as Hal UDIs, filesystem labels, traditional Unix devices (e.g. /dev/sda2), UUIDs. GIO uses predefined strings as names for the different kinds of identifiers: G_VOLUME_IDENTIFIER_KIND_UUID, G_VOLUME_IDENTIFIER_KIND_LABEL, etc. Use [method@Gio.Volume.get_identifier] to obtain an identifier for a volume. Note that G_VOLUME_IDENTIFIER_KIND_HAL_UDI will only be available when the GVFS hal volume monitor is in use. Other volume monitors will generally be able to provide the G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE identifier, which can be used to obtain a hal device by means of libhal_manager_find_device_string_match().

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • Volume (Handle = null)

    Creates a new Volume by wrapping a native handle or another wrapper.

    • @p Handle is the native handle or another wrapper whose handle to adopt.
  • toNativeHandle (Source)

    Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from fn.call(...), another generated wrapper exposing handle(), or null. Returns null when the argument carries no pointer.

    • @p Source is the raw handle, raw buffer, wrapper, or null.
    • @r A raw pointer carrier or null when no pointer is present.
  • getLib ()

    Returns the opened native library for this generated wrapper.

    • @r The opened native library.
  • handle ()

    Returns the wrapped NativeHandle.

    • @r The wrapped NativeHandle.
  • isNull ()

    Returns true when the wrapped handle is null.

    • @r A bool.
  • describe ()

    Returns a small string for debugging generated wrappers.

    • @r A string.
  • connectSignal (string Name, CallbackObj)

    Connects one generated callback wrapper to a named signal.

    • @p Name is the signal name.
    • @p CallbackObj is the generated callback wrapper to connect.
    • @r The connected handler id.
  • disconnectSignalHandler (int HandlerId)

    Disconnects one retained signal handler id.

    • @p HandlerId is the signal handler id to disconnect.
    • @r None.
  • setOnChanged (callback Fn, UserData = null)

    Emitted when the volume has been changed.

    • @p Fn is the Aussom callback.
    • @p Fn is called with (Volume Self).
    • @p UserData is retained and passed through to the generated callback wrapper when provided.
    • @r The connected handler id.
  • setOnRemoved (callback Fn, UserData = null)

    This signal is emitted when the #GVolume have been removed. If the recipient is holding references to the object they should release them so the object can be finalized.

    • @p Fn is the Aussom callback.
    • @p Fn is called with (Volume Self).
    • @p UserData is retained and passed through to the generated callback wrapper when provided.
    • @r The connected handler id.
  • can_eject ()

    Checks if a volume can be ejected.

    • @r %TRUE if the @volume can be ejected. %FALSE otherwise.
  • can_mount ()

    Checks if a volume can be mounted.

    • @r %TRUE if the @volume can be mounted. %FALSE otherwise.
  • eject_finish (object result)

    Finishes ejecting a volume. If any errors occurred during the operation,

    • @error will be set to contain the errors and %FALSE will be returned.
    • @p result is a #GAsyncResult.
    • @r %TRUE, %FALSE if operation failed.
  • eject_with_operation_finish (object result)

    Finishes ejecting a volume. If any errors occurred during the operation,

    • @error will be set to contain the errors and %FALSE will be returned.
    • @p result is a #GAsyncResult.
    • @r %TRUE if the volume was successfully ejected. %FALSE otherwise.
  • enumerate_identifiers ()

    Gets the kinds of identifiers that @volume has. Use g_volume_get_identifier() to obtain the identifiers themselves.

    • @r a %NULL-terminated array of strings containing kinds of identifiers. Use g_strfreev() to free..
  • get_activation_root ()

    Gets the activation root for a #GVolume if it is known ahead of mount time. Returns %NULL otherwise. If not %NULL and if @volume is mounted, then the result of g_mount_get_root() on the #GMount object obtained from g_volume_get_mount() will always either be equal or a prefix of what this function returns. In other words, in code |[ GMount *mount; GFile *mount_root GFile *volume_activation_root; mount = g_volume_get_mount (volume); // mounted, so never NULL mount_root = g_mount_get_root (mount); volume_activation_root = g_volume_get_activation_root (volume); // assume not NULL ]| then the expression |[ (g_file_has_prefix (volume_activation_root, mount_root) || g_file_equal (volume_activation_root, mount_root)) ]| will always be %TRUE. Activation roots are typically used in #GVolumeMonitor implementations to find the underlying mount to shadow, see g_mount_is_shadowed() for more details.

    • @r the activation root of @volume or %NULL. Use g_object_unref() to free..
  • get_drive ()

    Gets the drive for the @volume.

    • @r a #GDrive or %NULL if @volume is not associated with a drive. The returned object should be unreffed with g_object_unref() when no longer needed..
  • get_icon ()

    Gets the icon for @volume.

    • @r a #GIcon. The returned object should be unreffed with g_object_unref() when no longer needed..
  • get_identifier (string kind)

    Gets the identifier of the given kind for @volume. See the introduction for more information about volume identifiers.

    • @p kind is the kind of identifier to return.
    • @r a newly allocated string containing the requested identifier, or %NULL if the #GVolume doesn't have this kind of identifier.
  • get_mount ()

    Gets the mount for the @volume.

    • @r a #GMount or %NULL if @volume isn't mounted. The returned object should be unreffed with g_object_unref() when no longer needed..
  • get_name ()

    Gets the name of @volume.

    • @r the name for the given @volume. The returned string should be freed with g_free() when no longer needed..
  • get_sort_key ()

    Gets the sort key for @volume, if any.

    • @r Sorting key for @volume or %NULL if no such key is available.
  • get_symbolic_icon ()

    Gets the symbolic icon for @volume.

    • @r a #GIcon. The returned object should be unreffed with g_object_unref() when no longer needed..
  • get_uuid ()

    Gets the UUID for the @volume. The reference is typically based on the file system UUID for the volume in question and should be considered an opaque string. Returns %NULL if there is no UUID available.

    • @r the UUID for @volume or %NULL if no UUID can be computed. The returned string should be freed with g_free() when no longer needed..
  • mount_finish (object result)

    Finishes mounting a volume. If any errors occurred during the operation,

    • @error will be set to contain the errors and %FALSE will be returned. If the mount operation succeeded, g_volume_get_mount() on @volume is guaranteed to return the mount right after calling this function; there's no need to listen for the 'mount-added' signal on #GVolumeMonitor.
    • @p result is a #GAsyncResult.
    • @r %TRUE, %FALSE if operation failed.
  • should_automount ()

    Returns whether the volume should be automatically mounted.

    • @r %TRUE if the volume should be automatically mounted.

class: VolumeRemovedCallback

[465:7] extends: object

Generated low-level callback wrapper for GIR callback removed.

Members

  • callbackObj
  • userFn
  • userData
  • hasUserData

Methods

  • VolumeRemovedCallback (callback Fn, UserData = null)

    Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking Fn.

    • @p Fn is the Aussom callback implementation.
    • @p UserData is retained and passed through to Fn on each invocation when provided.
  • trampoline (nativeSelf, nativeUserData)

    Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.

  • callback ()

    Returns the wrapped NativeCallback.

  • handle ()

    Returns the callback as a NativeHandle.

  • close ()

    Closes the underlying NativeCallback.

  • isClosed ()

    Returns true when the callback has been closed.

class: VolumeChangedCallback

[395:7] extends: object

Generated low-level callback wrapper for GIR callback changed.

Members

  • callbackObj
  • userFn
  • userData
  • hasUserData

Methods

  • VolumeChangedCallback (callback Fn, UserData = null)

    Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking Fn.

    • @p Fn is the Aussom callback implementation.
    • @p UserData is retained and passed through to Fn on each invocation when provided.
  • trampoline (nativeSelf, nativeUserData)

    Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.

  • callback ()

    Returns the wrapped NativeCallback.

  • handle ()

    Returns the callback as a NativeHandle.

  • close ()

    Closes the underlying NativeCallback.

  • isClosed ()

    Returns true when the callback has been closed.