Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: Drive

[33:7] extends: object

GDrive represents a piece of hardware connected to the machine. It’s generally only created for removable hardware or hardware with removable media. For example, an optical disc drive, or a USB flash drive. GDrive is a container class for [iface@Gio.Volume] objects that stem from the same piece of media. As such, GDrive abstracts a drive with (or without) removable media and provides operations for querying whether media is available, determining whether media change is automatically detected and ejecting the media. If the GDrive reports that media isn’t automatically detected, one can poll for media; typically one should not do this periodically as a poll for media operation is potentially expensive and may spin up the drive creating noise. GDrive supports starting and stopping drives with authentication support for the former. This can be used to support a diverse set of use cases including connecting/disconnecting iSCSI devices, powering down external disk enclosures and starting/stopping multi-disk devices such as RAID devices. Note that the actual semantics and side-effects of starting/stopping a GDrive may vary according to implementation. To choose the correct verbs in e.g. a file manager, use [method@Gio.Drive.get_start_stop_type]. For porting from GnomeVFS note that there is no equivalent of GDrive in that API.

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • Drive (Handle = null)

    Creates a new Drive 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 drive's state has changed.

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

    This signal is emitted when the #GDrive have been disconnected. 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 (Drive Self).
    • @p UserData is retained and passed through to the generated callback wrapper when provided.
    • @r The connected handler id.
  • setOnEjectbutton (callback Fn, UserData = null)

    Emitted when the physical eject button (if any) of a drive has been pressed.

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

    Emitted when the physical stop button (if any) of a drive has been pressed.

    • @p Fn is the Aussom callback.
    • @p Fn is called with (Drive 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 drive can be ejected.

    • @r %TRUE if the @drive can be ejected, %FALSE otherwise..
  • can_poll_for_media ()

    Checks if a drive can be polled for media changes.

    • @r %TRUE if the @drive can be polled for media changes, %FALSE otherwise..
  • can_start ()

    Checks if a drive can be started.

    • @r %TRUE if the @drive can be started, %FALSE otherwise..
  • can_start_degraded ()

    Checks if a drive can be started degraded.

    • @r %TRUE if the @drive can be started degraded, %FALSE otherwise..
  • can_stop ()

    Checks if a drive can be stopped.

    • @r %TRUE if the @drive can be stopped, %FALSE otherwise..
  • eject_finish (object result)

    Finishes ejecting a drive.

    • @p result is a #GAsyncResult..
    • @r %TRUE if the drive has been ejected successfully, %FALSE otherwise..
  • eject_with_operation_finish (object result)

    Finishes ejecting a drive. 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 drive was successfully ejected. %FALSE otherwise..
  • enumerate_identifiers ()

    Gets the kinds of identifiers that @drive has. Use g_drive_get_identifier() to obtain the identifiers themselves.

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

    Gets the icon for @drive.

    • @r #GIcon for the @drive. Free the returned object with g_object_unref()..
  • get_identifier (string kind)

    Gets the identifier of the given kind for @drive. The only identifier currently available is %G_DRIVE_IDENTIFIER_KIND_UNIX_DEVICE.

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

    Gets the name of @drive.

    • @r a string containing @drive's name. The returned string should be freed when no longer needed..
  • get_sort_key ()

    Gets the sort key for @drive, if any.

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

    Gets a hint about how a drive can be started/stopped.

    • @r A value from the #GDriveStartStopType enumeration..
  • get_symbolic_icon ()

    Gets the icon for @drive.

    • @r symbolic #GIcon for the @drive. Free the returned object with g_object_unref()..
  • get_volumes ()

    Get a list of mountable volumes for @drive. The returned list should be freed with g_list_free(), after its elements have been unreffed with g_object_unref().

    • @r #GList containing any #GVolume objects on the given @drive..
  • has_media ()

    Checks if the @drive has media. Note that the OS may not be polling the drive for media changes; see g_drive_is_media_check_automatic() for more details.

    • @r %TRUE if @drive has media, %FALSE otherwise..
  • has_volumes ()

    Check if @drive has any mountable volumes.

    • @r %TRUE if the @drive contains volumes, %FALSE otherwise..
  • is_media_check_automatic ()

    Checks if @drive is capable of automatically detecting media changes.

    • @r %TRUE if the @drive is capable of automatically detecting media changes, %FALSE otherwise..
  • is_media_removable ()

    Checks if the @drive supports removable media.

    • @r %TRUE if @drive supports removable media, %FALSE otherwise..
  • is_removable ()

    Checks if the #GDrive and/or its media is considered removable by the user. See g_drive_is_media_removable().

    • @r %TRUE if @drive and/or its media is considered removable, %FALSE otherwise..
  • poll_for_media_finish (object result)

    Finishes an operation started with g_drive_poll_for_media() on a drive.

    • @p result is a #GAsyncResult..
    • @r %TRUE if the drive has been poll_for_mediaed successfully, %FALSE otherwise..
  • start_finish (object result)

    Finishes starting a drive.

    • @p result is a #GAsyncResult..
    • @r %TRUE if the drive has been started successfully, %FALSE otherwise..
  • stop_finish (object result)

    Finishes stopping a drive.

    • @p result is a #GAsyncResult..
    • @r %TRUE if the drive has been stopped successfully, %FALSE otherwise..
  • volumes ()

    Returns get_volumes as an Aussom list of wrapper objects. This companion method materializes the full collection up front; use get_volumes() when lazy or change-notify access is required.

    • @r An Aussom list of elements.

class: DriveChangedCallback

[499:7] extends: object

Generated low-level callback wrapper for GIR callback changed.

Members

  • callbackObj
  • userFn
  • userData
  • hasUserData

Methods

  • DriveChangedCallback (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: DriveDisconnectedCallback

[569:7] extends: object

Generated low-level callback wrapper for GIR callback disconnected.

Members

  • callbackObj
  • userFn
  • userData
  • hasUserData

Methods

  • DriveDisconnectedCallback (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: DriveMeta

[779:14] static extends: object

Generated metadata helpers for Drive interface surfaces.

Methods

  • signals ()

    Returns signal metadata for Drive.

    • @r A list.

class: DriveEjectbuttonCallback

[639:7] extends: object

Generated low-level callback wrapper for GIR callback eject-button.

Members

  • callbackObj
  • userFn
  • userData
  • hasUserData

Methods

  • DriveEjectbuttonCallback (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: DriveStopbuttonCallback

[709:7] extends: object

Generated low-level callback wrapper for GIR callback stop-button.

Members

  • callbackObj
  • userFn
  • userData
  • hasUserData

Methods

  • DriveStopbuttonCallback (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.