source: appstream-generator/build/girepo/gio/DriveIF.d @ 4841

Last change on this file since 4841 was 4841, checked in by Juanma, 2 years ago

Initial release

File size: 11.9 KB
Line 
1/*
2 * Licensed under the GNU Lesser General Public License Version 3
3 *
4 * This library is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the license, or
7 * (at your option) any later version.
8 *
9 * This software is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library.  If not, see <http://www.gnu.org/licenses/>.
16 */
17
18// generated automatically - do not change
19
20
21module gio.DriveIF;
22
23private import gi.gio;
24public  import gi.giotypes;
25private import gio.AsyncResultIF;
26private import gio.Cancellable;
27private import gio.Icon;
28private import gio.IconIF;
29private import gio.MountOperation;
30private import glib.ErrorG;
31private import glib.GException;
32private import glib.ListG;
33private import glib.Str;
34private import gobject.ObjectG;
35private import gobject.Signals;
36private import std.algorithm;
37
38
39/**
40 * #GDrive - this represent a piece of hardware connected to the machine.
41 * It's generally only created for removable hardware or hardware with
42 * removable media.
43 *
44 * #GDrive is a container class for #GVolume objects that stem from
45 * the same piece of media. As such, #GDrive abstracts a drive with
46 * (or without) removable media and provides operations for querying
47 * whether media is available, determining whether media change is
48 * automatically detected and ejecting the media.
49 *
50 * If the #GDrive reports that media isn't automatically detected, one
51 * can poll for media; typically one should not do this periodically
52 * as a poll for media operation is potententially expensive and may
53 * spin up the drive creating noise.
54 *
55 * #GDrive supports starting and stopping drives with authentication
56 * support for the former. This can be used to support a diverse set
57 * of use cases including connecting/disconnecting iSCSI devices,
58 * powering down external disk enclosures and starting/stopping
59 * multi-disk devices such as RAID devices. Note that the actual
60 * semantics and side-effects of starting/stopping a #GDrive may vary
61 * according to implementation. To choose the correct verbs in e.g. a
62 * file manager, use g_drive_get_start_stop_type().
63 *
64 * For porting from GnomeVFS note that there is no equivalent of
65 * #GDrive in that API.
66 */
67public interface DriveIF{
68        /** Get the main Gtk struct */
69        public GDrive* getDriveStruct();
70
71        /** the main Gtk struct as a void* */
72        protected void* getStruct();
73
74
75        /**
76         * Checks if a drive can be ejected.
77         *
78         * Returns: %TRUE if the @drive can be ejected, %FALSE otherwise.
79         */
80        public bool canEject();
81
82        /**
83         * Checks if a drive can be polled for media changes.
84         *
85         * Returns: %TRUE if the @drive can be polled for media changes,
86         *     %FALSE otherwise.
87         */
88        public bool canPollForMedia();
89
90        /**
91         * Checks if a drive can be started.
92         *
93         * Returns: %TRUE if the @drive can be started, %FALSE otherwise.
94         *
95         * Since: 2.22
96         */
97        public bool canStart();
98
99        /**
100         * Checks if a drive can be started degraded.
101         *
102         * Returns: %TRUE if the @drive can be started degraded, %FALSE otherwise.
103         *
104         * Since: 2.22
105         */
106        public bool canStartDegraded();
107
108        /**
109         * Checks if a drive can be stopped.
110         *
111         * Returns: %TRUE if the @drive can be stopped, %FALSE otherwise.
112         *
113         * Since: 2.22
114         */
115        public bool canStop();
116
117        /**
118         * Asynchronously ejects a drive.
119         *
120         * When the operation is finished, @callback will be called.
121         * You can then call g_drive_eject_finish() to obtain the
122         * result of the operation.
123         *
124         * Deprecated: Use g_drive_eject_with_operation() instead.
125         *
126         * Params:
127         *     flags = flags affecting the unmount if required for eject
128         *     cancellable = optional #GCancellable object, %NULL to ignore.
129         *     callback = a #GAsyncReadyCallback, or %NULL.
130         *     userData = user data to pass to @callback
131         */
132        public void eject(GMountUnmountFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
133
134        /**
135         * Finishes ejecting a drive.
136         *
137         * Deprecated: Use g_drive_eject_with_operation_finish() instead.
138         *
139         * Params:
140         *     result = a #GAsyncResult.
141         *
142         * Returns: %TRUE if the drive has been ejected successfully,
143         *     %FALSE otherwise.
144         *
145         * Throws: GException on failure.
146         */
147        public bool ejectFinish(AsyncResultIF result);
148
149        /**
150         * Ejects a drive. This is an asynchronous operation, and is
151         * finished by calling g_drive_eject_with_operation_finish() with the @drive
152         * and #GAsyncResult data returned in the @callback.
153         *
154         * Params:
155         *     flags = flags affecting the unmount if required for eject
156         *     mountOperation = a #GMountOperation or %NULL to avoid
157         *         user interaction.
158         *     cancellable = optional #GCancellable object, %NULL to ignore.
159         *     callback = a #GAsyncReadyCallback, or %NULL.
160         *     userData = user data passed to @callback.
161         *
162         * Since: 2.22
163         */
164        public void ejectWithOperation(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
165
166        /**
167         * Finishes ejecting a drive. If any errors occurred during the operation,
168         * @error will be set to contain the errors and %FALSE will be returned.
169         *
170         * Params:
171         *     result = a #GAsyncResult.
172         *
173         * Returns: %TRUE if the drive was successfully ejected. %FALSE otherwise.
174         *
175         * Since: 2.22
176         *
177         * Throws: GException on failure.
178         */
179        public bool ejectWithOperationFinish(AsyncResultIF result);
180
181        /**
182         * Gets the kinds of identifiers that @drive has.
183         * Use g_drive_get_identifier() to obtain the identifiers
184         * themselves.
185         *
186         * Returns: a %NULL-terminated
187         *     array of strings containing kinds of identifiers. Use g_strfreev()
188         *     to free.
189         */
190        public string[] enumerateIdentifiers();
191
192        /**
193         * Gets the icon for @drive.
194         *
195         * Returns: #GIcon for the @drive.
196         *     Free the returned object with g_object_unref().
197         */
198        public IconIF getIcon();
199
200        /**
201         * Gets the identifier of the given kind for @drive.
202         *
203         * Params:
204         *     kind = the kind of identifier to return
205         *
206         * Returns: a newly allocated string containing the
207         *     requested identfier, or %NULL if the #GDrive
208         *     doesn't have this kind of identifier.
209         */
210        public string getIdentifier(string kind);
211
212        /**
213         * Gets the name of @drive.
214         *
215         * Returns: a string containing @drive's name. The returned
216         *     string should be freed when no longer needed.
217         */
218        public string getName();
219
220        /**
221         * Gets the sort key for @drive, if any.
222         *
223         * Returns: Sorting key for @drive or %NULL if no such key is available.
224         *
225         * Since: 2.32
226         */
227        public string getSortKey();
228
229        /**
230         * Gets a hint about how a drive can be started/stopped.
231         *
232         * Returns: A value from the #GDriveStartStopType enumeration.
233         *
234         * Since: 2.22
235         */
236        public GDriveStartStopType getStartStopType();
237
238        /**
239         * Gets the icon for @drive.
240         *
241         * Returns: symbolic #GIcon for the @drive.
242         *     Free the returned object with g_object_unref().
243         *
244         * Since: 2.34
245         */
246        public IconIF getSymbolicIcon();
247
248        /**
249         * Get a list of mountable volumes for @drive.
250         *
251         * The returned list should be freed with g_list_free(), after
252         * its elements have been unreffed with g_object_unref().
253         *
254         * Returns: #GList containing any #GVolume objects on the given @drive.
255         */
256        public ListG getVolumes();
257
258        /**
259         * Checks if the @drive has media. Note that the OS may not be polling
260         * the drive for media changes; see g_drive_is_media_check_automatic()
261         * for more details.
262         *
263         * Returns: %TRUE if @drive has media, %FALSE otherwise.
264         */
265        public bool hasMedia();
266
267        /**
268         * Check if @drive has any mountable volumes.
269         *
270         * Returns: %TRUE if the @drive contains volumes, %FALSE otherwise.
271         */
272        public bool hasVolumes();
273
274        /**
275         * Checks if @drive is capabable of automatically detecting media changes.
276         *
277         * Returns: %TRUE if the @drive is capabable of automatically detecting
278         *     media changes, %FALSE otherwise.
279         */
280        public bool isMediaCheckAutomatic();
281
282        /**
283         * Checks if the @drive supports removable media.
284         *
285         * Returns: %TRUE if @drive supports removable media, %FALSE otherwise.
286         */
287        public bool isMediaRemovable();
288
289        /**
290         * Asynchronously polls @drive to see if media has been inserted or removed.
291         *
292         * When the operation is finished, @callback will be called.
293         * You can then call g_drive_poll_for_media_finish() to obtain the
294         * result of the operation.
295         *
296         * Params:
297         *     cancellable = optional #GCancellable object, %NULL to ignore.
298         *     callback = a #GAsyncReadyCallback, or %NULL.
299         *     userData = user data to pass to @callback
300         */
301        public void pollForMedia(Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
302
303        /**
304         * Finishes an operation started with g_drive_poll_for_media() on a drive.
305         *
306         * Params:
307         *     result = a #GAsyncResult.
308         *
309         * Returns: %TRUE if the drive has been poll_for_mediaed successfully,
310         *     %FALSE otherwise.
311         *
312         * Throws: GException on failure.
313         */
314        public bool pollForMediaFinish(AsyncResultIF result);
315
316        /**
317         * Asynchronously starts a drive.
318         *
319         * When the operation is finished, @callback will be called.
320         * You can then call g_drive_start_finish() to obtain the
321         * result of the operation.
322         *
323         * Params:
324         *     flags = flags affecting the start operation.
325         *     mountOperation = a #GMountOperation or %NULL to avoid
326         *         user interaction.
327         *     cancellable = optional #GCancellable object, %NULL to ignore.
328         *     callback = a #GAsyncReadyCallback, or %NULL.
329         *     userData = user data to pass to @callback
330         *
331         * Since: 2.22
332         */
333        public void start(GDriveStartFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
334
335        /**
336         * Finishes starting a drive.
337         *
338         * Params:
339         *     result = a #GAsyncResult.
340         *
341         * Returns: %TRUE if the drive has been started successfully,
342         *     %FALSE otherwise.
343         *
344         * Since: 2.22
345         *
346         * Throws: GException on failure.
347         */
348        public bool startFinish(AsyncResultIF result);
349
350        /**
351         * Asynchronously stops a drive.
352         *
353         * When the operation is finished, @callback will be called.
354         * You can then call g_drive_stop_finish() to obtain the
355         * result of the operation.
356         *
357         * Params:
358         *     flags = flags affecting the unmount if required for stopping.
359         *     mountOperation = a #GMountOperation or %NULL to avoid
360         *         user interaction.
361         *     cancellable = optional #GCancellable object, %NULL to ignore.
362         *     callback = a #GAsyncReadyCallback, or %NULL.
363         *     userData = user data to pass to @callback
364         *
365         * Since: 2.22
366         */
367        public void stop(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
368
369        /**
370         * Finishes stopping a drive.
371         *
372         * Params:
373         *     result = a #GAsyncResult.
374         *
375         * Returns: %TRUE if the drive has been stopped successfully,
376         *     %FALSE otherwise.
377         *
378         * Since: 2.22
379         *
380         * Throws: GException on failure.
381         */
382        public bool stopFinish(AsyncResultIF result);
383
384        /**
385         * Emitted when the drive's state has changed.
386         */
387        gulong addOnChanged(void delegate(DriveIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
388
389        /**
390         * This signal is emitted when the #GDrive have been
391         * disconnected. If the recipient is holding references to the
392         * object they should release them so the object can be
393         * finalized.
394         */
395        gulong addOnDisconnected(void delegate(DriveIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
396
397        /**
398         * Emitted when the physical eject button (if any) of a drive has
399         * been pressed.
400         */
401        gulong addOnEjectButton(void delegate(DriveIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
402
403        /**
404         * Emitted when the physical stop button (if any) of a drive has
405         * been pressed.
406         *
407         * Since: 2.22
408         */
409        gulong addOnStopButton(void delegate(DriveIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
410}
Note: See TracBrowser for help on using the repository browser.