diff options
author | Johan Hedberg <johan.hedberg@nokia.com> | 2008-10-24 15:49:52 +0300 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2008-10-24 15:49:52 +0300 |
commit | a5883ecb1aa94b09bcf0e7ce4184d262027c5939 (patch) | |
tree | 80ce381543b85d61ea54f930a25d08ebabc1291c | |
parent | fffc600099fdd44e485fa4925a599d790424f881 (diff) |
Use g_dbus_send_message instead of dbus_connection_send
-rw-r--r-- | audio/headset.c | 9 | ||||
-rw-r--r-- | audio/sink.c | 9 | ||||
-rw-r--r-- | src/adapter.c | 12 | ||||
-rw-r--r-- | src/agent.c | 8 | ||||
-rw-r--r-- | src/dbus-common.c | 14 | ||||
-rw-r--r-- | src/dbus-hci.c | 7 | ||||
-rw-r--r-- | src/device.c | 6 | ||||
-rw-r--r-- | src/error.c | 7 |
8 files changed, 21 insertions, 51 deletions
diff --git a/audio/headset.c b/audio/headset.c index 107618e5..648185b5 100644 --- a/audio/headset.c +++ b/audio/headset.c @@ -540,8 +540,7 @@ static void sco_connect_cb(GIOChannel *chan, int err, const bdaddr_t *src, if (p->msg) { DBusMessage *reply = dbus_message_new_method_return(p->msg); - dbus_connection_send(dev->conn, reply, NULL); - dbus_message_unref(reply); + g_dbus_send_message(dev->conn, reply); } pending_connect_finalize(dev); @@ -610,8 +609,7 @@ static void hfp_slc_complete(struct audio_device *dev) if (p->target_state == HEADSET_STATE_CONNECTED) { if (p->msg) { DBusMessage *reply = dbus_message_new_method_return(p->msg); - dbus_connection_send(dev->conn, reply, NULL); - dbus_message_unref(reply); + g_dbus_send_message(dev->conn, reply); } pending_connect_finalize(dev); return; @@ -1216,8 +1214,7 @@ static void rfcomm_connect_cb(GIOChannel *chan, int err, const bdaddr_t *src, if (p->msg) { DBusMessage *reply = dbus_message_new_method_return(p->msg); - dbus_connection_send(dev->conn, reply, NULL); - dbus_message_unref(reply); + g_dbus_send_message(dev->conn, reply); } pending_connect_finalize(dev); diff --git a/audio/sink.c b/audio/sink.c index e216980a..ea8570ac 100644 --- a/audio/sink.c +++ b/audio/sink.c @@ -100,8 +100,7 @@ static void stream_state_changed(struct avdtp_stream *stream, sink->disconnect = NULL; reply = dbus_message_new_method_return(p->msg); - dbus_connection_send(p->conn, reply, NULL); - dbus_message_unref(reply); + g_dbus_send_message(p->conn, reply); pending_request_free(p); } @@ -168,8 +167,7 @@ static gboolean stream_setup_retry(gpointer user_data) DBusMessage *reply; debug("Stream successfully created, after XCASE connect:connect"); reply = dbus_message_new_method_return(pending->msg); - dbus_connection_send(pending->conn, reply, NULL); - dbus_message_unref(reply); + g_dbus_send_message(pending->conn, reply); } else { debug("Stream setup failed, after XCASE connect:connect"); error_failed(pending->conn, pending->msg, "Stream setup failed"); @@ -194,8 +192,7 @@ static void stream_setup_complete(struct avdtp *session, struct a2dp_sep *sep, DBusMessage *reply; sink->connect = NULL; reply = dbus_message_new_method_return(pending->msg); - dbus_connection_send(pending->conn, reply, NULL); - dbus_message_unref(reply); + g_dbus_send_message(pending->conn, reply); pending_request_free(pending); debug("Stream successfully created"); } else { 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; } |