From b3489f2ee86c1d7ace388b43420a32f9a76b019c Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Sun, 20 May 2012 02:07:29 -0300 Subject: Convert GDBus methods to use macro helpers With these macro helpers we can separate in/out arguments and use their own vector. --- src/gprs.c | 48 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 16 deletions(-) (limited to 'src/gprs.c') diff --git a/src/gprs.c b/src/gprs.c index 83995f33..9a4138e7 100644 --- a/src/gprs.c +++ b/src/gprs.c @@ -1283,14 +1283,18 @@ static DBusMessage *pri_set_property(DBusConnection *conn, } static const GDBusMethodTable context_methods[] = { - { "GetProperties", "", "a{sv}", pri_get_properties }, - { "SetProperty", "sv", "", pri_set_property, - G_DBUS_METHOD_FLAG_ASYNC }, + { _GDBUS_METHOD("GetProperties", "", "a{sv}", + NULL, GDBUS_ARGS({ "properties", "a{sv}" }), + pri_get_properties) }, + { _GDBUS_ASYNC_METHOD("SetProperty", "sv", "", + GDBUS_ARGS({ "property", "s" }, { "value", "v" }), + NULL, pri_set_property) }, { } }; static const GDBusSignalTable context_signals[] = { - { "PropertyChanged", "sv" }, + { _GDBUS_SIGNAL("PropertyChanged", "sv", + GDBUS_ARGS({ "name", "s" }, { "value", "v" })) }, { } }; @@ -2063,22 +2067,34 @@ static DBusMessage *gprs_get_contexts(DBusConnection *conn, } static const GDBusMethodTable manager_methods[] = { - { "GetProperties", "", "a{sv}", gprs_get_properties }, - { "SetProperty", "sv", "", gprs_set_property }, - { "AddContext", "s", "o", gprs_add_context, - G_DBUS_METHOD_FLAG_ASYNC }, - { "RemoveContext", "o", "", gprs_remove_context, - G_DBUS_METHOD_FLAG_ASYNC }, - { "DeactivateAll", "", "", gprs_deactivate_all, - G_DBUS_METHOD_FLAG_ASYNC }, - { "GetContexts", "", "a(oa{sv})", gprs_get_contexts }, + { _GDBUS_METHOD("GetProperties", "", "a{sv}", + NULL, GDBUS_ARGS({ "properties", "a{sv}" }), + gprs_get_properties) }, + { _GDBUS_METHOD("SetProperty", "sv", "", + GDBUS_ARGS({ "property", "s" }, { "value", "v" }), + NULL, gprs_set_property) }, + { _GDBUS_ASYNC_METHOD("AddContext", "s", "o", + GDBUS_ARGS({ "type", "s" }), + GDBUS_ARGS({ "path", "o" }), + gprs_add_context) }, + { _GDBUS_ASYNC_METHOD("RemoveContext", "o", "", + GDBUS_ARGS({ "path", "o" }), NULL, + gprs_remove_context) }, + { _GDBUS_ASYNC_METHOD("DeactivateAll", "", "", NULL, NULL, + gprs_deactivate_all) }, + { _GDBUS_METHOD("GetContexts", "", "a(oa{sv})", + NULL, + GDBUS_ARGS({ "contexts_with_properties", "a(oa{sv})" }), + gprs_get_contexts) }, { } }; static const GDBusSignalTable manager_signals[] = { - { "PropertyChanged", "sv" }, - { "ContextAdded", "oa{sv}" }, - { "ContextRemoved", "o" }, + { _GDBUS_SIGNAL("PropertyChanged", "sv", + GDBUS_ARGS({ "name", "s" }, { "value", "v" })) }, + { _GDBUS_SIGNAL("ContextAdded", "oa{sv}", + GDBUS_ARGS({ "path", "o" }, { "properties", "v" })) }, + { _GDBUS_SIGNAL("ContextRemoved", "o", GDBUS_ARGS({ "path", "o" })) }, { } }; -- cgit v1.2.3