1 // -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 /* Copyright (C) 2007 The gtkmm Development Team
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.
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.
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.
21 #include <giomm/file.h>
22 #include <glibmm/error.h>
23 #include <glibmm/exceptionhandler.h>
24 #include "slot_async.h"
30 FileEnumerator::next_files_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int num_files, int io_priority)
32 // Create a copy of the slot.
33 // A pointer to it will be passed through the callback's data parameter
34 // and deleted in the callback.
35 SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
37 g_file_enumerator_next_files_async(gobj(),
41 &SignalProxy_async_callback,
46 FileEnumerator::next_files_async(const SlotAsyncReady& slot, int num_files, int io_priority)
48 // Create a copy of the slot.
49 // A pointer to it will be passed through the callback's data parameter
50 // and deleted in the callback.
51 SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
53 g_file_enumerator_next_files_async(gobj(),
57 &SignalProxy_async_callback,
62 FileEnumerator::close_async(int io_priority,
63 const Glib::RefPtr<Cancellable>& cancellable,
64 const SlotAsyncReady& slot)
66 // Create a copy of the slot.
67 // A pointer to it will be passed through the callback's data parameter
68 // and deleted in the callback.
69 SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
71 g_file_enumerator_close_async(gobj(),
74 &SignalProxy_async_callback,
79 FileEnumerator::close_async(int io_priority,
80 const SlotAsyncReady& slot)
82 // Create a copy of the slot.
83 // A pointer to it will be passed through the callback's data parameter
84 // and deleted in the callback.
85 SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
87 g_file_enumerator_close_async(gobj(),
90 &SignalProxy_async_callback,
94 #ifdef GLIBMM_EXCEPTIONS_ENABLED
95 Glib::RefPtr<FileInfo> FileEnumerator::next_file()
97 Glib::RefPtr<FileInfo> FileEnumerator::next_file(std::auto_ptr<Glib::Error>& error)
98 #endif //GLIBMM_EXCEPTIONS_ENABLED
101 Glib::RefPtr<FileInfo> retvalue = Glib::wrap(g_file_enumerator_next_file(gobj(), NULL, &(gerror)));
102 #ifdef GLIBMM_EXCEPTIONS_ENABLED
104 ::Glib::Error::throw_exception(gerror);
107 error = ::Glib::Error::throw_exception(gerror);
108 #endif //GLIBMM_EXCEPTIONS_ENABLED
113 #ifdef GLIBMM_EXCEPTIONS_ENABLED
114 bool FileEnumerator::close()
116 bool FileEnumerator::close(std::auto_ptr<Glib::Error>& error)
117 #endif //GLIBMM_EXCEPTIONS_ENABLED
120 bool retvalue = g_file_enumerator_close(gobj(), NULL, &(gerror));
121 #ifdef GLIBMM_EXCEPTIONS_ENABLED
123 ::Glib::Error::throw_exception(gerror);
126 error = ::Glib::Error::throw_exception(gerror);
127 #endif //GLIBMM_EXCEPTIONS_ENABLED