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

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

Initial release

File size: 132.8 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.FileT;
22
23public  import gi.gio;
24public  import gi.giotypes;
25public  import gio.AppInfo;
26public  import gio.AppInfoIF;
27public  import gio.AsyncResultIF;
28public  import gio.Cancellable;
29public  import gio.File;
30public  import gio.FileAttributeInfoList;
31public  import gio.FileEnumerator;
32public  import gio.FileIF;
33public  import gio.FileIOStream;
34public  import gio.FileInfo;
35public  import gio.FileInputStream;
36public  import gio.FileMonitor;
37public  import gio.FileOutputStream;
38public  import gio.Mount;
39public  import gio.MountIF;
40public  import gio.MountOperation;
41public  import glib.Bytes;
42public  import glib.ConstructionException;
43public  import glib.ErrorG;
44public  import glib.GException;
45public  import glib.Str;
46public  import gobject.ObjectG;
47
48
49/**
50 * #GFile is a high level abstraction for manipulating files on a
51 * virtual file system. #GFiles are lightweight, immutable objects
52 * that do no I/O upon creation. It is necessary to understand that
53 * #GFile objects do not represent files, merely an identifier for a
54 * file. All file content I/O is implemented as streaming operations
55 * (see #GInputStream and #GOutputStream).
56 *
57 * To construct a #GFile, you can use:
58 * - g_file_new_for_path() if you have a path.
59 * - g_file_new_for_uri() if you have a URI.
60 * - g_file_new_for_commandline_arg() for a command line argument.
61 * - g_file_new_tmp() to create a temporary file from a template.
62 * - g_file_parse_name() from a UTF-8 string gotten from g_file_get_parse_name().
63 *
64 * One way to think of a #GFile is as an abstraction of a pathname. For
65 * normal files the system pathname is what is stored internally, but as
66 * #GFiles are extensible it could also be something else that corresponds
67 * to a pathname in a userspace implementation of a filesystem.
68 *
69 * #GFiles make up hierarchies of directories and files that correspond to
70 * the files on a filesystem. You can move through the file system with
71 * #GFile using g_file_get_parent() to get an identifier for the parent
72 * directory, g_file_get_child() to get a child within a directory,
73 * g_file_resolve_relative_path() to resolve a relative path between two
74 * #GFiles. There can be multiple hierarchies, so you may not end up at
75 * the same root if you repeatedly call g_file_get_parent() on two different
76 * files.
77 *
78 * All #GFiles have a basename (get with g_file_get_basename()). These names
79 * are byte strings that are used to identify the file on the filesystem
80 * (relative to its parent directory) and there is no guarantees that they
81 * have any particular charset encoding or even make any sense at all. If
82 * you want to use filenames in a user interface you should use the display
83 * name that you can get by requesting the
84 * %G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME attribute with g_file_query_info().
85 * This is guaranteed to be in UTF-8 and can be used in a user interface.
86 * But always store the real basename or the #GFile to use to actually
87 * access the file, because there is no way to go from a display name to
88 * the actual name.
89 *
90 * Using #GFile as an identifier has the same weaknesses as using a path
91 * in that there may be multiple aliases for the same file. For instance,
92 * hard or soft links may cause two different #GFiles to refer to the same
93 * file. Other possible causes for aliases are: case insensitive filesystems,
94 * short and long names on FAT/NTFS, or bind mounts in Linux. If you want to
95 * check if two #GFiles point to the same file you can query for the
96 * %G_FILE_ATTRIBUTE_ID_FILE attribute. Note that #GFile does some trivial
97 * canonicalization of pathnames passed in, so that trivial differences in
98 * the path string used at creation (duplicated slashes, slash at end of
99 * path, "." or ".." path segments, etc) does not create different #GFiles.
100 *
101 * Many #GFile operations have both synchronous and asynchronous versions
102 * to suit your application. Asynchronous versions of synchronous functions
103 * simply have _async() appended to their function names. The asynchronous
104 * I/O functions call a #GAsyncReadyCallback which is then used to finalize
105 * the operation, producing a GAsyncResult which is then passed to the
106 * function's matching _finish() operation.
107 *
108 * It is highly recommended to use asynchronous calls when running within a
109 * shared main loop, such as in the main thread of an application. This avoids
110 * I/O operations blocking other sources on the main loop from being dispatched.
111 * Synchronous I/O operations should be performed from worker threads. See the
112 * [introduction to asynchronous programming section][async-programming] for
113 * more.
114 *
115 * Some #GFile operations almost always take a noticeable amount of time, and
116 * so do not have synchronous analogs. Notable cases include:
117 * - g_file_mount_mountable() to mount a mountable file.
118 * - g_file_unmount_mountable_with_operation() to unmount a mountable file.
119 * - g_file_eject_mountable_with_operation() to eject a mountable file.
120 *
121 * ## Entity Tags # {#gfile-etag}
122 *
123 * One notable feature of #GFiles are entity tags, or "etags" for
124 * short. Entity tags are somewhat like a more abstract version of the
125 * traditional mtime, and can be used to quickly determine if the file
126 * has been modified from the version on the file system. See the
127 * HTTP 1.1
128 * [specification](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html)
129 * for HTTP Etag headers, which are a very similar concept.
130 */
131public template FileT(TStruct)
132{
133        /** Get the main Gtk struct */
134        public GFile* getFileStruct()
135        {
136                return cast(GFile*)getStruct();
137        }
138
139
140        /**
141         * Constructs a #GFile with the given @parse_name (i.e. something
142         * given by g_file_get_parse_name()). This operation never fails,
143         * but the returned object might not support any I/O operation if
144         * the @parse_name cannot be parsed.
145         *
146         * Params:
147         *     parseName = a file name or path to be parsed
148         *
149         * Returns: a new #GFile.
150         */
151        public static FileIF parseName(string parseName)
152        {
153                auto p = g_file_parse_name(Str.toStringz(parseName));
154               
155                if(p is null)
156                {
157                        return null;
158                }
159               
160                return ObjectG.getDObject!(File, FileIF)(cast(GFile*) p, true);
161        }
162
163        /**
164         * Gets an output stream for appending data to the file.
165         * If the file doesn't already exist it is created.
166         *
167         * By default files created are generally readable by everyone,
168         * but if you pass #G_FILE_CREATE_PRIVATE in @flags the file
169         * will be made readable only to the current user, to the level that
170         * is supported on the target filesystem.
171         *
172         * If @cancellable is not %NULL, then the operation can be cancelled
173         * by triggering the cancellable object from another thread. If the
174         * operation was cancelled, the error %G_IO_ERROR_CANCELLED will be
175         * returned.
176         *
177         * Some file systems don't allow all file names, and may return an
178         * %G_IO_ERROR_INVALID_FILENAME error. If the file is a directory the
179         * %G_IO_ERROR_IS_DIRECTORY error will be returned. Other errors are
180         * possible too, and depend on what kind of filesystem the file is on.
181         *
182         * Params:
183         *     flags = a set of #GFileCreateFlags
184         *     cancellable = optional #GCancellable object,
185         *         %NULL to ignore
186         *
187         * Returns: a #GFileOutputStream, or %NULL on error.
188         *     Free the returned object with g_object_unref().
189         *
190         * Throws: GException on failure.
191         */
192        public FileOutputStream appendTo(GFileCreateFlags flags, Cancellable cancellable)
193        {
194                GError* err = null;
195               
196                auto p = g_file_append_to(getFileStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
197               
198                if (err !is null)
199                {
200                        throw new GException( new ErrorG(err) );
201                }
202               
203                if(p is null)
204                {
205                        return null;
206                }
207               
208                return ObjectG.getDObject!(FileOutputStream)(cast(GFileOutputStream*) p, true);
209        }
210
211        /**
212         * Asynchronously opens @file for appending.
213         *
214         * For more details, see g_file_append_to() which is
215         * the synchronous version of this call.
216         *
217         * When the operation is finished, @callback will be called.
218         * You can then call g_file_append_to_finish() to get the result
219         * of the operation.
220         *
221         * Params:
222         *     flags = a set of #GFileCreateFlags
223         *     ioPriority = the [I/O priority][io-priority] of the request
224         *     cancellable = optional #GCancellable object,
225         *         %NULL to ignore
226         *     callback = a #GAsyncReadyCallback to call
227         *         when the request is satisfied
228         *     userData = the data to pass to callback function
229         */
230        public void appendToAsync(GFileCreateFlags flags, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
231        {
232                g_file_append_to_async(getFileStruct(), flags, ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
233        }
234
235        /**
236         * Finishes an asynchronous file append operation started with
237         * g_file_append_to_async().
238         *
239         * Params:
240         *     res = #GAsyncResult
241         *
242         * Returns: a valid #GFileOutputStream
243         *     or %NULL on error.
244         *     Free the returned object with g_object_unref().
245         *
246         * Throws: GException on failure.
247         */
248        public FileOutputStream appendToFinish(AsyncResultIF res)
249        {
250                GError* err = null;
251               
252                auto p = g_file_append_to_finish(getFileStruct(), (res is null) ? null : res.getAsyncResultStruct(), &err);
253               
254                if (err !is null)
255                {
256                        throw new GException( new ErrorG(err) );
257                }
258               
259                if(p is null)
260                {
261                        return null;
262                }
263               
264                return ObjectG.getDObject!(FileOutputStream)(cast(GFileOutputStream*) p, true);
265        }
266
267        /**
268         * Copies the file @source to the location specified by @destination.
269         * Can not handle recursive copies of directories.
270         *
271         * If the flag #G_FILE_COPY_OVERWRITE is specified an already
272         * existing @destination file is overwritten.
273         *
274         * If the flag #G_FILE_COPY_NOFOLLOW_SYMLINKS is specified then symlinks
275         * will be copied as symlinks, otherwise the target of the
276         * @source symlink will be copied.
277         *
278         * If @cancellable is not %NULL, then the operation can be cancelled by
279         * triggering the cancellable object from another thread. If the operation
280         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
281         *
282         * If @progress_callback is not %NULL, then the operation can be monitored
283         * by setting this to a #GFileProgressCallback function.
284         * @progress_callback_data will be passed to this function. It is guaranteed
285         * that this callback will be called after all data has been transferred with
286         * the total number of bytes copied during the operation.
287         *
288         * If the @source file does not exist, then the %G_IO_ERROR_NOT_FOUND error
289         * is returned, independent on the status of the @destination.
290         *
291         * If #G_FILE_COPY_OVERWRITE is not specified and the target exists, then
292         * the error %G_IO_ERROR_EXISTS is returned.
293         *
294         * If trying to overwrite a file over a directory, the %G_IO_ERROR_IS_DIRECTORY
295         * error is returned. If trying to overwrite a directory with a directory the
296         * %G_IO_ERROR_WOULD_MERGE error is returned.
297         *
298         * If the source is a directory and the target does not exist, or
299         * #G_FILE_COPY_OVERWRITE is specified and the target is a file, then the
300         * %G_IO_ERROR_WOULD_RECURSE error is returned.
301         *
302         * If you are interested in copying the #GFile object itself (not the on-disk
303         * file), see g_file_dup().
304         *
305         * Params:
306         *     destination = destination #GFile
307         *     flags = set of #GFileCopyFlags
308         *     cancellable = optional #GCancellable object,
309         *         %NULL to ignore
310         *     progressCallback = function to callback with
311         *         progress information, or %NULL if progress information is not needed
312         *     progressCallbackData = user data to pass to @progress_callback
313         *
314         * Returns: %TRUE on success, %FALSE otherwise.
315         *
316         * Throws: GException on failure.
317         */
318        public bool copy(FileIF destination, GFileCopyFlags flags, Cancellable cancellable, GFileProgressCallback progressCallback, void* progressCallbackData)
319        {
320                GError* err = null;
321               
322                auto p = g_file_copy(getFileStruct(), (destination is null) ? null : destination.getFileStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), progressCallback, progressCallbackData, &err) != 0;
323               
324                if (err !is null)
325                {
326                        throw new GException( new ErrorG(err) );
327                }
328               
329                return p;
330        }
331
332        /**
333         * Copies the file @source to the location specified by @destination
334         * asynchronously. For details of the behaviour, see g_file_copy().
335         *
336         * If @progress_callback is not %NULL, then that function that will be called
337         * just like in g_file_copy(). The callback will run in the default main context
338         * of the thread calling g_file_copy_async() — the same context as @callback is
339         * run in.
340         *
341         * When the operation is finished, @callback will be called. You can then call
342         * g_file_copy_finish() to get the result of the operation.
343         *
344         * Params:
345         *     destination = destination #GFile
346         *     flags = set of #GFileCopyFlags
347         *     ioPriority = the [I/O priority][io-priority] of the request
348         *     cancellable = optional #GCancellable object,
349         *         %NULL to ignore
350         *     progressCallback = function to callback with progress
351         *         information, or %NULL if progress information is not needed
352         *     progressCallbackData = user data to pass to @progress_callback
353         *     callback = a #GAsyncReadyCallback to call when the request is satisfied
354         *     userData = the data to pass to callback function
355         */
356        public void copyAsync(FileIF destination, GFileCopyFlags flags, int ioPriority, Cancellable cancellable, GFileProgressCallback progressCallback, void* progressCallbackData, GAsyncReadyCallback callback, void* userData)
357        {
358                g_file_copy_async(getFileStruct(), (destination is null) ? null : destination.getFileStruct(), flags, ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct(), progressCallback, progressCallbackData, callback, userData);
359        }
360
361        /**
362         * Copies the file attributes from @source to @destination.
363         *
364         * Normally only a subset of the file attributes are copied,
365         * those that are copies in a normal file copy operation
366         * (which for instance does not include e.g. owner). However
367         * if #G_FILE_COPY_ALL_METADATA is specified in @flags, then
368         * all the metadata that is possible to copy is copied. This
369         * is useful when implementing move by copy + delete source.
370         *
371         * Params:
372         *     destination = a #GFile to copy attributes to
373         *     flags = a set of #GFileCopyFlags
374         *     cancellable = optional #GCancellable object,
375         *         %NULL to ignore
376         *
377         * Returns: %TRUE if the attributes were copied successfully,
378         *     %FALSE otherwise.
379         *
380         * Throws: GException on failure.
381         */
382        public bool copyAttributes(FileIF destination, GFileCopyFlags flags, Cancellable cancellable)
383        {
384                GError* err = null;
385               
386                auto p = g_file_copy_attributes(getFileStruct(), (destination is null) ? null : destination.getFileStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0;
387               
388                if (err !is null)
389                {
390                        throw new GException( new ErrorG(err) );
391                }
392               
393                return p;
394        }
395
396        /**
397         * Finishes copying the file started with g_file_copy_async().
398         *
399         * Params:
400         *     res = a #GAsyncResult
401         *
402         * Returns: a %TRUE on success, %FALSE on error.
403         *
404         * Throws: GException on failure.
405         */
406        public bool copyFinish(AsyncResultIF res)
407        {
408                GError* err = null;
409               
410                auto p = g_file_copy_finish(getFileStruct(), (res is null) ? null : res.getAsyncResultStruct(), &err) != 0;
411               
412                if (err !is null)
413                {
414                        throw new GException( new ErrorG(err) );
415                }
416               
417                return p;
418        }
419
420        /**
421         * Creates a new file and returns an output stream for writing to it.
422         * The file must not already exist.
423         *
424         * By default files created are generally readable by everyone,
425         * but if you pass #G_FILE_CREATE_PRIVATE in @flags the file
426         * will be made readable only to the current user, to the level
427         * that is supported on the target filesystem.
428         *
429         * If @cancellable is not %NULL, then the operation can be cancelled
430         * by triggering the cancellable object from another thread. If the
431         * operation was cancelled, the error %G_IO_ERROR_CANCELLED will be
432         * returned.
433         *
434         * If a file or directory with this name already exists the
435         * %G_IO_ERROR_EXISTS error will be returned. Some file systems don't
436         * allow all file names, and may return an %G_IO_ERROR_INVALID_FILENAME
437         * error, and if the name is to long %G_IO_ERROR_FILENAME_TOO_LONG will
438         * be returned. Other errors are possible too, and depend on what kind
439         * of filesystem the file is on.
440         *
441         * Params:
442         *     flags = a set of #GFileCreateFlags
443         *     cancellable = optional #GCancellable object,
444         *         %NULL to ignore
445         *
446         * Returns: a #GFileOutputStream for the newly created
447         *     file, or %NULL on error.
448         *     Free the returned object with g_object_unref().
449         *
450         * Throws: GException on failure.
451         */
452        public FileOutputStream create(GFileCreateFlags flags, Cancellable cancellable)
453        {
454                GError* err = null;
455               
456                auto p = g_file_create(getFileStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
457               
458                if (err !is null)
459                {
460                        throw new GException( new ErrorG(err) );
461                }
462               
463                if(p is null)
464                {
465                        return null;
466                }
467               
468                return ObjectG.getDObject!(FileOutputStream)(cast(GFileOutputStream*) p, true);
469        }
470
471        /**
472         * Asynchronously creates a new file and returns an output stream
473         * for writing to it. The file must not already exist.
474         *
475         * For more details, see g_file_create() which is
476         * the synchronous version of this call.
477         *
478         * When the operation is finished, @callback will be called.
479         * You can then call g_file_create_finish() to get the result
480         * of the operation.
481         *
482         * Params:
483         *     flags = a set of #GFileCreateFlags
484         *     ioPriority = the [I/O priority][io-priority] of the request
485         *     cancellable = optional #GCancellable object,
486         *         %NULL to ignore
487         *     callback = a #GAsyncReadyCallback to call
488         *         when the request is satisfied
489         *     userData = the data to pass to callback function
490         */
491        public void createAsync(GFileCreateFlags flags, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
492        {
493                g_file_create_async(getFileStruct(), flags, ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
494        }
495
496        /**
497         * Finishes an asynchronous file create operation started with
498         * g_file_create_async().
499         *
500         * Params:
501         *     res = a #GAsyncResult
502         *
503         * Returns: a #GFileOutputStream or %NULL on error.
504         *     Free the returned object with g_object_unref().
505         *
506         * Throws: GException on failure.
507         */
508        public FileOutputStream createFinish(AsyncResultIF res)
509        {
510                GError* err = null;
511               
512                auto p = g_file_create_finish(getFileStruct(), (res is null) ? null : res.getAsyncResultStruct(), &err);
513               
514                if (err !is null)
515                {
516                        throw new GException( new ErrorG(err) );
517                }
518               
519                if(p is null)
520                {
521                        return null;
522                }
523               
524                return ObjectG.getDObject!(FileOutputStream)(cast(GFileOutputStream*) p, true);
525        }
526
527        /**
528         * Creates a new file and returns a stream for reading and
529         * writing to it. The file must not already exist.
530         *
531         * By default files created are generally readable by everyone,
532         * but if you pass #G_FILE_CREATE_PRIVATE in @flags the file
533         * will be made readable only to the current user, to the level
534         * that is supported on the target filesystem.
535         *
536         * If @cancellable is not %NULL, then the operation can be cancelled
537         * by triggering the cancellable object from another thread. If the
538         * operation was cancelled, the error %G_IO_ERROR_CANCELLED will be
539         * returned.
540         *
541         * If a file or directory with this name already exists, the
542         * %G_IO_ERROR_EXISTS error will be returned. Some file systems don't
543         * allow all file names, and may return an %G_IO_ERROR_INVALID_FILENAME
544         * error, and if the name is too long, %G_IO_ERROR_FILENAME_TOO_LONG
545         * will be returned. Other errors are possible too, and depend on what
546         * kind of filesystem the file is on.
547         *
548         * Note that in many non-local file cases read and write streams are
549         * not supported, so make sure you really need to do read and write
550         * streaming, rather than just opening for reading or writing.
551         *
552         * Params:
553         *     flags = a set of #GFileCreateFlags
554         *     cancellable = optional #GCancellable object,
555         *         %NULL to ignore
556         *
557         * Returns: a #GFileIOStream for the newly created
558         *     file, or %NULL on error.
559         *     Free the returned object with g_object_unref().
560         *
561         * Since: 2.22
562         *
563         * Throws: GException on failure.
564         */
565        public FileIOStream createReadwrite(GFileCreateFlags flags, Cancellable cancellable)
566        {
567                GError* err = null;
568               
569                auto p = g_file_create_readwrite(getFileStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
570               
571                if (err !is null)
572                {
573                        throw new GException( new ErrorG(err) );
574                }
575               
576                if(p is null)
577                {
578                        return null;
579                }
580               
581                return ObjectG.getDObject!(FileIOStream)(cast(GFileIOStream*) p, true);
582        }
583
584        /**
585         * Asynchronously creates a new file and returns a stream
586         * for reading and writing to it. The file must not already exist.
587         *
588         * For more details, see g_file_create_readwrite() which is
589         * the synchronous version of this call.
590         *
591         * When the operation is finished, @callback will be called.
592         * You can then call g_file_create_readwrite_finish() to get
593         * the result of the operation.
594         *
595         * Params:
596         *     flags = a set of #GFileCreateFlags
597         *     ioPriority = the [I/O priority][io-priority] of the request
598         *     cancellable = optional #GCancellable object,
599         *         %NULL to ignore
600         *     callback = a #GAsyncReadyCallback to call
601         *         when the request is satisfied
602         *     userData = the data to pass to callback function
603         *
604         * Since: 2.22
605         */
606        public void createReadwriteAsync(GFileCreateFlags flags, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
607        {
608                g_file_create_readwrite_async(getFileStruct(), flags, ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
609        }
610
611        /**
612         * Finishes an asynchronous file create operation started with
613         * g_file_create_readwrite_async().
614         *
615         * Params:
616         *     res = a #GAsyncResult
617         *
618         * Returns: a #GFileIOStream or %NULL on error.
619         *     Free the returned object with g_object_unref().
620         *
621         * Since: 2.22
622         *
623         * Throws: GException on failure.
624         */
625        public FileIOStream createReadwriteFinish(AsyncResultIF res)
626        {
627                GError* err = null;
628               
629                auto p = g_file_create_readwrite_finish(getFileStruct(), (res is null) ? null : res.getAsyncResultStruct(), &err);
630               
631                if (err !is null)
632                {
633                        throw new GException( new ErrorG(err) );
634                }
635               
636                if(p is null)
637                {
638                        return null;
639                }
640               
641                return ObjectG.getDObject!(FileIOStream)(cast(GFileIOStream*) p, true);
642        }
643
644        /**
645         * Deletes a file. If the @file is a directory, it will only be
646         * deleted if it is empty. This has the same semantics as g_unlink().
647         *
648         * If @cancellable is not %NULL, then the operation can be cancelled by
649         * triggering the cancellable object from another thread. If the operation
650         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
651         *
652         * Params:
653         *     cancellable = optional #GCancellable object,
654         *         %NULL to ignore
655         *
656         * Returns: %TRUE if the file was deleted. %FALSE otherwise.
657         *
658         * Throws: GException on failure.
659         */
660        public bool delet(Cancellable cancellable)
661        {
662                GError* err = null;
663               
664                auto p = g_file_delete(getFileStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0;
665               
666                if (err !is null)
667                {
668                        throw new GException( new ErrorG(err) );
669                }
670               
671                return p;
672        }
673
674        /**
675         * Asynchronously delete a file. If the @file is a directory, it will
676         * only be deleted if it is empty.  This has the same semantics as
677         * g_unlink().
678         *
679         * Params:
680         *     ioPriority = the [I/O priority][io-priority] of the request
681         *     cancellable = optional #GCancellable object,
682         *         %NULL to ignore
683         *     callback = a #GAsyncReadyCallback to call
684         *         when the request is satisfied
685         *     userData = the data to pass to callback function
686         *
687         * Since: 2.34
688         */
689        public void deleteAsync(int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
690        {
691                g_file_delete_async(getFileStruct(), ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
692        }
693
694        /**
695         * Finishes deleting a file started with g_file_delete_async().
696         *
697         * Params:
698         *     result = a #GAsyncResult
699         *
700         * Returns: %TRUE if the file was deleted. %FALSE otherwise.
701         *
702         * Since: 2.34
703         *
704         * Throws: GException on failure.
705         */
706        public bool deleteFinish(AsyncResultIF result)
707        {
708                GError* err = null;
709               
710                auto p = g_file_delete_finish(getFileStruct(), (result is null) ? null : result.getAsyncResultStruct(), &err) != 0;
711               
712                if (err !is null)
713                {
714                        throw new GException( new ErrorG(err) );
715                }
716               
717                return p;
718        }
719
720        /**
721         * Duplicates a #GFile handle. This operation does not duplicate
722         * the actual file or directory represented by the #GFile; see
723         * g_file_copy() if attempting to copy a file.
724         *
725         * This call does no blocking I/O.
726         *
727         * Returns: a new #GFile that is a duplicate
728         *     of the given #GFile.
729         */
730        public FileIF dup()
731        {
732                auto p = g_file_dup(getFileStruct());
733               
734                if(p is null)
735                {
736                        return null;
737                }
738               
739                return ObjectG.getDObject!(File, FileIF)(cast(GFile*) p, true);
740        }
741
742        /**
743         * Starts an asynchronous eject on a mountable.
744         * When this operation has completed, @callback will be called with
745         * @user_user data, and the operation can be finalized with
746         * g_file_eject_mountable_finish().
747         *
748         * If @cancellable is not %NULL, then the operation can be cancelled by
749         * triggering the cancellable object from another thread. If the operation
750         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
751         *
752         * Deprecated: Use g_file_eject_mountable_with_operation() instead.
753         *
754         * Params:
755         *     flags = flags affecting the operation
756         *     cancellable = optional #GCancellable object,
757         *         %NULL to ignore
758         *     callback = a #GAsyncReadyCallback to call
759         *         when the request is satisfied, or %NULL
760         *     userData = the data to pass to callback function
761         */
762        public void ejectMountable(GMountUnmountFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
763        {
764                g_file_eject_mountable(getFileStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
765        }
766
767        /**
768         * Finishes an asynchronous eject operation started by
769         * g_file_eject_mountable().
770         *
771         * Deprecated: Use g_file_eject_mountable_with_operation_finish()
772         * instead.
773         *
774         * Params:
775         *     result = a #GAsyncResult
776         *
777         * Returns: %TRUE if the @file was ejected successfully.
778         *     %FALSE otherwise.
779         *
780         * Throws: GException on failure.
781         */
782        public bool ejectMountableFinish(AsyncResultIF result)
783        {
784                GError* err = null;
785               
786                auto p = g_file_eject_mountable_finish(getFileStruct(), (result is null) ? null : result.getAsyncResultStruct(), &err) != 0;
787               
788                if (err !is null)
789                {
790                        throw new GException( new ErrorG(err) );
791                }
792               
793                return p;
794        }
795
796        /**
797         * Starts an asynchronous eject on a mountable.
798         * When this operation has completed, @callback will be called with
799         * @user_user data, and the operation can be finalized with
800         * g_file_eject_mountable_with_operation_finish().
801         *
802         * If @cancellable is not %NULL, then the operation can be cancelled by
803         * triggering the cancellable object from another thread. If the operation
804         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
805         *
806         * Params:
807         *     flags = flags affecting the operation
808         *     mountOperation = a #GMountOperation,
809         *         or %NULL to avoid user interaction
810         *     cancellable = optional #GCancellable object,
811         *         %NULL to ignore
812         *     callback = a #GAsyncReadyCallback to call
813         *         when the request is satisfied, or %NULL
814         *     userData = the data to pass to callback function
815         *
816         * Since: 2.22
817         */
818        public void ejectMountableWithOperation(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
819        {
820                g_file_eject_mountable_with_operation(getFileStruct(), flags, (mountOperation is null) ? null : mountOperation.getMountOperationStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
821        }
822
823        /**
824         * Finishes an asynchronous eject operation started by
825         * g_file_eject_mountable_with_operation().
826         *
827         * Params:
828         *     result = a #GAsyncResult
829         *
830         * Returns: %TRUE if the @file was ejected successfully.
831         *     %FALSE otherwise.
832         *
833         * Since: 2.22
834         *
835         * Throws: GException on failure.
836         */
837        public bool ejectMountableWithOperationFinish(AsyncResultIF result)
838        {
839                GError* err = null;
840               
841                auto p = g_file_eject_mountable_with_operation_finish(getFileStruct(), (result is null) ? null : result.getAsyncResultStruct(), &err) != 0;
842               
843                if (err !is null)
844                {
845                        throw new GException( new ErrorG(err) );
846                }
847               
848                return p;
849        }
850
851        /**
852         * Gets the requested information about the files in a directory.
853         * The result is a #GFileEnumerator object that will give out
854         * #GFileInfo objects for all the files in the directory.
855         *
856         * The @attributes value is a string that specifies the file
857         * attributes that should be gathered. It is not an error if
858         * it's not possible to read a particular requested attribute
859         * from a file - it just won't be set. @attributes should
860         * be a comma-separated list of attributes or attribute wildcards.
861         * The wildcard "*" means all attributes, and a wildcard like
862         * "standard::*" means all attributes in the standard namespace.
863         * An example attribute query be "standard::*,owner::user".
864         * The standard attributes are available as defines, like
865         * #G_FILE_ATTRIBUTE_STANDARD_NAME.
866         *
867         * If @cancellable is not %NULL, then the operation can be cancelled
868         * by triggering the cancellable object from another thread. If the
869         * operation was cancelled, the error %G_IO_ERROR_CANCELLED will be
870         * returned.
871         *
872         * If the file does not exist, the %G_IO_ERROR_NOT_FOUND error will
873         * be returned. If the file is not a directory, the %G_IO_ERROR_NOT_DIRECTORY
874         * error will be returned. Other errors are possible too.
875         *
876         * Params:
877         *     attributes = an attribute query string
878         *     flags = a set of #GFileQueryInfoFlags
879         *     cancellable = optional #GCancellable object,
880         *         %NULL to ignore
881         *
882         * Returns: A #GFileEnumerator if successful,
883         *     %NULL on error. Free the returned object with g_object_unref().
884         *
885         * Throws: GException on failure.
886         */
887        public FileEnumerator enumerateChildren(string attributes, GFileQueryInfoFlags flags, Cancellable cancellable)
888        {
889                GError* err = null;
890               
891                auto p = g_file_enumerate_children(getFileStruct(), Str.toStringz(attributes), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
892               
893                if (err !is null)
894                {
895                        throw new GException( new ErrorG(err) );
896                }
897               
898                if(p is null)
899                {
900                        return null;
901                }
902               
903                return ObjectG.getDObject!(FileEnumerator)(cast(GFileEnumerator*) p, true);
904        }
905
906        /**
907         * Asynchronously gets the requested information about the files
908         * in a directory. The result is a #GFileEnumerator object that will
909         * give out #GFileInfo objects for all the files in the directory.
910         *
911         * For more details, see g_file_enumerate_children() which is
912         * the synchronous version of this call.
913         *
914         * When the operation is finished, @callback will be called. You can
915         * then call g_file_enumerate_children_finish() to get the result of
916         * the operation.
917         *
918         * Params:
919         *     attributes = an attribute query string
920         *     flags = a set of #GFileQueryInfoFlags
921         *     ioPriority = the [I/O priority][io-priority] of the request
922         *     cancellable = optional #GCancellable object,
923         *         %NULL to ignore
924         *     callback = a #GAsyncReadyCallback to call when the
925         *         request is satisfied
926         *     userData = the data to pass to callback function
927         */
928        public void enumerateChildrenAsync(string attributes, GFileQueryInfoFlags flags, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
929        {
930                g_file_enumerate_children_async(getFileStruct(), Str.toStringz(attributes), flags, ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
931        }
932
933        /**
934         * Finishes an async enumerate children operation.
935         * See g_file_enumerate_children_async().
936         *
937         * Params:
938         *     res = a #GAsyncResult
939         *
940         * Returns: a #GFileEnumerator or %NULL
941         *     if an error occurred.
942         *     Free the returned object with g_object_unref().
943         *
944         * Throws: GException on failure.
945         */
946        public FileEnumerator enumerateChildrenFinish(AsyncResultIF res)
947        {
948                GError* err = null;
949               
950                auto p = g_file_enumerate_children_finish(getFileStruct(), (res is null) ? null : res.getAsyncResultStruct(), &err);
951               
952                if (err !is null)
953                {
954                        throw new GException( new ErrorG(err) );
955                }
956               
957                if(p is null)
958                {
959                        return null;
960                }
961               
962                return ObjectG.getDObject!(FileEnumerator)(cast(GFileEnumerator*) p, true);
963        }
964
965        /**
966         * Checks if the two given #GFiles refer to the same file.
967         *
968         * Note that two #GFiles that differ can still refer to the same
969         * file on the filesystem due to various forms of filename
970         * aliasing.
971         *
972         * This call does no blocking I/O.
973         *
974         * Params:
975         *     file2 = the second #GFile
976         *
977         * Returns: %TRUE if @file1 and @file2 are equal.
978         */
979        public bool equal(FileIF file2)
980        {
981                return g_file_equal(getFileStruct(), (file2 is null) ? null : file2.getFileStruct()) != 0;
982        }
983
984        /**
985         * Gets a #GMount for the #GFile.
986         *
987         * If the #GFileIface for @file does not have a mount (e.g.
988         * possibly a remote share), @error will be set to %G_IO_ERROR_NOT_FOUND
989         * and %NULL will be returned.
990         *
991         * If @cancellable is not %NULL, then the operation can be cancelled by
992         * triggering the cancellable object from another thread. If the operation
993         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
994         *
995         * Params:
996         *     cancellable = optional #GCancellable object,
997         *         %NULL to ignore
998         *
999         * Returns: a #GMount where the @file is located
1000         *     or %NULL on error.
1001         *     Free the returned object with g_object_unref().
1002         *
1003         * Throws: GException on failure.
1004         */
1005        public MountIF findEnclosingMount(Cancellable cancellable)
1006        {
1007                GError* err = null;
1008               
1009                auto p = g_file_find_enclosing_mount(getFileStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
1010               
1011                if (err !is null)
1012                {
1013                        throw new GException( new ErrorG(err) );
1014                }
1015               
1016                if(p is null)
1017                {
1018                        return null;
1019                }
1020               
1021                return ObjectG.getDObject!(Mount, MountIF)(cast(GMount*) p, true);
1022        }
1023
1024        /**
1025         * Asynchronously gets the mount for the file.
1026         *
1027         * For more details, see g_file_find_enclosing_mount() which is
1028         * the synchronous version of this call.
1029         *
1030         * When the operation is finished, @callback will be called.
1031         * You can then call g_file_find_enclosing_mount_finish() to
1032         * get the result of the operation.
1033         *
1034         * Params:
1035         *     ioPriority = the [I/O priority][io-priority] of the request
1036         *     cancellable = optional #GCancellable object,
1037         *         %NULL to ignore
1038         *     callback = a #GAsyncReadyCallback to call
1039         *         when the request is satisfied
1040         *     userData = the data to pass to callback function
1041         */
1042        public void findEnclosingMountAsync(int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
1043        {
1044                g_file_find_enclosing_mount_async(getFileStruct(), ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
1045        }
1046
1047        /**
1048         * Finishes an asynchronous find mount request.
1049         * See g_file_find_enclosing_mount_async().
1050         *
1051         * Params:
1052         *     res = a #GAsyncResult
1053         *
1054         * Returns: #GMount for given @file or %NULL on error.
1055         *     Free the returned object with g_object_unref().
1056         *
1057         * Throws: GException on failure.
1058         */
1059        public MountIF findEnclosingMountFinish(AsyncResultIF res)
1060        {
1061                GError* err = null;
1062               
1063                auto p = g_file_find_enclosing_mount_finish(getFileStruct(), (res is null) ? null : res.getAsyncResultStruct(), &err);
1064               
1065                if (err !is null)
1066                {
1067                        throw new GException( new ErrorG(err) );
1068                }
1069               
1070                if(p is null)
1071                {
1072                        return null;
1073                }
1074               
1075                return ObjectG.getDObject!(Mount, MountIF)(cast(GMount*) p, true);
1076        }
1077
1078        /**
1079         * Gets the base name (the last component of the path) for a given #GFile.
1080         *
1081         * If called for the top level of a system (such as the filesystem root
1082         * or a uri like sftp://host/) it will return a single directory separator
1083         * (and on Windows, possibly a drive letter).
1084         *
1085         * The base name is a byte string (not UTF-8). It has no defined encoding
1086         * or rules other than it may not contain zero bytes.  If you want to use
1087         * filenames in a user interface you should use the display name that you
1088         * can get by requesting the %G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME
1089         * attribute with g_file_query_info().
1090         *
1091         * This call does no blocking I/O.
1092         *
1093         * Returns: string containing the #GFile's base name, or
1094         *     %NULL if given #GFile is invalid. The returned string should be
1095         *     freed with g_free() when no longer needed.
1096         */
1097        public string getBasename()
1098        {
1099                auto retStr = g_file_get_basename(getFileStruct());
1100               
1101                scope(exit) Str.freeString(retStr);
1102                return Str.toString(retStr);
1103        }
1104
1105        /**
1106         * Gets a child of @file with basename equal to @name.
1107         *
1108         * Note that the file with that specific name might not exist, but
1109         * you can still have a #GFile that points to it. You can use this
1110         * for instance to create that file.
1111         *
1112         * This call does no blocking I/O.
1113         *
1114         * Params:
1115         *     name = string containing the child's basename
1116         *
1117         * Returns: a #GFile to a child specified by @name.
1118         *     Free the returned object with g_object_unref().
1119         */
1120        public FileIF getChild(string name)
1121        {
1122                auto p = g_file_get_child(getFileStruct(), Str.toStringz(name));
1123               
1124                if(p is null)
1125                {
1126                        return null;
1127                }
1128               
1129                return ObjectG.getDObject!(File, FileIF)(cast(GFile*) p, true);
1130        }
1131
1132        /**
1133         * Gets the child of @file for a given @display_name (i.e. a UTF-8
1134         * version of the name). If this function fails, it returns %NULL
1135         * and @error will be set. This is very useful when constructing a
1136         * #GFile for a new file and the user entered the filename in the
1137         * user interface, for instance when you select a directory and
1138         * type a filename in the file selector.
1139         *
1140         * This call does no blocking I/O.
1141         *
1142         * Params:
1143         *     displayName = string to a possible child
1144         *
1145         * Returns: a #GFile to the specified child, or
1146         *     %NULL if the display name couldn't be converted.
1147         *     Free the returned object with g_object_unref().
1148         *
1149         * Throws: GException on failure.
1150         */
1151        public FileIF getChildForDisplayName(string displayName)
1152        {
1153                GError* err = null;
1154               
1155                auto p = g_file_get_child_for_display_name(getFileStruct(), Str.toStringz(displayName), &err);
1156               
1157                if (err !is null)
1158                {
1159                        throw new GException( new ErrorG(err) );
1160                }
1161               
1162                if(p is null)
1163                {
1164                        return null;
1165                }
1166               
1167                return ObjectG.getDObject!(File, FileIF)(cast(GFile*) p, true);
1168        }
1169
1170        /**
1171         * Gets the parent directory for the @file.
1172         * If the @file represents the root directory of the
1173         * file system, then %NULL will be returned.
1174         *
1175         * This call does no blocking I/O.
1176         *
1177         * Returns: a #GFile structure to the
1178         *     parent of the given #GFile or %NULL if there is no parent. Free
1179         *     the returned object with g_object_unref().
1180         */
1181        public FileIF getParent()
1182        {
1183                auto p = g_file_get_parent(getFileStruct());
1184               
1185                if(p is null)
1186                {
1187                        return null;
1188                }
1189               
1190                return ObjectG.getDObject!(File, FileIF)(cast(GFile*) p, true);
1191        }
1192
1193        /**
1194         * Gets the parse name of the @file.
1195         * A parse name is a UTF-8 string that describes the
1196         * file such that one can get the #GFile back using
1197         * g_file_parse_name().
1198         *
1199         * This is generally used to show the #GFile as a nice
1200         * full-pathname kind of string in a user interface,
1201         * like in a location entry.
1202         *
1203         * For local files with names that can safely be converted
1204         * to UTF-8 the pathname is used, otherwise the IRI is used
1205         * (a form of URI that allows UTF-8 characters unescaped).
1206         *
1207         * This call does no blocking I/O.
1208         *
1209         * Returns: a string containing the #GFile's parse name.
1210         *     The returned string should be freed with g_free()
1211         *     when no longer needed.
1212         */
1213        public string getParseName()
1214        {
1215                auto retStr = g_file_get_parse_name(getFileStruct());
1216               
1217                scope(exit) Str.freeString(retStr);
1218                return Str.toString(retStr);
1219        }
1220
1221        /**
1222         * Gets the local pathname for #GFile, if one exists. If non-%NULL, this is
1223         * guaranteed to be an absolute, canonical path. It might contain symlinks.
1224         *
1225         * This call does no blocking I/O.
1226         *
1227         * Returns: string containing the #GFile's path, or %NULL
1228         *     if no such path exists. The returned string should be freed
1229         *     with g_free() when no longer needed.
1230         */
1231        public string getPath()
1232        {
1233                auto retStr = g_file_get_path(getFileStruct());
1234               
1235                scope(exit) Str.freeString(retStr);
1236                return Str.toString(retStr);
1237        }
1238
1239        /**
1240         * Gets the path for @descendant relative to @parent.
1241         *
1242         * This call does no blocking I/O.
1243         *
1244         * Params:
1245         *     descendant = input #GFile
1246         *
1247         * Returns: string with the relative path from @descendant
1248         *     to @parent, or %NULL if @descendant doesn't have @parent as
1249         *     prefix. The returned string should be freed with g_free() when
1250         *     no longer needed.
1251         */
1252        public string getRelativePath(FileIF descendant)
1253        {
1254                auto retStr = g_file_get_relative_path(getFileStruct(), (descendant is null) ? null : descendant.getFileStruct());
1255               
1256                scope(exit) Str.freeString(retStr);
1257                return Str.toString(retStr);
1258        }
1259
1260        /**
1261         * Gets the URI for the @file.
1262         *
1263         * This call does no blocking I/O.
1264         *
1265         * Returns: a string containing the #GFile's URI.
1266         *     The returned string should be freed with g_free()
1267         *     when no longer needed.
1268         */
1269        public string getUri()
1270        {
1271                auto retStr = g_file_get_uri(getFileStruct());
1272               
1273                scope(exit) Str.freeString(retStr);
1274                return Str.toString(retStr);
1275        }
1276
1277        /**
1278         * Gets the URI scheme for a #GFile.
1279         * RFC 3986 decodes the scheme as:
1280         * |[
1281         * URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
1282         * ]|
1283         * Common schemes include "file", "http", "ftp", etc.
1284         *
1285         * This call does no blocking I/O.
1286         *
1287         * Returns: a string containing the URI scheme for the given
1288         *     #GFile. The returned string should be freed with g_free()
1289         *     when no longer needed.
1290         */
1291        public string getUriScheme()
1292        {
1293                auto retStr = g_file_get_uri_scheme(getFileStruct());
1294               
1295                scope(exit) Str.freeString(retStr);
1296                return Str.toString(retStr);
1297        }
1298
1299        /**
1300         * Checks if @file has a parent, and optionally, if it is @parent.
1301         *
1302         * If @parent is %NULL then this function returns %TRUE if @file has any
1303         * parent at all.  If @parent is non-%NULL then %TRUE is only returned
1304         * if @file is an immediate child of @parent.
1305         *
1306         * Params:
1307         *     parent = the parent to check for, or %NULL
1308         *
1309         * Returns: %TRUE if @file is an immediate child of @parent (or any parent in
1310         *     the case that @parent is %NULL).
1311         *
1312         * Since: 2.24
1313         */
1314        public bool hasParent(FileIF parent)
1315        {
1316                return g_file_has_parent(getFileStruct(), (parent is null) ? null : parent.getFileStruct()) != 0;
1317        }
1318
1319        /**
1320         * Checks whether @file has the prefix specified by @prefix.
1321         *
1322         * In other words, if the names of initial elements of @file's
1323         * pathname match @prefix. Only full pathname elements are matched,
1324         * so a path like /foo is not considered a prefix of /foobar, only
1325         * of /foo/bar.
1326         *
1327         * A #GFile is not a prefix of itself. If you want to check for
1328         * equality, use g_file_equal().
1329         *
1330         * This call does no I/O, as it works purely on names. As such it can
1331         * sometimes return %FALSE even if @file is inside a @prefix (from a
1332         * filesystem point of view), because the prefix of @file is an alias
1333         * of @prefix.
1334         *
1335         * Params:
1336         *     prefix = input #GFile
1337         *
1338         * Returns: %TRUE if the @files's parent, grandparent, etc is @prefix,
1339         *     %FALSE otherwise.
1340         */
1341        public bool hasPrefix(FileIF prefix)
1342        {
1343                return g_file_has_prefix(getFileStruct(), (prefix is null) ? null : prefix.getFileStruct()) != 0;
1344        }
1345
1346        /**
1347         * Checks to see if a #GFile has a given URI scheme.
1348         *
1349         * This call does no blocking I/O.
1350         *
1351         * Params:
1352         *     uriScheme = a string containing a URI scheme
1353         *
1354         * Returns: %TRUE if #GFile's backend supports the
1355         *     given URI scheme, %FALSE if URI scheme is %NULL,
1356         *     not supported, or #GFile is invalid.
1357         */
1358        public bool hasUriScheme(string uriScheme)
1359        {
1360                return g_file_has_uri_scheme(getFileStruct(), Str.toStringz(uriScheme)) != 0;
1361        }
1362
1363        /**
1364         * Creates a hash value for a #GFile.
1365         *
1366         * This call does no blocking I/O.
1367         *
1368         * Returns: 0 if @file is not a valid #GFile, otherwise an
1369         *     integer that can be used as hash value for the #GFile.
1370         *     This function is intended for easily hashing a #GFile to
1371         *     add to a #GHashTable or similar data structure.
1372         */
1373        public uint hash()
1374        {
1375                return g_file_hash(getFileStruct());
1376        }
1377
1378        /**
1379         * Checks to see if a file is native to the platform.
1380         *
1381         * A native file s one expressed in the platform-native filename format,
1382         * e.g. "C:\Windows" or "/usr/bin/". This does not mean the file is local,
1383         * as it might be on a locally mounted remote filesystem.
1384         *
1385         * On some systems non-native files may be available using the native
1386         * filesystem via a userspace filesystem (FUSE), in these cases this call
1387         * will return %FALSE, but g_file_get_path() will still return a native path.
1388         *
1389         * This call does no blocking I/O.
1390         *
1391         * Returns: %TRUE if @file is native
1392         */
1393        public bool isNative()
1394        {
1395                return g_file_is_native(getFileStruct()) != 0;
1396        }
1397
1398        /**
1399         * Loads the content of the file into memory. The data is always
1400         * zero-terminated, but this is not included in the resultant @length.
1401         * The returned @content should be freed with g_free() when no longer
1402         * needed.
1403         *
1404         * If @cancellable is not %NULL, then the operation can be cancelled by
1405         * triggering the cancellable object from another thread. If the operation
1406         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
1407         *
1408         * Params:
1409         *     cancellable = optional #GCancellable object, %NULL to ignore
1410         *     contents = a location to place the contents of the file
1411         *     length = a location to place the length of the contents of the file,
1412         *         or %NULL if the length is not needed
1413         *     etagOut = a location to place the current entity tag for the file,
1414         *         or %NULL if the entity tag is not needed
1415         *
1416         * Returns: %TRUE if the @file's contents were successfully loaded.
1417         *     %FALSE if there were errors.
1418         *
1419         * Throws: GException on failure.
1420         */
1421        public bool loadContents(Cancellable cancellable, out string contents, out string etagOut)
1422        {
1423                char* outcontents = null;
1424                size_t length;
1425                char* outetagOut = null;
1426                GError* err = null;
1427               
1428                auto p = g_file_load_contents(getFileStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), &outcontents, &length, &outetagOut, &err) != 0;
1429               
1430                if (err !is null)
1431                {
1432                        throw new GException( new ErrorG(err) );
1433                }
1434               
1435                contents = Str.toString(outcontents, length);
1436                etagOut = Str.toString(outetagOut);
1437               
1438                return p;
1439        }
1440
1441        /**
1442         * Starts an asynchronous load of the @file's contents.
1443         *
1444         * For more details, see g_file_load_contents() which is
1445         * the synchronous version of this call.
1446         *
1447         * When the load operation has completed, @callback will be called
1448         * with @user data. To finish the operation, call
1449         * g_file_load_contents_finish() with the #GAsyncResult returned by
1450         * the @callback.
1451         *
1452         * If @cancellable is not %NULL, then the operation can be cancelled by
1453         * triggering the cancellable object from another thread. If the operation
1454         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
1455         *
1456         * Params:
1457         *     cancellable = optional #GCancellable object, %NULL to ignore
1458         *     callback = a #GAsyncReadyCallback to call when the request is satisfied
1459         *     userData = the data to pass to callback function
1460         */
1461        public void loadContentsAsync(Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
1462        {
1463                g_file_load_contents_async(getFileStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
1464        }
1465
1466        /**
1467         * Finishes an asynchronous load of the @file's contents.
1468         * The contents are placed in @contents, and @length is set to the
1469         * size of the @contents string. The @content should be freed with
1470         * g_free() when no longer needed. If @etag_out is present, it will be
1471         * set to the new entity tag for the @file.
1472         *
1473         * Params:
1474         *     res = a #GAsyncResult
1475         *     contents = a location to place the contents of the file
1476         *     length = a location to place the length of the contents of the file,
1477         *         or %NULL if the length is not needed
1478         *     etagOut = a location to place the current entity tag for the file,
1479         *         or %NULL if the entity tag is not needed
1480         *
1481         * Returns: %TRUE if the load was successful. If %FALSE and @error is
1482         *     present, it will be set appropriately.
1483         *
1484         * Throws: GException on failure.
1485         */
1486        public bool loadContentsFinish(AsyncResultIF res, out string contents, out string etagOut)
1487        {
1488                char* outcontents = null;
1489                size_t length;
1490                char* outetagOut = null;
1491                GError* err = null;
1492               
1493                auto p = g_file_load_contents_finish(getFileStruct(), (res is null) ? null : res.getAsyncResultStruct(), &outcontents, &length, &outetagOut, &err) != 0;
1494               
1495                if (err !is null)
1496                {
1497                        throw new GException( new ErrorG(err) );
1498                }
1499               
1500                contents = Str.toString(outcontents, length);
1501                etagOut = Str.toString(outetagOut);
1502               
1503                return p;
1504        }
1505
1506        /**
1507         * Reads the partial contents of a file. A #GFileReadMoreCallback should
1508         * be used to stop reading from the file when appropriate, else this
1509         * function will behave exactly as g_file_load_contents_async(). This
1510         * operation can be finished by g_file_load_partial_contents_finish().
1511         *
1512         * Users of this function should be aware that @user_data is passed to
1513         * both the @read_more_callback and the @callback.
1514         *
1515         * If @cancellable is not %NULL, then the operation can be cancelled by
1516         * triggering the cancellable object from another thread. If the operation
1517         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
1518         *
1519         * Params:
1520         *     cancellable = optional #GCancellable object, %NULL to ignore
1521         *     readMoreCallback = a #GFileReadMoreCallback to receive partial data
1522         *         and to specify whether further data should be read
1523         *     callback = a #GAsyncReadyCallback to call when the request is satisfied
1524         *     userData = the data to pass to the callback functions
1525         */
1526        public void loadPartialContentsAsync(Cancellable cancellable, GFileReadMoreCallback readMoreCallback, GAsyncReadyCallback callback, void* userData)
1527        {
1528                g_file_load_partial_contents_async(getFileStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), readMoreCallback, callback, userData);
1529        }
1530
1531        /**
1532         * Finishes an asynchronous partial load operation that was started
1533         * with g_file_load_partial_contents_async(). The data is always
1534         * zero-terminated, but this is not included in the resultant @length.
1535         * The returned @content should be freed with g_free() when no longer
1536         * needed.
1537         *
1538         * Params:
1539         *     res = a #GAsyncResult
1540         *     contents = a location to place the contents of the file
1541         *     length = a location to place the length of the contents of the file,
1542         *         or %NULL if the length is not needed
1543         *     etagOut = a location to place the current entity tag for the file,
1544         *         or %NULL if the entity tag is not needed
1545         *
1546         * Returns: %TRUE if the load was successful. If %FALSE and @error is
1547         *     present, it will be set appropriately.
1548         *
1549         * Throws: GException on failure.
1550         */
1551        public bool loadPartialContentsFinish(AsyncResultIF res, out string contents, out string etagOut)
1552        {
1553                char* outcontents = null;
1554                size_t length;
1555                char* outetagOut = null;
1556                GError* err = null;
1557               
1558                auto p = g_file_load_partial_contents_finish(getFileStruct(), (res is null) ? null : res.getAsyncResultStruct(), &outcontents, &length, &outetagOut, &err) != 0;
1559               
1560                if (err !is null)
1561                {
1562                        throw new GException( new ErrorG(err) );
1563                }
1564               
1565                contents = Str.toString(outcontents, length);
1566                etagOut = Str.toString(outetagOut);
1567               
1568                return p;
1569        }
1570
1571        /**
1572         * Creates a directory. Note that this will only create a child directory
1573         * of the immediate parent directory of the path or URI given by the #GFile.
1574         * To recursively create directories, see g_file_make_directory_with_parents().
1575         * This function will fail if the parent directory does not exist, setting
1576         * @error to %G_IO_ERROR_NOT_FOUND. If the file system doesn't support
1577         * creating directories, this function will fail, setting @error to
1578         * %G_IO_ERROR_NOT_SUPPORTED.
1579         *
1580         * For a local #GFile the newly created directory will have the default
1581         * (current) ownership and permissions of the current process.
1582         *
1583         * If @cancellable is not %NULL, then the operation can be cancelled by
1584         * triggering the cancellable object from another thread. If the operation
1585         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
1586         *
1587         * Params:
1588         *     cancellable = optional #GCancellable object,
1589         *         %NULL to ignore
1590         *
1591         * Returns: %TRUE on successful creation, %FALSE otherwise.
1592         *
1593         * Throws: GException on failure.
1594         */
1595        public bool makeDirectory(Cancellable cancellable)
1596        {
1597                GError* err = null;
1598               
1599                auto p = g_file_make_directory(getFileStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0;
1600               
1601                if (err !is null)
1602                {
1603                        throw new GException( new ErrorG(err) );
1604                }
1605               
1606                return p;
1607        }
1608
1609        /**
1610         * Asynchronously creates a directory.
1611         *
1612         * Params:
1613         *     ioPriority = the [I/O priority][io-priority] of the request
1614         *     cancellable = optional #GCancellable object,
1615         *         %NULL to ignore
1616         *     callback = a #GAsyncReadyCallback to call
1617         *         when the request is satisfied
1618         *     userData = the data to pass to callback function
1619         *
1620         * Since: 2.38
1621         */
1622        public void makeDirectoryAsync(int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
1623        {
1624                g_file_make_directory_async(getFileStruct(), ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
1625        }
1626
1627        /**
1628         * Finishes an asynchronous directory creation, started with
1629         * g_file_make_directory_async().
1630         *
1631         * Params:
1632         *     result = a #GAsyncResult
1633         *
1634         * Returns: %TRUE on successful directory creation, %FALSE otherwise.
1635         *
1636         * Since: 2.38
1637         *
1638         * Throws: GException on failure.
1639         */
1640        public bool makeDirectoryFinish(AsyncResultIF result)
1641        {
1642                GError* err = null;
1643               
1644                auto p = g_file_make_directory_finish(getFileStruct(), (result is null) ? null : result.getAsyncResultStruct(), &err) != 0;
1645               
1646                if (err !is null)
1647                {
1648                        throw new GException( new ErrorG(err) );
1649                }
1650               
1651                return p;
1652        }
1653
1654        /**
1655         * Creates a directory and any parent directories that may not
1656         * exist similar to 'mkdir -p'. If the file system does not support
1657         * creating directories, this function will fail, setting @error to
1658         * %G_IO_ERROR_NOT_SUPPORTED. If the directory itself already exists,
1659         * this function will fail setting @error to %G_IO_ERROR_EXISTS, unlike
1660         * the similar g_mkdir_with_parents().
1661         *
1662         * For a local #GFile the newly created directories will have the default
1663         * (current) ownership and permissions of the current process.
1664         *
1665         * If @cancellable is not %NULL, then the operation can be cancelled by
1666         * triggering the cancellable object from another thread. If the operation
1667         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
1668         *
1669         * Params:
1670         *     cancellable = optional #GCancellable object,
1671         *         %NULL to ignore
1672         *
1673         * Returns: %TRUE if all directories have been successfully created, %FALSE
1674         *     otherwise.
1675         *
1676         * Since: 2.18
1677         *
1678         * Throws: GException on failure.
1679         */
1680        public bool makeDirectoryWithParents(Cancellable cancellable)
1681        {
1682                GError* err = null;
1683               
1684                auto p = g_file_make_directory_with_parents(getFileStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0;
1685               
1686                if (err !is null)
1687                {
1688                        throw new GException( new ErrorG(err) );
1689                }
1690               
1691                return p;
1692        }
1693
1694        /**
1695         * Creates a symbolic link named @file which contains the string
1696         * @symlink_value.
1697         *
1698         * If @cancellable is not %NULL, then the operation can be cancelled by
1699         * triggering the cancellable object from another thread. If the operation
1700         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
1701         *
1702         * Params:
1703         *     symlinkValue = a string with the path for the target of the new symlink
1704         *     cancellable = optional #GCancellable object,
1705         *         %NULL to ignore
1706         *
1707         * Returns: %TRUE on the creation of a new symlink, %FALSE otherwise.
1708         *
1709         * Throws: GException on failure.
1710         */
1711        public bool makeSymbolicLink(string symlinkValue, Cancellable cancellable)
1712        {
1713                GError* err = null;
1714               
1715                auto p = g_file_make_symbolic_link(getFileStruct(), Str.toStringz(symlinkValue), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0;
1716               
1717                if (err !is null)
1718                {
1719                        throw new GException( new ErrorG(err) );
1720                }
1721               
1722                return p;
1723        }
1724
1725        /**
1726         * Recursively measures the disk usage of @file.
1727         *
1728         * This is essentially an analog of the 'du' command, but it also
1729         * reports the number of directories and non-directory files encountered
1730         * (including things like symbolic links).
1731         *
1732         * By default, errors are only reported against the toplevel file
1733         * itself.  Errors found while recursing are silently ignored, unless
1734         * %G_FILE_DISK_USAGE_REPORT_ALL_ERRORS is given in @flags.
1735         *
1736         * The returned size, @disk_usage, is in bytes and should be formatted
1737         * with g_format_size() in order to get something reasonable for showing
1738         * in a user interface.
1739         *
1740         * @progress_callback and @progress_data can be given to request
1741         * periodic progress updates while scanning.  See the documentation for
1742         * #GFileMeasureProgressCallback for information about when and how the
1743         * callback will be invoked.
1744         *
1745         * Params:
1746         *     flags = #GFileMeasureFlags
1747         *     cancellable = optional #GCancellable
1748         *     progressCallback = a #GFileMeasureProgressCallback
1749         *     progressData = user_data for @progress_callback
1750         *     diskUsage = the number of bytes of disk space used
1751         *     numDirs = the number of directories encountered
1752         *     numFiles = the number of non-directories encountered
1753         *
1754         * Returns: %TRUE if successful, with the out parameters set.
1755         *     %FALSE otherwise, with @error set.
1756         *
1757         * Since: 2.38
1758         *
1759         * Throws: GException on failure.
1760         */
1761        public bool measureDiskUsage(GFileMeasureFlags flags, Cancellable cancellable, GFileMeasureProgressCallback progressCallback, void* progressData, out ulong diskUsage, out ulong numDirs, out ulong numFiles)
1762        {
1763                GError* err = null;
1764               
1765                auto p = g_file_measure_disk_usage(getFileStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), progressCallback, progressData, &diskUsage, &numDirs, &numFiles, &err) != 0;
1766               
1767                if (err !is null)
1768                {
1769                        throw new GException( new ErrorG(err) );
1770                }
1771               
1772                return p;
1773        }
1774
1775        /**
1776         * Recursively measures the disk usage of @file.
1777         *
1778         * This is the asynchronous version of g_file_measure_disk_usage().  See
1779         * there for more information.
1780         *
1781         * Params:
1782         *     flags = #GFileMeasureFlags
1783         *     ioPriority = the [I/O priority][io-priority] of the request
1784         *     cancellable = optional #GCancellable
1785         *     progressCallback = a #GFileMeasureProgressCallback
1786         *     progressData = user_data for @progress_callback
1787         *     callback = a #GAsyncReadyCallback to call when complete
1788         *     userData = the data to pass to callback function
1789         *
1790         * Since: 2.38
1791         */
1792        public void measureDiskUsageAsync(GFileMeasureFlags flags, int ioPriority, Cancellable cancellable, GFileMeasureProgressCallback progressCallback, void* progressData, GAsyncReadyCallback callback, void* userData)
1793        {
1794                g_file_measure_disk_usage_async(getFileStruct(), flags, ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct(), progressCallback, progressData, callback, userData);
1795        }
1796
1797        /**
1798         * Collects the results from an earlier call to
1799         * g_file_measure_disk_usage_async().  See g_file_measure_disk_usage() for
1800         * more information.
1801         *
1802         * Params:
1803         *     result = the #GAsyncResult passed to your #GAsyncReadyCallback
1804         *     diskUsage = the number of bytes of disk space used
1805         *     numDirs = the number of directories encountered
1806         *     numFiles = the number of non-directories encountered
1807         *
1808         * Returns: %TRUE if successful, with the out parameters set.
1809         *     %FALSE otherwise, with @error set.
1810         *
1811         * Since: 2.38
1812         *
1813         * Throws: GException on failure.
1814         */
1815        public bool measureDiskUsageFinish(AsyncResultIF result, out ulong diskUsage, out ulong numDirs, out ulong numFiles)
1816        {
1817                GError* err = null;
1818               
1819                auto p = g_file_measure_disk_usage_finish(getFileStruct(), (result is null) ? null : result.getAsyncResultStruct(), &diskUsage, &numDirs, &numFiles, &err) != 0;
1820               
1821                if (err !is null)
1822                {
1823                        throw new GException( new ErrorG(err) );
1824                }
1825               
1826                return p;
1827        }
1828
1829        /**
1830         * Obtains a file or directory monitor for the given file,
1831         * depending on the type of the file.
1832         *
1833         * If @cancellable is not %NULL, then the operation can be cancelled by
1834         * triggering the cancellable object from another thread. If the operation
1835         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
1836         *
1837         * Params:
1838         *     flags = a set of #GFileMonitorFlags
1839         *     cancellable = optional #GCancellable object,
1840         *         %NULL to ignore
1841         *
1842         * Returns: a #GFileMonitor for the given @file,
1843         *     or %NULL on error.
1844         *     Free the returned object with g_object_unref().
1845         *
1846         * Since: 2.18
1847         *
1848         * Throws: GException on failure.
1849         */
1850        public FileMonitor monitor(GFileMonitorFlags flags, Cancellable cancellable)
1851        {
1852                GError* err = null;
1853               
1854                auto p = g_file_monitor(getFileStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
1855               
1856                if (err !is null)
1857                {
1858                        throw new GException( new ErrorG(err) );
1859                }
1860               
1861                if(p is null)
1862                {
1863                        return null;
1864                }
1865               
1866                return ObjectG.getDObject!(FileMonitor)(cast(GFileMonitor*) p, true);
1867        }
1868
1869        /**
1870         * Obtains a directory monitor for the given file.
1871         * This may fail if directory monitoring is not supported.
1872         *
1873         * If @cancellable is not %NULL, then the operation can be cancelled by
1874         * triggering the cancellable object from another thread. If the operation
1875         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
1876         *
1877         * It does not make sense for @flags to contain
1878         * %G_FILE_MONITOR_WATCH_HARD_LINKS, since hard links can not be made to
1879         * directories.  It is not possible to monitor all the files in a
1880         * directory for changes made via hard links; if you want to do this then
1881         * you must register individual watches with g_file_monitor().
1882         *
1883         * Params:
1884         *     flags = a set of #GFileMonitorFlags
1885         *     cancellable = optional #GCancellable object,
1886         *         %NULL to ignore
1887         *
1888         * Returns: a #GFileMonitor for the given @file,
1889         *     or %NULL on error.
1890         *     Free the returned object with g_object_unref().
1891         *
1892         * Throws: GException on failure.
1893         */
1894        public FileMonitor monitorDirectory(GFileMonitorFlags flags, Cancellable cancellable)
1895        {
1896                GError* err = null;
1897               
1898                auto p = g_file_monitor_directory(getFileStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
1899               
1900                if (err !is null)
1901                {
1902                        throw new GException( new ErrorG(err) );
1903                }
1904               
1905                if(p is null)
1906                {
1907                        return null;
1908                }
1909               
1910                return ObjectG.getDObject!(FileMonitor)(cast(GFileMonitor*) p, true);
1911        }
1912
1913        /**
1914         * Obtains a file monitor for the given file. If no file notification
1915         * mechanism exists, then regular polling of the file is used.
1916         *
1917         * If @cancellable is not %NULL, then the operation can be cancelled by
1918         * triggering the cancellable object from another thread. If the operation
1919         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
1920         *
1921         * If @flags contains %G_FILE_MONITOR_WATCH_HARD_LINKS then the monitor
1922         * will also attempt to report changes made to the file via another
1923         * filename (ie, a hard link). Without this flag, you can only rely on
1924         * changes made through the filename contained in @file to be
1925         * reported. Using this flag may result in an increase in resource
1926         * usage, and may not have any effect depending on the #GFileMonitor
1927         * backend and/or filesystem type.
1928         *
1929         * Params:
1930         *     flags = a set of #GFileMonitorFlags
1931         *     cancellable = optional #GCancellable object,
1932         *         %NULL to ignore
1933         *
1934         * Returns: a #GFileMonitor for the given @file,
1935         *     or %NULL on error.
1936         *     Free the returned object with g_object_unref().
1937         *
1938         * Throws: GException on failure.
1939         */
1940        public FileMonitor monitorFile(GFileMonitorFlags flags, Cancellable cancellable)
1941        {
1942                GError* err = null;
1943               
1944                auto p = g_file_monitor_file(getFileStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
1945               
1946                if (err !is null)
1947                {
1948                        throw new GException( new ErrorG(err) );
1949                }
1950               
1951                if(p is null)
1952                {
1953                        return null;
1954                }
1955               
1956                return ObjectG.getDObject!(FileMonitor)(cast(GFileMonitor*) p, true);
1957        }
1958
1959        /**
1960         * Starts a @mount_operation, mounting the volume that contains
1961         * the file @location.
1962         *
1963         * When this operation has completed, @callback will be called with
1964         * @user_user data, and the operation can be finalized with
1965         * g_file_mount_enclosing_volume_finish().
1966         *
1967         * If @cancellable is not %NULL, then the operation can be cancelled by
1968         * triggering the cancellable object from another thread. If the operation
1969         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
1970         *
1971         * Params:
1972         *     flags = flags affecting the operation
1973         *     mountOperation = a #GMountOperation
1974         *         or %NULL to avoid user interaction
1975         *     cancellable = optional #GCancellable object,
1976         *         %NULL to ignore
1977         *     callback = a #GAsyncReadyCallback to call
1978         *         when the request is satisfied, or %NULL
1979         *     userData = the data to pass to callback function
1980         */
1981        public void mountEnclosingVolume(GMountMountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
1982        {
1983                g_file_mount_enclosing_volume(getFileStruct(), flags, (mountOperation is null) ? null : mountOperation.getMountOperationStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
1984        }
1985
1986        /**
1987         * Finishes a mount operation started by g_file_mount_enclosing_volume().
1988         *
1989         * Params:
1990         *     result = a #GAsyncResult
1991         *
1992         * Returns: %TRUE if successful. If an error has occurred,
1993         *     this function will return %FALSE and set @error
1994         *     appropriately if present.
1995         *
1996         * Throws: GException on failure.
1997         */
1998        public bool mountEnclosingVolumeFinish(AsyncResultIF result)
1999        {
2000                GError* err = null;
2001               
2002                auto p = g_file_mount_enclosing_volume_finish(getFileStruct(), (result is null) ? null : result.getAsyncResultStruct(), &err) != 0;
2003               
2004                if (err !is null)
2005                {
2006                        throw new GException( new ErrorG(err) );
2007                }
2008               
2009                return p;
2010        }
2011
2012        /**
2013         * Mounts a file of type G_FILE_TYPE_MOUNTABLE.
2014         * Using @mount_operation, you can request callbacks when, for instance,
2015         * passwords are needed during authentication.
2016         *
2017         * If @cancellable is not %NULL, then the operation can be cancelled by
2018         * triggering the cancellable object from another thread. If the operation
2019         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
2020         *
2021         * When the operation is finished, @callback will be called.
2022         * You can then call g_file_mount_mountable_finish() to get
2023         * the result of the operation.
2024         *
2025         * Params:
2026         *     flags = flags affecting the operation
2027         *     mountOperation = a #GMountOperation,
2028         *         or %NULL to avoid user interaction
2029         *     cancellable = optional #GCancellable object,
2030         *         %NULL to ignore
2031         *     callback = a #GAsyncReadyCallback to call
2032         *         when the request is satisfied, or %NULL
2033         *     userData = the data to pass to callback function
2034         */
2035        public void mountMountable(GMountMountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
2036        {
2037                g_file_mount_mountable(getFileStruct(), flags, (mountOperation is null) ? null : mountOperation.getMountOperationStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
2038        }
2039
2040        /**
2041         * Finishes a mount operation. See g_file_mount_mountable() for details.
2042         *
2043         * Finish an asynchronous mount operation that was started
2044         * with g_file_mount_mountable().
2045         *
2046         * Params:
2047         *     result = a #GAsyncResult
2048         *
2049         * Returns: a #GFile or %NULL on error.
2050         *     Free the returned object with g_object_unref().
2051         *
2052         * Throws: GException on failure.
2053         */
2054        public FileIF mountMountableFinish(AsyncResultIF result)
2055        {
2056                GError* err = null;
2057               
2058                auto p = g_file_mount_mountable_finish(getFileStruct(), (result is null) ? null : result.getAsyncResultStruct(), &err);
2059               
2060                if (err !is null)
2061                {
2062                        throw new GException( new ErrorG(err) );
2063                }
2064               
2065                if(p is null)
2066                {
2067                        return null;
2068                }
2069               
2070                return ObjectG.getDObject!(File, FileIF)(cast(GFile*) p, true);
2071        }
2072
2073        /**
2074         * Tries to move the file or directory @source to the location specified
2075         * by @destination. If native move operations are supported then this is
2076         * used, otherwise a copy + delete fallback is used. The native
2077         * implementation may support moving directories (for instance on moves
2078         * inside the same filesystem), but the fallback code does not.
2079         *
2080         * If the flag #G_FILE_COPY_OVERWRITE is specified an already
2081         * existing @destination file is overwritten.
2082         *
2083         * If the flag #G_FILE_COPY_NOFOLLOW_SYMLINKS is specified then symlinks
2084         * will be copied as symlinks, otherwise the target of the
2085         * @source symlink will be copied.
2086         *
2087         * If @cancellable is not %NULL, then the operation can be cancelled by
2088         * triggering the cancellable object from another thread. If the operation
2089         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
2090         *
2091         * If @progress_callback is not %NULL, then the operation can be monitored
2092         * by setting this to a #GFileProgressCallback function.
2093         * @progress_callback_data will be passed to this function. It is
2094         * guaranteed that this callback will be called after all data has been
2095         * transferred with the total number of bytes copied during the operation.
2096         *
2097         * If the @source file does not exist, then the %G_IO_ERROR_NOT_FOUND
2098         * error is returned, independent on the status of the @destination.
2099         *
2100         * If #G_FILE_COPY_OVERWRITE is not specified and the target exists,
2101         * then the error %G_IO_ERROR_EXISTS is returned.
2102         *
2103         * If trying to overwrite a file over a directory, the %G_IO_ERROR_IS_DIRECTORY
2104         * error is returned. If trying to overwrite a directory with a directory the
2105         * %G_IO_ERROR_WOULD_MERGE error is returned.
2106         *
2107         * If the source is a directory and the target does not exist, or
2108         * #G_FILE_COPY_OVERWRITE is specified and the target is a file, then
2109         * the %G_IO_ERROR_WOULD_RECURSE error may be returned (if the native
2110         * move operation isn't available).
2111         *
2112         * Params:
2113         *     destination = #GFile pointing to the destination location
2114         *     flags = set of #GFileCopyFlags
2115         *     cancellable = optional #GCancellable object,
2116         *         %NULL to ignore
2117         *     progressCallback = #GFileProgressCallback
2118         *         function for updates
2119         *     progressCallbackData = gpointer to user data for
2120         *         the callback function
2121         *
2122         * Returns: %TRUE on successful move, %FALSE otherwise.
2123         *
2124         * Throws: GException on failure.
2125         */
2126        public bool move(FileIF destination, GFileCopyFlags flags, Cancellable cancellable, GFileProgressCallback progressCallback, void* progressCallbackData)
2127        {
2128                GError* err = null;
2129               
2130                auto p = g_file_move(getFileStruct(), (destination is null) ? null : destination.getFileStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), progressCallback, progressCallbackData, &err) != 0;
2131               
2132                if (err !is null)
2133                {
2134                        throw new GException( new ErrorG(err) );
2135                }
2136               
2137                return p;
2138        }
2139
2140        /**
2141         * Opens an existing file for reading and writing. The result is
2142         * a #GFileIOStream that can be used to read and write the contents
2143         * of the file.
2144         *
2145         * If @cancellable is not %NULL, then the operation can be cancelled
2146         * by triggering the cancellable object from another thread. If the
2147         * operation was cancelled, the error %G_IO_ERROR_CANCELLED will be
2148         * returned.
2149         *
2150         * If the file does not exist, the %G_IO_ERROR_NOT_FOUND error will
2151         * be returned. If the file is a directory, the %G_IO_ERROR_IS_DIRECTORY
2152         * error will be returned. Other errors are possible too, and depend on
2153         * what kind of filesystem the file is on. Note that in many non-local
2154         * file cases read and write streams are not supported, so make sure you
2155         * really need to do read and write streaming, rather than just opening
2156         * for reading or writing.
2157         *
2158         * Params:
2159         *     cancellable = a #GCancellable
2160         *
2161         * Returns: #GFileIOStream or %NULL on error.
2162         *     Free the returned object with g_object_unref().
2163         *
2164         * Since: 2.22
2165         *
2166         * Throws: GException on failure.
2167         */
2168        public FileIOStream openReadwrite(Cancellable cancellable)
2169        {
2170                GError* err = null;
2171               
2172                auto p = g_file_open_readwrite(getFileStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
2173               
2174                if (err !is null)
2175                {
2176                        throw new GException( new ErrorG(err) );
2177                }
2178               
2179                if(p is null)
2180                {
2181                        return null;
2182                }
2183               
2184                return ObjectG.getDObject!(FileIOStream)(cast(GFileIOStream*) p, true);
2185        }
2186
2187        /**
2188         * Asynchronously opens @file for reading and writing.
2189         *
2190         * For more details, see g_file_open_readwrite() which is
2191         * the synchronous version of this call.
2192         *
2193         * When the operation is finished, @callback will be called.
2194         * You can then call g_file_open_readwrite_finish() to get
2195         * the result of the operation.
2196         *
2197         * Params:
2198         *     ioPriority = the [I/O priority][io-priority] of the request
2199         *     cancellable = optional #GCancellable object,
2200         *         %NULL to ignore
2201         *     callback = a #GAsyncReadyCallback to call
2202         *         when the request is satisfied
2203         *     userData = the data to pass to callback function
2204         *
2205         * Since: 2.22
2206         */
2207        public void openReadwriteAsync(int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
2208        {
2209                g_file_open_readwrite_async(getFileStruct(), ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
2210        }
2211
2212        /**
2213         * Finishes an asynchronous file read operation started with
2214         * g_file_open_readwrite_async().
2215         *
2216         * Params:
2217         *     res = a #GAsyncResult
2218         *
2219         * Returns: a #GFileIOStream or %NULL on error.
2220         *     Free the returned object with g_object_unref().
2221         *
2222         * Since: 2.22
2223         *
2224         * Throws: GException on failure.
2225         */
2226        public FileIOStream openReadwriteFinish(AsyncResultIF res)
2227        {
2228                GError* err = null;
2229               
2230                auto p = g_file_open_readwrite_finish(getFileStruct(), (res is null) ? null : res.getAsyncResultStruct(), &err);
2231               
2232                if (err !is null)
2233                {
2234                        throw new GException( new ErrorG(err) );
2235                }
2236               
2237                if(p is null)
2238                {
2239                        return null;
2240                }
2241               
2242                return ObjectG.getDObject!(FileIOStream)(cast(GFileIOStream*) p, true);
2243        }
2244
2245        /**
2246         * Polls a file of type #G_FILE_TYPE_MOUNTABLE.
2247         *
2248         * If @cancellable is not %NULL, then the operation can be cancelled by
2249         * triggering the cancellable object from another thread. If the operation
2250         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
2251         *
2252         * When the operation is finished, @callback will be called.
2253         * You can then call g_file_mount_mountable_finish() to get
2254         * the result of the operation.
2255         *
2256         * Params:
2257         *     cancellable = optional #GCancellable object, %NULL to ignore
2258         *     callback = a #GAsyncReadyCallback to call
2259         *         when the request is satisfied, or %NULL
2260         *     userData = the data to pass to callback function
2261         *
2262         * Since: 2.22
2263         */
2264        public void pollMountable(Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
2265        {
2266                g_file_poll_mountable(getFileStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
2267        }
2268
2269        /**
2270         * Finishes a poll operation. See g_file_poll_mountable() for details.
2271         *
2272         * Finish an asynchronous poll operation that was polled
2273         * with g_file_poll_mountable().
2274         *
2275         * Params:
2276         *     result = a #GAsyncResult
2277         *
2278         * Returns: %TRUE if the operation finished successfully. %FALSE
2279         *     otherwise.
2280         *
2281         * Since: 2.22
2282         *
2283         * Throws: GException on failure.
2284         */
2285        public bool pollMountableFinish(AsyncResultIF result)
2286        {
2287                GError* err = null;
2288               
2289                auto p = g_file_poll_mountable_finish(getFileStruct(), (result is null) ? null : result.getAsyncResultStruct(), &err) != 0;
2290               
2291                if (err !is null)
2292                {
2293                        throw new GException( new ErrorG(err) );
2294                }
2295               
2296                return p;
2297        }
2298
2299        /**
2300         * Returns the #GAppInfo that is registered as the default
2301         * application to handle the file specified by @file.
2302         *
2303         * If @cancellable is not %NULL, then the operation can be cancelled by
2304         * triggering the cancellable object from another thread. If the operation
2305         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
2306         *
2307         * Params:
2308         *     cancellable = optional #GCancellable object, %NULL to ignore
2309         *
2310         * Returns: a #GAppInfo if the handle was found,
2311         *     %NULL if there were errors.
2312         *     When you are done with it, release it with g_object_unref()
2313         *
2314         * Throws: GException on failure.
2315         */
2316        public AppInfoIF queryDefaultHandler(Cancellable cancellable)
2317        {
2318                GError* err = null;
2319               
2320                auto p = g_file_query_default_handler(getFileStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
2321               
2322                if (err !is null)
2323                {
2324                        throw new GException( new ErrorG(err) );
2325                }
2326               
2327                if(p is null)
2328                {
2329                        return null;
2330                }
2331               
2332                return ObjectG.getDObject!(AppInfo, AppInfoIF)(cast(GAppInfo*) p, true);
2333        }
2334
2335        /**
2336         * Utility function to check if a particular file exists. This is
2337         * implemented using g_file_query_info() and as such does blocking I/O.
2338         *
2339         * Note that in many cases it is racy to first check for file existence
2340         * and then execute something based on the outcome of that, because the
2341         * file might have been created or removed in between the operations. The
2342         * general approach to handling that is to not check, but just do the
2343         * operation and handle the errors as they come.
2344         *
2345         * As an example of race-free checking, take the case of reading a file,
2346         * and if it doesn't exist, creating it. There are two racy versions: read
2347         * it, and on error create it; and: check if it exists, if not create it.
2348         * These can both result in two processes creating the file (with perhaps
2349         * a partially written file as the result). The correct approach is to
2350         * always try to create the file with g_file_create() which will either
2351         * atomically create the file or fail with a %G_IO_ERROR_EXISTS error.
2352         *
2353         * However, in many cases an existence check is useful in a user interface,
2354         * for instance to make a menu item sensitive/insensitive, so that you don't
2355         * have to fool users that something is possible and then just show an error
2356         * dialog. If you do this, you should make sure to also handle the errors
2357         * that can happen due to races when you execute the operation.
2358         *
2359         * Params:
2360         *     cancellable = optional #GCancellable object,
2361         *         %NULL to ignore
2362         *
2363         * Returns: %TRUE if the file exists (and can be detected without error),
2364         *     %FALSE otherwise (or if cancelled).
2365         */
2366        public bool queryExists(Cancellable cancellable)
2367        {
2368                return g_file_query_exists(getFileStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct()) != 0;
2369        }
2370
2371        /**
2372         * Utility function to inspect the #GFileType of a file. This is
2373         * implemented using g_file_query_info() and as such does blocking I/O.
2374         *
2375         * The primary use case of this method is to check if a file is
2376         * a regular file, directory, or symlink.
2377         *
2378         * Params:
2379         *     flags = a set of #GFileQueryInfoFlags passed to g_file_query_info()
2380         *     cancellable = optional #GCancellable object,
2381         *         %NULL to ignore
2382         *
2383         * Returns: The #GFileType of the file and #G_FILE_TYPE_UNKNOWN
2384         *     if the file does not exist
2385         *
2386         * Since: 2.18
2387         */
2388        public GFileType queryFileType(GFileQueryInfoFlags flags, Cancellable cancellable)
2389        {
2390                return g_file_query_file_type(getFileStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct());
2391        }
2392
2393        /**
2394         * Similar to g_file_query_info(), but obtains information
2395         * about the filesystem the @file is on, rather than the file itself.
2396         * For instance the amount of space available and the type of
2397         * the filesystem.
2398         *
2399         * The @attributes value is a string that specifies the attributes
2400         * that should be gathered. It is not an error if it's not possible
2401         * to read a particular requested attribute from a file - it just
2402         * won't be set. @attributes should be a comma-separated list of
2403         * attributes or attribute wildcards. The wildcard "*" means all
2404         * attributes, and a wildcard like "filesystem::*" means all attributes
2405         * in the filesystem namespace. The standard namespace for filesystem
2406         * attributes is "filesystem". Common attributes of interest are
2407         * #G_FILE_ATTRIBUTE_FILESYSTEM_SIZE (the total size of the filesystem
2408         * in bytes), #G_FILE_ATTRIBUTE_FILESYSTEM_FREE (number of bytes available),
2409         * and #G_FILE_ATTRIBUTE_FILESYSTEM_TYPE (type of the filesystem).
2410         *
2411         * If @cancellable is not %NULL, then the operation can be cancelled
2412         * by triggering the cancellable object from another thread. If the
2413         * operation was cancelled, the error %G_IO_ERROR_CANCELLED will be
2414         * returned.
2415         *
2416         * If the file does not exist, the %G_IO_ERROR_NOT_FOUND error will
2417         * be returned. Other errors are possible too, and depend on what
2418         * kind of filesystem the file is on.
2419         *
2420         * Params:
2421         *     attributes = an attribute query string
2422         *     cancellable = optional #GCancellable object,
2423         *         %NULL to ignore
2424         *
2425         * Returns: a #GFileInfo or %NULL if there was an error.
2426         *     Free the returned object with g_object_unref().
2427         *
2428         * Throws: GException on failure.
2429         */
2430        public FileInfo queryFilesystemInfo(string attributes, Cancellable cancellable)
2431        {
2432                GError* err = null;
2433               
2434                auto p = g_file_query_filesystem_info(getFileStruct(), Str.toStringz(attributes), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
2435               
2436                if (err !is null)
2437                {
2438                        throw new GException( new ErrorG(err) );
2439                }
2440               
2441                if(p is null)
2442                {
2443                        return null;
2444                }
2445               
2446                return ObjectG.getDObject!(FileInfo)(cast(GFileInfo*) p, true);
2447        }
2448
2449        /**
2450         * Asynchronously gets the requested information about the filesystem
2451         * that the specified @file is on. The result is a #GFileInfo object
2452         * that contains key-value attributes (such as type or size for the
2453         * file).
2454         *
2455         * For more details, see g_file_query_filesystem_info() which is the
2456         * synchronous version of this call.
2457         *
2458         * When the operation is finished, @callback will be called. You can
2459         * then call g_file_query_info_finish() to get the result of the
2460         * operation.
2461         *
2462         * Params:
2463         *     attributes = an attribute query string
2464         *     ioPriority = the [I/O priority][io-priority] of the request
2465         *     cancellable = optional #GCancellable object,
2466         *         %NULL to ignore
2467         *     callback = a #GAsyncReadyCallback to call
2468         *         when the request is satisfied
2469         *     userData = the data to pass to callback function
2470         */
2471        public void queryFilesystemInfoAsync(string attributes, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
2472        {
2473                g_file_query_filesystem_info_async(getFileStruct(), Str.toStringz(attributes), ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
2474        }
2475
2476        /**
2477         * Finishes an asynchronous filesystem info query.
2478         * See g_file_query_filesystem_info_async().
2479         *
2480         * Params:
2481         *     res = a #GAsyncResult
2482         *
2483         * Returns: #GFileInfo for given @file
2484         *     or %NULL on error.
2485         *     Free the returned object with g_object_unref().
2486         *
2487         * Throws: GException on failure.
2488         */
2489        public FileInfo queryFilesystemInfoFinish(AsyncResultIF res)
2490        {
2491                GError* err = null;
2492               
2493                auto p = g_file_query_filesystem_info_finish(getFileStruct(), (res is null) ? null : res.getAsyncResultStruct(), &err);
2494               
2495                if (err !is null)
2496                {
2497                        throw new GException( new ErrorG(err) );
2498                }
2499               
2500                if(p is null)
2501                {
2502                        return null;
2503                }
2504               
2505                return ObjectG.getDObject!(FileInfo)(cast(GFileInfo*) p, true);
2506        }
2507
2508        /**
2509         * Gets the requested information about specified @file.
2510         * The result is a #GFileInfo object that contains key-value
2511         * attributes (such as the type or size of the file).
2512         *
2513         * The @attributes value is a string that specifies the file
2514         * attributes that should be gathered. It is not an error if
2515         * it's not possible to read a particular requested attribute
2516         * from a file - it just won't be set. @attributes should be a
2517         * comma-separated list of attributes or attribute wildcards.
2518         * The wildcard "*" means all attributes, and a wildcard like
2519         * "standard::*" means all attributes in the standard namespace.
2520         * An example attribute query be "standard::*,owner::user".
2521         * The standard attributes are available as defines, like
2522         * #G_FILE_ATTRIBUTE_STANDARD_NAME.
2523         *
2524         * If @cancellable is not %NULL, then the operation can be cancelled
2525         * by triggering the cancellable object from another thread. If the
2526         * operation was cancelled, the error %G_IO_ERROR_CANCELLED will be
2527         * returned.
2528         *
2529         * For symlinks, normally the information about the target of the
2530         * symlink is returned, rather than information about the symlink
2531         * itself. However if you pass #G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS
2532         * in @flags the information about the symlink itself will be returned.
2533         * Also, for symlinks that point to non-existing files the information
2534         * about the symlink itself will be returned.
2535         *
2536         * If the file does not exist, the %G_IO_ERROR_NOT_FOUND error will be
2537         * returned. Other errors are possible too, and depend on what kind of
2538         * filesystem the file is on.
2539         *
2540         * Params:
2541         *     attributes = an attribute query string
2542         *     flags = a set of #GFileQueryInfoFlags
2543         *     cancellable = optional #GCancellable object,
2544         *         %NULL to ignore
2545         *
2546         * Returns: a #GFileInfo for the given @file, or %NULL
2547         *     on error. Free the returned object with g_object_unref().
2548         *
2549         * Throws: GException on failure.
2550         */
2551        public FileInfo queryInfo(string attributes, GFileQueryInfoFlags flags, Cancellable cancellable)
2552        {
2553                GError* err = null;
2554               
2555                auto p = g_file_query_info(getFileStruct(), Str.toStringz(attributes), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
2556               
2557                if (err !is null)
2558                {
2559                        throw new GException( new ErrorG(err) );
2560                }
2561               
2562                if(p is null)
2563                {
2564                        return null;
2565                }
2566               
2567                return ObjectG.getDObject!(FileInfo)(cast(GFileInfo*) p, true);
2568        }
2569
2570        /**
2571         * Asynchronously gets the requested information about specified @file.
2572         * The result is a #GFileInfo object that contains key-value attributes
2573         * (such as type or size for the file).
2574         *
2575         * For more details, see g_file_query_info() which is the synchronous
2576         * version of this call.
2577         *
2578         * When the operation is finished, @callback will be called. You can
2579         * then call g_file_query_info_finish() to get the result of the operation.
2580         *
2581         * Params:
2582         *     attributes = an attribute query string
2583         *     flags = a set of #GFileQueryInfoFlags
2584         *     ioPriority = the [I/O priority][io-priority] of the request
2585         *     cancellable = optional #GCancellable object,
2586         *         %NULL to ignore
2587         *     callback = a #GAsyncReadyCallback to call when the
2588         *         request is satisfied
2589         *     userData = the data to pass to callback function
2590         */
2591        public void queryInfoAsync(string attributes, GFileQueryInfoFlags flags, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
2592        {
2593                g_file_query_info_async(getFileStruct(), Str.toStringz(attributes), flags, ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
2594        }
2595
2596        /**
2597         * Finishes an asynchronous file info query.
2598         * See g_file_query_info_async().
2599         *
2600         * Params:
2601         *     res = a #GAsyncResult
2602         *
2603         * Returns: #GFileInfo for given @file
2604         *     or %NULL on error. Free the returned object with
2605         *     g_object_unref().
2606         *
2607         * Throws: GException on failure.
2608         */
2609        public FileInfo queryInfoFinish(AsyncResultIF res)
2610        {
2611                GError* err = null;
2612               
2613                auto p = g_file_query_info_finish(getFileStruct(), (res is null) ? null : res.getAsyncResultStruct(), &err);
2614               
2615                if (err !is null)
2616                {
2617                        throw new GException( new ErrorG(err) );
2618                }
2619               
2620                if(p is null)
2621                {
2622                        return null;
2623                }
2624               
2625                return ObjectG.getDObject!(FileInfo)(cast(GFileInfo*) p, true);
2626        }
2627
2628        /**
2629         * Obtain the list of settable attributes for the file.
2630         *
2631         * Returns the type and full attribute name of all the attributes
2632         * that can be set on this file. This doesn't mean setting it will
2633         * always succeed though, you might get an access failure, or some
2634         * specific file may not support a specific attribute.
2635         *
2636         * If @cancellable is not %NULL, then the operation can be cancelled by
2637         * triggering the cancellable object from another thread. If the operation
2638         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
2639         *
2640         * Params:
2641         *     cancellable = optional #GCancellable object,
2642         *         %NULL to ignore
2643         *
2644         * Returns: a #GFileAttributeInfoList describing the settable attributes.
2645         *     When you are done with it, release it with
2646         *     g_file_attribute_info_list_unref()
2647         *
2648         * Throws: GException on failure.
2649         */
2650        public FileAttributeInfoList querySettableAttributes(Cancellable cancellable)
2651        {
2652                GError* err = null;
2653               
2654                auto p = g_file_query_settable_attributes(getFileStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
2655               
2656                if (err !is null)
2657                {
2658                        throw new GException( new ErrorG(err) );
2659                }
2660               
2661                if(p is null)
2662                {
2663                        return null;
2664                }
2665               
2666                return ObjectG.getDObject!(FileAttributeInfoList)(cast(GFileAttributeInfoList*) p, true);
2667        }
2668
2669        /**
2670         * Obtain the list of attribute namespaces where new attributes
2671         * can be created by a user. An example of this is extended
2672         * attributes (in the "xattr" namespace).
2673         *
2674         * If @cancellable is not %NULL, then the operation can be cancelled by
2675         * triggering the cancellable object from another thread. If the operation
2676         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
2677         *
2678         * Params:
2679         *     cancellable = optional #GCancellable object,
2680         *         %NULL to ignore
2681         *
2682         * Returns: a #GFileAttributeInfoList describing the writable namespaces.
2683         *     When you are done with it, release it with
2684         *     g_file_attribute_info_list_unref()
2685         *
2686         * Throws: GException on failure.
2687         */
2688        public FileAttributeInfoList queryWritableNamespaces(Cancellable cancellable)
2689        {
2690                GError* err = null;
2691               
2692                auto p = g_file_query_writable_namespaces(getFileStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
2693               
2694                if (err !is null)
2695                {
2696                        throw new GException( new ErrorG(err) );
2697                }
2698               
2699                if(p is null)
2700                {
2701                        return null;
2702                }
2703               
2704                return ObjectG.getDObject!(FileAttributeInfoList)(cast(GFileAttributeInfoList*) p, true);
2705        }
2706
2707        /**
2708         * Opens a file for reading. The result is a #GFileInputStream that
2709         * can be used to read the contents of the file.
2710         *
2711         * If @cancellable is not %NULL, then the operation can be cancelled by
2712         * triggering the cancellable object from another thread. If the operation
2713         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
2714         *
2715         * If the file does not exist, the %G_IO_ERROR_NOT_FOUND error will be
2716         * returned. If the file is a directory, the %G_IO_ERROR_IS_DIRECTORY
2717         * error will be returned. Other errors are possible too, and depend
2718         * on what kind of filesystem the file is on.
2719         *
2720         * Params:
2721         *     cancellable = a #GCancellable
2722         *
2723         * Returns: #GFileInputStream or %NULL on error.
2724         *     Free the returned object with g_object_unref().
2725         *
2726         * Throws: GException on failure.
2727         */
2728        public FileInputStream read(Cancellable cancellable)
2729        {
2730                GError* err = null;
2731               
2732                auto p = g_file_read(getFileStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
2733               
2734                if (err !is null)
2735                {
2736                        throw new GException( new ErrorG(err) );
2737                }
2738               
2739                if(p is null)
2740                {
2741                        return null;
2742                }
2743               
2744                return ObjectG.getDObject!(FileInputStream)(cast(GFileInputStream*) p, true);
2745        }
2746
2747        /**
2748         * Asynchronously opens @file for reading.
2749         *
2750         * For more details, see g_file_read() which is
2751         * the synchronous version of this call.
2752         *
2753         * When the operation is finished, @callback will be called.
2754         * You can then call g_file_read_finish() to get the result
2755         * of the operation.
2756         *
2757         * Params:
2758         *     ioPriority = the [I/O priority][io-priority] of the request
2759         *     cancellable = optional #GCancellable object,
2760         *         %NULL to ignore
2761         *     callback = a #GAsyncReadyCallback to call
2762         *         when the request is satisfied
2763         *     userData = the data to pass to callback function
2764         */
2765        public void readAsync(int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
2766        {
2767                g_file_read_async(getFileStruct(), ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
2768        }
2769
2770        /**
2771         * Finishes an asynchronous file read operation started with
2772         * g_file_read_async().
2773         *
2774         * Params:
2775         *     res = a #GAsyncResult
2776         *
2777         * Returns: a #GFileInputStream or %NULL on error.
2778         *     Free the returned object with g_object_unref().
2779         *
2780         * Throws: GException on failure.
2781         */
2782        public FileInputStream readFinish(AsyncResultIF res)
2783        {
2784                GError* err = null;
2785               
2786                auto p = g_file_read_finish(getFileStruct(), (res is null) ? null : res.getAsyncResultStruct(), &err);
2787               
2788                if (err !is null)
2789                {
2790                        throw new GException( new ErrorG(err) );
2791                }
2792               
2793                if(p is null)
2794                {
2795                        return null;
2796                }
2797               
2798                return ObjectG.getDObject!(FileInputStream)(cast(GFileInputStream*) p, true);
2799        }
2800
2801        /**
2802         * Returns an output stream for overwriting the file, possibly
2803         * creating a backup copy of the file first. If the file doesn't exist,
2804         * it will be created.
2805         *
2806         * This will try to replace the file in the safest way possible so
2807         * that any errors during the writing will not affect an already
2808         * existing copy of the file. For instance, for local files it
2809         * may write to a temporary file and then atomically rename over
2810         * the destination when the stream is closed.
2811         *
2812         * By default files created are generally readable by everyone,
2813         * but if you pass #G_FILE_CREATE_PRIVATE in @flags the file
2814         * will be made readable only to the current user, to the level that
2815         * is supported on the target filesystem.
2816         *
2817         * If @cancellable is not %NULL, then the operation can be cancelled
2818         * by triggering the cancellable object from another thread. If the
2819         * operation was cancelled, the error %G_IO_ERROR_CANCELLED will be
2820         * returned.
2821         *
2822         * If you pass in a non-%NULL @etag value and @file already exists, then
2823         * this value is compared to the current entity tag of the file, and if
2824         * they differ an %G_IO_ERROR_WRONG_ETAG error is returned. This
2825         * generally means that the file has been changed since you last read
2826         * it. You can get the new etag from g_file_output_stream_get_etag()
2827         * after you've finished writing and closed the #GFileOutputStream. When
2828         * you load a new file you can use g_file_input_stream_query_info() to
2829         * get the etag of the file.
2830         *
2831         * If @make_backup is %TRUE, this function will attempt to make a
2832         * backup of the current file before overwriting it. If this fails
2833         * a %G_IO_ERROR_CANT_CREATE_BACKUP error will be returned. If you
2834         * want to replace anyway, try again with @make_backup set to %FALSE.
2835         *
2836         * If the file is a directory the %G_IO_ERROR_IS_DIRECTORY error will
2837         * be returned, and if the file is some other form of non-regular file
2838         * then a %G_IO_ERROR_NOT_REGULAR_FILE error will be returned. Some
2839         * file systems don't allow all file names, and may return an
2840         * %G_IO_ERROR_INVALID_FILENAME error, and if the name is to long
2841         * %G_IO_ERROR_FILENAME_TOO_LONG will be returned. Other errors are
2842         * possible too, and depend on what kind of filesystem the file is on.
2843         *
2844         * Params:
2845         *     etag = an optional [entity tag][gfile-etag]
2846         *         for the current #GFile, or #NULL to ignore
2847         *     makeBackup = %TRUE if a backup should be created
2848         *     flags = a set of #GFileCreateFlags
2849         *     cancellable = optional #GCancellable object,
2850         *         %NULL to ignore
2851         *
2852         * Returns: a #GFileOutputStream or %NULL on error.
2853         *     Free the returned object with g_object_unref().
2854         *
2855         * Throws: GException on failure.
2856         */
2857        public FileOutputStream replace(string etag, bool makeBackup, GFileCreateFlags flags, Cancellable cancellable)
2858        {
2859                GError* err = null;
2860               
2861                auto p = g_file_replace(getFileStruct(), Str.toStringz(etag), makeBackup, flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
2862               
2863                if (err !is null)
2864                {
2865                        throw new GException( new ErrorG(err) );
2866                }
2867               
2868                if(p is null)
2869                {
2870                        return null;
2871                }
2872               
2873                return ObjectG.getDObject!(FileOutputStream)(cast(GFileOutputStream*) p, true);
2874        }
2875
2876        /**
2877         * Asynchronously overwrites the file, replacing the contents,
2878         * possibly creating a backup copy of the file first.
2879         *
2880         * For more details, see g_file_replace() which is
2881         * the synchronous version of this call.
2882         *
2883         * When the operation is finished, @callback will be called.
2884         * You can then call g_file_replace_finish() to get the result
2885         * of the operation.
2886         *
2887         * Params:
2888         *     etag = an [entity tag][gfile-etag] for the current #GFile,
2889         *         or %NULL to ignore
2890         *     makeBackup = %TRUE if a backup should be created
2891         *     flags = a set of #GFileCreateFlags
2892         *     ioPriority = the [I/O priority][io-priority] of the request
2893         *     cancellable = optional #GCancellable object,
2894         *         %NULL to ignore
2895         *     callback = a #GAsyncReadyCallback to call
2896         *         when the request is satisfied
2897         *     userData = the data to pass to callback function
2898         */
2899        public void replaceAsync(string etag, bool makeBackup, GFileCreateFlags flags, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
2900        {
2901                g_file_replace_async(getFileStruct(), Str.toStringz(etag), makeBackup, flags, ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
2902        }
2903
2904        /**
2905         * Replaces the contents of @file with @contents of @length bytes.
2906         *
2907         * If @etag is specified (not %NULL), any existing file must have that etag,
2908         * or the error %G_IO_ERROR_WRONG_ETAG will be returned.
2909         *
2910         * If @make_backup is %TRUE, this function will attempt to make a backup
2911         * of @file. Internally, it uses g_file_replace(), so will try to replace the
2912         * file contents in the safest way possible. For example, atomic renames are
2913         * used when replacing local files’ contents.
2914         *
2915         * If @cancellable is not %NULL, then the operation can be cancelled by
2916         * triggering the cancellable object from another thread. If the operation
2917         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
2918         *
2919         * The returned @new_etag can be used to verify that the file hasn't
2920         * changed the next time it is saved over.
2921         *
2922         * Params:
2923         *     contents = a string containing the new contents for @file
2924         *     length = the length of @contents in bytes
2925         *     etag = the old [entity-tag][gfile-etag] for the document,
2926         *         or %NULL
2927         *     makeBackup = %TRUE if a backup should be created
2928         *     flags = a set of #GFileCreateFlags
2929         *     newEtag = a location to a new [entity tag][gfile-etag]
2930         *         for the document. This should be freed with g_free() when no longer
2931         *         needed, or %NULL
2932         *     cancellable = optional #GCancellable object, %NULL to ignore
2933         *
2934         * Returns: %TRUE if successful. If an error has occurred, this function
2935         *     will return %FALSE and set @error appropriately if present.
2936         *
2937         * Throws: GException on failure.
2938         */
2939        public bool replaceContents(string contents, string etag, bool makeBackup, GFileCreateFlags flags, out string newEtag, Cancellable cancellable)
2940        {
2941                char* outnewEtag = null;
2942                GError* err = null;
2943               
2944                auto p = g_file_replace_contents(getFileStruct(), Str.toStringz(contents), cast(size_t)contents.length, Str.toStringz(etag), makeBackup, flags, &outnewEtag, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0;
2945               
2946                if (err !is null)
2947                {
2948                        throw new GException( new ErrorG(err) );
2949                }
2950               
2951                newEtag = Str.toString(outnewEtag);
2952               
2953                return p;
2954        }
2955
2956        /**
2957         * Starts an asynchronous replacement of @file with the given
2958         * @contents of @length bytes. @etag will replace the document's
2959         * current entity tag.
2960         *
2961         * When this operation has completed, @callback will be called with
2962         * @user_user data, and the operation can be finalized with
2963         * g_file_replace_contents_finish().
2964         *
2965         * If @cancellable is not %NULL, then the operation can be cancelled by
2966         * triggering the cancellable object from another thread. If the operation
2967         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
2968         *
2969         * If @make_backup is %TRUE, this function will attempt to
2970         * make a backup of @file.
2971         *
2972         * Note that no copy of @content will be made, so it must stay valid
2973         * until @callback is called. See g_file_replace_contents_bytes_async()
2974         * for a #GBytes version that will automatically hold a reference to the
2975         * contents (without copying) for the duration of the call.
2976         *
2977         * Params:
2978         *     contents = string of contents to replace the file with
2979         *     length = the length of @contents in bytes
2980         *     etag = a new [entity tag][gfile-etag] for the @file, or %NULL
2981         *     makeBackup = %TRUE if a backup should be created
2982         *     flags = a set of #GFileCreateFlags
2983         *     cancellable = optional #GCancellable object, %NULL to ignore
2984         *     callback = a #GAsyncReadyCallback to call when the request is satisfied
2985         *     userData = the data to pass to callback function
2986         */
2987        public void replaceContentsAsync(string contents, string etag, bool makeBackup, GFileCreateFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
2988        {
2989                g_file_replace_contents_async(getFileStruct(), Str.toStringz(contents), cast(size_t)contents.length, Str.toStringz(etag), makeBackup, flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
2990        }
2991
2992        /**
2993         * Same as g_file_replace_contents_async() but takes a #GBytes input instead.
2994         * This function will keep a ref on @contents until the operation is done.
2995         * Unlike g_file_replace_contents_async() this allows forgetting about the
2996         * content without waiting for the callback.
2997         *
2998         * When this operation has completed, @callback will be called with
2999         * @user_user data, and the operation can be finalized with
3000         * g_file_replace_contents_finish().
3001         *
3002         * Params:
3003         *     contents = a #GBytes
3004         *     etag = a new [entity tag][gfile-etag] for the @file, or %NULL
3005         *     makeBackup = %TRUE if a backup should be created
3006         *     flags = a set of #GFileCreateFlags
3007         *     cancellable = optional #GCancellable object, %NULL to ignore
3008         *     callback = a #GAsyncReadyCallback to call when the request is satisfied
3009         *     userData = the data to pass to callback function
3010         *
3011         * Since: 2.40
3012         */
3013        public void replaceContentsBytesAsync(Bytes contents, string etag, bool makeBackup, GFileCreateFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
3014        {
3015                g_file_replace_contents_bytes_async(getFileStruct(), (contents is null) ? null : contents.getBytesStruct(), Str.toStringz(etag), makeBackup, flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
3016        }
3017
3018        /**
3019         * Finishes an asynchronous replace of the given @file. See
3020         * g_file_replace_contents_async(). Sets @new_etag to the new entity
3021         * tag for the document, if present.
3022         *
3023         * Params:
3024         *     res = a #GAsyncResult
3025         *     newEtag = a location of a new [entity tag][gfile-etag]
3026         *         for the document. This should be freed with g_free() when it is no
3027         *         longer needed, or %NULL
3028         *
3029         * Returns: %TRUE on success, %FALSE on failure.
3030         *
3031         * Throws: GException on failure.
3032         */
3033        public bool replaceContentsFinish(AsyncResultIF res, out string newEtag)
3034        {
3035                char* outnewEtag = null;
3036                GError* err = null;
3037               
3038                auto p = g_file_replace_contents_finish(getFileStruct(), (res is null) ? null : res.getAsyncResultStruct(), &outnewEtag, &err) != 0;
3039               
3040                if (err !is null)
3041                {
3042                        throw new GException( new ErrorG(err) );
3043                }
3044               
3045                newEtag = Str.toString(outnewEtag);
3046               
3047                return p;
3048        }
3049
3050        /**
3051         * Finishes an asynchronous file replace operation started with
3052         * g_file_replace_async().
3053         *
3054         * Params:
3055         *     res = a #GAsyncResult
3056         *
3057         * Returns: a #GFileOutputStream, or %NULL on error.
3058         *     Free the returned object with g_object_unref().
3059         *
3060         * Throws: GException on failure.
3061         */
3062        public FileOutputStream replaceFinish(AsyncResultIF res)
3063        {
3064                GError* err = null;
3065               
3066                auto p = g_file_replace_finish(getFileStruct(), (res is null) ? null : res.getAsyncResultStruct(), &err);
3067               
3068                if (err !is null)
3069                {
3070                        throw new GException( new ErrorG(err) );
3071                }
3072               
3073                if(p is null)
3074                {
3075                        return null;
3076                }
3077               
3078                return ObjectG.getDObject!(FileOutputStream)(cast(GFileOutputStream*) p, true);
3079        }
3080
3081        /**
3082         * Returns an output stream for overwriting the file in readwrite mode,
3083         * possibly creating a backup copy of the file first. If the file doesn't
3084         * exist, it will be created.
3085         *
3086         * For details about the behaviour, see g_file_replace() which does the
3087         * same thing but returns an output stream only.
3088         *
3089         * Note that in many non-local file cases read and write streams are not
3090         * supported, so make sure you really need to do read and write streaming,
3091         * rather than just opening for reading or writing.
3092         *
3093         * Params:
3094         *     etag = an optional [entity tag][gfile-etag]
3095         *         for the current #GFile, or #NULL to ignore
3096         *     makeBackup = %TRUE if a backup should be created
3097         *     flags = a set of #GFileCreateFlags
3098         *     cancellable = optional #GCancellable object,
3099         *         %NULL to ignore
3100         *
3101         * Returns: a #GFileIOStream or %NULL on error.
3102         *     Free the returned object with g_object_unref().
3103         *
3104         * Since: 2.22
3105         *
3106         * Throws: GException on failure.
3107         */
3108        public FileIOStream replaceReadwrite(string etag, bool makeBackup, GFileCreateFlags flags, Cancellable cancellable)
3109        {
3110                GError* err = null;
3111               
3112                auto p = g_file_replace_readwrite(getFileStruct(), Str.toStringz(etag), makeBackup, flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
3113               
3114                if (err !is null)
3115                {
3116                        throw new GException( new ErrorG(err) );
3117                }
3118               
3119                if(p is null)
3120                {
3121                        return null;
3122                }
3123               
3124                return ObjectG.getDObject!(FileIOStream)(cast(GFileIOStream*) p, true);
3125        }
3126
3127        /**
3128         * Asynchronously overwrites the file in read-write mode,
3129         * replacing the contents, possibly creating a backup copy
3130         * of the file first.
3131         *
3132         * For more details, see g_file_replace_readwrite() which is
3133         * the synchronous version of this call.
3134         *
3135         * When the operation is finished, @callback will be called.
3136         * You can then call g_file_replace_readwrite_finish() to get
3137         * the result of the operation.
3138         *
3139         * Params:
3140         *     etag = an [entity tag][gfile-etag] for the current #GFile,
3141         *         or %NULL to ignore
3142         *     makeBackup = %TRUE if a backup should be created
3143         *     flags = a set of #GFileCreateFlags
3144         *     ioPriority = the [I/O priority][io-priority] of the request
3145         *     cancellable = optional #GCancellable object,
3146         *         %NULL to ignore
3147         *     callback = a #GAsyncReadyCallback to call
3148         *         when the request is satisfied
3149         *     userData = the data to pass to callback function
3150         *
3151         * Since: 2.22
3152         */
3153        public void replaceReadwriteAsync(string etag, bool makeBackup, GFileCreateFlags flags, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
3154        {
3155                g_file_replace_readwrite_async(getFileStruct(), Str.toStringz(etag), makeBackup, flags, ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
3156        }
3157
3158        /**
3159         * Finishes an asynchronous file replace operation started with
3160         * g_file_replace_readwrite_async().
3161         *
3162         * Params:
3163         *     res = a #GAsyncResult
3164         *
3165         * Returns: a #GFileIOStream, or %NULL on error.
3166         *     Free the returned object with g_object_unref().
3167         *
3168         * Since: 2.22
3169         *
3170         * Throws: GException on failure.
3171         */
3172        public FileIOStream replaceReadwriteFinish(AsyncResultIF res)
3173        {
3174                GError* err = null;
3175               
3176                auto p = g_file_replace_readwrite_finish(getFileStruct(), (res is null) ? null : res.getAsyncResultStruct(), &err);
3177               
3178                if (err !is null)
3179                {
3180                        throw new GException( new ErrorG(err) );
3181                }
3182               
3183                if(p is null)
3184                {
3185                        return null;
3186                }
3187               
3188                return ObjectG.getDObject!(FileIOStream)(cast(GFileIOStream*) p, true);
3189        }
3190
3191        /**
3192         * Resolves a relative path for @file to an absolute path.
3193         *
3194         * This call does no blocking I/O.
3195         *
3196         * Params:
3197         *     relativePath = a given relative path string
3198         *
3199         * Returns: #GFile to the resolved path.
3200         *     %NULL if @relative_path is %NULL or if @file is invalid.
3201         *     Free the returned object with g_object_unref().
3202         */
3203        public FileIF resolveRelativePath(string relativePath)
3204        {
3205                auto p = g_file_resolve_relative_path(getFileStruct(), Str.toStringz(relativePath));
3206               
3207                if(p is null)
3208                {
3209                        return null;
3210                }
3211               
3212                return ObjectG.getDObject!(File, FileIF)(cast(GFile*) p, true);
3213        }
3214
3215        /**
3216         * Sets an attribute in the file with attribute name @attribute to @value.
3217         *
3218         * Some attributes can be unset by setting @attribute to
3219         * %G_FILE_ATTRIBUTE_TYPE_INVALID and @value_p to %NULL.
3220         *
3221         * If @cancellable is not %NULL, then the operation can be cancelled by
3222         * triggering the cancellable object from another thread. If the operation
3223         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
3224         *
3225         * Params:
3226         *     attribute = a string containing the attribute's name
3227         *     type = The type of the attribute
3228         *     valueP = a pointer to the value (or the pointer
3229         *         itself if the type is a pointer type)
3230         *     flags = a set of #GFileQueryInfoFlags
3231         *     cancellable = optional #GCancellable object,
3232         *         %NULL to ignore
3233         *
3234         * Returns: %TRUE if the attribute was set, %FALSE otherwise.
3235         *
3236         * Throws: GException on failure.
3237         */
3238        public bool setAttribute(string attribute, GFileAttributeType type, void* valueP, GFileQueryInfoFlags flags, Cancellable cancellable)
3239        {
3240                GError* err = null;
3241               
3242                auto p = g_file_set_attribute(getFileStruct(), Str.toStringz(attribute), type, valueP, flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0;
3243               
3244                if (err !is null)
3245                {
3246                        throw new GException( new ErrorG(err) );
3247                }
3248               
3249                return p;
3250        }
3251
3252        /**
3253         * Sets @attribute of type %G_FILE_ATTRIBUTE_TYPE_BYTE_STRING to @value.
3254         * If @attribute is of a different type, this operation will fail,
3255         * returning %FALSE.
3256         *
3257         * If @cancellable is not %NULL, then the operation can be cancelled by
3258         * triggering the cancellable object from another thread. If the operation
3259         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
3260         *
3261         * Params:
3262         *     attribute = a string containing the attribute's name
3263         *     value = a string containing the attribute's new value
3264         *     flags = a #GFileQueryInfoFlags
3265         *     cancellable = optional #GCancellable object,
3266         *         %NULL to ignore
3267         *
3268         * Returns: %TRUE if the @attribute was successfully set to @value
3269         *     in the @file, %FALSE otherwise.
3270         *
3271         * Throws: GException on failure.
3272         */
3273        public bool setAttributeByteString(string attribute, string value, GFileQueryInfoFlags flags, Cancellable cancellable)
3274        {
3275                GError* err = null;
3276               
3277                auto p = g_file_set_attribute_byte_string(getFileStruct(), Str.toStringz(attribute), Str.toStringz(value), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0;
3278               
3279                if (err !is null)
3280                {
3281                        throw new GException( new ErrorG(err) );
3282                }
3283               
3284                return p;
3285        }
3286
3287        /**
3288         * Sets @attribute of type %G_FILE_ATTRIBUTE_TYPE_INT32 to @value.
3289         * If @attribute is of a different type, this operation will fail.
3290         *
3291         * If @cancellable is not %NULL, then the operation can be cancelled by
3292         * triggering the cancellable object from another thread. If the operation
3293         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
3294         *
3295         * Params:
3296         *     attribute = a string containing the attribute's name
3297         *     value = a #gint32 containing the attribute's new value
3298         *     flags = a #GFileQueryInfoFlags
3299         *     cancellable = optional #GCancellable object,
3300         *         %NULL to ignore
3301         *
3302         * Returns: %TRUE if the @attribute was successfully set to @value
3303         *     in the @file, %FALSE otherwise.
3304         *
3305         * Throws: GException on failure.
3306         */
3307        public bool setAttributeInt32(string attribute, int value, GFileQueryInfoFlags flags, Cancellable cancellable)
3308        {
3309                GError* err = null;
3310               
3311                auto p = g_file_set_attribute_int32(getFileStruct(), Str.toStringz(attribute), value, flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0;
3312               
3313                if (err !is null)
3314                {
3315                        throw new GException( new ErrorG(err) );
3316                }
3317               
3318                return p;
3319        }
3320
3321        /**
3322         * Sets @attribute of type %G_FILE_ATTRIBUTE_TYPE_INT64 to @value.
3323         * If @attribute is of a different type, this operation will fail.
3324         *
3325         * If @cancellable is not %NULL, then the operation can be cancelled by
3326         * triggering the cancellable object from another thread. If the operation
3327         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
3328         *
3329         * Params:
3330         *     attribute = a string containing the attribute's name
3331         *     value = a #guint64 containing the attribute's new value
3332         *     flags = a #GFileQueryInfoFlags
3333         *     cancellable = optional #GCancellable object,
3334         *         %NULL to ignore
3335         *
3336         * Returns: %TRUE if the @attribute was successfully set, %FALSE otherwise.
3337         *
3338         * Throws: GException on failure.
3339         */
3340        public bool setAttributeInt64(string attribute, long value, GFileQueryInfoFlags flags, Cancellable cancellable)
3341        {
3342                GError* err = null;
3343               
3344                auto p = g_file_set_attribute_int64(getFileStruct(), Str.toStringz(attribute), value, flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0;
3345               
3346                if (err !is null)
3347                {
3348                        throw new GException( new ErrorG(err) );
3349                }
3350               
3351                return p;
3352        }
3353
3354        /**
3355         * Sets @attribute of type %G_FILE_ATTRIBUTE_TYPE_STRING to @value.
3356         * If @attribute is of a different type, this operation will fail.
3357         *
3358         * If @cancellable is not %NULL, then the operation can be cancelled by
3359         * triggering the cancellable object from another thread. If the operation
3360         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
3361         *
3362         * Params:
3363         *     attribute = a string containing the attribute's name
3364         *     value = a string containing the attribute's value
3365         *     flags = #GFileQueryInfoFlags
3366         *     cancellable = optional #GCancellable object,
3367         *         %NULL to ignore
3368         *
3369         * Returns: %TRUE if the @attribute was successfully set, %FALSE otherwise.
3370         *
3371         * Throws: GException on failure.
3372         */
3373        public bool setAttributeString(string attribute, string value, GFileQueryInfoFlags flags, Cancellable cancellable)
3374        {
3375                GError* err = null;
3376               
3377                auto p = g_file_set_attribute_string(getFileStruct(), Str.toStringz(attribute), Str.toStringz(value), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0;
3378               
3379                if (err !is null)
3380                {
3381                        throw new GException( new ErrorG(err) );
3382                }
3383               
3384                return p;
3385        }
3386
3387        /**
3388         * Sets @attribute of type %G_FILE_ATTRIBUTE_TYPE_UINT32 to @value.
3389         * If @attribute is of a different type, this operation will fail.
3390         *
3391         * If @cancellable is not %NULL, then the operation can be cancelled by
3392         * triggering the cancellable object from another thread. If the operation
3393         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
3394         *
3395         * Params:
3396         *     attribute = a string containing the attribute's name
3397         *     value = a #guint32 containing the attribute's new value
3398         *     flags = a #GFileQueryInfoFlags
3399         *     cancellable = optional #GCancellable object,
3400         *         %NULL to ignore
3401         *
3402         * Returns: %TRUE if the @attribute was successfully set to @value
3403         *     in the @file, %FALSE otherwise.
3404         *
3405         * Throws: GException on failure.
3406         */
3407        public bool setAttributeUint32(string attribute, uint value, GFileQueryInfoFlags flags, Cancellable cancellable)
3408        {
3409                GError* err = null;
3410               
3411                auto p = g_file_set_attribute_uint32(getFileStruct(), Str.toStringz(attribute), value, flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0;
3412               
3413                if (err !is null)
3414                {
3415                        throw new GException( new ErrorG(err) );
3416                }
3417               
3418                return p;
3419        }
3420
3421        /**
3422         * Sets @attribute of type %G_FILE_ATTRIBUTE_TYPE_UINT64 to @value.
3423         * If @attribute is of a different type, this operation will fail.
3424         *
3425         * If @cancellable is not %NULL, then the operation can be cancelled by
3426         * triggering the cancellable object from another thread. If the operation
3427         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
3428         *
3429         * Params:
3430         *     attribute = a string containing the attribute's name
3431         *     value = a #guint64 containing the attribute's new value
3432         *     flags = a #GFileQueryInfoFlags
3433         *     cancellable = optional #GCancellable object,
3434         *         %NULL to ignore
3435         *
3436         * Returns: %TRUE if the @attribute was successfully set to @value
3437         *     in the @file, %FALSE otherwise.
3438         *
3439         * Throws: GException on failure.
3440         */
3441        public bool setAttributeUint64(string attribute, ulong value, GFileQueryInfoFlags flags, Cancellable cancellable)
3442        {
3443                GError* err = null;
3444               
3445                auto p = g_file_set_attribute_uint64(getFileStruct(), Str.toStringz(attribute), value, flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0;
3446               
3447                if (err !is null)
3448                {
3449                        throw new GException( new ErrorG(err) );
3450                }
3451               
3452                return p;
3453        }
3454
3455        /**
3456         * Asynchronously sets the attributes of @file with @info.
3457         *
3458         * For more details, see g_file_set_attributes_from_info(),
3459         * which is the synchronous version of this call.
3460         *
3461         * When the operation is finished, @callback will be called.
3462         * You can then call g_file_set_attributes_finish() to get
3463         * the result of the operation.
3464         *
3465         * Params:
3466         *     info = a #GFileInfo
3467         *     flags = a #GFileQueryInfoFlags
3468         *     ioPriority = the [I/O priority][io-priority] of the request
3469         *     cancellable = optional #GCancellable object,
3470         *         %NULL to ignore
3471         *     callback = a #GAsyncReadyCallback
3472         *     userData = a #gpointer
3473         */
3474        public void setAttributesAsync(FileInfo info, GFileQueryInfoFlags flags, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
3475        {
3476                g_file_set_attributes_async(getFileStruct(), (info is null) ? null : info.getFileInfoStruct(), flags, ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
3477        }
3478
3479        /**
3480         * Finishes setting an attribute started in g_file_set_attributes_async().
3481         *
3482         * Params:
3483         *     result = a #GAsyncResult
3484         *     info = a #GFileInfo
3485         *
3486         * Returns: %TRUE if the attributes were set correctly, %FALSE otherwise.
3487         *
3488         * Throws: GException on failure.
3489         */
3490        public bool setAttributesFinish(AsyncResultIF result, out FileInfo info)
3491        {
3492                GFileInfo* outinfo = null;
3493                GError* err = null;
3494               
3495                auto p = g_file_set_attributes_finish(getFileStruct(), (result is null) ? null : result.getAsyncResultStruct(), &outinfo, &err) != 0;
3496               
3497                if (err !is null)
3498                {
3499                        throw new GException( new ErrorG(err) );
3500                }
3501               
3502                info = ObjectG.getDObject!(FileInfo)(outinfo);
3503               
3504                return p;
3505        }
3506
3507        /**
3508         * Tries to set all attributes in the #GFileInfo on the target
3509         * values, not stopping on the first error.
3510         *
3511         * If there is any error during this operation then @error will
3512         * be set to the first error. Error on particular fields are flagged
3513         * by setting the "status" field in the attribute value to
3514         * %G_FILE_ATTRIBUTE_STATUS_ERROR_SETTING, which means you can
3515         * also detect further errors.
3516         *
3517         * If @cancellable is not %NULL, then the operation can be cancelled by
3518         * triggering the cancellable object from another thread. If the operation
3519         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
3520         *
3521         * Params:
3522         *     info = a #GFileInfo
3523         *     flags = #GFileQueryInfoFlags
3524         *     cancellable = optional #GCancellable object,
3525         *         %NULL to ignore
3526         *
3527         * Returns: %FALSE if there was any error, %TRUE otherwise.
3528         *
3529         * Throws: GException on failure.
3530         */
3531        public bool setAttributesFromInfo(FileInfo info, GFileQueryInfoFlags flags, Cancellable cancellable)
3532        {
3533                GError* err = null;
3534               
3535                auto p = g_file_set_attributes_from_info(getFileStruct(), (info is null) ? null : info.getFileInfoStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0;
3536               
3537                if (err !is null)
3538                {
3539                        throw new GException( new ErrorG(err) );
3540                }
3541               
3542                return p;
3543        }
3544
3545        /**
3546         * Renames @file to the specified display name.
3547         *
3548         * The display name is converted from UTF-8 to the correct encoding
3549         * for the target filesystem if possible and the @file is renamed to this.
3550         *
3551         * If you want to implement a rename operation in the user interface the
3552         * edit name (#G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME) should be used as the
3553         * initial value in the rename widget, and then the result after editing
3554         * should be passed to g_file_set_display_name().
3555         *
3556         * On success the resulting converted filename is returned.
3557         *
3558         * If @cancellable is not %NULL, then the operation can be cancelled by
3559         * triggering the cancellable object from another thread. If the operation
3560         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
3561         *
3562         * Params:
3563         *     displayName = a string
3564         *     cancellable = optional #GCancellable object,
3565         *         %NULL to ignore
3566         *
3567         * Returns: a #GFile specifying what @file was renamed to,
3568         *     or %NULL if there was an error.
3569         *     Free the returned object with g_object_unref().
3570         *
3571         * Throws: GException on failure.
3572         */
3573        public FileIF setDisplayName(string displayName, Cancellable cancellable)
3574        {
3575                GError* err = null;
3576               
3577                auto p = g_file_set_display_name(getFileStruct(), Str.toStringz(displayName), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
3578               
3579                if (err !is null)
3580                {
3581                        throw new GException( new ErrorG(err) );
3582                }
3583               
3584                if(p is null)
3585                {
3586                        return null;
3587                }
3588               
3589                return ObjectG.getDObject!(File, FileIF)(cast(GFile*) p, true);
3590        }
3591
3592        /**
3593         * Asynchronously sets the display name for a given #GFile.
3594         *
3595         * For more details, see g_file_set_display_name() which is
3596         * the synchronous version of this call.
3597         *
3598         * When the operation is finished, @callback will be called.
3599         * You can then call g_file_set_display_name_finish() to get
3600         * the result of the operation.
3601         *
3602         * Params:
3603         *     displayName = a string
3604         *     ioPriority = the [I/O priority][io-priority] of the request
3605         *     cancellable = optional #GCancellable object,
3606         *         %NULL to ignore
3607         *     callback = a #GAsyncReadyCallback to call
3608         *         when the request is satisfied
3609         *     userData = the data to pass to callback function
3610         */
3611        public void setDisplayNameAsync(string displayName, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
3612        {
3613                g_file_set_display_name_async(getFileStruct(), Str.toStringz(displayName), ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
3614        }
3615
3616        /**
3617         * Finishes setting a display name started with
3618         * g_file_set_display_name_async().
3619         *
3620         * Params:
3621         *     res = a #GAsyncResult
3622         *
3623         * Returns: a #GFile or %NULL on error.
3624         *     Free the returned object with g_object_unref().
3625         *
3626         * Throws: GException on failure.
3627         */
3628        public FileIF setDisplayNameFinish(AsyncResultIF res)
3629        {
3630                GError* err = null;
3631               
3632                auto p = g_file_set_display_name_finish(getFileStruct(), (res is null) ? null : res.getAsyncResultStruct(), &err);
3633               
3634                if (err !is null)
3635                {
3636                        throw new GException( new ErrorG(err) );
3637                }
3638               
3639                if(p is null)
3640                {
3641                        return null;
3642                }
3643               
3644                return ObjectG.getDObject!(File, FileIF)(cast(GFile*) p, true);
3645        }
3646
3647        /**
3648         * Starts a file of type #G_FILE_TYPE_MOUNTABLE.
3649         * Using @start_operation, you can request callbacks when, for instance,
3650         * passwords are needed during authentication.
3651         *
3652         * If @cancellable is not %NULL, then the operation can be cancelled by
3653         * triggering the cancellable object from another thread. If the operation
3654         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
3655         *
3656         * When the operation is finished, @callback will be called.
3657         * You can then call g_file_mount_mountable_finish() to get
3658         * the result of the operation.
3659         *
3660         * Params:
3661         *     flags = flags affecting the operation
3662         *     startOperation = a #GMountOperation, or %NULL to avoid user interaction
3663         *     cancellable = optional #GCancellable object, %NULL to ignore
3664         *     callback = a #GAsyncReadyCallback to call when the request is satisfied, or %NULL
3665         *     userData = the data to pass to callback function
3666         *
3667         * Since: 2.22
3668         */
3669        public void startMountable(GDriveStartFlags flags, MountOperation startOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
3670        {
3671                g_file_start_mountable(getFileStruct(), flags, (startOperation is null) ? null : startOperation.getMountOperationStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
3672        }
3673
3674        /**
3675         * Finishes a start operation. See g_file_start_mountable() for details.
3676         *
3677         * Finish an asynchronous start operation that was started
3678         * with g_file_start_mountable().
3679         *
3680         * Params:
3681         *     result = a #GAsyncResult
3682         *
3683         * Returns: %TRUE if the operation finished successfully. %FALSE
3684         *     otherwise.
3685         *
3686         * Since: 2.22
3687         *
3688         * Throws: GException on failure.
3689         */
3690        public bool startMountableFinish(AsyncResultIF result)
3691        {
3692                GError* err = null;
3693               
3694                auto p = g_file_start_mountable_finish(getFileStruct(), (result is null) ? null : result.getAsyncResultStruct(), &err) != 0;
3695               
3696                if (err !is null)
3697                {
3698                        throw new GException( new ErrorG(err) );
3699                }
3700               
3701                return p;
3702        }
3703
3704        /**
3705         * Stops a file of type #G_FILE_TYPE_MOUNTABLE.
3706         *
3707         * If @cancellable is not %NULL, then the operation can be cancelled by
3708         * triggering the cancellable object from another thread. If the operation
3709         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
3710         *
3711         * When the operation is finished, @callback will be called.
3712         * You can then call g_file_stop_mountable_finish() to get
3713         * the result of the operation.
3714         *
3715         * Params:
3716         *     flags = flags affecting the operation
3717         *     mountOperation = a #GMountOperation,
3718         *         or %NULL to avoid user interaction.
3719         *     cancellable = optional #GCancellable object,
3720         *         %NULL to ignore
3721         *     callback = a #GAsyncReadyCallback to call
3722         *         when the request is satisfied, or %NULL
3723         *     userData = the data to pass to callback function
3724         *
3725         * Since: 2.22
3726         */
3727        public void stopMountable(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
3728        {
3729                g_file_stop_mountable(getFileStruct(), flags, (mountOperation is null) ? null : mountOperation.getMountOperationStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
3730        }
3731
3732        /**
3733         * Finishes an stop operation, see g_file_stop_mountable() for details.
3734         *
3735         * Finish an asynchronous stop operation that was started
3736         * with g_file_stop_mountable().
3737         *
3738         * Params:
3739         *     result = a #GAsyncResult
3740         *
3741         * Returns: %TRUE if the operation finished successfully.
3742         *     %FALSE otherwise.
3743         *
3744         * Since: 2.22
3745         *
3746         * Throws: GException on failure.
3747         */
3748        public bool stopMountableFinish(AsyncResultIF result)
3749        {
3750                GError* err = null;
3751               
3752                auto p = g_file_stop_mountable_finish(getFileStruct(), (result is null) ? null : result.getAsyncResultStruct(), &err) != 0;
3753               
3754                if (err !is null)
3755                {
3756                        throw new GException( new ErrorG(err) );
3757                }
3758               
3759                return p;
3760        }
3761
3762        /**
3763         * Checks if @file supports
3764         * [thread-default contexts][g-main-context-push-thread-default-context].
3765         * If this returns %FALSE, you cannot perform asynchronous operations on
3766         * @file in a thread that has a thread-default context.
3767         *
3768         * Returns: Whether or not @file supports thread-default contexts.
3769         *
3770         * Since: 2.22
3771         */
3772        public bool supportsThreadContexts()
3773        {
3774                return g_file_supports_thread_contexts(getFileStruct()) != 0;
3775        }
3776
3777        /**
3778         * Sends @file to the "Trashcan", if possible. This is similar to
3779         * deleting it, but the user can recover it before emptying the trashcan.
3780         * Not all file systems support trashing, so this call can return the
3781         * %G_IO_ERROR_NOT_SUPPORTED error.
3782         *
3783         * If @cancellable is not %NULL, then the operation can be cancelled by
3784         * triggering the cancellable object from another thread. If the operation
3785         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
3786         *
3787         * Params:
3788         *     cancellable = optional #GCancellable object,
3789         *         %NULL to ignore
3790         *
3791         * Returns: %TRUE on successful trash, %FALSE otherwise.
3792         *
3793         * Throws: GException on failure.
3794         */
3795        public bool trash(Cancellable cancellable)
3796        {
3797                GError* err = null;
3798               
3799                auto p = g_file_trash(getFileStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0;
3800               
3801                if (err !is null)
3802                {
3803                        throw new GException( new ErrorG(err) );
3804                }
3805               
3806                return p;
3807        }
3808
3809        /**
3810         * Asynchronously sends @file to the Trash location, if possible.
3811         *
3812         * Params:
3813         *     ioPriority = the [I/O priority][io-priority] of the request
3814         *     cancellable = optional #GCancellable object,
3815         *         %NULL to ignore
3816         *     callback = a #GAsyncReadyCallback to call
3817         *         when the request is satisfied
3818         *     userData = the data to pass to callback function
3819         *
3820         * Since: 2.38
3821         */
3822        public void trashAsync(int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
3823        {
3824                g_file_trash_async(getFileStruct(), ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
3825        }
3826
3827        /**
3828         * Finishes an asynchronous file trashing operation, started with
3829         * g_file_trash_async().
3830         *
3831         * Params:
3832         *     result = a #GAsyncResult
3833         *
3834         * Returns: %TRUE on successful trash, %FALSE otherwise.
3835         *
3836         * Since: 2.38
3837         *
3838         * Throws: GException on failure.
3839         */
3840        public bool trashFinish(AsyncResultIF result)
3841        {
3842                GError* err = null;
3843               
3844                auto p = g_file_trash_finish(getFileStruct(), (result is null) ? null : result.getAsyncResultStruct(), &err) != 0;
3845               
3846                if (err !is null)
3847                {
3848                        throw new GException( new ErrorG(err) );
3849                }
3850               
3851                return p;
3852        }
3853
3854        /**
3855         * Unmounts a file of type G_FILE_TYPE_MOUNTABLE.
3856         *
3857         * If @cancellable is not %NULL, then the operation can be cancelled by
3858         * triggering the cancellable object from another thread. If the operation
3859         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
3860         *
3861         * When the operation is finished, @callback will be called.
3862         * You can then call g_file_unmount_mountable_finish() to get
3863         * the result of the operation.
3864         *
3865         * Deprecated: Use g_file_unmount_mountable_with_operation() instead.
3866         *
3867         * Params:
3868         *     flags = flags affecting the operation
3869         *     cancellable = optional #GCancellable object,
3870         *         %NULL to ignore
3871         *     callback = a #GAsyncReadyCallback to call
3872         *         when the request is satisfied, or %NULL
3873         *     userData = the data to pass to callback function
3874         */
3875        public void unmountMountable(GMountUnmountFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
3876        {
3877                g_file_unmount_mountable(getFileStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
3878        }
3879
3880        /**
3881         * Finishes an unmount operation, see g_file_unmount_mountable() for details.
3882         *
3883         * Finish an asynchronous unmount operation that was started
3884         * with g_file_unmount_mountable().
3885         *
3886         * Deprecated: Use g_file_unmount_mountable_with_operation_finish()
3887         * instead.
3888         *
3889         * Params:
3890         *     result = a #GAsyncResult
3891         *
3892         * Returns: %TRUE if the operation finished successfully.
3893         *     %FALSE otherwise.
3894         *
3895         * Throws: GException on failure.
3896         */
3897        public bool unmountMountableFinish(AsyncResultIF result)
3898        {
3899                GError* err = null;
3900               
3901                auto p = g_file_unmount_mountable_finish(getFileStruct(), (result is null) ? null : result.getAsyncResultStruct(), &err) != 0;
3902               
3903                if (err !is null)
3904                {
3905                        throw new GException( new ErrorG(err) );
3906                }
3907               
3908                return p;
3909        }
3910
3911        /**
3912         * Unmounts a file of type #G_FILE_TYPE_MOUNTABLE.
3913         *
3914         * If @cancellable is not %NULL, then the operation can be cancelled by
3915         * triggering the cancellable object from another thread. If the operation
3916         * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
3917         *
3918         * When the operation is finished, @callback will be called.
3919         * You can then call g_file_unmount_mountable_finish() to get
3920         * the result of the operation.
3921         *
3922         * Params:
3923         *     flags = flags affecting the operation
3924         *     mountOperation = a #GMountOperation,
3925         *         or %NULL to avoid user interaction
3926         *     cancellable = optional #GCancellable object,
3927         *         %NULL to ignore
3928         *     callback = a #GAsyncReadyCallback to call
3929         *         when the request is satisfied, or %NULL
3930         *     userData = the data to pass to callback function
3931         *
3932         * Since: 2.22
3933         */
3934        public void unmountMountableWithOperation(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
3935        {
3936                g_file_unmount_mountable_with_operation(getFileStruct(), flags, (mountOperation is null) ? null : mountOperation.getMountOperationStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
3937        }
3938
3939        /**
3940         * Finishes an unmount operation,
3941         * see g_file_unmount_mountable_with_operation() for details.
3942         *
3943         * Finish an asynchronous unmount operation that was started
3944         * with g_file_unmount_mountable_with_operation().
3945         *
3946         * Params:
3947         *     result = a #GAsyncResult
3948         *
3949         * Returns: %TRUE if the operation finished successfully.
3950         *     %FALSE otherwise.
3951         *
3952         * Since: 2.22
3953         *
3954         * Throws: GException on failure.
3955         */
3956        public bool unmountMountableWithOperationFinish(AsyncResultIF result)
3957        {
3958                GError* err = null;
3959               
3960                auto p = g_file_unmount_mountable_with_operation_finish(getFileStruct(), (result is null) ? null : result.getAsyncResultStruct(), &err) != 0;
3961               
3962                if (err !is null)
3963                {
3964                        throw new GException( new ErrorG(err) );
3965                }
3966               
3967                return p;
3968        }
3969}
Note: See TracBrowser for help on using the repository browser.