summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2007-05-09 19:59:18 +0000
committerLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2007-05-09 19:59:18 +0000
commitbec9d1838bc0bf9e8ee21f452b6e0431a3abe0bf (patch)
treedf7fb343867fadf3164ac09a911952026613b4fe
parente8db465169591d3f77056294699c30113fe5206a (diff)
Use dbus_connection_emit_signal to emit signals.
-rw-r--r--network/connection.c20
-rw-r--r--network/manager.c28
-rw-r--r--network/server.c18
3 files changed, 26 insertions, 40 deletions
diff --git a/network/connection.c b/network/connection.c
index cd963dad..d565fea2 100644
--- a/network/connection.c
+++ b/network/connection.c
@@ -79,13 +79,12 @@ static gboolean bnep_watchdog_cb(GIOChannel *chan, GIOCondition cond,
gpointer data)
{
struct network_conn *nc = data;
- DBusMessage *signal;
if (nc->conn != NULL) {
- signal = dbus_message_new_signal(nc->path,
- NETWORK_CONNECTION_INTERFACE, "Disconnected");
-
- send_message_and_unref(nc->conn, signal);
+ dbus_connection_emit_signal(nc->conn, nc->path,
+ NETWORK_CONNECTION_INTERFACE,
+ "Disconnected",
+ DBUS_TYPE_INVALID);
}
info("%s disconnected", nc->dev);
nc->state = DISCONNECTED;
@@ -103,7 +102,7 @@ static gboolean bnep_connect_cb(GIOChannel *chan, GIOCondition cond,
char pkt[BNEP_MTU];
gsize r;
int sk;
- DBusMessage *reply, *signal;
+ DBusMessage *reply;
const char *pdev;
if (cond & G_IO_NVAL)
@@ -157,11 +156,10 @@ static gboolean bnep_connect_cb(GIOChannel *chan, GIOCondition cond,
}
bnep_if_up(nc->dev, TRUE);
-
- signal = dbus_message_new_signal(nc->path,
- NETWORK_CONNECTION_INTERFACE, "Connected");
-
- send_message_and_unref(nc->conn, signal);
+ dbus_connection_emit_signal(nc->conn, nc->path,
+ NETWORK_CONNECTION_INTERFACE,
+ "Connected",
+ DBUS_TYPE_INVALID);
reply = dbus_message_new_method_return(nc->msg);
diff --git a/network/manager.c b/network/manager.c
index 07f30d46..b61233c9 100644
--- a/network/manager.c
+++ b/network/manager.c
@@ -94,18 +94,14 @@ static DBusHandlerResult create_path(DBusConnection *conn,
DBusMessage *msg, const char *path,
const char *sname)
{
- DBusMessage *reply, *signal;
+ DBusMessage *reply;
/* emit signal when it is a new path */
if (sname) {
- signal = dbus_message_new_signal(NETWORK_PATH,
- NETWORK_MANAGER_INTERFACE, sname);
-
- dbus_message_append_args(signal,
- DBUS_TYPE_STRING, &path,
- DBUS_TYPE_INVALID);
-
- send_message_and_unref(conn, signal);
+ dbus_connection_emit_signal(conn, NETWORK_PATH,
+ NETWORK_MANAGER_INTERFACE,
+ sname, DBUS_TYPE_STRING, &path,
+ DBUS_TYPE_INVALID);
}
reply = dbus_message_new_method_return(msg);
@@ -148,7 +144,7 @@ static DBusHandlerResult remove_path(DBusConnection *conn,
const char *sname)
{
const char *path;
- DBusMessage *reply, *signal;
+ DBusMessage *reply;
DBusError derr;
GSList *l;
@@ -180,14 +176,10 @@ static DBusHandlerResult remove_path(DBusConnection *conn,
if (!dbus_connection_destroy_object_path(conn, path))
error("Network path unregister failed");
- signal = dbus_message_new_signal(NETWORK_PATH,
- NETWORK_MANAGER_INTERFACE, sname);
-
- dbus_message_append_args(signal,
- DBUS_TYPE_STRING, &path,
- DBUS_TYPE_INVALID);
-
- send_message_and_unref(conn, signal);
+ dbus_connection_emit_signal(conn, NETWORK_PATH,
+ NETWORK_MANAGER_INTERFACE,
+ sname, DBUS_TYPE_STRING, &path,
+ DBUS_TYPE_INVALID);
return send_message_and_unref(conn, reply);
}
diff --git a/network/server.c b/network/server.c
index 077c63b9..8abbc592 100644
--- a/network/server.c
+++ b/network/server.c
@@ -773,7 +773,7 @@ static DBusHandlerResult enable(DBusConnection *conn,
DBusMessage *msg, void *data)
{
struct network_server *ns = data;
- DBusMessage *reply, *signal;
+ DBusMessage *reply;
int err;
if (ns->io)
@@ -800,10 +800,8 @@ static DBusHandlerResult enable(DBusConnection *conn,
store_property(&ns->src, ns->id, "enabled", "1");
- signal = dbus_message_new_signal(ns->path,
- NETWORK_SERVER_INTERFACE, "Enabled");
-
- send_message_and_unref(conn, signal);
+ dbus_connection_emit_signal(conn, ns->path, NETWORK_SERVER_INTERFACE,
+ "Enabled", DBUS_TYPE_INVALID);
return send_message_and_unref(conn, reply);
}
@@ -812,7 +810,7 @@ static DBusHandlerResult disable(DBusConnection *conn,
DBusMessage *msg, void *data)
{
struct network_server *ns = data;
- DBusMessage *reply, *signal;
+ DBusMessage *reply;
reply = dbus_message_new_method_return(msg);
if (!reply)
@@ -823,7 +821,7 @@ static DBusHandlerResult disable(DBusConnection *conn,
/* Remove the service record */
if (ns->record_id) {
- remove_server_record(conn, ns->record_id);
+ remove_server_record(conn, ns->record_id);
ns->record_id = 0;
}
@@ -833,10 +831,8 @@ static DBusHandlerResult disable(DBusConnection *conn,
store_property(&ns->src, ns->id, "enabled", "0");
- signal = dbus_message_new_signal(ns->path,
- NETWORK_SERVER_INTERFACE, "Disabled");
-
- send_message_and_unref(conn, signal);
+ dbus_connection_emit_signal(conn, ns->path, NETWORK_SERVER_INTERFACE,
+ "Disabled", DBUS_TYPE_INVALID);
return send_message_and_unref(conn, reply);
}