From 7bc004006cb45f73276ef56edc03dac4177becc3 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 19 Dec 2009 13:23:15 -0800 Subject: [PATCH] Add user data argument to D-Bus array property helpers --- include/dbus.h | 7 ++++--- src/dbus.c | 5 +++-- src/device.c | 2 +- src/notifier.c | 6 +++--- src/profile.c | 8 ++++---- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/include/dbus.h b/include/dbus.h index db681b9..bc25295 100644 --- a/include/dbus.h +++ b/include/dbus.h @@ -55,8 +55,9 @@ void connman_dbus_property_append_dict(DBusMessageIter *iter, const char *key, connman_dbus_append_cb_t function, void *user_data); void connman_dbus_property_append_fixed_array(DBusMessageIter *iter, const char *key, int type, void *val, int len); -void connman_dbus_property_append_variable_array(DBusMessageIter *dict, - const char *key, int type, connman_dbus_append_cb_t function); +void connman_dbus_property_append_variable_array(DBusMessageIter *iter, + const char *key, int type, + connman_dbus_append_cb_t function, void *user_data); dbus_bool_t connman_dbus_property_changed_basic(const char *path, const char *interface, const char *key, @@ -121,7 +122,7 @@ static inline void connman_dbus_dict_append_variable_array(DBusMessageIter *dict dbus_message_iter_open_container(dict, DBUS_TYPE_DICT_ENTRY, NULL, &entry); connman_dbus_property_append_variable_array(&entry, key, - type, function); + type, function, NULL); dbus_message_iter_close_container(dict, &entry); } diff --git a/src/dbus.c b/src/dbus.c index dbf3623..2253eaf 100644 --- a/src/dbus.c +++ b/src/dbus.c @@ -168,7 +168,8 @@ void connman_dbus_property_append_fixed_array(DBusMessageIter *iter, } void connman_dbus_property_append_variable_array(DBusMessageIter *iter, - const char *key, int type, connman_dbus_append_cb_t function) + const char *key, int type, + connman_dbus_append_cb_t function, void *user_data) { DBusMessageIter value, array; const char *variant_sig, *array_sig; @@ -194,7 +195,7 @@ void connman_dbus_property_append_variable_array(DBusMessageIter *iter, dbus_message_iter_open_container(&value, DBUS_TYPE_ARRAY, array_sig, &array); if (function) - function(&array, NULL); + function(&array, user_data); dbus_message_iter_close_container(&value, &array); dbus_message_iter_close_container(iter, &value); diff --git a/src/device.c b/src/device.c index 63aa915..41b131b 100644 --- a/src/device.c +++ b/src/device.c @@ -505,7 +505,7 @@ static void emit_devices_signal(void) dbus_message_iter_init_append(signal, &iter); connman_dbus_property_append_variable_array(&iter, "Devices", - DBUS_TYPE_OBJECT_PATH, __connman_device_list); + DBUS_TYPE_OBJECT_PATH, __connman_device_list, NULL); g_dbus_send_message(connection, signal); } diff --git a/src/notifier.c b/src/notifier.c index 2f682f7..de371be 100644 --- a/src/notifier.c +++ b/src/notifier.c @@ -140,7 +140,7 @@ static void technology_registered(enum connman_service_type type, dbus_message_iter_init_append(signal, &iter); connman_dbus_property_append_variable_array(&iter, "AvailableTechnologies", DBUS_TYPE_STRING, - __connman_notifier_list_registered); + __connman_notifier_list_registered, NULL); g_dbus_send_message(connection, signal); } @@ -162,7 +162,7 @@ static void technology_enabled(enum connman_service_type type, dbus_message_iter_init_append(signal, &iter); connman_dbus_property_append_variable_array(&iter, "EnabledTechnologies", DBUS_TYPE_STRING, - __connman_notifier_list_enabled); + __connman_notifier_list_enabled, NULL); g_dbus_send_message(connection, signal); @@ -191,7 +191,7 @@ static void technology_connected(enum connman_service_type type, dbus_message_iter_init_append(signal, &iter); connman_dbus_property_append_variable_array(&iter, "ConnectedTechnologies", DBUS_TYPE_STRING, - __connman_notifier_list_connected); + __connman_notifier_list_connected, NULL); g_dbus_send_message(connection, signal); } diff --git a/src/profile.c b/src/profile.c index fe9ddb8..808a7c0 100644 --- a/src/profile.c +++ b/src/profile.c @@ -72,7 +72,7 @@ static void profiles_changed(void) dbus_message_iter_init_append(signal, &iter); connman_dbus_property_append_variable_array(&iter, "Profiles", - DBUS_TYPE_OBJECT_PATH, __connman_profile_list); + DBUS_TYPE_OBJECT_PATH, __connman_profile_list, NULL); g_dbus_send_message(connection, signal); } @@ -167,10 +167,10 @@ static gboolean services_changed(gpointer user_data) dbus_message_iter_init_append(signal, &iter); if (g_strcmp0(profile->ident, PROFILE_DEFAULT_IDENT) == 0) connman_dbus_property_append_variable_array(&iter, "Services", - DBUS_TYPE_OBJECT_PATH, __connman_service_list); + DBUS_TYPE_OBJECT_PATH, __connman_service_list, NULL); else connman_dbus_property_append_variable_array(&iter, "Services", - DBUS_TYPE_OBJECT_PATH, NULL); + DBUS_TYPE_OBJECT_PATH, NULL, NULL); g_dbus_send_message(connection, signal); @@ -184,7 +184,7 @@ static gboolean services_changed(gpointer user_data) dbus_message_iter_init_append(signal, &iter); connman_dbus_property_append_variable_array(&iter, "Services", - DBUS_TYPE_OBJECT_PATH, __connman_service_list); + DBUS_TYPE_OBJECT_PATH, __connman_service_list, NULL); g_dbus_send_message(connection, signal); -- 2.7.4