diff options
author | Marko Anastasov <marko.anastasov@gmail.com> | 2007-12-28 13:18:50 +0000 |
---|---|---|
committer | Marko Anastasov <markoa@src.gnome.org> | 2007-12-28 13:18:50 +0000 |
commit | 1a4f133833a0e8340d8355e04b0ccddbe001a0ef (patch) | |
tree | 0d6b5cbebdc4cda73f957ec56b72ea83d293f473 /gio/src/fileoutputstream.ccg | |
parent | d8aaa79cecd3c032e78ce189c05cfd1f3ed2e817 (diff) | |
download | glibmm-1a4f133833a0e8340d8355e04b0ccddbe001a0ef.tar.gz |
Checked in sources from giomm. Build needs to be fixed to work with
2007-12-28 Marko Anastasov <marko.anastasov@gmail.com>
* gio/*:
* configure.in:
* Makefile.am:
* tools/m4/convert_glib.m4: Checked in sources from giomm. Build
needs to be fixed to work with scripts in build_shared/.
svn path=/trunk/; revision=482
Diffstat (limited to 'gio/src/fileoutputstream.ccg')
-rw-r--r-- | gio/src/fileoutputstream.ccg | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/gio/src/fileoutputstream.ccg b/gio/src/fileoutputstream.ccg new file mode 100644 index 00000000..92932066 --- /dev/null +++ b/gio/src/fileoutputstream.ccg @@ -0,0 +1,73 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + +/* Copyright (C) 2007 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gio/gio.h> +#include <glib.h> +#include <glibmm/error.h> +#include <glibmm/exceptionhandler.h> + +namespace { + +static void +SignalProxy_async_callback(GObject*, GAsyncResult* res, void* data) +{ + Gio::SlotAsyncReady* the_slot = static_cast<Gio::SlotAsyncReady*>(data); + + #ifdef GLIBMM_EXCEPTIONS_ENABLED + try + { + #endif //GLIBMM_EXCEPTIONS_ENABLED + Glib::RefPtr<Gio::AsyncResult> result = Glib::wrap(res, true /* take copy */); + (*the_slot)(result); + #ifdef GLIBMM_EXCEPTIONS_ENABLED + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + #endif //GLIBMM_EXCEPTIONS_ENABLED + + delete the_slot; +} + +} // anonymous namespace + +namespace Gio +{ + +void +FileOutputStream::query_info_async(const std::string& attributes, + int io_priority, + Glib::RefPtr<Cancellable>& cancellable, + const SlotAsyncReady& slot) +{ + // Create a copy of the slot. + // A pointer to it will be passed through the callback's data parameter + // and deleted in the callback. + SlotAsyncReady* slot_copy = new SlotAsyncReady(slot); + + g_file_output_stream_query_info_async(gobj(), + const_cast<char*>(attributes.c_str()), + io_priority, + cancellable->gobj(), + &SignalProxy_async_callback, + slot_copy); +} + +} // namespace Gio |