1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* 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, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
//#include <giomm/dbusconnection.h>
#include <giomm/dbusmessage.h>
#include <giomm/dbusintrospection.h>
#include <glibmm/object.h>
#include <glibmm/variant.h>
_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/object_p.h)
namespace Glib
{
class 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 MethodInvocation : public Glib::Object
{
_CLASS_GOBJECT(MethodInvocation, GDBusMethodInvocation, G_DBUS_METHOD_INVOCATION, Glib::Object, GObject)
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<const MethodInfo>', `Glib::wrap(const_cast<GDBusMethodInfo*>($3))')
// The C API only returns a const GDBusMethodInfo.
_WRAP_METHOD(Glib::RefPtr<const MethodInfo> get_method_info() const, g_dbus_method_invocation_get_method_info, refreturn)
_WRAP_METHOD(Glib::RefPtr<Connection> get_connection(), g_dbus_method_invocation_get_connection, refreturn)
_WRAP_METHOD(Glib::RefPtr<const Connection> get_connection() const, g_dbus_method_invocation_get_connection, refreturn, constversion)
_WRAP_METHOD(Glib::RefPtr<Message> get_message(), g_dbus_method_invocation_get_message, refreturn)
_WRAP_METHOD(Glib::RefPtr<const Message> 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<UnixFDList>& 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
|