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

Classes

OnChangedDelegateWrapper
class OnChangedDelegateWrapper
Undocumented in source.
OnDisconnectedDelegateWrapper
class OnDisconnectedDelegateWrapper
Undocumented in source.
OnEjectButtonDelegateWrapper
class OnEjectButtonDelegateWrapper
Undocumented in source.
OnStopButtonDelegateWrapper
class OnStopButtonDelegateWrapper
Undocumented in source.

Functions

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

Emitted when the drive's state has changed.

addOnDisconnected
gulong 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
gulong addOnEjectButton(void delegate(DriveIF) dlg, ConnectFlags connectFlags)

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

addOnStopButton
gulong 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.

internalRemoveOnChanged
void internalRemoveOnChanged(OnChangedDelegateWrapper source)
Undocumented in source. Be warned that the author may not have intended to support it.
internalRemoveOnDisconnected
void internalRemoveOnDisconnected(OnDisconnectedDelegateWrapper source)
Undocumented in source. Be warned that the author may not have intended to support it.
internalRemoveOnEjectButton
void internalRemoveOnEjectButton(OnEjectButtonDelegateWrapper source)
Undocumented in source. Be warned that the author may not have intended to support it.
internalRemoveOnStopButton
void internalRemoveOnStopButton(OnStopButtonDelegateWrapper source)
Undocumented in source. Be warned that the author may not have intended to support it.
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.

Static functions

callBackChanged
void callBackChanged(GDrive* driveStruct, OnChangedDelegateWrapper wrapper)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackChangedDestroy
void callBackChangedDestroy(OnChangedDelegateWrapper wrapper, GClosure* closure)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackDisconnected
void callBackDisconnected(GDrive* driveStruct, OnDisconnectedDelegateWrapper wrapper)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackDisconnectedDestroy
void callBackDisconnectedDestroy(OnDisconnectedDelegateWrapper wrapper, GClosure* closure)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackEjectButton
void callBackEjectButton(GDrive* driveStruct, OnEjectButtonDelegateWrapper wrapper)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackEjectButtonDestroy
void callBackEjectButtonDestroy(OnEjectButtonDelegateWrapper wrapper, GClosure* closure)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackStopButton
void callBackStopButton(GDrive* driveStruct, OnStopButtonDelegateWrapper wrapper)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackStopButtonDestroy
void callBackStopButtonDestroy(OnStopButtonDelegateWrapper wrapper, GClosure* closure)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

onChangedListeners
OnChangedDelegateWrapper[] onChangedListeners;
Undocumented in source.
onDisconnectedListeners
OnDisconnectedDelegateWrapper[] onDisconnectedListeners;
Undocumented in source.
onEjectButtonListeners
OnEjectButtonDelegateWrapper[] onEjectButtonListeners;
Undocumented in source.
onStopButtonListeners
OnStopButtonDelegateWrapper[] onStopButtonListeners;
Undocumented in source.

Meta