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.

canEject
bool canEject()

Checks if a drive can be ejected.

canPollForMedia
bool canPollForMedia()

Checks if a drive can be polled for media changes.

canStart
bool canStart()

Checks if a drive can be started.

canStartDegraded
bool canStartDegraded()

Checks if a drive can be started degraded.

canStop
bool canStop()

Checks if a drive can be stopped.

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

Asynchronously ejects a drive.

ejectFinish
bool ejectFinish(AsyncResultIF result)

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.

ejectWithOperationFinish
bool 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.

enumerateIdentifiers
string[] enumerateIdentifiers()

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

getDriveStruct
GDrive* getDriveStruct()

Get the main Gtk struct

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.

getStartStopType
GDriveStartStopType getStartStopType()

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

getSymbolicIcon
IconIF getSymbolicIcon()

Gets the icon for @drive.

getVolumes
ListG getVolumes()

Get a list of mountable volumes for @drive.

hasMedia
bool 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
bool hasVolumes()

Check if @drive has any mountable volumes.

isMediaCheckAutomatic
bool isMediaCheckAutomatic()

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

isMediaRemovable
bool isMediaRemovable()

Checks if the @drive supports removable media.

isRemovable
bool isRemovable()

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

pollForMedia
void pollForMedia(Cancellable cancellable, GAsyncReadyCallback callback, void* userData)

Asynchronously polls @drive to see if media has been inserted or removed.

pollForMediaFinish
bool 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.

startFinish
bool startFinish(AsyncResultIF result)

Finishes starting a drive.

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

Asynchronously stops a drive.

stopFinish
bool stopFinish(AsyncResultIF result)

Finishes stopping a drive.

Properties

onChangedListeners
void delegate(DriveIF)[] onChangedListeners [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
onDisconnectedListeners
void delegate(DriveIF)[] onDisconnectedListeners [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
onEjectButtonListeners
void delegate(DriveIF)[] onEjectButtonListeners [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
onStopButtonListeners
void delegate(DriveIF)[] onStopButtonListeners [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.

Static functions

callBackChanged
void callBackChanged(GDrive* driveStruct, DriveIF _drive)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackDisconnected
void callBackDisconnected(GDrive* driveStruct, DriveIF _drive)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackEjectButton
void callBackEjectButton(GDrive* driveStruct, DriveIF _drive)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackStopButton
void callBackStopButton(GDrive* driveStruct, DriveIF _drive)
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;
Undocumented in source.

Meta