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  * The GVolume interface represents user-visible objects that can be
104  * mounted. Note, when porting from GnomeVFS, GVolume is the moral
105  * equivalent of GnomeVFSDrive.
106  *
107  * Mounting a GVolume instance is an asynchronous operation. For more
108  * information about asynchronous operations, see GAsyncResult and
109  * GTask. To mount a GVolume, first call g_volume_mount() with (at
110  * least) the GVolume instance, optionally a GMountOperation object
111  * and a GAsyncReadyCallback.
112  *
113  * Typically, one will only want to pass NULL for the
114  * GMountOperation if automounting all volumes when a desktop session
115  * starts since it's not desirable to put up a lot of dialogs asking
116  * for credentials.
117  *
118  * The callback will be fired when the operation has resolved (either
119  * with success or failure), and a GAsyncReady structure will be
120  * passed to the callback. That callback should then call
121  * g_volume_mount_finish() with the GVolume instance and the
122  * GAsyncReady data to see if the operation was completed
123  * successfully. If an error is present when g_volume_mount_finish()
124  * is called, then it will be filled with any error information.
125  *
126  * It is sometimes necessary to directly access the underlying
127  * operating system object behind a volume (e.g. for passing a volume
128  * to an application via the commandline). For this purpose, GIO
129  * allows to obtain an 'identifier' for the volume. There can be
130  * different kinds of identifiers, such as Hal UDIs, filesystem labels,
131  * traditional Unix devices (e.g. /dev/sda2),
132  * uuids. GIO uses predefind strings as names for the different kinds
133  * of identifiers: G_VOLUME_IDENTIFIER_KIND_HAL_UDI,
134  * G_VOLUME_IDENTIFIER_KIND_LABEL, etc. Use g_volume_get_identifier()
135  * to obtain an identifier for a volume.
136  *
137  * Note that G_VOLUME_IDENTIFIER_KIND_HAL_UDI will only be available
138  * when the gvfs hal volume monitor is in use. Other volume monitors
139  * will generally be able to provide the G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE
140  * identifier, which can be used to obtain a hal device by means of
141  * libhal_manager_find_device_string_match().
142  */
143 public interface VolumeIF
144 {
145 	
146 	
147 	public GVolume* getVolumeTStruct();
148 	
149 	/** the main Gtk struct as a void* */
150 	protected void* getStruct();
151 	
152 	
153 	/**
154 	 */
155 	
156 	@property void delegate(VolumeIF)[] onChangedListeners();
157 	/**
158 	 * Emitted when the volume has been changed.
159 	 */
160 	void addOnChanged(void delegate(VolumeIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
161 	@property void delegate(VolumeIF)[] onRemovedListeners();
162 	/**
163 	 * This signal is emitted when the GVolume have been removed. If
164 	 * the recipient is holding references to the object they should
165 	 * release them so the object can be finalized.
166 	 */
167 	void addOnRemoved(void delegate(VolumeIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
168 	
169 	/**
170 	 * Gets the name of volume.
171 	 * Returns: the name for the given volume. The returned string should be freed with g_free() when no longer needed.
172 	 */
173 	public string getName();
174 	
175 	/**
176 	 * Gets the UUID for the volume. The reference is typically based on
177 	 * the file system UUID for the volume in question and should be
178 	 * considered an opaque string. Returns NULL if there is no UUID
179 	 * available.
180 	 * 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.
181 	 */
182 	public string getUuid();
183 	
184 	/**
185 	 * Gets the icon for volume.
186 	 * Returns: a GIcon. The returned object should be unreffed with g_object_unref() when no longer needed. [transfer full]
187 	 */
188 	public IconIF getIcon();
189 	
190 	/**
191 	 * Gets the symbolic icon for volume.
192 	 * Since 2.34
193 	 * Returns: a GIcon. The returned object should be unreffed with g_object_unref() when no longer needed. [transfer full]
194 	 */
195 	public IconIF getSymbolicIcon();
196 	
197 	/**
198 	 * Gets the drive for the volume.
199 	 * 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]
200 	 */
201 	public DriveIF getDrive();
202 	
203 	/**
204 	 * Gets the mount for the volume.
205 	 * 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]
206 	 */
207 	public MountIF getMount();
208 	
209 	/**
210 	 * Checks if a volume can be mounted.
211 	 * Returns: TRUE if the volume can be mounted. FALSE otherwise.
212 	 */
213 	public int canMount();
214 	
215 	/**
216 	 * Returns whether the volume should be automatically mounted.
217 	 * Returns: TRUE if the volume should be automatically mounted.
218 	 */
219 	public int shouldAutomount();
220 	
221 	/**
222 	 * Gets the activation root for a GVolume if it is known ahead of
223 	 * mount time. Returns NULL otherwise. If not NULL and if volume
224 	 * is mounted, then the result of g_mount_get_root() on the
225 	 * GMount object obtained from g_volume_get_mount() will always
226 	 * either be equal or a prefix of what this function returns. In
227 	 * other words, in code
228 	 *  GMount *mount;
229 	 *  GFile *mount_root
230 	 *  GFile *volume_activation_root;
231 	 *  mount = g_volume_get_mount (volume); /+* mounted, so never NULL +/
232 	 *  mount_root = g_mount_get_root (mount);
233 	 *  volume_activation_root = g_volume_get_activation_root(volume); /+* assume not NULL +/
234 	 * then the expression
235 	 *  (g_file_has_prefix (volume_activation_root, mount_root) ||
236 	 *  g_file_equal (volume_activation_root, mount_root))
237 	 * will always be TRUE.
238 	 * Activation roots are typically used in GVolumeMonitor
239 	 * implementations to find the underlying mount to shadow, see
240 	 * g_mount_is_shadowed() for more details.
241 	 * Since 2.18
242 	 * Returns: the activation root of volume or NULL. Use g_object_unref() to free. [transfer full]
243 	 */
244 	public File getActivationRoot();
245 	
246 	/**
247 	 * Mounts a volume. This is an asynchronous operation, and is
248 	 * finished by calling g_volume_mount_finish() with the volume
249 	 * and GAsyncResult returned in the callback.
250 	 * Virtual: mount_fn
251 	 * Params:
252 	 * flags = flags affecting the operation
253 	 * mountOperation = a GMountOperation or NULL to avoid user interaction. [allow-none]
254 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
255 	 * callback = a GAsyncReadyCallback, or NULL. [allow-none]
256 	 * userData = user data that gets passed to callback
257 	 */
258 	public void mount(GMountMountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
259 	
260 	/**
261 	 * Finishes mounting a volume. If any errors occurred during the operation,
262 	 * error will be set to contain the errors and FALSE will be returned.
263 	 * If the mount operation succeeded, g_volume_get_mount() on volume
264 	 * is guaranteed to return the mount right after calling this
265 	 * function; there's no need to listen for the 'mount-added' signal on
266 	 * GVolumeMonitor.
267 	 * Params:
268 	 * result = a GAsyncResult
269 	 * Returns: TRUE, FALSE if operation failed.
270 	 * Throws: GException on failure.
271 	 */
272 	public int mountFinish(AsyncResultIF result);
273 	
274 	/**
275 	 * Checks if a volume can be ejected.
276 	 * Returns: TRUE if the volume can be ejected. FALSE otherwise.
277 	 */
278 	public int canEject();
279 	
280 	/**
281 	 * Warning
282 	 * 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.
283 	 * Ejects a volume. This is an asynchronous operation, and is
284 	 * finished by calling g_volume_eject_finish() with the volume
285 	 * and GAsyncResult returned in the callback.
286 	 * Params:
287 	 * flags = flags affecting the unmount if required for eject
288 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
289 	 * callback = a GAsyncReadyCallback, or NULL. [allow-none]
290 	 * userData = user data that gets passed to callback
291 	 */
292 	public void eject(GMountUnmountFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
293 	
294 	/**
295 	 * Warning
296 	 * 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.
297 	 * Finishes ejecting a volume. If any errors occurred during the operation,
298 	 * error will be set to contain the errors and FALSE will be returned.
299 	 * Params:
300 	 * result = a GAsyncResult.
301 	 * Returns: TRUE, FALSE if operation failed.
302 	 * Throws: GException on failure.
303 	 */
304 	public int ejectFinish(AsyncResultIF result);
305 	
306 	/**
307 	 * Ejects a volume. This is an asynchronous operation, and is
308 	 * finished by calling g_volume_eject_with_operation_finish() with the volume
309 	 * and GAsyncResult data returned in the callback.
310 	 * Since 2.22
311 	 * Params:
312 	 * flags = flags affecting the unmount if required for eject
313 	 * mountOperation = a GMountOperation or NULL to
314 	 * avoid user interaction. [allow-none]
315 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
316 	 * callback = a GAsyncReadyCallback, or NULL. [allow-none]
317 	 * userData = user data passed to callback.
318 	 */
319 	public void ejectWithOperation(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
320 	
321 	/**
322 	 * Finishes ejecting a volume. If any errors occurred during the operation,
323 	 * error will be set to contain the errors and FALSE will be returned.
324 	 * Since 2.22
325 	 * Params:
326 	 * result = a GAsyncResult.
327 	 * Returns: TRUE if the volume was successfully ejected. FALSE otherwise.
328 	 * Throws: GException on failure.
329 	 */
330 	public int ejectWithOperationFinish(AsyncResultIF result);
331 	
332 	/**
333 	 * Gets the kinds of identifiers
334 	 * that volume has. Use g_volume_get_identifier() to obtain
335 	 * the identifiers themselves.
336 	 * Returns: a NULL-terminated array of strings containing kinds of identifiers. Use g_strfreev() to free. [array zero-terminated=1][transfer full]
337 	 */
338 	public string[] enumerateIdentifiers();
339 	
340 	/**
341 	 * Gets the identifier of the given kind for volume.
342 	 * See the introduction
343 	 * for more information about volume identifiers.
344 	 * Params:
345 	 * kind = the kind of identifier to return
346 	 * Returns: a newly allocated string containing the requested identfier, or NULL if the GVolume doesn't have this kind of identifier
347 	 */
348 	public string getIdentifier(string kind);
349 	
350 	/**
351 	 * Gets the sort key for volume, if any.
352 	 * Since 2.32
353 	 * Signal Details
354 	 * The "changed" signal
355 	 * void user_function (GVolume *arg0,
356 	 *  gpointer user_data) : Run Last
357 	 * Emitted when the volume has been changed.
358 	 * Returns: Sorting key for volume or NULL if no such key is available.
359 	 */
360 	public string getSortKey();
361 }