From 0bb3ef14d109f12fbb629e623b5c460915425e70 Mon Sep 17 00:00:00 2001 From: Henrique Dante de Almeida Date: Fri, 18 May 2012 17:30:06 -0300 Subject: Convert GDBus methods and signals to use macro helpers With these macro helpers we can separate in/out arguments and use their own vector. --- src/manager.c | 81 ++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 58 insertions(+), 23 deletions(-) (limited to 'src/manager.c') diff --git a/src/manager.c b/src/manager.c index b4481859..33b50e2a 100644 --- a/src/manager.c +++ b/src/manager.c @@ -394,33 +394,68 @@ static DBusMessage *release_private_network(DBusConnection *conn, } static const GDBusMethodTable manager_methods[] = { - { "GetProperties", "", "a{sv}", get_properties }, - { "SetProperty", "sv", "", set_property, - G_DBUS_METHOD_FLAG_ASYNC }, - { "GetTechnologies", "", "a(oa{sv})", get_technologies }, - { "RemoveProvider", "o", "", remove_provider }, - { "GetServices", "", "a(oa{sv})", get_services }, - { "ConnectProvider", "a{sv}", "o", connect_provider, - G_DBUS_METHOD_FLAG_ASYNC }, - { "RegisterAgent", "o", "", register_agent }, - { "UnregisterAgent", "o", "", unregister_agent }, - { "RegisterCounter", "ouu", "", register_counter }, - { "UnregisterCounter", "o", "", unregister_counter }, - { "CreateSession", "a{sv}o", "o", create_session }, - { "DestroySession", "o", "", destroy_session }, - { "RequestPrivateNetwork", "", "oa{sv}h", - request_private_network, - G_DBUS_METHOD_FLAG_ASYNC }, - { "ReleasePrivateNetwork", "o", "", - release_private_network }, + { _GDBUS_METHOD("GetProperties", "", "a{sv}", + NULL, GDBUS_ARGS({ "properties", "a{sv}" }), + get_properties) }, + { _GDBUS_ASYNC_METHOD("SetProperty", "sv", "", + GDBUS_ARGS({ "properties", "a{sv}" }), NULL, + set_property) }, + { _GDBUS_METHOD("GetTechnologies", "", "a(oa{sv})", + NULL, GDBUS_ARGS({ "technologies", "a(oa{sv})" }), + get_technologies) }, + { _GDBUS_METHOD("RemoveProvider", "o", "", + GDBUS_ARGS({ "provider", "o" }), NULL, + remove_provider) }, + { _GDBUS_METHOD("GetServices", "", "a(oa{sv})", + NULL, GDBUS_ARGS({ "services", "a(oa{sv})" }), + get_services) }, + { _GDBUS_ASYNC_METHOD("ConnectProvider", "a{sv}", "o", + GDBUS_ARGS({ "provider", "a{sv}" }), + GDBUS_ARGS({ "path", "o" }), + connect_provider) }, + { _GDBUS_METHOD("RegisterAgent", "o", "", + GDBUS_ARGS({ "path", "o" }), NULL, + register_agent) }, + { _GDBUS_METHOD("UnregisterAgent", "o", "", + GDBUS_ARGS({ "path", "o" }), NULL, + unregister_agent) }, + { _GDBUS_METHOD("RegisterCounter", "ouu", "", + GDBUS_ARGS({ "path", "o" }, { "accuracy", "u" }, + { "period", "u" }), + NULL, register_counter) }, + { _GDBUS_METHOD("UnregisterCounter", "o", "", + GDBUS_ARGS({ "path", "o" }), NULL, + unregister_counter) }, + { _GDBUS_METHOD("CreateSession", "a{sv}o", "o", + GDBUS_ARGS({ "settings", "a{sv}" }, + { "notifier", "o" }), + GDBUS_ARGS({ "session", "o" }), + create_session) }, + { _GDBUS_METHOD("DestroySession", "o", "", + GDBUS_ARGS({ "session", "o" }), NULL, + destroy_session) }, + { _GDBUS_ASYNC_METHOD("RequestPrivateNetwork", "", "oa{sv}h", + NULL, GDBUS_ARGS({ "path", "o" }, + { "settings", "a{sv}" }, + { "socket", "h" }), + request_private_network) }, + { _GDBUS_METHOD("ReleasePrivateNetwork", "o", "", + GDBUS_ARGS({ "path", "o" }), NULL, + release_private_network) }, { }, }; static const GDBusSignalTable manager_signals[] = { - { "PropertyChanged", "sv" }, - { "TechnologyAdded", "oa{sv}" }, - { "TechnologyRemoved", "o" }, - { "ServicesChanged", "a(oa{sv})ao" }, + { _GDBUS_SIGNAL("PropertyChanged", "sv", + GDBUS_ARGS({ "name", "s" }, { "value", "v" })) }, + { _GDBUS_SIGNAL("TechnologyAdded", "oa{sv}", + GDBUS_ARGS({ "path", "o" }, + { "properties", "a{sv}" })) }, + { _GDBUS_SIGNAL("TechnologyRemoved", "o", + GDBUS_ARGS({ "path", "o" })) }, + { _GDBUS_SIGNAL("ServicesChanged", "a(oa{sv})ao", + GDBUS_ARGS({ "services_changed", "a(oa{sv})" }, + { "services_removed", "ao" })) }, { }, }; -- cgit v1.2.3