root/trunk/src/gio/DriveIF.d

Revision 938, 12.7 kB (checked in by Mike Wey, 3 months ago)

Update Gio to 2.28.

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