Package ch.bailu.gtk.gio
Klasse Drive
- Alle implementierten Schnittstellen:
PointerInterface
`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](migrating-gnome-vfs.html) note that there is no
equivalent of `GDrive` in that API.
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](migrating-gnome-vfs.html) note that there is no
equivalent of `GDrive` in that API.
-
Verschachtelte Klassen - Übersicht
Verschachtelte KlassenModifizierer und TypKlasseBeschreibungstatic interface
static interface
static interface
static interface
static interface
Von Klasse geerbte verschachtelte Klassen/Schnittstellen ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDestroyNotify, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Feldübersicht
FelderModifizierer und TypFeldBeschreibungstatic final String
static final String
static final String
static final String
Von Klasse geerbte Felder ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungboolean
canEject()
Checks if a drive can be ejected.boolean
Checks if a drive can be polled for media changes.boolean
canStart()
Checks if a drive can be started.boolean
Checks if a drive can be started degraded.boolean
canStop()
Checks if a drive can be stopped.void
eject
(int flags, Cancellable cancellable, Drive.OnAsyncReadyCallback callback, Pointer user_data) Veraltet.boolean
ejectFinish
(AsyncResult result) Veraltet.void
ejectWithOperation
(int flags, MountOperation mount_operation, Cancellable cancellable, Drive.OnAsyncReadyCallback callback, Pointer user_data) Ejects a drive.boolean
ejectWithOperationFinish
(AsyncResult result) Finishes ejecting a drive.Gets the kinds of identifiers that @drive has.static ClassHandler
getIcon()
Gets the icon for @drive.getIdentifier
(Str kind) Gets the identifier of the given kind for @drive.getIdentifier
(String kind) Gets the identifier of the given kind for @drive.static int
getName()
Gets the name of @drive.static long
static TypeSystem.TypeSize
Gets the sort key for @drive, if any.int
Gets a hint about how a drive can be started/stopped.Gets the icon for @drive.static long
static TypeSystem.TypeSize
Get a list of mountable volumes for @drive.boolean
hasMedia()
Checks if the @drive has media.boolean
Check if @drive has any mountable volumes.boolean
Checks if @drive is capable of automatically detecting media changes.boolean
Checks if the @drive supports removable media.boolean
Checks if the #GDrive and/or its media is considered removable by the user.onChanged
(Drive.OnChanged signal) Connect to signal "changed".onDisconnected
(Drive.OnDisconnected signal) Connect to signal "disconnected".onEjectButton
(Drive.OnEjectButton signal) Connect to signal "eject-button".onStopButton
(Drive.OnStopButton signal) Connect to signal "stop-button".void
pollForMedia
(Cancellable cancellable, Drive.OnAsyncReadyCallback callback, Pointer user_data) Asynchronously polls @drive to see if media has been inserted or removed.boolean
pollForMediaFinish
(AsyncResult result) Finishes an operation started with g_drive_poll_for_media() on a drive.void
start
(int flags, MountOperation mount_operation, Cancellable cancellable, Drive.OnAsyncReadyCallback callback, Pointer user_data) Asynchronously starts a drive.boolean
startFinish
(AsyncResult result) Finishes starting a drive.void
stop
(int flags, MountOperation mount_operation, Cancellable cancellable, Drive.OnAsyncReadyCallback callback, Pointer user_data) Asynchronously stops a drive.boolean
stopFinish
(AsyncResult result) Finishes stopping a drive.Von Klasse geerbte Methoden ch.bailu.gtk.type.PropertyHolder
getBooleanProperty, getIntProperty, getObjectProperty, getStringProperty, getStrProperty, setBooleanProperty, setIntProperty, setObjectProperty, setStringProperty, setStrProperty
Von Klasse geerbte Methoden ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref
Von Klasse geerbte Methoden ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Von Klasse geerbte Methoden ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Von Klasse geerbte Methoden java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Von Schnittstelle geerbte Methoden ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Felddetails
-
SIGNAL_ON_CHANGED
- Siehe auch:
-
SIGNAL_ON_DISCONNECTED
- Siehe auch:
-
SIGNAL_ON_EJECT_BUTTON
- Siehe auch:
-
SIGNAL_ON_STOP_BUTTON
- Siehe auch:
-
-
Konstruktordetails
-
Drive
-
-
Methodendetails
-
getClassHandler
-
canEject
public boolean canEject()Checks if a drive can be ejected.- Gibt zurück:
- %TRUE if the @drive can be ejected, %FALSE otherwise.
-
canPollForMedia
public boolean canPollForMedia()Checks if a drive can be polled for media changes.- Gibt zurück:
- %TRUE if the @drive can be polled for media changes, %FALSE otherwise.
-
canStart
public boolean canStart()Checks if a drive can be started.- Gibt zurück:
- %TRUE if the @drive can be started, %FALSE otherwise.
-
canStartDegraded
public boolean canStartDegraded()Checks if a drive can be started degraded.- Gibt zurück:
- %TRUE if the @drive can be started degraded, %FALSE otherwise.
-
canStop
public boolean canStop()Checks if a drive can be stopped.- Gibt zurück:
- %TRUE if the @drive can be stopped, %FALSE otherwise.
-
eject
@Deprecated public void eject(int flags, @Nullable Cancellable cancellable, Drive.OnAsyncReadyCallback callback, @Nullable Pointer user_data) Veraltet.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.- Parameter:
flags
- flags affecting the unmount if required for ejectcancellable
- optional #GCancellable object, %NULL to ignore.callback
- a #GAsyncReadyCallback, or %NULL.user_data
- user data to pass to @callback
-
ejectFinish
Veraltet.Finishes ejecting a drive.- Parameter:
result
- a #GAsyncResult.- Gibt zurück:
- %TRUE if the drive has been ejected successfully, %FALSE otherwise.
- Löst aus:
AllocationError
-
ejectWithOperation
public void ejectWithOperation(int flags, @Nullable MountOperation mount_operation, @Nullable Cancellable cancellable, Drive.OnAsyncReadyCallback callback, @Nullable Pointer user_data) 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.- Parameter:
flags
- flags affecting the unmount if required for ejectmount_operation
- a #GMountOperation or %NULL to avoid user interaction.cancellable
- optional #GCancellable object, %NULL to ignore.callback
- a #GAsyncReadyCallback, or %NULL.user_data
- user data passed to @callback.
-
ejectWithOperationFinish
Finishes ejecting a drive. If any errors occurred during the operation,
@error will be set to contain the errors and %FALSE will be returned.- Parameter:
result
- a #GAsyncResult.- Gibt zurück:
- %TRUE if the drive was successfully ejected. %FALSE otherwise.
- Löst aus:
AllocationError
-
enumerateIdentifiers
Gets the kinds of identifiers that @drive has.
Use g_drive_get_identifier() to obtain the identifiers
themselves.- Gibt zurück:
- a %NULL-terminated array of strings containing kinds of identifiers. Use g_strfreev() to free.
-
getIcon
Gets the icon for @drive.- Gibt zurück:
- #GIcon for the @drive. Free the returned object with g_object_unref().
-
getIdentifier
Gets the identifier of the given kind for @drive. The only
identifier currently available is
%G_DRIVE_IDENTIFIER_KIND_UNIX_DEVICE.- Parameter:
kind
- the kind of identifier to return- Gibt zurück:
- a newly allocated string containing the requested identifier, or %NULL if the #GDrive doesn't have this kind of identifier.
-
getIdentifier
Gets the identifier of the given kind for @drive. The only
identifier currently available is
%G_DRIVE_IDENTIFIER_KIND_UNIX_DEVICE.- Parameter:
kind
- the kind of identifier to return- Gibt zurück:
- a newly allocated string containing the requested identifier, or %NULL if the #GDrive doesn't have this kind of identifier.
-
getName
Gets the name of @drive.- Gibt zurück:
- a string containing @drive's name. The returned string should be freed when no longer needed.
-
getSortKey
Gets the sort key for @drive, if any.- Gibt zurück:
- Sorting key for @drive or %NULL if no such key is available.
-
getStartStopType
public int getStartStopType()Gets a hint about how a drive can be started/stopped.- Gibt zurück:
- A value from the #GDriveStartStopType enumeration.
-
getSymbolicIcon
Gets the icon for @drive.- Gibt zurück:
- symbolic #GIcon for the @drive. Free the returned object with g_object_unref().
-
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().- Gibt zurück:
- #GList containing any #GVolume objects on the given @drive.
-
hasMedia
public boolean 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.- Gibt zurück:
- %TRUE if @drive has media, %FALSE otherwise.
-
hasVolumes
public boolean hasVolumes()Check if @drive has any mountable volumes.- Gibt zurück:
- %TRUE if the @drive contains volumes, %FALSE otherwise.
-
isMediaCheckAutomatic
public boolean isMediaCheckAutomatic()Checks if @drive is capable of automatically detecting media changes.- Gibt zurück:
- %TRUE if the @drive is capable of automatically detecting media changes, %FALSE otherwise.
-
isMediaRemovable
public boolean isMediaRemovable()Checks if the @drive supports removable media.- Gibt zurück:
- %TRUE if @drive supports removable media, %FALSE otherwise.
-
isRemovable
public boolean isRemovable()Checks if the #GDrive and/or its media is considered removable by the user.
See g_drive_is_media_removable().- Gibt zurück:
- %TRUE if @drive and/or its media is considered removable, %FALSE otherwise.
-
pollForMedia
public void pollForMedia(@Nullable Cancellable cancellable, Drive.OnAsyncReadyCallback callback, @Nullable Pointer user_data) 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.- Parameter:
cancellable
- optional #GCancellable object, %NULL to ignore.callback
- a #GAsyncReadyCallback, or %NULL.user_data
- user data to pass to @callback
-
pollForMediaFinish
Finishes an operation started with g_drive_poll_for_media() on a drive.- Parameter:
result
- a #GAsyncResult.- Gibt zurück:
- %TRUE if the drive has been poll_for_mediaed successfully, %FALSE otherwise.
- Löst aus:
AllocationError
-
start
public void start(int flags, @Nullable MountOperation mount_operation, @Nullable Cancellable cancellable, Drive.OnAsyncReadyCallback callback, @Nullable Pointer user_data) 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.- Parameter:
flags
- flags affecting the start operation.mount_operation
- a #GMountOperation or %NULL to avoid user interaction.cancellable
- optional #GCancellable object, %NULL to ignore.callback
- a #GAsyncReadyCallback, or %NULL.user_data
- user data to pass to @callback
-
startFinish
Finishes starting a drive.- Parameter:
result
- a #GAsyncResult.- Gibt zurück:
- %TRUE if the drive has been started successfully, %FALSE otherwise.
- Löst aus:
AllocationError
-
stop
public void stop(int flags, @Nullable MountOperation mount_operation, @Nullable Cancellable cancellable, Drive.OnAsyncReadyCallback callback, @Nullable Pointer user_data) 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.- Parameter:
flags
- flags affecting the unmount if required for stopping.mount_operation
- a #GMountOperation or %NULL to avoid user interaction.cancellable
- optional #GCancellable object, %NULL to ignore.callback
- a #GAsyncReadyCallback, or %NULL.user_data
- user data to pass to @callback
-
stopFinish
Finishes stopping a drive.- Parameter:
result
- a #GAsyncResult.- Gibt zurück:
- %TRUE if the drive has been stopped successfully, %FALSE otherwise.
- Löst aus:
AllocationError
-
onChanged
Connect to signal "changed".
SeeDrive.OnChanged.onChanged()
for signal description.
FieldSIGNAL_ON_CHANGED
contains original signal name and can be used as resource reference.- Parameter:
signal
- callback function (lambda).- Gibt zurück:
SignalHandler
. Can be used to disconnect signal and to release callback function.
-
onDisconnected
Connect to signal "disconnected".
SeeDrive.OnDisconnected.onDisconnected()
for signal description.
FieldSIGNAL_ON_DISCONNECTED
contains original signal name and can be used as resource reference.- Parameter:
signal
- callback function (lambda).- Gibt zurück:
SignalHandler
. Can be used to disconnect signal and to release callback function.
-
onEjectButton
Connect to signal "eject-button".
SeeDrive.OnEjectButton.onEjectButton()
for signal description.
FieldSIGNAL_ON_EJECT_BUTTON
contains original signal name and can be used as resource reference.- Parameter:
signal
- callback function (lambda).- Gibt zurück:
SignalHandler
. Can be used to disconnect signal and to release callback function.
-
onStopButton
Connect to signal "stop-button".
SeeDrive.OnStopButton.onStopButton()
for signal description.
FieldSIGNAL_ON_STOP_BUTTON
contains original signal name and can be used as resource reference.- Parameter:
signal
- callback function (lambda).- Gibt zurück:
SignalHandler
. Can be used to disconnect signal and to release callback function.
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-