obexd: Use g_dbus_dict_append_entry()
diff --git a/obexd/client/ftp.c b/obexd/client/ftp.c
index 3628657..f4923b3 100644
--- a/obexd/client/ftp.c
+++ b/obexd/client/ftp.c
@@ -115,7 +115,7 @@
DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING
DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &dict);
- obex_dbus_dict_append(&dict, "Type", DBUS_TYPE_STRING, &element);
+ g_dbus_dict_append_entry(&dict, "Type", DBUS_TYPE_STRING, &element);
/* FIXME: User, Group, Other permission must be reviewed */
@@ -125,10 +125,10 @@
if (g_str_equal("Size", key) == TRUE) {
guint64 size;
size = g_ascii_strtoll(values[i], NULL, 10);
- obex_dbus_dict_append(&dict, key, DBUS_TYPE_UINT64,
+ g_dbus_dict_append_entry(&dict, key, DBUS_TYPE_UINT64,
&size);
} else
- obex_dbus_dict_append(&dict, key, DBUS_TYPE_STRING,
+ g_dbus_dict_append_entry(&dict, key, DBUS_TYPE_STRING,
&values[i]);
}
diff --git a/obexd/client/map.c b/obexd/client/map.c
index 4c6d676..d1c8976 100644
--- a/obexd/client/map.c
+++ b/obexd/client/map.c
@@ -231,8 +231,9 @@
for (i = 0, key = names[i]; key; key = names[++i]) {
if (strcasecmp("name", key) == 0)
- obex_dbus_dict_append(&dict, "Name", DBUS_TYPE_STRING,
- &values[i]);
+ g_dbus_dict_append_entry(&dict, "Name",
+ DBUS_TYPE_STRING,
+ &values[i]);
}
dbus_message_iter_close_container(iter, &dict);
diff --git a/obexd/plugins/bluetooth.c b/obexd/plugins/bluetooth.c
index d6028d1..ba1e0a9 100644
--- a/obexd/plugins/bluetooth.c
+++ b/obexd/plugins/bluetooth.c
@@ -231,40 +231,6 @@
g_free(profile);
}
-static void append_variant(DBusMessageIter *iter, int type, void *val)
-{
- DBusMessageIter value;
- char sig[2] = { type, '\0' };
-
- dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT, sig, &value);
-
- dbus_message_iter_append_basic(&value, type, val);
-
- dbus_message_iter_close_container(iter, &value);
-}
-
-
-static void dict_append_entry(DBusMessageIter *dict,
- const char *key, int type, void *val)
-{
- DBusMessageIter entry;
-
- if (type == DBUS_TYPE_STRING) {
- const char *str = *((const char **) val);
- if (str == NULL)
- return;
- }
-
- dbus_message_iter_open_container(dict, DBUS_TYPE_DICT_ENTRY,
- NULL, &entry);
-
- dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &key);
-
- append_variant(&entry, type, val);
-
- dbus_message_iter_close_container(dict, &entry);
-}
-
static int register_profile(struct bluetooth_profile *profile)
{
DBusMessage *msg;
@@ -303,7 +269,7 @@
DBUS_TYPE_VARIANT_AS_STRING
DBUS_DICT_ENTRY_END_CHAR_AS_STRING,
&opt);
- dict_append_entry(&opt, "AutoConnect", DBUS_TYPE_BOOLEAN,
+ g_dbus_dict_append_entry(&opt, "AutoConnect", DBUS_TYPE_BOOLEAN,
&auto_connect);
if (profile->driver->record) {
if (profile->driver->port != 0)
@@ -315,8 +281,8 @@
xml = g_markup_printf_escaped(profile->driver->record,
profile->driver->channel,
profile->driver->name);
- dict_append_entry(&opt, "ServiceRecord", DBUS_TYPE_STRING,
- &xml);
+ g_dbus_dict_append_entry(&opt, "ServiceRecord",
+ DBUS_TYPE_STRING, &xml);
g_free(xml);
}
dbus_message_iter_close_container(&iter, &opt);