DriveT

GDrive - this represent a piece of hardware connected to the machine. It's generally only created for removable hardware or hardware with removable media.

GDrive is a container class for GVolume 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 potententially 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 g_drive_get_start_stop_type().

For porting from GnomeVFS note that there is no equivalent of GDrive in that API.

template DriveT (
TStruct
) {}

Members

Functions

addOnChanged
void addOnChanged(void delegate(DriveIF) dlg, ConnectFlags connectFlags)

Emitted when the drive's state has changed.

addOnDisconnected
void addOnDisconnected(void delegate(DriveIF) dlg, ConnectFlags connectFlags)

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.

addOnEjectButton
void addOnEjectButton(void delegate(DriveIF) dlg, ConnectFlags connectFlags)

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

addOnStopButton
void addOnStopButton(void delegate(DriveIF) dlg, ConnectFlags connectFlags)

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

canEject
int canEject()

Checks if a drive can be ejected.

canPollForMedia
int canPollForMedia()

Checks if a drive can be polled for media changes.

canStart
int canStart()

Checks if a drive can be started. Since 2.22

canStartDegraded
int canStartDegraded()

Checks if a drive can be started degraded. Since 2.22

canStop
int canStop()

Checks if a drive can be stopped. Since 2.22

eject
void eject(GMountUnmountFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)

Warning g_drive_eject has been deprecated since version 2.22 and should not be used in newly-written code. Use g_drive_eject_with_operation() instead. Asynchronously ejects a drive. When the operation is finished, callback will be called. You can then call g_drive_eject_finish() to obtain the result of the operation.

ejectFinish
int ejectFinish(AsyncResultIF result)

Warning g_drive_eject_finish has been deprecated since version 2.22 and should not be used in newly-written code. Use g_drive_eject_with_operation_finish() instead. Finishes ejecting a drive.

ejectWithOperation
void ejectWithOperation(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)

Ejects a drive. This is an asynchronous operation, and is finished by calling g_drive_eject_with_operation_finish() with the drive and GAsyncResult data returned in the callback. Since 2.22

ejectWithOperationFinish
int ejectWithOperationFinish(AsyncResultIF 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. Since 2.22

enumerateIdentifiers
string[] enumerateIdentifiers()

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

getDriveTStruct
GDrive* getDriveTStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
getIcon
IconIF getIcon()

Gets the icon for drive.

getIdentifier
string getIdentifier(string kind)

Gets the identifier of the given kind for drive.

getName
string getName()

Gets the name of drive.

getSortKey
string getSortKey()

Gets the sort key for drive, if any. Since 2.32 Signal Details The "changed" signal void user_function (GDrive *drive, gpointer user_data) : Run Last Emitted when the drive's state has changed.

getStartStopType
GDriveStartStopType getStartStopType()

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

getSymbolicIcon
IconIF getSymbolicIcon()

Gets the icon for drive. Since 2.34

getVolumes
ListG getVolumes()

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().

hasMedia
int hasMedia()

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.

hasVolumes
int hasVolumes()

Check if drive has any mountable volumes.

isMediaCheckAutomatic
int isMediaCheckAutomatic()

Checks if drive is capabable of automatically detecting media changes.

isMediaRemovable
int isMediaRemovable()

Checks if the drive supports removable media.

onChangedListeners
void delegate(DriveIF)[] onChangedListeners()
Undocumented in source. Be warned that the author may not have intended to support it.
onDisconnectedListeners
void delegate(DriveIF)[] onDisconnectedListeners()
Undocumented in source. Be warned that the author may not have intended to support it.
onEjectButtonListeners
void delegate(DriveIF)[] onEjectButtonListeners()
Undocumented in source. Be warned that the author may not have intended to support it.
onStopButtonListeners
void delegate(DriveIF)[] onStopButtonListeners()
Undocumented in source. Be warned that the author may not have intended to support it.
pollForMedia
void pollForMedia(Cancellable cancellable, GAsyncReadyCallback callback, void* userData)

Asynchronously polls drive to see if media has been inserted or removed. When the operation is finished, callback will be called. You can then call g_drive_poll_for_media_finish() to obtain the result of the operation.

pollForMediaFinish
int pollForMediaFinish(AsyncResultIF result)

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

start
void start(GDriveStartFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)

Asynchronously starts a drive. When the operation is finished, callback will be called. You can then call g_drive_start_finish() to obtain the result of the operation. Since 2.22

startFinish
int startFinish(AsyncResultIF result)

Finishes starting a drive. Since 2.22

stop
void stop(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)

Asynchronously stops a drive. When the operation is finished, callback will be called. You can then call g_drive_stop_finish() to obtain the result of the operation. Since 2.22

stopFinish
int stopFinish(AsyncResultIF result)

Finishes stopping a drive. Since 2.22

Static functions

callBackChanged
void callBackChanged(GDrive* driveStruct, DriveIF _driveIF)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackDisconnected
void callBackDisconnected(GDrive* driveStruct, DriveIF _driveIF)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackEjectButton
void callBackEjectButton(GDrive* driveStruct, DriveIF _driveIF)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackStopButton
void callBackStopButton(GDrive* driveStruct, DriveIF _driveIF)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

_onChangedListeners
void delegate(DriveIF)[] _onChangedListeners;
Undocumented in source.
_onDisconnectedListeners
void delegate(DriveIF)[] _onDisconnectedListeners;
Undocumented in source.
_onEjectButtonListeners
void delegate(DriveIF)[] _onEjectButtonListeners;
Undocumented in source.
_onStopButtonListeners
void delegate(DriveIF)[] _onStopButtonListeners;
Undocumented in source.
connectedSignals
int[string] connectedSignals;
gDrive
GDrive* gDrive;

the main Gtk struct

Meta