summaryrefslogtreecommitdiff
path: root/gdbus
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@profusion.mobi>2012-05-18 00:23:28 -0300
committerMarcel Holtmann <marcel@holtmann.org>2012-05-17 20:32:20 -0700
commit2e576dd2f9ec1aa8e06b648707a746945b335fc7 (patch)
tree89d42e2cbd27c41085a09ac958df426b5f1e21ae /gdbus
parent56f4b3c8aefef58d27aedbab729fea46cf531133 (diff)
downloadbluez-2e576dd2f9ec1aa8e06b648707a746945b335fc7.tar.gz
gdbus: add and use helpers for table declarations
Diffstat (limited to 'gdbus')
-rw-r--r--gdbus/gdbus.h86
-rw-r--r--gdbus/object.c3
2 files changed, 88 insertions, 1 deletions
diff --git a/gdbus/gdbus.h b/gdbus/gdbus.h
index e5e7938da..8354633b4 100644
--- a/gdbus/gdbus.h
+++ b/gdbus/gdbus.h
@@ -118,6 +118,92 @@ typedef struct {
GDBusSecurityFunction function;
} GDBusSecurityTable;
+#define GDBUS_ARGS(args...) (const GDBusArgInfo[]) { args, { } }
+
+#define _GDBUS_METHOD(_name, _signature, _reply, _in_args, _out_args, _function) \
+ .name = _name, \
+ .signature = _signature, \
+ .reply = _reply, \
+ .in_args = _in_args, \
+ .out_args = _out_args, \
+ .function = _function
+
+#define _GDBUS_ASYNC_METHOD(_name, _signature, _reply, _in_args, _out_args, _function) \
+ .name = _name, \
+ .signature = _signature, \
+ .reply = _reply, \
+ .in_args = _in_args, \
+ .out_args = _out_args, \
+ .function = _function, \
+ .flags = G_DBUS_METHOD_FLAG_ASYNC
+
+#define _GDBUS_DEPRECATED_METHOD(_name, _signature, _reply, _in_args, _out_args, _function) \
+ .name = _name, \
+ .signature = _signature, \
+ .reply = _reply, \
+ .in_args = _in_args, \
+ .out_args = _out_args, \
+ .function = _function, \
+ .flags = G_DBUS_METHOD_FLAG_DEPRECATED
+
+#define _GDBUS_DEPRECATED_ASYNC_METHOD(_name, _signature, _reply, _in_args, _out_args, _function) \
+ .name = _name, \
+ .signature = _signature, \
+ .reply = _reply, \
+ .in_args = _in_args, \
+ .out_args = _out_args, \
+ .function = _function, \
+ .flags = G_DBUS_METHOD_FLAG_ASYNC | G_DBUS_METHOD_FLAG_DEPRECATED
+
+#define _GDBUS_SIGNAL(_name, _signature, _args) \
+ .name = _name, \
+ .signature = _signature, \
+ .args = _args
+
+#define _GDBUS_DEPRECATED_SIGNAL(_name, _signature, _args) \
+ .name = _name, \
+ .signature = _signature, \
+ .args = _args, \
+ .flags = G_DBUS_SIGNAL_FLAG_DEPRECATED
+
+/* Helpers with no signature and reply */
+
+#define GDBUS_METHOD(_name, _in_args, _out_args, _function) \
+ .name = _name, \
+ .in_args = _in_args, \
+ .out_args = _out_args, \
+ .function = _function
+
+#define GDBUS_ASYNC_METHOD(_name, _in_args, _out_args, _function) \
+ .name = _name, \
+ .in_args = _in_args, \
+ .out_args = _out_args, \
+ .function = _function, \
+ .flags = G_DBUS_METHOD_FLAG_ASYNC
+
+#define GDBUS_DEPRECATED_METHOD(_name, _in_args, _out_args, _function) \
+ .name = _name, \
+ .in_args = _in_args, \
+ .out_args = _out_args, \
+ .function = _function, \
+ .flags = G_DBUS_METHOD_FLAG_DEPRECATED
+
+#define GDBUS_DEPRECATED_ASYNC_METHOD(_name, _in_args, _out_args, _function) \
+ .name = _name, \
+ .in_args = _in_args, \
+ .out_args = _out_args, \
+ .function = _function, \
+ .flags = G_DBUS_METHOD_FLAG_ASYNC | G_DBUS_METHOD_FLAG_DEPRECATED
+
+#define GDBUS_SIGNAL(_name, _args) \
+ .name = _name, \
+ .args = _args
+
+#define GDBUS_DEPRECATED_SIGNAL(_name, _args) \
+ .name = _name, \
+ .args = _args, \
+ .flags = G_DBUS_SIGNAL_FLAG_DEPRECATED
+
gboolean g_dbus_register_interface(DBusConnection *connection,
const char *path, const char *name,
const GDBusMethodTable *methods,
diff --git a/gdbus/object.c b/gdbus/object.c
index 0ef6c80ef..2ddc574db 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -497,7 +497,8 @@ done:
}
static const GDBusMethodTable introspect_methods[] = {
- { "Introspect", "", "s", introspect },
+ { _GDBUS_METHOD("Introspect", "", "s", NULL,
+ GDBUS_ARGS({ "xml", "s" }), introspect) },
{ }
};