summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2008-10-24 15:49:52 +0300
committerJohan Hedberg <johan.hedberg@nokia.com>2008-10-24 15:49:52 +0300
commita5883ecb1aa94b09bcf0e7ce4184d262027c5939 (patch)
tree80ce381543b85d61ea54f930a25d08ebabc1291c /src
parentfffc600099fdd44e485fa4925a599d790424f881 (diff)
Use g_dbus_send_message instead of dbus_connection_send
Diffstat (limited to 'src')
-rw-r--r--src/adapter.c12
-rw-r--r--src/agent.c8
-rw-r--r--src/dbus-common.c14
-rw-r--r--src/dbus-hci.c7
-rw-r--r--src/device.c6
-rw-r--r--src/error.c7
6 files changed, 15 insertions, 39 deletions
diff --git a/src/adapter.c b/src/adapter.c
index bf65acea..f1f4222c 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -762,14 +762,12 @@ static void confirm_mode_cb(struct agent *agent, DBusError *err, void *data)
if (err && dbus_error_is_set(err)) {
reply = dbus_message_new_error(req->msg, err->name, err->message);
- dbus_connection_send(req->conn, reply, NULL);
- dbus_message_unref(reply);
+ g_dbus_send_message(req->conn, reply);
goto cleanup;
}
reply = set_mode(req->conn, req->msg, req->mode, req->adapter);
- dbus_connection_send(req->conn, reply, NULL);
- dbus_message_unref(reply);
+ g_dbus_send_message(req->conn, reply);
if (!find_session(req->adapter->mode_sessions, req->msg))
goto cleanup;
@@ -923,10 +921,8 @@ static void reply_authentication_failure(struct bonding_request_info *bonding)
bonding->hci_status : HCI_AUTHENTICATION_FAILURE;
reply = new_authentication_return(bonding->msg, status);
- if (reply) {
- dbus_connection_send(bonding->conn, reply, NULL);
- dbus_message_unref(reply);
- }
+ if (reply)
+ g_dbus_send_message(bonding->conn, reply);
}
struct btd_device *adapter_find_device(struct btd_adapter *adapter, const char *dest)
diff --git a/src/agent.c b/src/agent.c
index c4c9b27d..d8f1b34c 100644
--- a/src/agent.c
+++ b/src/agent.c
@@ -103,9 +103,7 @@ static void agent_release(struct agent *agent)
dbus_message_set_no_reply(message, TRUE);
- dbus_connection_send(connection, message, NULL);
-
- dbus_message_unref(message);
+ g_dbus_send_message(connection, message);
}
static int send_cancel_request(struct agent_request *req)
@@ -121,9 +119,7 @@ static int send_cancel_request(struct agent_request *req)
dbus_message_set_no_reply(message, TRUE);
- dbus_connection_send(connection, message, NULL);
-
- dbus_message_unref(message);
+ g_dbus_send_message(connection, message);
return 0;
}
diff --git a/src/dbus-common.c b/src/dbus-common.c
index 60662398..de42769e 100644
--- a/src/dbus-common.c
+++ b/src/dbus-common.c
@@ -314,7 +314,6 @@ dbus_bool_t emit_property_changed(DBusConnection *conn,
{
DBusMessage *signal;
DBusMessageIter iter;
- gboolean ret;
signal = dbus_message_new_signal(path, interface, "PropertyChanged");
@@ -330,11 +329,7 @@ dbus_bool_t emit_property_changed(DBusConnection *conn,
append_variant(&iter, type, value);
- ret = dbus_connection_send(conn, signal, NULL);
-
- dbus_message_unref(signal);
-
- return ret;
+ return g_dbus_send_message(conn, signal);
}
dbus_bool_t emit_array_property_changed(DBusConnection *conn,
@@ -345,7 +340,6 @@ dbus_bool_t emit_array_property_changed(DBusConnection *conn,
{
DBusMessage *signal;
DBusMessageIter iter;
- gboolean ret;
signal = dbus_message_new_signal(path, interface, "PropertyChanged");
@@ -361,9 +355,5 @@ dbus_bool_t emit_array_property_changed(DBusConnection *conn,
append_array_variant(&iter, type, value);
- ret = dbus_connection_send(conn, signal, NULL);
-
- dbus_message_unref(signal);
-
- return ret;
+ return g_dbus_send_message(conn, signal);
}
diff --git a/src/dbus-hci.c b/src/dbus-hci.c
index 9ee2e09b..a043406d 100644
--- a/src/dbus-hci.c
+++ b/src/dbus-hci.c
@@ -877,9 +877,7 @@ static void emit_device_found(const char *path, const char *address,
append_dict_valist(&iter, first_key, var_args);
va_end(var_args);
- dbus_connection_send(connection, signal, NULL);
-
- dbus_message_unref(signal);
+ g_dbus_send_message(connection, signal);
}
void hcid_dbus_inquiry_result(bdaddr_t *local, bdaddr_t *peer, uint32_t class,
@@ -1208,8 +1206,7 @@ void hcid_dbus_disconn_complete(bdaddr_t *local, uint8_t status,
} else {
reply = new_authentication_return(bonding->msg,
HCI_AUTHENTICATION_FAILURE);
- dbus_connection_send(connection, reply, NULL);
- dbus_message_unref(reply);
+ g_dbus_send_message(connection, reply);
}
adapter_free_bonding_request(adapter);
}
diff --git a/src/device.c b/src/device.c
index ab3017cd..031b5f4d 100644
--- a/src/device.c
+++ b/src/device.c
@@ -813,8 +813,7 @@ static void discover_device_reply(struct browse_req *req, sdp_list_t *recs)
dbus_message_iter_close_container(&iter, &dict);
- dbus_connection_send(req->conn, reply, NULL);
- dbus_message_unref(reply);
+ g_dbus_send_message(req->conn, reply);
}
static void services_changed(struct btd_device *device)
@@ -1050,8 +1049,7 @@ proceed:
dbus_message_append_args(reply, DBUS_TYPE_OBJECT_PATH, &device->path,
DBUS_TYPE_INVALID);
- dbus_connection_send(req->conn, reply, NULL);
- dbus_message_unref(reply);
+ g_dbus_send_message(req->conn, reply);
cleanup:
browse_req_free(req);
diff --git a/src/error.c b/src/error.c
index 2f5fc7e0..d7c9d3ca 100644
--- a/src/error.c
+++ b/src/error.c
@@ -27,6 +27,8 @@
#include <config.h>
#endif
+#include <gdbus.h>
+
#include "error.h"
/* Helper function - internal use only */
@@ -34,7 +36,6 @@ DBusHandlerResult error_common_reply(DBusConnection *conn, DBusMessage *msg,
const char *name, const char *descr)
{
DBusMessage *derr;
- dbus_bool_t ret;
if (!conn || !msg)
return DBUS_HANDLER_RESULT_HANDLED;
@@ -43,9 +44,7 @@ DBusHandlerResult error_common_reply(DBusConnection *conn, DBusMessage *msg,
if (!derr)
return DBUS_HANDLER_RESULT_NEED_MEMORY;
- ret = dbus_connection_send(conn, derr, NULL);
-
- dbus_message_unref(derr);
+ g_dbus_send_message(conn, derr);
return DBUS_HANDLER_RESULT_HANDLED;
}