switch glibmm/giomm to 2.18
[ardour.git] / libs / glibmm2 / gio / src / file.ccg
1 // -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2
3 /* Copyright (C) 2007 The gtkmm Development Team
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the Free
17  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19
20 #include <giomm/mount.h>
21 #include <gio/gio.h>
22 #include <utility>
23 #include <glibmm/error.h>
24 #include <glibmm/exceptionhandler.h>
25 #include "slot_async.h"
26
27 namespace
28 {
29
30 typedef std::pair<Gio::File::SlotReadMore*, Gio::SlotAsyncReady*> LoadPartialSlots;
31
32 static void
33 SignalProxy_file_progress_callback(goffset current_num_bytes,
34                                    goffset total_num_bytes,
35                                    gpointer data)
36 {
37   Gio::File::SlotFileProgress* the_slot = static_cast<Gio::File::SlotFileProgress*>(data);
38
39   #ifdef GLIBMM_EXCEPTIONS_ENABLED
40   try
41   {
42   #endif //GLIBMM_EXCEPTIONS_ENABLED
43
44     (*the_slot)(current_num_bytes, total_num_bytes);
45
46   #ifdef GLIBMM_EXCEPTIONS_ENABLED
47   }
48   catch(...)
49   {
50     Glib::exception_handlers_invoke();
51   }
52   #endif //GLIBMM_EXCEPTIONS_ENABLED
53
54   delete the_slot;
55 }
56
57 static gboolean
58 SignalProxy_load_partial_contents_read_more_callback(const char* file_contents, goffset file_size, gpointer data)
59 {
60   LoadPartialSlots* slot_pair = static_cast<LoadPartialSlots*>(data);
61   Gio::File::SlotReadMore* the_slot = slot_pair->first;
62
63   bool result = false;
64
65   #ifdef GLIBMM_EXCEPTIONS_ENABLED
66   try
67   {
68   #endif //GLIBMM_EXCEPTIONS_ENABLED
69
70     result = (*the_slot)(file_contents, file_size);
71
72   #ifdef GLIBMM_EXCEPTIONS_ENABLED
73   }
74   catch(...)
75   {
76     Glib::exception_handlers_invoke();
77   }
78   #endif //GLIBMM_EXCEPTIONS_ENABLED
79
80   return result;
81 }
82
83 // Same as SignalProxy_async_callback, except that this one knows that
84 // the slot is packed in a pair. The operation is assumed to be finished
85 // after the callback is triggered, so we delete that pair here.
86 static void
87 SignalProxy_load_partial_contents_ready_callback(GObject*, GAsyncResult* res, void* data)
88 {
89   LoadPartialSlots* slot_pair = static_cast<LoadPartialSlots*>(data);
90   Gio::SlotAsyncReady* the_slot = slot_pair->second;
91
92   #ifdef GLIBMM_EXCEPTIONS_ENABLED
93   try
94   {
95   #endif //GLIBMM_EXCEPTIONS_ENABLED
96     Glib::RefPtr<Gio::AsyncResult> result = Glib::wrap(res, true /* take copy */);
97     (*the_slot)(result);
98   #ifdef GLIBMM_EXCEPTIONS_ENABLED
99   }
100   catch(...)
101   {
102     Glib::exception_handlers_invoke();
103   }
104   #endif //GLIBMM_EXCEPTIONS_ENABLED
105
106   delete the_slot;
107   delete slot_pair->first; // read_more slot
108   delete slot_pair;
109 }
110
111 } // anonymous namespace
112
113 namespace Gio {
114
115 Glib::RefPtr<File>
116 File::create_for_path(const std::string& path)
117 {
118   GFile* cfile = g_file_new_for_path(path.c_str());
119   return Glib::wrap(G_FILE(cfile));
120 }
121
122 Glib::RefPtr<File>
123 File::create_for_uri(const std::string& uri)
124 {
125   GFile* cfile = g_file_new_for_uri(uri.c_str());
126   return Glib::wrap(G_FILE(cfile));
127 }
128
129 Glib::RefPtr<File>
130 File::create_for_commandline_arg(const std::string& arg)
131 {
132   GFile* cfile = g_file_new_for_commandline_arg(arg.c_str());
133   return Glib::wrap(G_FILE(cfile));
134 }
135
136 Glib::RefPtr<File>
137 File::create_for_parse_name(const Glib::ustring& parse_name)
138 {
139   GFile* cfile = g_file_parse_name(parse_name.c_str());
140   return Glib::wrap(G_FILE(cfile));
141 }
142
143 void
144 File::read_async(const SlotAsyncReady& slot, int io_priority)
145 {
146   // Create a copy of the slot.
147   // A pointer to it will be passed through the callback's data parameter
148   // and deleted in the callback.
149   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
150
151   g_file_read_async(gobj(),
152                     io_priority,
153                     NULL,
154                     &SignalProxy_async_callback,
155                     slot_copy);
156 }
157
158 void
159 File::read_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority)
160 {
161   // Create a copy of the slot.
162   // A pointer to it will be passed through the callback's data parameter
163   // and deleted in the callback.
164   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
165
166   g_file_read_async(gobj(),
167                     io_priority,
168                     cancellable->gobj(),
169                     &SignalProxy_async_callback,
170                     slot_copy);
171 }
172
173 void
174 File::append_to_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, FileCreateFlags flags, int io_priority)
175 {
176   // Create a copy of the slot.
177   // A pointer to it will be passed through the callback's data parameter
178   // and deleted in the callback.
179   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
180
181   g_file_append_to_async(gobj(),
182                          static_cast<GFileCreateFlags>(flags),
183                          io_priority,
184                          cancellable->gobj(),
185                          &SignalProxy_async_callback,
186                          slot_copy);
187 }
188
189 void
190 File::append_to_async(const SlotAsyncReady& slot, FileCreateFlags flags, int io_priority)
191 {
192   // Create a copy of the slot.
193   // A pointer to it will be passed through the callback's data parameter
194   // and deleted in the callback.
195   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
196
197   g_file_append_to_async(gobj(),
198                          static_cast<GFileCreateFlags>(flags),
199                          io_priority,
200                          NULL, // cancellable
201                          &SignalProxy_async_callback,
202                          slot_copy);
203 }
204
205 void
206 File::create_file_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, FileCreateFlags flags, int io_priority)
207 {
208   // Create a copy of the slot.
209   // A pointer to it will be passed through the callback's data parameter
210   // and deleted in the callback.
211   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
212
213   g_file_create_async(gobj(),
214                       static_cast<GFileCreateFlags>(flags),
215                       io_priority,
216                       cancellable->gobj(),
217                       &SignalProxy_async_callback,
218                       slot_copy);
219 }
220
221 void
222 File::create_file_async(const SlotAsyncReady& slot, FileCreateFlags flags, int io_priority)
223 {
224   // Create a copy of the slot.
225   // A pointer to it will be passed through the callback's data parameter
226   // and deleted in the callback.
227   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
228
229   g_file_create_async(gobj(),
230                       static_cast<GFileCreateFlags>(flags),
231                       io_priority,
232                       NULL, // cancellable
233                       &SignalProxy_async_callback,
234                       slot_copy);
235 }
236
237 void
238 File::replace_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, const std::string& etag, bool make_backup, FileCreateFlags flags, int io_priority)
239 {
240   // Create a copy of the slot.
241   // A pointer to it will be passed through the callback's data parameter
242   // and deleted in the callback.
243   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
244
245   g_file_replace_async(gobj(),
246                        etag.empty() ? NULL : etag.c_str(),
247                        make_backup,
248                        static_cast<GFileCreateFlags>(flags),
249                        io_priority,
250                        cancellable->gobj(),
251                        &SignalProxy_async_callback,
252                        slot_copy);
253 }
254
255 void
256 File::replace_async(const SlotAsyncReady& slot, const std::string& etag, bool make_backup, FileCreateFlags flags, int io_priority)
257 {
258   // Create a copy of the slot.
259   // A pointer to it will be passed through the callback's data parameter
260   // and deleted in the callback.
261   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
262
263   g_file_replace_async(gobj(),
264                        etag.empty() ? NULL : etag.c_str(),
265                        make_backup,
266                        static_cast<GFileCreateFlags>(flags),
267                        io_priority,
268                        NULL, // cancellable
269                        &SignalProxy_async_callback,
270                        slot_copy);
271 }
272
273 #ifdef GLIBMM_EXCEPTIONS_ENABLED
274 Glib::RefPtr<FileInfo> File::query_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, FileQueryInfoFlags flags) const
275 #else
276 Glib::RefPtr<FileInfo> File::query_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, FileQueryInfoFlags flags, std::auto_ptr<Glib::Error>& error) const
277 #endif //GLIBMM_EXCEPTIONS_ENABLED
278 {
279   GError* gerror = 0;
280   Glib::RefPtr<FileInfo> retvalue = Glib::wrap(g_file_query_info(const_cast<GFile*>(gobj()), attributes.c_str(), ((GFileQueryInfoFlags)(flags)), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
281 #ifdef GLIBMM_EXCEPTIONS_ENABLED
282   if(gerror)
283     ::Glib::Error::throw_exception(gerror);
284 #else
285   if(gerror)
286     error = ::Glib::Error::throw_exception(gerror);
287 #endif //GLIBMM_EXCEPTIONS_ENABLED
288
289   return retvalue;
290 }
291
292 #ifdef GLIBMM_EXCEPTIONS_ENABLED
293 Glib::RefPtr<FileInfo> File::query_info(const std::string& attributes, FileQueryInfoFlags flags) const
294 #else
295 Glib::RefPtr<FileInfo> File::query_info(const std::string& attributes, FileQueryInfoFlags flags, std::auto_ptr<Glib::Error>& error) const
296 #endif //GLIBMM_EXCEPTIONS_ENABLED
297 {
298   GError* gerror = 0;
299   Glib::RefPtr<FileInfo> retvalue = Glib::wrap(g_file_query_info(const_cast<GFile*>(gobj()), attributes.c_str(), ((GFileQueryInfoFlags)(flags)), NULL, &(gerror)));
300 #ifdef GLIBMM_EXCEPTIONS_ENABLED
301   if(gerror)
302     ::Glib::Error::throw_exception(gerror);
303 #else
304   if(gerror)
305     error = ::Glib::Error::throw_exception(gerror);
306 #endif //GLIBMM_EXCEPTIONS_ENABLED
307
308   return retvalue;
309 }
310
311 bool File::query_exists() const
312 {
313   return g_file_query_exists(const_cast<GFile*>(gobj()), NULL);
314 }
315
316 FileType File::query_file_type(FileQueryInfoFlags flags) const
317 {
318   return (FileType)g_file_query_file_type(const_cast<GFile*>(gobj()), (GFileQueryInfoFlags)flags, NULL);
319 }
320
321 void
322 File::query_info_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, FileQueryInfoFlags flags, int io_priority) const
323 {
324   // Create a copy of the slot.
325   // A pointer to it will be passed through the callback's data parameter
326   // and deleted in the callback.
327   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
328
329   g_file_query_info_async(const_cast<GFile*>(gobj()),
330                           attributes.c_str(),
331                           static_cast<GFileQueryInfoFlags>(flags),
332                           io_priority,
333                           cancellable->gobj(),
334                           &SignalProxy_async_callback,
335                           slot_copy);
336 }
337
338 void
339 File::query_info_async(const SlotAsyncReady& slot, const std::string& attributes, FileQueryInfoFlags flags, int io_priority) const
340 {
341   // Create a copy of the slot.
342   // A pointer to it will be passed through the callback's data parameter
343   // and deleted in the callback.
344   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
345
346   g_file_query_info_async(const_cast<GFile*>(gobj()),
347                           attributes.c_str(),
348                           static_cast<GFileQueryInfoFlags>(flags),
349                           io_priority,
350                           NULL, // cancellable
351                           &SignalProxy_async_callback,
352                           slot_copy);
353 }
354
355
356 #ifdef GLIBMM_EXCEPTIONS_ENABLED
357 Glib::RefPtr<FileInfo> File::query_filesystem_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes)
358 #else
359 Glib::RefPtr<FileInfo> File::query_filesystem_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, std::auto_ptr<Glib::Error>& error)
360 #endif //GLIBMM_EXCEPTIONS_ENABLED
361 {
362   GError* gerror = 0;
363   Glib::RefPtr<FileInfo> retvalue = Glib::wrap(g_file_query_filesystem_info(gobj(), attributes.c_str(), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
364 #ifdef GLIBMM_EXCEPTIONS_ENABLED
365   if(gerror)
366     ::Glib::Error::throw_exception(gerror);
367 #else
368   if(gerror)
369     error = ::Glib::Error::throw_exception(gerror);
370 #endif //GLIBMM_EXCEPTIONS_ENABLED
371
372   return retvalue;
373 }
374
375 #ifdef GLIBMM_EXCEPTIONS_ENABLED
376 Glib::RefPtr<FileInfo> File::query_filesystem_info(const std::string& attributes)
377 #else
378 Glib::RefPtr<FileInfo> File::query_filesystem_info(const std::string& attributes, std::auto_ptr<Glib::Error>& error)
379 #endif //GLIBMM_EXCEPTIONS_ENABLED
380 {
381   GError* gerror = 0;
382   Glib::RefPtr<FileInfo> retvalue = Glib::wrap(g_file_query_filesystem_info(gobj(), attributes.c_str(), NULL, &(gerror)));
383 #ifdef GLIBMM_EXCEPTIONS_ENABLED
384   if(gerror)
385     ::Glib::Error::throw_exception(gerror);
386 #else
387   if(gerror)
388     error = ::Glib::Error::throw_exception(gerror);
389 #endif //GLIBMM_EXCEPTIONS_ENABLED
390
391   return retvalue;
392 }
393
394 void
395 File::query_filesystem_info_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, int io_priority) const
396 {
397   // Create a copy of the slot.
398   // A pointer to it will be passed through the callback's data parameter
399   // and deleted in the callback.
400   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
401
402   g_file_query_filesystem_info_async(const_cast<GFile*>(gobj()),
403                           attributes.c_str(),
404                           io_priority,
405                           cancellable->gobj(),
406                           &SignalProxy_async_callback,
407                           slot_copy);
408 }
409
410 void
411 File::query_filesystem_info_async(const SlotAsyncReady& slot, const std::string& attributes, int io_priority) const
412 {
413   // Create a copy of the slot.
414   // A pointer to it will be passed through the callback's data parameter
415   // and deleted in the callback.
416   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
417
418   g_file_query_filesystem_info_async(const_cast<GFile*>(gobj()),
419                           attributes.c_str(),
420                           io_priority,
421                           NULL, // cancellable
422                           &SignalProxy_async_callback,
423                           slot_copy);
424 }
425
426 #ifdef GLIBMM_EXCEPTIONS_ENABLED
427 Glib::RefPtr<FileEnumerator> File::enumerate_children(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, FileQueryInfoFlags flags)
428 #else
429 Glib::RefPtr<FileEnumerator> File::enumerate_children(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, FileQueryInfoFlags flags, std::auto_ptr<Glib::Error>& error)
430 #endif //GLIBMM_EXCEPTIONS_ENABLED
431 {
432   GError* gerror = 0;
433   Glib::RefPtr<FileEnumerator> retvalue = Glib::wrap(g_file_enumerate_children(gobj(), attributes.c_str(), ((GFileQueryInfoFlags)(flags)), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
434 #ifdef GLIBMM_EXCEPTIONS_ENABLED
435   if(gerror)
436     ::Glib::Error::throw_exception(gerror);
437 #else
438   if(gerror)
439     error = ::Glib::Error::throw_exception(gerror);
440 #endif //GLIBMM_EXCEPTIONS_ENABLED
441
442   return retvalue;
443 }
444
445 #ifdef GLIBMM_EXCEPTIONS_ENABLED
446 Glib::RefPtr<FileEnumerator> File::enumerate_children(const std::string& attributes, FileQueryInfoFlags flags)
447 #else
448 Glib::RefPtr<FileEnumerator> File::enumerate_children(const std::string& attributes, FileQueryInfoFlags flags, std::auto_ptr<Glib::Error>& error)
449 #endif //GLIBMM_EXCEPTIONS_ENABLED
450 {
451   GError* gerror = 0;
452   Glib::RefPtr<FileEnumerator> retvalue = Glib::wrap(g_file_enumerate_children(gobj(), attributes.c_str(), ((GFileQueryInfoFlags)(flags)), NULL, &(gerror)));
453 #ifdef GLIBMM_EXCEPTIONS_ENABLED
454   if(gerror)
455     ::Glib::Error::throw_exception(gerror);
456 #else
457   if(gerror)
458     error = ::Glib::Error::throw_exception(gerror);
459 #endif //GLIBMM_EXCEPTIONS_ENABLED
460
461   return retvalue;
462 }
463
464 void
465 File::enumerate_children_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, FileQueryInfoFlags flags, int io_priority)
466 {
467   // Create a copy of the slot.
468   // A pointer to it will be passed through the callback's data parameter
469   // and deleted in the callback.
470   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
471
472   g_file_enumerate_children_async(gobj(),
473                                   attributes.c_str(),
474                                   static_cast<GFileQueryInfoFlags>(flags),
475                                   io_priority,
476                                   cancellable->gobj(),
477                                   &SignalProxy_async_callback,
478                                   slot_copy);
479 }
480
481 void
482 File::enumerate_children_async(const SlotAsyncReady& slot, const std::string& attributes, FileQueryInfoFlags flags, int io_priority)
483 {
484   // Create a copy of the slot.
485   // A pointer to it will be passed through the callback's data parameter
486   // and deleted in the callback.
487   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
488
489   g_file_enumerate_children_async(gobj(),
490                                   attributes.c_str(),
491                                   static_cast<GFileQueryInfoFlags>(flags),
492                                   io_priority,
493                                   NULL,
494                                   &SignalProxy_async_callback,
495                                   slot_copy);
496 }
497
498 #ifdef GLIBMM_EXCEPTIONS_ENABLED
499 Glib::RefPtr<File> File::set_display_name(const Glib::ustring& display_name)
500 #else
501 Glib::RefPtr<File> File::set_display_name(const Glib::ustring& display_name, std::auto_ptr<Glib::Error>& error)
502 #endif //GLIBMM_EXCEPTIONS_ENABLED
503 {
504   GError* gerror = 0;
505   Glib::RefPtr<File> retvalue = Glib::wrap(g_file_set_display_name(gobj(), display_name.c_str(), NULL, &(gerror)));
506 #ifdef GLIBMM_EXCEPTIONS_ENABLED
507   if(gerror)
508     ::Glib::Error::throw_exception(gerror);
509 #else
510   if(gerror)
511     error = ::Glib::Error::throw_exception(gerror);
512 #endif //GLIBMM_EXCEPTIONS_ENABLED
513
514   return retvalue;
515
516 }
517
518 void
519 File::set_display_name_async(const Glib::ustring& display_name, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority)
520 {
521   // Create a copy of the slot.
522   // A pointer to it will be passed through the callback's data parameter
523   // and deleted in the callback.
524   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
525
526   g_file_set_display_name_async(gobj(),
527                                 display_name.c_str(),
528                                 io_priority,
529                                 cancellable->gobj(),
530                                 &SignalProxy_async_callback,
531                                 slot_copy);
532 }
533
534 void
535 File::set_display_name_async(const Glib::ustring& display_name, const SlotAsyncReady& slot, int io_priority)
536 {
537   // Create a copy of the slot.
538   // A pointer to it will be passed through the callback's data parameter
539   // and deleted in the callback.
540   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
541
542   g_file_set_display_name_async(gobj(),
543                                 display_name.c_str(),
544                                 io_priority,
545                                 NULL,
546                                 &SignalProxy_async_callback,
547                                 slot_copy);
548 }
549
550 #ifdef GLIBMM_EXCEPTIONS_ENABLED
551 bool
552 File::copy(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot, const Glib::RefPtr<Cancellable>& cancellable, FileCopyFlags flags)
553 #else
554 bool
555 File::copy(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot, const Glib::RefPtr<Cancellable>& cancellable, FileCopyFlags flags, std::auto_ptr<Glib::Error>& error)
556 #endif // GLIBMM_EXCEPTIONS_ENABLED
557 {
558   GError* gerror = 0;
559   bool res;
560
561   // Create a copy of the slot.
562   // A pointer to it will be passed through the callback's data parameter
563   // and deleted in the callback.
564   SlotFileProgress* slot_copy = new SlotFileProgress(slot);
565
566   res = g_file_copy(gobj(),
567                     destination->gobj(),
568                     static_cast<GFileCopyFlags>(flags),
569                     cancellable->gobj(),
570                     &SignalProxy_file_progress_callback,
571                     slot_copy,
572                     &gerror);
573
574 #ifdef GLIBMM_EXCEPTIONS_ENABLED
575   if (gerror)
576     ::Glib::Error::throw_exception(gerror);
577 #else
578   if (gerror)
579     error = ::Glib::Error::throw_exception(gerror);
580 #endif //GLIBMM_EXCEPTIONS_ENABLED
581
582   return res;
583 }
584
585 #ifdef GLIBMM_EXCEPTIONS_ENABLED
586 bool
587 File::copy(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot, FileCopyFlags flags)
588 #else
589 bool
590 File::copy(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot, FileCopyFlags flags, std::auto_ptr<Glib::Error>& error)
591 #endif // GLIBMM_EXCEPTIONS_ENABLED
592 {
593   GError* gerror = 0;
594   bool res;
595
596   // Create a copy of the slot.
597   // A pointer to it will be passed through the callback's data parameter
598   // and deleted in the callback.
599   SlotFileProgress* slot_copy = new SlotFileProgress(slot);
600
601   res = g_file_copy(gobj(),
602                     destination->gobj(),
603                     static_cast<GFileCopyFlags>(flags),
604                     NULL,
605                     &SignalProxy_file_progress_callback,
606                     slot_copy,
607                     &gerror);
608
609 #ifdef GLIBMM_EXCEPTIONS_ENABLED
610   if (gerror)
611     ::Glib::Error::throw_exception(gerror);
612 #else
613   if (gerror)
614     error = ::Glib::Error::throw_exception(gerror);
615 #endif //GLIBMM_EXCEPTIONS_ENABLED
616
617   return res;
618 }
619
620 #ifdef GLIBMM_EXCEPTIONS_ENABLED
621 bool
622 File::copy(const Glib::RefPtr<File>& destination, FileCopyFlags flags)
623 #else
624 bool
625 File::copy(const Glib::RefPtr<File>& destination, FileCopyFlags flags, std::auto_ptr<Glib::Error>& error)
626 #endif // GLIBMM_EXCEPTIONS_ENABLED
627 {
628   GError* gerror = 0;
629   bool res = g_file_copy(gobj(),
630                     destination->gobj(),
631                     static_cast<GFileCopyFlags>(flags),
632                     NULL,
633                     NULL,
634                     NULL,
635                     &gerror);
636
637 #ifdef GLIBMM_EXCEPTIONS_ENABLED
638   if (gerror)
639     ::Glib::Error::throw_exception(gerror);
640 #else
641   if (gerror)
642     error = ::Glib::Error::throw_exception(gerror);
643 #endif //GLIBMM_EXCEPTIONS_ENABLED
644
645   return res;
646 }
647
648 void
649 File::copy_async(const Glib::RefPtr<File>& destination,
650                  const SlotFileProgress& slot_progress,
651                  const SlotAsyncReady& slot_ready,
652                  const Glib::RefPtr<Cancellable>& cancellable,
653                  FileCopyFlags flags,
654                  int io_priority)
655 {
656   // Create copies of slots.
657   // Pointers to them will be passed through the callbacks' data parameter
658   // and deleted in the corresponding callback.
659   SlotAsyncReady* slot_ready_copy = new SlotAsyncReady(slot_ready);
660   SlotFileProgress* slot_progress_copy = new SlotFileProgress(slot_progress);
661
662   g_file_copy_async(gobj(),
663                     destination->gobj(),
664                     static_cast<GFileCopyFlags>(flags),
665                     io_priority,
666                     cancellable->gobj(),
667                     &SignalProxy_file_progress_callback,
668                     slot_progress_copy,
669                     &SignalProxy_async_callback,
670                     slot_ready_copy);
671 }
672
673 void
674 File::copy_async(const Glib::RefPtr<File>& destination,
675                  const SlotAsyncReady& slot_ready,
676                  const Glib::RefPtr<Cancellable>& cancellable,
677                  FileCopyFlags flags,
678                  int io_priority)
679 {
680   // Create copies of slots.
681   // Pointers to them will be passed through the callbacks' data parameter
682   // and deleted in the corresponding callback.
683   SlotAsyncReady* slot_ready_copy = new SlotAsyncReady(slot_ready);
684
685   g_file_copy_async(gobj(),
686                     destination->gobj(),
687                     static_cast<GFileCopyFlags>(flags),
688                     io_priority,
689                     cancellable->gobj(),
690                     NULL,
691                     NULL,
692                     &SignalProxy_async_callback,
693                     slot_ready_copy);
694 }
695
696 void
697 File::copy_async(const Glib::RefPtr<File>& destination,
698                  const SlotFileProgress& slot_progress,
699                  const SlotAsyncReady& slot_ready,
700                  FileCopyFlags flags,
701                  int io_priority)
702 {
703   // Create copies of slots.
704   // Pointers to them will be passed through the callbacks' data parameter
705   // and deleted in the corresponding callback.
706   SlotAsyncReady* slot_ready_copy = new SlotAsyncReady(slot_ready);
707   SlotFileProgress* slot_progress_copy = new SlotFileProgress(slot_progress);
708
709   g_file_copy_async(gobj(),
710                     destination->gobj(),
711                     static_cast<GFileCopyFlags>(flags),
712                     io_priority,
713                     NULL,
714                     &SignalProxy_file_progress_callback,
715                     slot_progress_copy,
716                     &SignalProxy_async_callback,
717                     slot_ready_copy);
718 }
719
720 void
721 File::copy_async(const Glib::RefPtr<File>& destination,
722                  const SlotAsyncReady& slot_ready,
723                  FileCopyFlags flags,
724                  int io_priority)
725 {
726   // Create copies of slots.
727   // Pointers to them will be passed through the callbacks' data parameter
728   // and deleted in the corresponding callback.
729   SlotAsyncReady* slot_ready_copy = new SlotAsyncReady(slot_ready);
730
731   g_file_copy_async(gobj(),
732                     destination->gobj(),
733                     static_cast<GFileCopyFlags>(flags),
734                     io_priority,
735                     NULL,
736                     NULL,
737                     NULL,
738                     &SignalProxy_async_callback,
739                     slot_ready_copy);
740 }
741
742 #ifdef GLIBMM_EXCEPTIONS_ENABLED
743 bool
744 File::move(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot, const Glib::RefPtr<Cancellable>& cancellable, FileCopyFlags flags)
745 #else
746 bool
747 File::move(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot, const Glib::RefPtr<Cancellable>& cancellable, FileCopyFlags flags, std::auto_ptr<Glib::Error>& error)
748 #endif // GLIBMM_EXCEPTIONS_ENABLED
749 {
750   GError* gerror = 0;
751   bool res;
752
753   // Create a move of the slot.
754   // A pointer to it will be passed through the callback's data parameter
755   // and deleted in the callback.
756   SlotFileProgress* slot_copy = new SlotFileProgress(slot);
757
758   res = g_file_move(gobj(),
759                     destination->gobj(),
760                     static_cast<GFileCopyFlags>(flags),
761                     cancellable->gobj(),
762                     &SignalProxy_file_progress_callback,
763                     slot_copy,
764                     &gerror);
765
766 #ifdef GLIBMM_EXCEPTIONS_ENABLED
767   if (gerror)
768     ::Glib::Error::throw_exception(gerror);
769 #else
770   if (gerror)
771     error = ::Glib::Error::throw_exception(gerror);
772 #endif //GLIBMM_EXCEPTIONS_ENABLED
773
774   return res;
775 }
776
777 #ifdef GLIBMM_EXCEPTIONS_ENABLED
778 bool
779 File::move(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot, FileCopyFlags flags)
780 #else
781 bool
782 File::move(const Glib::RefPtr<File>& destination, const SlotFileProgress& slot, FileCopyFlags flags, std::auto_ptr<Glib::Error>& error)
783 #endif // GLIBMM_EXCEPTIONS_ENABLED
784 {
785   GError* gerror = 0;
786   bool res;
787
788   // Create a move of the slot.
789   // A pointer to it will be passed through the callback's data parameter
790   // and deleted in the callback.
791   SlotFileProgress* slot_copy = new SlotFileProgress(slot);
792
793   res = g_file_move(gobj(),
794                     destination->gobj(),
795                     static_cast<GFileCopyFlags>(flags),
796                     NULL,
797                     &SignalProxy_file_progress_callback,
798                     slot_copy,
799                     &gerror);
800
801 #ifdef GLIBMM_EXCEPTIONS_ENABLED
802   if (gerror)
803     ::Glib::Error::throw_exception(gerror);
804 #else
805   if (gerror)
806     error = ::Glib::Error::throw_exception(gerror);
807 #endif //GLIBMM_EXCEPTIONS_ENABLED
808
809   return res;
810 }
811
812 #ifdef GLIBMM_EXCEPTIONS_ENABLED
813 bool
814 File::move(const Glib::RefPtr<File>& destination, FileCopyFlags flags)
815 #else
816 bool
817 File::move(const Glib::RefPtr<File>& destination, FileCopyFlags flags, std::auto_ptr<Glib::Error>& error)
818 #endif // GLIBMM_EXCEPTIONS_ENABLED
819 {
820   GError* gerror = 0;
821   bool res;
822
823   res = g_file_move(gobj(),
824                     destination->gobj(),
825                     static_cast<GFileCopyFlags>(flags),
826                     NULL,
827                     NULL,
828                     NULL,
829                     &gerror);
830
831 #ifdef GLIBMM_EXCEPTIONS_ENABLED
832   if (gerror)
833     ::Glib::Error::throw_exception(gerror);
834 #else
835   if (gerror)
836     error = ::Glib::Error::throw_exception(gerror);
837 #endif //GLIBMM_EXCEPTIONS_ENABLED
838
839   return res;
840 }
841
842 void
843 File::set_attributes_async(const Glib::RefPtr<FileInfo>& info, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, FileQueryInfoFlags flags, int io_priority)
844 {
845   // Create a copy of the slot.
846   // A pointer to it will be passed through the callback's data parameter
847   // and deleted in the callback.
848   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
849
850   g_file_set_attributes_async(gobj(),
851                               info->gobj(),
852                               static_cast<GFileQueryInfoFlags>(flags),
853                               io_priority,
854                               cancellable->gobj(),
855                               &SignalProxy_async_callback,
856                               slot_copy);
857 }
858
859 void
860 File::set_attributes_async(const Glib::RefPtr<FileInfo>& info, const SlotAsyncReady& slot, FileQueryInfoFlags flags, int io_priority)
861 {
862   // Create a copy of the slot.
863   // A pointer to it will be passed through the callback's data parameter
864   // and deleted in the callback.
865   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
866
867   g_file_set_attributes_async(gobj(),
868                               info->gobj(),
869                               static_cast<GFileQueryInfoFlags>(flags),
870                               io_priority,
871                               NULL,
872                               &SignalProxy_async_callback,
873                               slot_copy);
874 }
875
876 #ifdef GLIBMM_EXCEPTIONS_ENABLED
877 bool
878 File::set_attributes_finish(const Glib::RefPtr<AsyncResult>& result,
879                             const Glib::RefPtr<FileInfo>& info)
880 #else
881 bool
882 File::set_attributes_finish(const Glib::RefPtr<AsyncResult>& result,
883                             const Glib::RefPtr<FileInfo>& info,
884                             std::auto_ptr<Glib::Error>& error)
885 #endif // GLIBMM_EXCEPTIONS_ENABLED
886 {
887   GError* gerror = 0;
888   GFileInfo* cinfo = info->gobj();
889   bool res;
890
891   res = g_file_set_attributes_finish(gobj(),
892                                      result->gobj(),
893                                      &cinfo,
894                                      &gerror);
895
896 #ifdef GLIBMM_EXCEPTIONS_ENABLED
897   if (gerror)
898     ::Glib::Error::throw_exception(gerror);
899 #else
900   if (gerror)
901     error = ::Glib::Error::throw_exception(gerror);
902 #endif //GLIBMM_EXCEPTIONS_ENABLED
903
904   return res;
905 }
906
907 #ifdef GLIBMM_EXCEPTIONS_ENABLED
908 bool File::set_attribute_string(const std::string& attribute, const std::string& value, FileQueryInfoFlags flags)
909 #else
910 bool File::set_attribute_string(const std::string& attribute, const std::string& value, FileQueryInfoFlags flags, std::auto_ptr<Glib::Error>& error)
911 #endif //GLIBMM_EXCEPTIONS_ENABLED
912 {
913   GError* gerror = 0;
914   bool retvalue = g_file_set_attribute_string(gobj(), attribute.c_str(), value.c_str(), ((GFileQueryInfoFlags)(flags)), NULL, &(gerror));
915 #ifdef GLIBMM_EXCEPTIONS_ENABLED
916   if(gerror)
917     ::Glib::Error::throw_exception(gerror);
918 #else
919   if(gerror)
920     error = ::Glib::Error::throw_exception(gerror);
921 #endif //GLIBMM_EXCEPTIONS_ENABLED
922
923   return retvalue;
924
925 }
926
927 #ifdef GLIBMM_EXCEPTIONS_ENABLED
928 bool File::set_attribute_byte_string(const std::string& attribute, const std::string& value, FileQueryInfoFlags flags)
929 #else
930 bool File::set_attribute_byte_string(const std::string& attribute, const std::string& value, FileQueryInfoFlags flags, std::auto_ptr<Glib::Error>& error)
931 #endif //GLIBMM_EXCEPTIONS_ENABLED
932 {
933   GError* gerror = 0;
934   bool retvalue = g_file_set_attribute_byte_string(gobj(), attribute.c_str(), value.c_str(), ((GFileQueryInfoFlags)(flags)), NULL, &(gerror));
935 #ifdef GLIBMM_EXCEPTIONS_ENABLED
936   if(gerror)
937     ::Glib::Error::throw_exception(gerror);
938 #else
939   if(gerror)
940     error = ::Glib::Error::throw_exception(gerror);
941 #endif //GLIBMM_EXCEPTIONS_ENABLED
942
943   return retvalue;
944
945 }
946
947 #ifdef GLIBMM_EXCEPTIONS_ENABLED
948 bool File::set_attribute_uint32(const std::string& attribute, guint32 value, FileQueryInfoFlags flags)
949 #else
950 bool File::set_attribute_uint32(const std::string& attribute, guint32 value, FileQueryInfoFlags flags, std::auto_ptr<Glib::Error>& error)
951 #endif //GLIBMM_EXCEPTIONS_ENABLED
952 {
953   GError* gerror = 0;
954   bool retvalue = g_file_set_attribute_uint32(gobj(), attribute.c_str(), value, ((GFileQueryInfoFlags)(flags)), NULL, &(gerror));
955 #ifdef GLIBMM_EXCEPTIONS_ENABLED
956   if(gerror)
957     ::Glib::Error::throw_exception(gerror);
958 #else
959   if(gerror)
960     error = ::Glib::Error::throw_exception(gerror);
961 #endif //GLIBMM_EXCEPTIONS_ENABLED
962
963   return retvalue;
964
965 }
966
967 #ifdef GLIBMM_EXCEPTIONS_ENABLED
968 bool File::set_attribute_int32(const std::string& attribute, gint32 value, FileQueryInfoFlags flags)
969 #else
970 bool File::set_attribute_int32(const std::string& attribute, gint32 value, FileQueryInfoFlags flags, std::auto_ptr<Glib::Error>& error)
971 #endif //GLIBMM_EXCEPTIONS_ENABLED
972 {
973   GError* gerror = 0;
974   bool retvalue = g_file_set_attribute_int32(gobj(), attribute.c_str(), value, ((GFileQueryInfoFlags)(flags)), NULL, &(gerror));
975 #ifdef GLIBMM_EXCEPTIONS_ENABLED
976   if(gerror)
977     ::Glib::Error::throw_exception(gerror);
978 #else
979   if(gerror)
980     error = ::Glib::Error::throw_exception(gerror);
981 #endif //GLIBMM_EXCEPTIONS_ENABLED
982
983   return retvalue;
984
985 }
986
987 #ifdef GLIBMM_EXCEPTIONS_ENABLED
988 bool File::set_attribute_uint64(const std::string& attribute, guint64 value, FileQueryInfoFlags flags)
989 #else
990 bool File::set_attribute_uint64(const std::string& attribute, guint64 value, FileQueryInfoFlags flags, std::auto_ptr<Glib::Error>& error)
991 #endif //GLIBMM_EXCEPTIONS_ENABLED
992 {
993   GError* gerror = 0;
994   bool retvalue = g_file_set_attribute_uint64(gobj(), attribute.c_str(), value, ((GFileQueryInfoFlags)(flags)), NULL, &(gerror));
995 #ifdef GLIBMM_EXCEPTIONS_ENABLED
996   if(gerror)
997     ::Glib::Error::throw_exception(gerror);
998 #else
999   if(gerror)
1000     error = ::Glib::Error::throw_exception(gerror);
1001 #endif //GLIBMM_EXCEPTIONS_ENABLED
1002
1003   return retvalue;
1004
1005 }
1006
1007 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1008 bool File::set_attribute_int64(const std::string& attribute, gint64 value, FileQueryInfoFlags flags)
1009 #else
1010 bool File::set_attribute_int64(const std::string& attribute, gint64 value, FileQueryInfoFlags flags, std::auto_ptr<Glib::Error>& error)
1011 #endif //GLIBMM_EXCEPTIONS_ENABLED
1012 {
1013   GError* gerror = 0;
1014   bool retvalue = g_file_set_attribute_int64(gobj(), attribute.c_str(), value, ((GFileQueryInfoFlags)(flags)), NULL, &(gerror));
1015 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1016   if(gerror)
1017     ::Glib::Error::throw_exception(gerror);
1018 #else
1019   if(gerror)
1020     error = ::Glib::Error::throw_exception(gerror);
1021 #endif //GLIBMM_EXCEPTIONS_ENABLED
1022
1023   return retvalue;
1024
1025 }
1026
1027 void File::mount_mountable(const Glib::RefPtr<MountOperation>& mount_operation, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountMountFlags flags)
1028 {
1029   // Create a copy of the slot.
1030   // A pointer to it will be passed through the callback's data parameter
1031   // and deleted in the callback.
1032   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
1033
1034   g_file_mount_mountable(gobj(),
1035                          static_cast<GMountMountFlags>(flags),
1036                          mount_operation->gobj(),
1037                          cancellable->gobj(),
1038                          &SignalProxy_async_callback,
1039                          slot_copy);
1040 }
1041
1042 void File::mount_mountable(const Glib::RefPtr<MountOperation>& mount_operation, const SlotAsyncReady& slot, MountMountFlags flags)
1043 {
1044   // Create a copy of the slot.
1045   // A pointer to it will be passed through the callback's data parameter
1046   // and deleted in the callback.
1047   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
1048
1049   g_file_mount_mountable(gobj(),
1050                          static_cast<GMountMountFlags>(flags),
1051                          mount_operation->gobj(),
1052                          NULL,
1053                          &SignalProxy_async_callback,
1054                          slot_copy);
1055 }
1056
1057 void File::mount_mountable(const SlotAsyncReady& slot, MountMountFlags flags)
1058 {
1059   // Create a copy of the slot.
1060   // A pointer to it will be passed through the callback's data parameter
1061   // and deleted in the callback.
1062   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
1063
1064   g_file_mount_mountable(gobj(),
1065                          static_cast<GMountMountFlags>(flags),
1066                          NULL,
1067                          NULL,
1068                          &SignalProxy_async_callback,
1069                          slot_copy);
1070 }
1071
1072 void File::mount_mountable(MountMountFlags flags)
1073 {
1074   g_file_mount_mountable(gobj(),
1075                          static_cast<GMountMountFlags>(flags),
1076                          NULL,
1077                          NULL,
1078                          NULL,
1079                          NULL);
1080 }
1081
1082 void File::unmount_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags)
1083 {
1084   // Create a copy of the slot.
1085   // A pointer to it will be passed through the callback's data parameter
1086   // and deleted in the callback.
1087   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
1088
1089   g_file_unmount_mountable(gobj(),
1090                            static_cast<GMountUnmountFlags>(flags), 
1091                            cancellable->gobj(),
1092                            &SignalProxy_async_callback,
1093                            slot_copy);
1094 }
1095
1096 void
1097 File::unmount_mountable(const SlotAsyncReady& slot, MountUnmountFlags flags)
1098 {
1099   // Create a copy of the slot.
1100   // A pointer to it will be passed through the callback's data parameter
1101   // and deleted in the callback.
1102   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
1103
1104   g_file_unmount_mountable(gobj(),
1105                            static_cast<GMountUnmountFlags>(flags), 
1106                            NULL,
1107                            &SignalProxy_async_callback,
1108                            slot_copy);
1109 }
1110
1111 void
1112 File::unmount_mountable(MountUnmountFlags flags)
1113 {
1114   g_file_unmount_mountable(gobj(),
1115                            static_cast<GMountUnmountFlags>(flags), 
1116                            NULL,
1117                            NULL,
1118                            NULL);
1119 }
1120
1121 void File::mount_enclosing_volume(const Glib::RefPtr<MountOperation>& mount_operation, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountMountFlags flags)
1122 {
1123   // Create a copy of the slot.
1124   // A pointer to it will be passed through the callback's data parameter
1125   // and deleted in the callback.
1126   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
1127
1128   g_file_mount_enclosing_volume(gobj(),
1129                          static_cast<GMountMountFlags>(flags),
1130                          mount_operation->gobj(),
1131                          cancellable->gobj(),
1132                          &SignalProxy_async_callback,
1133                          slot_copy);
1134 }
1135
1136 void File::mount_enclosing_volume(const Glib::RefPtr<MountOperation>& mount_operation, const SlotAsyncReady& slot, MountMountFlags flags)
1137 {
1138   // Create a copy of the slot.
1139   // A pointer to it will be passed through the callback's data parameter
1140   // and deleted in the callback.
1141   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
1142
1143   g_file_mount_enclosing_volume(gobj(),
1144                          static_cast<GMountMountFlags>(flags),
1145                          mount_operation->gobj(),
1146                          NULL,
1147                          &SignalProxy_async_callback,
1148                          slot_copy);
1149 }
1150
1151 void File::mount_enclosing_volume(const SlotAsyncReady& slot, MountMountFlags flags)
1152 {
1153   // Create a copy of the slot.
1154   // A pointer to it will be passed through the callback's data parameter
1155   // and deleted in the callback.
1156   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
1157
1158   g_file_mount_enclosing_volume(gobj(),
1159                          static_cast<GMountMountFlags>(flags),
1160                          NULL,
1161                          NULL,
1162                          &SignalProxy_async_callback,
1163                          slot_copy);
1164 }
1165
1166 void File::mount_enclosing_volume(MountMountFlags flags)
1167 {
1168   g_file_mount_enclosing_volume(gobj(),
1169                          static_cast<GMountMountFlags>(flags),
1170                          NULL,
1171                          NULL,
1172                          NULL,
1173                          NULL);
1174 }
1175
1176 void
1177 File::eject_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags)
1178 {
1179   // Create a copy of the slot.
1180   // A pointer to it will be passed through the callback's data parameter
1181   // and deleted in the callback.
1182   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
1183
1184   g_file_eject_mountable(gobj(),
1185                          static_cast<GMountUnmountFlags>(flags), 
1186                          cancellable->gobj(),
1187                          &SignalProxy_async_callback,
1188                          slot_copy);
1189 }
1190
1191 void
1192 File::eject_mountable(const SlotAsyncReady& slot, MountUnmountFlags flags)
1193 {
1194   // Create a copy of the slot.
1195   // A pointer to it will be passed through the callback's data parameter
1196   // and deleted in the callback.
1197   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
1198
1199   g_file_eject_mountable(gobj(),
1200                          static_cast<GMountUnmountFlags>(flags), 
1201                          NULL,
1202                          &SignalProxy_async_callback,
1203                          slot_copy);
1204 }
1205
1206 void
1207 File::eject_mountable(MountUnmountFlags flags)
1208 {
1209   g_file_eject_mountable(gobj(),
1210                          static_cast<GMountUnmountFlags>(flags), 
1211                          NULL,
1212                          NULL,
1213                          NULL);
1214 }
1215
1216 void
1217 File::load_contents_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable)
1218 {
1219   // Create a copy of the slot.
1220   // A pointer to it will be passed through the callback's data parameter
1221   // and deleted in the callback.
1222   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
1223
1224   g_file_load_contents_async(gobj(),
1225                              cancellable->gobj(),
1226                              &SignalProxy_async_callback,
1227                              slot_copy);
1228 }
1229
1230 void
1231 File::load_contents_async(const SlotAsyncReady& slot)
1232 {
1233   // Create a copy of the slot.
1234   // A pointer to it will be passed through the callback's data parameter
1235   // and deleted in the callback.
1236   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
1237
1238   g_file_load_contents_async(gobj(),
1239                              NULL,
1240                              &SignalProxy_async_callback,
1241                              slot_copy);
1242 }
1243
1244 void
1245 File::load_partial_contents_async(const SlotReadMore& slot_read_more, const SlotAsyncReady& slot_async_ready, const Glib::RefPtr<Cancellable>& cancellable)
1246 {
1247   // Create a new pair which will hold copies of passed slots.
1248   // This will be deleted in the SignalProxy_load_partial_contents_ready_callback() callback
1249   LoadPartialSlots* slots = new LoadPartialSlots();
1250   SlotReadMore* slot_read_more_copy = new SlotReadMore(slot_read_more);
1251   SlotAsyncReady* slot_async_copy = new SlotAsyncReady(slot_async_ready);
1252
1253   slots->first = slot_read_more_copy;
1254   slots->second = slot_async_copy;
1255
1256   g_file_load_partial_contents_async(gobj(),
1257                                      cancellable->gobj(),
1258                                      &SignalProxy_load_partial_contents_read_more_callback,
1259                                      &SignalProxy_load_partial_contents_ready_callback,
1260                                      slots);
1261 }
1262
1263 void
1264 File::load_partial_contents_async(const SlotReadMore& slot_read_more,
1265                                   const SlotAsyncReady& slot_async_ready)
1266 {
1267   // Create a new pair which will hold copies of passed slots.
1268   // This will be deleted in the SignalProxy_load_partial_contents_ready_callback() callback
1269   LoadPartialSlots* slots = new LoadPartialSlots();
1270   SlotReadMore* slot_read_more_copy = new SlotReadMore(slot_read_more);
1271   SlotAsyncReady* slot_async_copy = new SlotAsyncReady(slot_async_ready);
1272
1273   slots->first = slot_read_more_copy;
1274   slots->second = slot_async_copy;
1275
1276   g_file_load_partial_contents_async(gobj(),
1277                                      NULL,
1278                                      &SignalProxy_load_partial_contents_read_more_callback,
1279                                      &SignalProxy_load_partial_contents_ready_callback,
1280                                      slots);
1281 }
1282
1283 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1284 void File::replace_contents(const char* contents, gsize length, const std::string& etag, std::string& new_etag, const Glib::RefPtr<Cancellable>& cancellable, bool make_backup, FileCreateFlags flags)
1285 #else
1286 void File::replace_contents(const char* contents, gsize length, const std::string& etag, std::string& new_etag, const Glib::RefPtr<Cancellable>& cancellable, bool make_backup, FileCreateFlags flags, std::auto_ptr<Glib::Error>& error)
1287 #endif //GLIBMM_EXCEPTIONS_ENABLED
1288 {
1289   GError* gerror = 0;
1290   gchar* c_etag_new = 0;
1291   g_file_replace_contents(gobj(), contents, length, etag.empty() ? NULL : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), &c_etag_new, const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror));
1292 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1293   if(gerror)
1294     ::Glib::Error::throw_exception(gerror);
1295 #else
1296   if(gerror)
1297     error = ::Glib::Error::throw_exception(gerror);
1298 #endif //GLIBMM_EXCEPTIONS_ENABLED
1299
1300   if(c_etag_new)
1301     new_etag = c_etag_new;
1302   else
1303     new_etag = std::string();
1304 }
1305
1306 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1307 void File::replace_contents(const char* contents, gsize length, const std::string& etag, std::string& new_etag, bool make_backup, FileCreateFlags flags)
1308 #else
1309 void File::replace_contents(const char* contents, gsize length, const std::string& etag, std::string& new_etag, bool make_backup, FileCreateFlags flags, std::auto_ptr<Glib::Error>& error)
1310 #endif //GLIBMM_EXCEPTIONS_ENABLED
1311 {
1312   GError* gerror = 0;
1313   gchar* c_etag_new = 0;
1314   g_file_replace_contents(gobj(), contents, length, etag.empty() ? NULL : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), &c_etag_new, NULL, &(gerror));
1315 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1316   if(gerror)
1317     ::Glib::Error::throw_exception(gerror);
1318 #else
1319   if(gerror)
1320     error = ::Glib::Error::throw_exception(gerror);
1321 #endif //GLIBMM_EXCEPTIONS_ENABLED
1322
1323   if(c_etag_new)
1324     new_etag = c_etag_new;
1325   else
1326     new_etag = std::string();
1327 }
1328
1329 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1330 void File::replace_contents(const std::string& contents, const std::string& etag, std::string& new_etag, const Glib::RefPtr<Cancellable>& cancellable, bool make_backup, FileCreateFlags flags)
1331 #else
1332 void File::replace_contents(const std::string& contents, const std::string& etag, std::string& new_etag, const Glib::RefPtr<Cancellable>& cancellable, bool make_backup, FileCreateFlags flags, std::auto_ptr<Glib::Error>& error)
1333 #endif //GLIBMM_EXCEPTIONS_ENABLED
1334 {
1335   GError* gerror = 0;
1336   gchar* c_etag_new = 0;
1337   g_file_replace_contents(gobj(), contents.c_str(), contents.size(), etag.empty() ? NULL : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), &c_etag_new, const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror));
1338 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1339   if(gerror)
1340     ::Glib::Error::throw_exception(gerror);
1341 #else
1342   if(gerror)
1343     error = ::Glib::Error::throw_exception(gerror);
1344 #endif //GLIBMM_EXCEPTIONS_ENABLED
1345
1346   if(c_etag_new)
1347     new_etag = c_etag_new;
1348   else
1349     new_etag = std::string();
1350 }
1351
1352 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1353 void File::replace_contents(const std::string& contents, const std::string& etag, std::string& new_etag, bool make_backup, FileCreateFlags flags)
1354 #else
1355 void File::replace_contents(const std::string& contents, const std::string& etag, std::string& new_etag, bool make_backup, FileCreateFlags flags, std::auto_ptr<Glib::Error>& error)
1356 #endif //GLIBMM_EXCEPTIONS_ENABLED
1357 {
1358   GError* gerror = 0;
1359   gchar* c_etag_new = 0;
1360   g_file_replace_contents(gobj(), contents.c_str(), contents.size(), etag.empty() ? NULL : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), &c_etag_new, NULL, &(gerror));
1361 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1362   if(gerror)
1363     ::Glib::Error::throw_exception(gerror);
1364 #else
1365   if(gerror)
1366     error = ::Glib::Error::throw_exception(gerror);
1367 #endif //GLIBMM_EXCEPTIONS_ENABLED
1368
1369   if(c_etag_new)
1370     new_etag = c_etag_new;
1371   else
1372     new_etag = std::string();
1373 }
1374
1375 void
1376 File::replace_contents_async(const SlotAsyncReady& slot,
1377                              const Glib::RefPtr<Cancellable>& cancellable,
1378                              const char* contents,
1379                              gsize length,
1380                              const std::string& etag,
1381                              bool make_backup,
1382                              FileCreateFlags flags)
1383 {
1384   // Create a copy of the slot.
1385   // A pointer to it will be passed through the callback's data parameter
1386   // and deleted in the callback.
1387   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
1388
1389   g_file_replace_contents_async(gobj(),
1390                                 contents,
1391                                 length,
1392                                 etag.empty() ? NULL : etag.c_str(),
1393                                 make_backup,
1394                                 static_cast<GFileCreateFlags>(flags),
1395                                 cancellable->gobj(),
1396                                 &SignalProxy_async_callback,
1397                                 slot_copy);
1398 }
1399
1400 void
1401 File::replace_contents_async(const SlotAsyncReady& slot,
1402                              const char* contents,
1403                              gsize length,
1404                              const std::string& etag,
1405                              bool make_backup,
1406                              FileCreateFlags flags)
1407 {
1408   // Create a copy of the slot.
1409   // A pointer to it will be passed through the callback's data parameter
1410   // and deleted in the callback.
1411   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
1412
1413   g_file_replace_contents_async(gobj(),
1414                                 contents,
1415                                 length,
1416                                 etag.empty() ? NULL : etag.c_str(),
1417                                 make_backup,
1418                                 static_cast<GFileCreateFlags>(flags),
1419                                 NULL,
1420                                 &SignalProxy_async_callback,
1421                                 slot_copy);
1422 }
1423
1424 void
1425 File::replace_contents_async(const SlotAsyncReady& slot,
1426                              const Glib::RefPtr<Cancellable>& cancellable,
1427                              const std::string& contents,
1428                              const std::string& etag,
1429                              bool make_backup,
1430                              FileCreateFlags flags)
1431 {
1432   // Create a copy of the slot.
1433   // A pointer to it will be passed through the callback's data parameter
1434   // and deleted in the callback.
1435   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
1436
1437   g_file_replace_contents_async(gobj(),
1438                                 contents.c_str(),
1439                                 contents.size(),
1440                                 etag.empty() ? NULL : etag.c_str(),
1441                                 make_backup,
1442                                 static_cast<GFileCreateFlags>(flags),
1443                                 cancellable->gobj(),
1444                                 &SignalProxy_async_callback,
1445                                 slot_copy);
1446 }
1447
1448 void
1449 File::replace_contents_async(const SlotAsyncReady& slot,
1450                              const std::string& contents,
1451                              const std::string& etag,
1452                              bool make_backup,
1453                              FileCreateFlags flags)
1454 {
1455   // Create a copy of the slot.
1456   // A pointer to it will be passed through the callback's data parameter
1457   // and deleted in the callback.
1458   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
1459
1460   g_file_replace_contents_async(gobj(),
1461                                 contents.c_str(),
1462                                 contents.size(),
1463                                 etag.empty() ? NULL : etag.c_str(),
1464                                 make_backup,
1465                                 static_cast<GFileCreateFlags>(flags),
1466                                 NULL,
1467                                 &SignalProxy_async_callback,
1468                                 slot_copy);
1469 }
1470
1471 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1472 void File::replace_contents_finish(const Glib::RefPtr<AsyncResult>& result, std::string& new_etag)
1473 #else
1474 void File::replace_contents_finish(const Glib::RefPtr<AsyncResult>& result, std::string& new_etag, std::auto_ptr<Glib::Error>& error)
1475 #endif //GLIBMM_EXCEPTIONS_ENABLED
1476 {
1477   GError* gerror = 0;
1478   gchar* c_new_etag = 0;
1479   g_file_replace_contents_finish(gobj(), Glib::unwrap(result), &c_new_etag, &(gerror));
1480 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1481   if(gerror)
1482     ::Glib::Error::throw_exception(gerror);
1483 #else
1484   if(gerror)
1485     error = ::Glib::Error::throw_exception(gerror);
1486 #endif //GLIBMM_EXCEPTIONS_ENABLED
1487
1488   if(c_new_etag)
1489     new_etag = c_new_etag;
1490   else
1491    new_etag = std::string();
1492 }
1493
1494
1495 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1496 void File::replace_contents_finish(const Glib::RefPtr<AsyncResult>& result)
1497 #else
1498 void File::replace_contents_finish(const Glib::RefPtr<AsyncResult>& result, std::auto_ptr<Glib::Error>& error)
1499 #endif //GLIBMM_EXCEPTIONS_ENABLED
1500 {
1501   GError* gerror = 0;
1502   g_file_replace_contents_finish(gobj(), Glib::unwrap(result), NULL, &(gerror));
1503 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1504   if(gerror)
1505     ::Glib::Error::throw_exception(gerror);
1506 #else
1507   if(gerror)
1508     error = ::Glib::Error::throw_exception(gerror);
1509 #endif //GLIBMM_EXCEPTIONS_ENABLED
1510 }
1511
1512
1513 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1514 Glib::RefPtr<FileOutputStream> File::replace(const Glib::RefPtr<Cancellable>& cancellable, const std::string& etag, bool make_backup, FileCreateFlags flags)
1515 #else
1516 Glib::RefPtr<FileOutputStream> File::replace(const Glib::RefPtr<Cancellable>& cancellable, const std::string& etag, bool make_backup, FileCreateFlags flags, std::auto_ptr<Glib::Error>& error)
1517 #endif //GLIBMM_EXCEPTIONS_ENABLED
1518 {
1519   GError* gerror = 0;
1520   Glib::RefPtr<FileOutputStream> retvalue = Glib::wrap(g_file_replace(gobj(), etag.empty() ? NULL : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
1521 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1522   if(gerror)
1523     ::Glib::Error::throw_exception(gerror);
1524 #else
1525   if(gerror)
1526     error = ::Glib::Error::throw_exception(gerror);
1527 #endif //GLIBMM_EXCEPTIONS_ENABLED
1528
1529   return retvalue;
1530 }
1531
1532 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1533 Glib::RefPtr<FileOutputStream> File::replace(const std::string& etag, bool make_backup, FileCreateFlags flags)
1534 #else
1535 Glib::RefPtr<FileOutputStream> File::replace(const std::string& etag, bool make_backup, FileCreateFlags flags, std::auto_ptr<Glib::Error>& error)
1536 #endif //GLIBMM_EXCEPTIONS_ENABLED
1537 {
1538   GError* gerror = 0;
1539   Glib::RefPtr<FileOutputStream> retvalue = Glib::wrap(g_file_replace(gobj(), etag.empty() ? NULL : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), NULL, &(gerror)));
1540 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1541   if(gerror)
1542     ::Glib::Error::throw_exception(gerror);
1543 #else
1544   if(gerror)
1545     error = ::Glib::Error::throw_exception(gerror);
1546 #endif //GLIBMM_EXCEPTIONS_ENABLED
1547
1548   return retvalue;
1549 }
1550
1551 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1552 Glib::RefPtr<FileMonitor> File::monitor_directory(const Glib::RefPtr<Cancellable>& cancellable, FileMonitorFlags flags)
1553 #else
1554 Glib::RefPtr<FileMonitor> File::monitor_directory(const Glib::RefPtr<Cancellable>& cancellable, FileMonitorFlags flags, std::auto_ptr<Glib::Error>& error)
1555 #endif //GLIBMM_EXCEPTIONS_ENABLED
1556 {
1557   GError* gerror = 0;
1558   Glib::RefPtr<FileMonitor> retvalue = Glib::wrap(g_file_monitor_directory(gobj(), ((GFileMonitorFlags)(flags)), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
1559 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1560   if(gerror)
1561     ::Glib::Error::throw_exception(gerror);
1562 #else
1563   if(gerror)
1564     error = ::Glib::Error::throw_exception(gerror);
1565 #endif //GLIBMM_EXCEPTIONS_ENABLED
1566
1567   return retvalue;
1568 }
1569
1570 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1571 Glib::RefPtr<FileMonitor> File::monitor_directory(FileMonitorFlags flags)
1572 #else
1573 Glib::RefPtr<FileMonitor> File::monitor_directory(FileMonitorFlags flags, std::auto_ptr<Glib::Error>& error)
1574 #endif //GLIBMM_EXCEPTIONS_ENABLED
1575 {
1576   GError* gerror = 0;
1577   Glib::RefPtr<FileMonitor> retvalue = Glib::wrap(g_file_monitor_directory(gobj(), ((GFileMonitorFlags)(flags)), NULL, &(gerror)));
1578 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1579   if(gerror)
1580     ::Glib::Error::throw_exception(gerror);
1581 #else
1582   if(gerror)
1583     error = ::Glib::Error::throw_exception(gerror);
1584 #endif //GLIBMM_EXCEPTIONS_ENABLED
1585
1586   return retvalue;
1587 }
1588
1589 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1590 Glib::RefPtr<FileMonitor> File::monitor_file(const Glib::RefPtr<Cancellable>& cancellable, FileMonitorFlags flags)
1591 #else
1592 Glib::RefPtr<FileMonitor> File::monitor_file(const Glib::RefPtr<Cancellable>& cancellable, FileMonitorFlags flags,  std::auto_ptr<Glib::Error>& error)
1593 #endif //GLIBMM_EXCEPTIONS_ENABLED
1594 {
1595   GError* gerror = 0;
1596   Glib::RefPtr<FileMonitor> retvalue = Glib::wrap(g_file_monitor_file(gobj(), ((GFileMonitorFlags)(flags)), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
1597 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1598   if(gerror)
1599     ::Glib::Error::throw_exception(gerror);
1600 #else
1601   if(gerror)
1602     error = ::Glib::Error::throw_exception(gerror);
1603 #endif //GLIBMM_EXCEPTIONS_ENABLED
1604
1605   return retvalue;
1606 }
1607
1608 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1609 Glib::RefPtr<FileMonitor> File::monitor_file(FileMonitorFlags flags)
1610 #else
1611 Glib::RefPtr<FileMonitor> File::monitor_file(FileMonitorFlags flags,  std::auto_ptr<Glib::Error>& error)
1612 #endif //GLIBMM_EXCEPTIONS_ENABLED
1613 {
1614   GError* gerror = 0;
1615   Glib::RefPtr<FileMonitor> retvalue = Glib::wrap(g_file_monitor_file(gobj(), ((GFileMonitorFlags)(flags)), NULL, &(gerror)));
1616 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1617   if(gerror)
1618     ::Glib::Error::throw_exception(gerror);
1619 #else
1620   if(gerror)
1621     error = ::Glib::Error::throw_exception(gerror);
1622 #endif //GLIBMM_EXCEPTIONS_ENABLED
1623
1624   return retvalue;
1625 }
1626
1627
1628 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1629 Glib::RefPtr<FileMonitor> File::monitor(const Glib::RefPtr<Cancellable>& cancellable, FileMonitorFlags flags)
1630 #else
1631 Glib::RefPtr<FileMonitor> File::monitor(const Glib::RefPtr<Cancellable>& cancellable, FileMonitorFlags flags,  std::auto_ptr<Glib::Error>& error)
1632 #endif //GLIBMM_EXCEPTIONS_ENABLED
1633 {
1634   GError* gerror = 0;
1635   Glib::RefPtr<FileMonitor> retvalue = Glib::wrap(g_file_monitor(gobj(), ((GFileMonitorFlags)(flags)), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
1636 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1637   if(gerror)
1638     ::Glib::Error::throw_exception(gerror);
1639 #else
1640   if(gerror)
1641     error = ::Glib::Error::throw_exception(gerror);
1642 #endif //GLIBMM_EXCEPTIONS_ENABLED
1643
1644   return retvalue;
1645 }
1646
1647 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1648 Glib::RefPtr<FileMonitor> File::monitor(FileMonitorFlags flags)
1649 #else
1650 Glib::RefPtr<FileMonitor> File::monitor(FileMonitorFlags flags,  std::auto_ptr<Glib::Error>& error)
1651 #endif //GLIBMM_EXCEPTIONS_ENABLED
1652 {
1653   GError* gerror = 0;
1654   Glib::RefPtr<FileMonitor> retvalue = Glib::wrap(g_file_monitor(gobj(), ((GFileMonitorFlags)(flags)), NULL, &(gerror)));
1655 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1656   if(gerror)
1657     ::Glib::Error::throw_exception(gerror);
1658 #else
1659   if(gerror)
1660     error = ::Glib::Error::throw_exception(gerror);
1661 #endif //GLIBMM_EXCEPTIONS_ENABLED
1662
1663   return retvalue;
1664 }
1665
1666
1667 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1668 Glib::RefPtr<FileInputStream> File::read()
1669 #else
1670 Glib::RefPtr<FileInputStream> File::read(std::auto_ptr<Glib::Error>& error)
1671 #endif //GLIBMM_EXCEPTIONS_ENABLED
1672 {
1673   GError* gerror = 0;
1674   Glib::RefPtr<FileInputStream> retvalue = Glib::wrap(g_file_read(gobj(), NULL, &(gerror)));
1675 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1676   if(gerror)
1677     ::Glib::Error::throw_exception(gerror);
1678 #else
1679   if(gerror)
1680     error = ::Glib::Error::throw_exception(gerror);
1681 #endif //GLIBMM_EXCEPTIONS_ENABLED
1682
1683   return retvalue;
1684 }
1685
1686 void File::find_enclosing_mount_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority)
1687 {
1688   // Create a copy of the slot.
1689   // A pointer to it will be passed through the callback's data parameter
1690   // and deleted in the callback.
1691   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
1692
1693   g_file_find_enclosing_mount_async(gobj(),
1694                     io_priority,
1695                     cancellable->gobj(),
1696                     &SignalProxy_async_callback,
1697                     slot_copy);
1698 }
1699
1700 void File::find_enclosing_mount_async(const SlotAsyncReady& slot, int io_priority)
1701 {
1702   // Create a copy of the slot.
1703   // A pointer to it will be passed through the callback's data parameter
1704   // and deleted in the callback.
1705   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
1706
1707   g_file_find_enclosing_mount_async(gobj(),
1708                     io_priority,
1709                     NULL,
1710                     &SignalProxy_async_callback,
1711                     slot_copy);
1712 }
1713
1714 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1715 bool File::set_attributes_from_info(const Glib::RefPtr<FileInfo>& info, const Glib::RefPtr<Cancellable>& cancellable, FileQueryInfoFlags flags)
1716 #else
1717 bool File::set_attributes_from_info(const Glib::RefPtr<FileInfo>& info, const Glib::RefPtr<Cancellable>& cancellable, FileQueryInfoFlags flags, std::auto_ptr<Glib::Error>& error)
1718 #endif //GLIBMM_EXCEPTIONS_ENABLED
1719 {
1720   GError* gerror = 0;
1721   bool retvalue = g_file_set_attributes_from_info(gobj(), Glib::unwrap(info), ((GFileQueryInfoFlags)(flags)), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror));
1722 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1723   if(gerror)
1724     ::Glib::Error::throw_exception(gerror);
1725 #else
1726   if(gerror)
1727     error = ::Glib::Error::throw_exception(gerror);
1728 #endif //GLIBMM_EXCEPTIONS_ENABLED
1729
1730   return retvalue;
1731 }
1732
1733 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1734 bool File::set_attributes_from_info(const Glib::RefPtr<FileInfo>& info, FileQueryInfoFlags flags)
1735 #else
1736 bool File::set_attributes_from_info(const Glib::RefPtr<FileInfo>& info, FileQueryInfoFlags flags, std::auto_ptr<Glib::Error>& error)
1737 #endif //GLIBMM_EXCEPTIONS_ENABLED
1738 {
1739   GError* gerror = 0;
1740   bool retvalue = g_file_set_attributes_from_info(gobj(), Glib::unwrap(info), ((GFileQueryInfoFlags)(flags)), NULL, &(gerror));
1741 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1742   if(gerror)
1743     ::Glib::Error::throw_exception(gerror);
1744 #else
1745   if(gerror)
1746     error = ::Glib::Error::throw_exception(gerror);
1747 #endif //GLIBMM_EXCEPTIONS_ENABLED
1748
1749   return retvalue;
1750 }
1751
1752 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1753 bool
1754 File::copy_attributes(const Glib::RefPtr<File>& destination, const Glib::RefPtr<Cancellable>& cancellable, FileCopyFlags flags)
1755 #else
1756 bool
1757 File::copy_attributes(const Glib::RefPtr<File>& destination, const Glib::RefPtr<Cancellable>& cancellable, FileCopyFlags flags, std::auto_ptr<Glib::Error>& error)
1758 #endif // GLIBMM_EXCEPTIONS_ENABLED
1759 {
1760   GError* gerror = 0;
1761   bool res;
1762
1763   res = g_file_copy_attributes(gobj(),
1764                     destination->gobj(),
1765                     static_cast<GFileCopyFlags>(flags),
1766                     cancellable->gobj(),
1767                     &gerror);
1768
1769 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1770   if (gerror)
1771     ::Glib::Error::throw_exception(gerror);
1772 #else
1773   if (gerror)
1774     error = ::Glib::Error::throw_exception(gerror);
1775 #endif //GLIBMM_EXCEPTIONS_ENABLED
1776
1777   return res;
1778 }
1779
1780 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1781 bool
1782 File::copy_attributes(const Glib::RefPtr<File>& destination, FileCopyFlags flags)
1783 #else
1784 bool
1785 File::copy_attributes(const Glib::RefPtr<File>& destination, FileCopyFlags flags, std::auto_ptr<Glib::Error>& error)
1786 #endif // GLIBMM_EXCEPTIONS_ENABLED
1787 {
1788   GError* gerror = 0;
1789   bool res;
1790
1791   res = g_file_copy_attributes(gobj(),
1792                     destination->gobj(),
1793                     static_cast<GFileCopyFlags>(flags),
1794                     NULL,
1795                     &gerror);
1796
1797 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1798   if (gerror)
1799     ::Glib::Error::throw_exception(gerror);
1800 #else
1801   if (gerror)
1802     error = ::Glib::Error::throw_exception(gerror);
1803 #endif //GLIBMM_EXCEPTIONS_ENABLED
1804
1805   return res;
1806 }
1807
1808 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1809 Glib::RefPtr<FileOutputStream> File::create_file(const Glib::RefPtr<Cancellable>& cancellable, FileCreateFlags flags)
1810 #else
1811 Glib::RefPtr<FileOutputStream> File::create_file(const Glib::RefPtr<Cancellable>& cancellable, FileCreateFlags flags, std::auto_ptr<Glib::Error>& error)
1812 #endif //GLIBMM_EXCEPTIONS_ENABLED
1813 {
1814   GError* gerror = 0;
1815   Glib::RefPtr<FileOutputStream> retvalue = Glib::wrap(g_file_create(gobj(), ((GFileCreateFlags)(flags)), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
1816 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1817   if(gerror)
1818     ::Glib::Error::throw_exception(gerror);
1819 #else
1820   if(gerror)
1821     error = ::Glib::Error::throw_exception(gerror);
1822 #endif //GLIBMM_EXCEPTIONS_ENABLED
1823
1824   return retvalue;
1825 }
1826
1827 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1828 Glib::RefPtr<FileOutputStream> File::create_file(FileCreateFlags flags)
1829 #else
1830 Glib::RefPtr<FileOutputStream> File::create_file(FileCreateFlags flags, std::auto_ptr<Glib::Error>& error)
1831 #endif //GLIBMM_EXCEPTIONS_ENABLED
1832 {
1833   GError* gerror = 0;
1834   Glib::RefPtr<FileOutputStream> retvalue = Glib::wrap(g_file_create(gobj(), ((GFileCreateFlags)(flags)), NULL, &(gerror)));
1835 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1836   if(gerror)
1837     ::Glib::Error::throw_exception(gerror);
1838 #else
1839   if(gerror)
1840     error = ::Glib::Error::throw_exception(gerror);
1841 #endif //GLIBMM_EXCEPTIONS_ENABLED
1842
1843   return retvalue;
1844 }
1845
1846 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1847 bool File::remove()
1848 #else
1849 bool File::remove(std::auto_ptr<Glib::Error>& error)
1850 #endif //GLIBMM_EXCEPTIONS_ENABLED
1851 {
1852   GError* gerror = 0;
1853   bool retvalue = g_file_delete(gobj(), NULL, &(gerror));
1854 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1855   if(gerror)
1856     ::Glib::Error::throw_exception(gerror);
1857 #else
1858   if(gerror)
1859     error = ::Glib::Error::throw_exception(gerror);
1860 #endif //GLIBMM_EXCEPTIONS_ENABLED
1861
1862   return retvalue;
1863 }
1864
1865 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1866 bool File::trash()
1867 #else
1868 bool File::trash(std::auto_ptr<Glib::Error>& error)
1869 #endif //GLIBMM_EXCEPTIONS_ENABLED
1870 {
1871   GError* gerror = 0;
1872   bool retvalue = g_file_trash(gobj(), NULL, &(gerror));
1873 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1874   if(gerror)
1875     ::Glib::Error::throw_exception(gerror);
1876 #else
1877   if(gerror)
1878     error = ::Glib::Error::throw_exception(gerror);
1879 #endif //GLIBMM_EXCEPTIONS_ENABLED
1880
1881   return retvalue;
1882 }
1883
1884 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1885 bool File::make_directory()
1886 #else
1887 bool File::make_directory(std::auto_ptr<Glib::Error>& error)
1888 #endif //GLIBMM_EXCEPTIONS_ENABLED
1889 {
1890   GError* gerror = 0;
1891   bool retvalue = g_file_make_directory(gobj(), NULL, &(gerror));
1892 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1893   if(gerror)
1894     ::Glib::Error::throw_exception(gerror);
1895 #else
1896   if(gerror)
1897     error = ::Glib::Error::throw_exception(gerror);
1898 #endif //GLIBMM_EXCEPTIONS_ENABLED
1899
1900   return retvalue;
1901 }
1902
1903 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1904 bool File::make_symbolic_link(const std::string& symlink_value)
1905 #else
1906 bool File::make_symbolic_link(const std::string& symlink_value, std::auto_ptr<Glib::Error>& error)
1907 #endif //GLIBMM_EXCEPTIONS_ENABLED
1908 {
1909   GError* gerror = 0;
1910   bool retvalue = g_file_make_symbolic_link(gobj(), symlink_value.c_str(), NULL, &(gerror));
1911 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1912   if(gerror)
1913     ::Glib::Error::throw_exception(gerror);
1914 #else
1915   if(gerror)
1916     error = ::Glib::Error::throw_exception(gerror);
1917 #endif //GLIBMM_EXCEPTIONS_ENABLED
1918
1919   return retvalue;
1920 }
1921
1922 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1923 Glib::RefPtr<FileAttributeInfoList> File::query_settable_attributes()
1924 #else
1925 Glib::RefPtr<FileAttributeInfoList> File::query_settable_attributes(std::auto_ptr<Glib::Error>& error)
1926 #endif //GLIBMM_EXCEPTIONS_ENABLED
1927 {
1928   GError* gerror = 0;
1929   Glib::RefPtr<FileAttributeInfoList> retvalue = Glib::wrap(g_file_query_settable_attributes(gobj(), NULL, &(gerror)));
1930 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1931   if(gerror)
1932     ::Glib::Error::throw_exception(gerror);
1933 #else
1934   if(gerror)
1935     error = ::Glib::Error::throw_exception(gerror);
1936 #endif //GLIBMM_EXCEPTIONS_ENABLED
1937
1938   return retvalue;
1939 }
1940
1941 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1942 Glib::RefPtr<FileAttributeInfoList> File::query_writable_namespaces()
1943 #else
1944 Glib::RefPtr<FileAttributeInfoList> File::query_writable_namespaces(std::auto_ptr<Glib::Error>& error)
1945 #endif //GLIBMM_EXCEPTIONS_ENABLED
1946 {
1947   GError* gerror = 0;
1948   Glib::RefPtr<FileAttributeInfoList> retvalue = Glib::wrap(g_file_query_writable_namespaces(gobj(), NULL, &(gerror)));
1949 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1950   if(gerror)
1951     ::Glib::Error::throw_exception(gerror);
1952 #else
1953   if(gerror)
1954     error = ::Glib::Error::throw_exception(gerror);
1955 #endif //GLIBMM_EXCEPTIONS_ENABLED
1956
1957   return retvalue;
1958 }
1959
1960
1961 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1962 Glib::RefPtr<FileOutputStream> File::append_to(const Glib::RefPtr<Cancellable>& cancellable, FileCreateFlags flags)
1963 #else
1964 Glib::RefPtr<FileOutputStream> File::append_to(const Glib::RefPtr<Cancellable>& cancellable, FileCreateFlags flags, std::auto_ptr<Glib::Error>& error)
1965 #endif //GLIBMM_EXCEPTIONS_ENABLED
1966 {
1967   GError* gerror = 0;
1968   Glib::RefPtr<FileOutputStream> retvalue = Glib::wrap(g_file_append_to(gobj(), ((GFileCreateFlags)(flags)), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
1969 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1970   if(gerror)
1971     ::Glib::Error::throw_exception(gerror);
1972 #else
1973   if(gerror)
1974     error = ::Glib::Error::throw_exception(gerror);
1975 #endif //GLIBMM_EXCEPTIONS_ENABLED
1976
1977   return retvalue;
1978 }
1979
1980 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1981 Glib::RefPtr<FileOutputStream> File::append_to(FileCreateFlags flags)
1982 #else
1983 Glib::RefPtr<FileOutputStream> File::append_to(FileCreateFlags flags, std::auto_ptr<Glib::Error>& error)
1984 #endif //GLIBMM_EXCEPTIONS_ENABLED
1985 {
1986   GError* gerror = 0;
1987   Glib::RefPtr<FileOutputStream> retvalue = Glib::wrap(g_file_append_to(gobj(), ((GFileCreateFlags)(flags)), NULL, &(gerror)));
1988 #ifdef GLIBMM_EXCEPTIONS_ENABLED
1989   if(gerror)
1990     ::Glib::Error::throw_exception(gerror);
1991 #else
1992   if(gerror)
1993     error = ::Glib::Error::throw_exception(gerror);
1994 #endif //GLIBMM_EXCEPTIONS_ENABLED
1995
1996   return retvalue;
1997 }
1998
1999 #ifdef GLIBMM_EXCEPTIONS_ENABLED
2000 Glib::RefPtr<Mount> File::find_enclosing_mount()
2001 #else
2002 Glib::RefPtr<Mount> File::find_enclosing_mount(std::auto_ptr<Glib::Error>& error)
2003 #endif //GLIBMM_EXCEPTIONS_ENABLED
2004 {
2005   GError* gerror = 0;
2006   Glib::RefPtr<Mount> retvalue = Glib::wrap(g_file_find_enclosing_mount(gobj(), NULL, &(gerror)));
2007 #ifdef GLIBMM_EXCEPTIONS_ENABLED
2008   if(gerror)
2009     ::Glib::Error::throw_exception(gerror);
2010 #else
2011   if(gerror)
2012     error = ::Glib::Error::throw_exception(gerror);
2013 #endif //GLIBMM_EXCEPTIONS_ENABLED
2014
2015   return retvalue;
2016 }
2017
2018 #ifdef GLIBMM_EXCEPTIONS_ENABLED
2019 Glib::RefPtr<AppInfo> File::query_default_handler()
2020 #else
2021 Glib::RefPtr<AppInfo> File::query_default_handler(std::auto_ptr<Glib::Error>& error)
2022 #endif //GLIBMM_EXCEPTIONS_ENABLED
2023 {
2024   GError* gerror = 0;
2025   Glib::RefPtr<AppInfo> retvalue = Glib::wrap(g_file_query_default_handler(gobj(), NULL, &(gerror)));
2026 #ifdef GLIBMM_EXCEPTIONS_ENABLED
2027   if(gerror)
2028     ::Glib::Error::throw_exception(gerror);
2029 #else
2030   if(gerror)
2031     error = ::Glib::Error::throw_exception(gerror);
2032 #endif //GLIBMM_EXCEPTIONS_ENABLED
2033
2034   return retvalue;
2035 }
2036
2037 #ifdef GLIBMM_EXCEPTIONS_ENABLED
2038 bool File::load_contents(const Glib::RefPtr<Cancellable>& cancellable, char*& contents, gsize& length, std::string& etag_out)
2039 #else
2040 bool File::load_contents(const Glib::RefPtr<Cancellable>& cancellable, char*& contents, gsize& length, std::string& etag_out, std::auto_ptr<Glib::Error>& error)
2041 #endif //GLIBMM_EXCEPTIONS_ENABLED
2042 {
2043   GError* gerror = 0;
2044   gchar* cetag_out = 0;
2045   bool retvalue = g_file_load_contents(gobj(), Glib::unwrap(cancellable), &contents, &(length), &cetag_out, &(gerror));
2046 #ifdef GLIBMM_EXCEPTIONS_ENABLED
2047   if(gerror)
2048     ::Glib::Error::throw_exception(gerror);
2049 #else
2050   if(gerror)
2051     error = ::Glib::Error::throw_exception(gerror);
2052 #endif //GLIBMM_EXCEPTIONS_ENABLED
2053
2054   etag_out = Glib::convert_return_gchar_ptr_to_stdstring(cetag_out);
2055
2056   return retvalue;
2057 }
2058
2059 #ifdef GLIBMM_EXCEPTIONS_ENABLED
2060 bool File::load_contents(char*& contents, gsize& length, std::string& etag_out)
2061 #else
2062 bool File::load_contents(char*& contents, gsize& length, std::string& etag_out, std::auto_ptr<Glib::Error>& error)
2063 #endif //GLIBMM_EXCEPTIONS_ENABLED
2064 {
2065   GError* gerror = 0;
2066   gchar* cetag_out = 0;
2067   bool retvalue = g_file_load_contents(gobj(), NULL, &contents, &(length), &cetag_out, &(gerror));
2068 #ifdef GLIBMM_EXCEPTIONS_ENABLED
2069   if(gerror)
2070     ::Glib::Error::throw_exception(gerror);
2071 #else
2072   if(gerror)
2073     error = ::Glib::Error::throw_exception(gerror);
2074 #endif //GLIBMM_EXCEPTIONS_ENABLED
2075
2076   etag_out = Glib::convert_return_gchar_ptr_to_stdstring(cetag_out);
2077
2078   return retvalue;
2079 }
2080
2081 #ifdef GLIBMM_EXCEPTIONS_ENABLED
2082 bool File::load_contents_finish(const Glib::RefPtr<AsyncResult>& result, char*& contents, gsize& length, std::string& etag_out)
2083 #else
2084 bool File::load_contents_finish(const Glib::RefPtr<AsyncResult>& result, char*& contents, gsize& length, std::string& etag_out, std::auto_ptr<Glib::Error>& error)
2085 #endif //GLIBMM_EXCEPTIONS_ENABLED
2086 {
2087   GError* gerror = 0;
2088   gchar* cetag_out = 0;
2089   bool retvalue = g_file_load_contents_finish(gobj(), Glib::unwrap(result), &contents, &(length), &cetag_out, &(gerror));
2090 #ifdef GLIBMM_EXCEPTIONS_ENABLED
2091   if(gerror)
2092     ::Glib::Error::throw_exception(gerror);
2093 #else
2094   if(gerror)
2095     error = ::Glib::Error::throw_exception(gerror);
2096 #endif //GLIBMM_EXCEPTIONS_ENABLED
2097
2098   etag_out = Glib::convert_return_gchar_ptr_to_stdstring(cetag_out);
2099
2100   return retvalue;
2101 }
2102
2103 #ifdef GLIBMM_EXCEPTIONS_ENABLED
2104 bool File::load_partial_contents_finish(const Glib::RefPtr<AsyncResult>& result, char*& contents, gsize& length, std::string& etag_out)
2105 #else
2106 bool File::load_partial_contents_finish(const Glib::RefPtr<AsyncResult>& result, char*& contents, gsize& length, std::string& etag_out, std::auto_ptr<Glib::Error>& error)
2107 #endif //GLIBMM_EXCEPTIONS_ENABLED
2108 {
2109   GError* gerror = 0;
2110   gchar* cetag_out = 0;
2111   bool retvalue = g_file_load_partial_contents_finish(gobj(), Glib::unwrap(result), &contents, &(length), &cetag_out, &(gerror));
2112 #ifdef GLIBMM_EXCEPTIONS_ENABLED
2113   if(gerror)
2114     ::Glib::Error::throw_exception(gerror);
2115 #else
2116   if(gerror)
2117     error = ::Glib::Error::throw_exception(gerror);
2118 #endif //GLIBMM_EXCEPTIONS_ENABLED
2119
2120   etag_out = Glib::convert_return_gchar_ptr_to_stdstring(cetag_out);
2121
2122   return retvalue;
2123 }
2124
2125 } // namespace Gio