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