/* Copyright (C) 2010 The giomm Development Team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ //#include #include #include #include #include _DEFS(giomm,gio) _PINCLUDE(glibmm/private/object_p.h) namespace Glib { class GIOMM_API Error; } namespace Gio { namespace DBus { class Connection; _GMMPROC_EXTRA_NAMESPACE(DBus) /** An Object for handling remote calls. * Instances of the MethodInvocation class are used when handling D-Bus * method calls. It provides a way to asynchronously return results and * errors. * * The normal way to obtain a MethodInvocation object is to receive it as * an argument to the SlotMethodCall that was passed to * Gio::DBus::Connection::register_object(). * * @newin{2,28} * @ingroup DBus */ class GIOMM_API MethodInvocation : public Glib::Object { _CLASS_GOBJECT(MethodInvocation, GDBusMethodInvocation, G_DBUS_METHOD_INVOCATION, Glib::Object, GObject, , , GIOMM_API) public: _WRAP_METHOD(Glib::ustring get_sender() const, g_dbus_method_invocation_get_sender) _WRAP_METHOD(Glib::ustring get_object_path() const, g_dbus_method_invocation_get_object_path) _WRAP_METHOD(Glib::ustring get_interface_name() const, g_dbus_method_invocation_get_interface_name) _WRAP_METHOD(Glib::ustring get_method_name() const, g_dbus_method_invocation_get_method_name) #m4 _CONVERSION(`const GDBusMethodInfo*', `Glib::RefPtr', `Glib::wrap(const_cast($3))') // The C API only returns a const GDBusMethodInfo. _WRAP_METHOD(Glib::RefPtr get_method_info() const, g_dbus_method_invocation_get_method_info, refreturn) _WRAP_METHOD(Glib::RefPtr get_connection(), g_dbus_method_invocation_get_connection, refreturn) _WRAP_METHOD(Glib::RefPtr get_connection() const, g_dbus_method_invocation_get_connection, refreturn, constversion) _WRAP_METHOD(Glib::RefPtr get_message(), g_dbus_method_invocation_get_message, refreturn) _WRAP_METHOD(Glib::RefPtr get_message() const, g_dbus_method_invocation_get_message, refreturn, constversion) //We assume that this is a tuple (VariantContainerBase). //See https://bugzilla.gnome.org/show_bug.cgi?id=646420 _WRAP_METHOD(Glib::VariantContainerBase get_parameters() const, g_dbus_method_invocation_get_parameters) //TODO: Add a return_single_value() method? //A return_value(VariantBase) would probably be ambiguous to people //even if it isn't ambiguous to the compiler. _WRAP_METHOD(void return_value(const Glib::VariantContainerBase& parameters), g_dbus_method_invocation_return_value) _WRAP_METHOD(void return_value(const Glib::VariantContainerBase& parameters, const Glib::RefPtr& fd_list), g_dbus_method_invocation_return_value_with_unix_fd_list, ifdef G_OS_UNIX) #m4 _CONVERSION(`const Glib::ustring&', `GQuark', `Glib::QueryQuark($3).id()') _WRAP_METHOD(void return_error(const Glib::ustring& domain, int code, const Glib::ustring& message), g_dbus_method_invocation_return_error_literal) // This function does not have to be wrapped because it's a convenience C // function to avoid having to unreference the error (in C). _IGNORE(g_dbus_method_invocation_take_error) #m4 _CONVERSION(`const Glib::Error&', `const GError*', `$3.gobj()') _WRAP_METHOD(void return_error(const Glib::Error& error), g_dbus_method_invocation_return_gerror) _WRAP_METHOD(void return_dbus_error(const Glib::ustring& error_name, const Glib::ustring& error_message), g_dbus_method_invocation_return_dbus_error) // Ignore vararg methods and ones that don't make sense for C++ API. _IGNORE(g_dbus_method_invocation_return_error, g_dbus_method_invocation_return_error_valist, g_dbus_method_invocation_get_user_data) }; } //namespace DBus } // namespace Gio