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  = GVolume.html
27  * outPack = gio
28  * outFile = VolumeIF
29  * strct   = GVolume
30  * realStrct=
31  * ctorStrct=
32  * clss    = VolumeT
33  * interf  = VolumeIF
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- g_volume_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * 	- glib.ErrorG
48  * 	- glib.GException
49  * 	- gobject.Signals
50  * 	- gio.AsyncResultIF
51  * 	- gio.Cancellable
52  * 	- gio.Drive
53  * 	- gio.DriveIF
54  * 	- gio.File
55  * 	- gio.Icon
56  * 	- gio.IconIF
57  * 	- gio.Mount
58  * 	- gio.MountIF
59  * 	- gio.MountOperation
60  * structWrap:
61  * 	- GAsyncResult* -> AsyncResultIF
62  * 	- GCancellable* -> Cancellable
63  * 	- GDrive* -> DriveIF
64  * 	- GFile* -> File
65  * 	- GIcon* -> IconIF
66  * 	- GMount* -> MountIF
67  * 	- GMountOperation* -> MountOperation
68  * module aliases:
69  * local aliases:
70  * overrides:
71  */
72 
73 module gio.VolumeIF;
74 
75 public  import gtkc.giotypes;
76 
77 private import gtkc.gio;
78 private import glib.ConstructionException;
79 private import gobject.ObjectG;
80 
81 private import gobject.Signals;
82 public  import gtkc.gdktypes;
83 
84 private import glib.Str;
85 private import glib.ErrorG;
86 private import glib.GException;
87 private import gobject.Signals;
88 private import gio.AsyncResultIF;
89 private import gio.Cancellable;
90 private import gio.Drive;
91 private import gio.DriveIF;
92 private import gio.File;
93 private import gio.Icon;
94 private import gio.IconIF;
95 private import gio.Mount;
96 private import gio.MountIF;
97 private import gio.MountOperation;
98 
99 
100 
101 
102 /**
103  * Description
104  * The GVolume interface represents user-visible objects that can be
105  * mounted. Note, when porting from GnomeVFS, GVolume is the moral
106  * equivalent of GnomeVFSDrive.
107  * Mounting a GVolume instance is an asynchronous operation. For more
108  * information about asynchronous operations, see GAsyncReady and
109  * GSimpleAsyncReady. To mount a GVolume, first call
110  * g_volume_mount() with (at least) the GVolume instance, optionally
111  * a GMountOperation object and a GAsyncReadyCallback.
112  * Typically, one will only want to pass NULL for the
113  * GMountOperation if automounting all volumes when a desktop session
114  * starts since it's not desirable to put up a lot of dialogs asking
115  * for credentials.
116  * The callback will be fired when the operation has resolved (either
117  * with success or failure), and a GAsyncReady structure will be
118  * passed to the callback. That callback should then call
119  * g_volume_mount_finish() with the GVolume instance and the
120  * GAsyncReady data to see if the operation was completed
121  * successfully. If an error is present when g_volume_mount_finish()
122  * is called, then it will be filled with any error information.
123  * It is sometimes necessary to directly access the underlying
124  * operating system object behind a volume (e.g. for passing a volume
125  * to an application via the commandline). For this purpose, GIO
126  * allows to obtain an 'identifier' for the volume. There can be
127  * different kinds of identifiers, such as Hal UDIs, filesystem labels,
128  * traditional Unix devices (e.g. /dev/sda2),
129  * uuids. GIO uses predefind strings as names for the different kinds
130  * of identifiers: G_VOLUME_IDENTIFIER_KIND_HAL_UDI,
131  * G_VOLUME_IDENTIFIER_KIND_LABEL, etc. Use g_volume_get_identifier()
132  * to obtain an identifier for a volume.
133  * Note that G_VOLUME_IDENTIFIER_KIND_HAL_UDI will only be available
134  * when the gvfs hal volume monitor is in use. Other volume monitors
135  * will generally be able to provide the G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE
136  * identifier, which can be used to obtain a hal device by means of
137  * libhal_manger_find_device_string_match().
138  */
139 public interface VolumeIF
140 {
141 	
142 	
143 	public GVolume* getVolumeTStruct();
144 	
145 	/** the main Gtk struct as a void* */
146 	protected void* getStruct();
147 	
148 	
149 	/**
150 	 */
151 	
152 	void delegate(VolumeIF)[] onChangedListeners();
153 	/**
154 	 * Emitted when the volume has been changed.
155 	 */
156 	void addOnChanged(void delegate(VolumeIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
157 	void delegate(VolumeIF)[] onRemovedListeners();
158 	/**
159 	 * This signal is emitted when the GVolume have been removed. If
160 	 * the recipient is holding references to the object they should
161 	 * release them so the object can be finalized.
162 	 */
163 	void addOnRemoved(void delegate(VolumeIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
164 	
165 	/**
166 	 * Gets the name of volume.
167 	 * Returns: the name for the given volume. The returned string should be freed with g_free() when no longer needed.
168 	 */
169 	public string getName();
170 	
171 	/**
172 	 * Gets the UUID for the volume. The reference is typically based on
173 	 * the file system UUID for the volume in question and should be
174 	 * considered an opaque string. Returns NULL if there is no UUID
175 	 * available.
176 	 * Returns: the UUID for volume or NULL if no UUID can be computed. The returned string should be freed with g_free() when no longer needed.
177 	 */
178 	public string getUuid();
179 	
180 	/**
181 	 * Gets the icon for volume.
182 	 * Returns: a GIcon. The returned object should be unreffed with g_object_unref() when no longer needed. [transfer full]
183 	 */
184 	public IconIF getIcon();
185 	
186 	/**
187 	 * Gets the drive for the volume.
188 	 * Returns: a GDrive or NULL if volume is not associated with a drive. The returned object should be unreffed with g_object_unref() when no longer needed. [transfer full]
189 	 */
190 	public DriveIF getDrive();
191 	
192 	/**
193 	 * Gets the mount for the volume.
194 	 * Returns: a GMount or NULL if volume isn't mounted. The returned object should be unreffed with g_object_unref() when no longer needed. [transfer full]
195 	 */
196 	public MountIF getMount();
197 	
198 	/**
199 	 * Checks if a volume can be mounted.
200 	 * Returns: TRUE if the volume can be mounted. FALSE otherwise.
201 	 */
202 	public int canMount();
203 	
204 	/**
205 	 * Returns whether the volume should be automatically mounted.
206 	 * Returns: TRUE if the volume should be automatically mounted.
207 	 */
208 	public int shouldAutomount();
209 	
210 	/**
211 	 * Gets the activation root for a GVolume if it is known ahead of
212 	 * mount time. Returns NULL otherwise. If not NULL and if volume
213 	 * is mounted, then the result of g_mount_get_root() on the
214 	 * GMount object obtained from g_volume_get_mount() will always
215 	 * either be equal or a prefix of what this function returns. In
216 	 * other words, in code
217 	 *  GMount *mount;
218 	 *  GFile *mount_root
219 	 *  GFile *volume_activation_root;
220 	 *  mount = g_volume_get_mount (volume); /+* mounted, so never NULL +/
221 	 *  mount_root = g_mount_get_root (mount);
222 	 *  volume_activation_root = g_volume_get_activation_root(volume); /+* assume not NULL +/
223 	 * then the expression
224 	 *  (g_file_has_prefix (volume_activation_root, mount_root) ||
225 	 *  g_file_equal (volume_activation_root, mount_root))
226 	 * will always be TRUE.
227 	 * Activation roots are typically used in GVolumeMonitor
228 	 * implementations to find the underlying mount to shadow, see
229 	 * g_mount_is_shadowed() for more details.
230 	 * Since 2.18
231 	 * Returns: the activation root of volume or NULL. Use g_object_unref() to free. [transfer full]
232 	 */
233 	public File getActivationRoot();
234 	
235 	/**
236 	 * Mounts a volume. This is an asynchronous operation, and is
237 	 * finished by calling g_volume_mount_finish() with the volume
238 	 * and GAsyncResult returned in the callback.
239 	 * Virtual: mount_fn
240 	 * Params:
241 	 * flags = flags affecting the operation
242 	 * mountOperation = a GMountOperation or NULL to avoid user interaction. [allow-none]
243 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
244 	 * callback = a GAsyncReadyCallback, or NULL. [allow-none]
245 	 * userData = user data that gets passed to callback
246 	 */
247 	public void mount(GMountMountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
248 	
249 	/**
250 	 * Finishes mounting a volume. If any errors occured during the operation,
251 	 * error will be set to contain the errors and FALSE will be returned.
252 	 * If the mount operation succeeded, g_volume_get_mount() on volume
253 	 * is guaranteed to return the mount right after calling this
254 	 * function; there's no need to listen for the 'mount-added' signal on
255 	 * GVolumeMonitor.
256 	 * Params:
257 	 * result = a GAsyncResult
258 	 * Returns: TRUE, FALSE if operation failed.
259 	 * Throws: GException on failure.
260 	 */
261 	public int mountFinish(AsyncResultIF result);
262 	
263 	/**
264 	 * Checks if a volume can be ejected.
265 	 * Returns: TRUE if the volume can be ejected. FALSE otherwise.
266 	 */
267 	public int canEject();
268 	
269 	/**
270 	 * Warning
271 	 * g_volume_eject has been deprecated since version 2.22 and should not be used in newly-written code. Use g_volume_eject_with_operation() instead.
272 	 * Ejects a volume. This is an asynchronous operation, and is
273 	 * finished by calling g_volume_eject_finish() with the volume
274 	 * and GAsyncResult returned in the callback.
275 	 * Params:
276 	 * flags = flags affecting the unmount if required for eject
277 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
278 	 * callback = a GAsyncReadyCallback, or NULL. [allow-none]
279 	 * userData = user data that gets passed to callback
280 	 */
281 	public void eject(GMountUnmountFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
282 	
283 	/**
284 	 * Warning
285 	 * g_volume_eject_finish has been deprecated since version 2.22 and should not be used in newly-written code. Use g_volume_eject_with_operation_finish() instead.
286 	 * Finishes ejecting a volume. If any errors occured during the operation,
287 	 * error will be set to contain the errors and FALSE will be returned.
288 	 * Params:
289 	 * result = a GAsyncResult.
290 	 * Returns: TRUE, FALSE if operation failed.
291 	 * Throws: GException on failure.
292 	 */
293 	public int ejectFinish(AsyncResultIF result);
294 	
295 	/**
296 	 * Ejects a volume. This is an asynchronous operation, and is
297 	 * finished by calling g_volume_eject_with_operation_finish() with the volume
298 	 * and GAsyncResult data returned in the callback.
299 	 * Since 2.22
300 	 * Params:
301 	 * flags = flags affecting the unmount if required for eject
302 	 * mountOperation = a GMountOperation or NULL to
303 	 * avoid user interaction. [allow-none]
304 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
305 	 * callback = a GAsyncReadyCallback, or NULL.
306 	 * userData = user data passed to callback.
307 	 */
308 	public void ejectWithOperation(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
309 	
310 	/**
311 	 * Finishes ejecting a volume. If any errors occurred during the operation,
312 	 * error will be set to contain the errors and FALSE will be returned.
313 	 * Since 2.22
314 	 * Params:
315 	 * result = a GAsyncResult.
316 	 * Returns: TRUE if the volume was successfully ejected. FALSE otherwise.
317 	 * Throws: GException on failure.
318 	 */
319 	public int ejectWithOperationFinish(AsyncResultIF result);
320 	
321 	/**
322 	 * Gets the kinds of identifiers
323 	 * that volume has. Use g_volume_get_identifer() to obtain
324 	 * the identifiers themselves.
325 	 * Returns: a NULL-terminated array of strings containing kinds of identifiers. Use g_strfreev() to free. [array zero-terminated=1][transfer full]
326 	 */
327 	public string[] enumerateIdentifiers();
328 	
329 	/**
330 	 * Gets the identifier of the given kind for volume.
331 	 * See the introduction
332 	 * for more information about volume identifiers.
333 	 * Params:
334 	 * kind = the kind of identifier to return
335 	 * Returns: a newly allocated string containing the requested identfier, or NULL if the GVolume doesn't have this kind of identifier Signal Details The "changed" signal void user_function (GVolume *arg0, gpointer user_data) : Run Last Emitted when the volume has been changed.
336 	 */
337 	public string getIdentifier(string kind);
338 }