Libraries:Gtk:Gio:GVolume
Types
T
ParentT
Constants
InterfaceInfo : Std.Object.T
Nil : T
Functions
GetType() : Gtk.GObject.Type.T
Methods
:CanEject(self @ T) : Std.Symbol.T
Checks if a volume can be ejected.
:CanEject(_ @ ParentT)
:CanMount(self @ T) : Std.Symbol.T
Checks if a volume can be mounted.
:CanMount(_ @ ParentT)
:Changed(_ @ ParentT)
:Eject(self @ T, flags @ Std.Integer.SmallT, cancellable @ Gtk.Gio.GCancellable.T, callback @ Std.Function.T, user_data) : Std.Object.T
Warning
Eject has been deprecated since version 2.22 and should not be used in newly-written code. Use EjectWithOperation instead.
:Eject(_ @ ParentT, _ @ Std.Integer.SmallT, _ @ Gtk.Gio.GCancellable.T, _ @ Std.Function.T, _ @ Std.Address.T)
:EjectFinish(self @ T, result @ Gtk.Gio.GAsyncResult.T, error @ Std.Object.T) : Std.Symbol.T
Warning
EjectFinish has been deprecated since version 2.22 and should not be used in newly-written code. Use EjectWithOperationFinish instead.
:EjectFinish(_ @ ParentT, _ @ Gtk.Gio.GAsyncResult.T, _ @ Std.Object.T)
:EjectWithOperation(self @ T, flags @ Std.Integer.SmallT, mount_operation @ Gtk.Gio.GMountOperation.T, cancellable @ Gtk.Gio.GCancellable.T, callback @ Std.Function.T, user_data) : Std.Object.T
Ejects a volume. This is an asynchronous operation, and is finished by calling EjectWithOperationFinish with the volume and Gtk.Gio.GAsyncResult.T data returned in the callback.
volume | a T. |
flags | flags affecting the unmount if required for eject |
mount_operation | a Gtk.Gio.GMountOperation.T or NULL to avoid user interaction. [allow-none] |
cancellable | optional Gtk.Gio.GCancellable.T object, NULL to ignore. [allow-none] |
callback | a Gtk.Gio.GAsyncReadyCallback, or NULL. |
user_data | user data passed to callback. |
:EjectWithOperation(_ @ ParentT, _ @ Std.Integer.SmallT, _ @ Gtk.Gio.GMountOperation.T, _ @ Gtk.Gio.GCancellable.T, _ @ Std.Function.T, _ @ Std.Address.T)
:EjectWithOperationFinish(self @ T, result @ Gtk.Gio.GAsyncResult.T, error @ Std.Object.T) : Std.Symbol.T
Finishes ejecting a volume. If any errors occurred during the operation, error will be set to contain the errors and FALSE will be returned.
volume | a T. |
result | a Gtk.Gio.GAsyncResult.T. |
error | a Gtk.Glib.GError.T location to store the error occurring, or NULL to ignore. |
Returns | TRUE if the volume was successfully ejected. FALSE otherwise. |
:EjectWithOperationFinish(_ @ ParentT, _ @ Gtk.Gio.GAsyncResult.T, _ @ Std.Object.T)
:EnumerateIdentifiers(self @ T) : Std.Object.T
Gets the kinds of identifiers that volume has. Use g_volume_get_identifer() to obtain the identifiers themselves.
volume | a T |
Returns | a NULL-terminated array of strings containing kinds of identifiers. Use Gtk.Glib.GStrfuncs.Strfreev to free. [array zero-terminated=1][transfer full] |
:EnumerateIdentifiers(_ @ ParentT)
:GetActivationRoot(self @ T) : Gtk.Gio.GFile.T
Gets the activation root for a T if it is known ahead of mount time. Returns NULL otherwise. If not NULL and if volume is mounted, then the result of Gtk.Gio.GMount.GetRoot on the Gtk.Gio.GMount.T object obtained from GetMount 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 Gtk.Gio.GVolumeMonitor.T implementations to find the underlying mount to shadow, see Gtk.Gio.GMount.IsShadowed for more details.
volume | a T |
Returns | the activation root of volume or NULL. Use g_object_unref() to free. [transfer full] |
:GetActivationRoot(_ @ ParentT)
:GetDrive(self @ T) : Gtk.Gio.GDrive.T
Gets the drive for the volume.
volume | a T. |
Returns | a Gtk.Gio.GDrive.T or NULL if volume is not associated with a drive. The returned object should be unreffed with g_object_unref() when no longer needed. [transfer full] |
:GetDrive(_ @ ParentT)
:GetIcon(self @ T) : Gtk.Gio.GIcon.T
Gets the icon for volume.
volume | a T. |
Returns | a Gtk.Gio.GIcon.T. The returned object should be unreffed with g_object_unref() when no longer needed. [transfer full] |
:GetIcon(_ @ ParentT)
:GetIdentifier(self @ T, kind @ Std.String.T) : Std.String.T
Gets the identifier of the given kind for volume. See the introduction for more information about volume identifiers.
volume | a T |
kind | the kind of identifier to return |
Returns | a newly allocated string containing the requested identfier, or NULL if the T doesn't have this kind of identifier |
:GetIdentifier(_ @ ParentT, _ @ Std.String.T)
:GetMount(self @ T) : Gtk.Gio.GMount.T
Gets the mount for the volume.
volume | a T. |
Returns | a Gtk.Gio.GMount.T or NULL if volume isn't mounted. The returned object should be unreffed with g_object_unref() when no longer needed. [transfer full] |
:GetMount(_ @ ParentT)
:GetName(self @ T) : Std.String.T
Gets the name of volume.
volume | a T. |
Returns | the name for the given volume. The returned string should be freed with g_free() when no longer needed. |
:GetName(_ @ ParentT)
:GetUuid(self @ T) : Std.String.T
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.
volume | a T. |
Returns | 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. |
:GetUuid(_ @ ParentT)
:Mount(self @ T, flags @ Gtk.Gio.GMountMountFlags.T, mount_operation @ Gtk.Gio.GMountOperation.T, cancellable @ Gtk.Gio.GCancellable.T, callback @ Std.Function.T, user_data) : Std.Object.T
Mounts a volume. This is an asynchronous operation, and is finished by calling MountFinish with the volume and Gtk.Gio.GAsyncResult.T returned in the callback.
Virtual: mount_fn
volume | a T. |
flags | flags affecting the operation |
mount_operation | a Gtk.Gio.GMountOperation.T or NULL to avoid user interaction. [allow-none] |
cancellable | optional Gtk.Gio.GCancellable.T object, NULL to ignore. [allow-none] |
callback | a Gtk.Gio.GAsyncReadyCallback, or NULL. [allow-none] |
user_data | user data that gets passed to callback |
:MountFinish(self @ T, result @ Gtk.Gio.GAsyncResult.T, error @ Std.Object.T) : Std.Symbol.T
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, GetMount 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 Gtk.Gio.GVolumeMonitor.T.
volume | a T |
result | a Gtk.Gio.GAsyncResult.T |
error | a Gtk.Glib.GError.T location to store an error, or NULL to ignore |
Returns | TRUE, FALSE if operation failed. |
:MountFinish(_ @ ParentT, _ @ Gtk.Gio.GAsyncResult.T, _ @ Std.Object.T)
:MountFn(_ @ ParentT, _ @ Gtk.Gio.GMountMountFlags.T, _ @ Gtk.Gio.GMountOperation.T, _ @ Gtk.Gio.GCancellable.T, _ @ Std.Function.T, _ @ Std.Address.T)
:Removed(_ @ ParentT)
:ShouldAutomount(self @ T) : Std.Symbol.T
Returns whether the volume should be automatically mounted.
The T interface represents user-visible objects that can be mounted. Note, when porting from GnomeVFS, T is the moral equivalent of Gtk.GnomeVFS.Drive.T.
Mounting a T instance is an asynchronous operation. For more information about asynchronous operations, see GAsyncReady and GSimpleAsyncReady. To mount a T, first call Mount with (at least) the T instance, optionally a Gtk.Gio.GMountOperation.T object and a Gtk.Gio.GAsyncReadyCallback.
Typically, one will only want to pass NULL for the Gtk.Gio.GMountOperation.T 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 GAsyncReady structure will be passed to the callback. That callback should then call MountFinish with the T instance and the GAsyncReady data to see if the operation was completed successfully. If an error is present when MountFinish is called, then it will be filled with any error information.
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 commandline). 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 predefind strings as names for the different kinds of identifiers: G_VOLUME_IDENTIFIER_KIND_HAL_UDI, G_VOLUME_IDENTIFIER_KIND_LABEL, etc. Use GetIdentifier 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_manger_find_device_string_match().