summaryrefslogtreecommitdiffstats
path: root/serial
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2007-08-10 20:18:21 +0000
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2007-08-10 20:18:21 +0000
commit609a9e3c7876e30ba9538cbc406ca17b3addc806 (patch)
treeee6e557760a98aa220dcc45f8587287cded49739 /serial
parentef00bdddbc2a37b1e0b8d0b4ad8430352d45c21b (diff)
serial: RemoveProxy implementation
Diffstat (limited to 'serial')
-rw-r--r--serial/manager.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/serial/manager.c b/serial/manager.c
index 913ea540..072457e4 100644
--- a/serial/manager.c
+++ b/serial/manager.c
@@ -1099,7 +1099,35 @@ static DBusHandlerResult list_proxies(DBusConnection *conn,
static DBusHandlerResult remove_proxy(DBusConnection *conn,
DBusMessage *msg, void *data)
{
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ const char *path;
+ GSList *l;
+ DBusError derr;
+
+ dbus_error_init(&derr);
+ if (!dbus_message_get_args(msg, &derr,
+ DBUS_TYPE_STRING, &path,
+ DBUS_TYPE_INVALID)) {
+ err_invalid_args(conn, msg, derr.message);
+ dbus_error_free(&derr);
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
+
+ l = g_slist_find_custom(proxies_paths, path, (GCompareFunc) strcmp);
+ if (!l)
+ return err_does_not_exist(conn, msg, "Invalid proxy path");
+
+ g_free(l->data);
+ proxies_paths = g_slist_remove(proxies_paths, l->data);
+
+ dbus_connection_destroy_object_path(conn, path);
+
+ dbus_connection_emit_signal(conn, SERIAL_MANAGER_PATH,
+ SERIAL_MANAGER_INTERFACE, "ProxyRemoved",
+ DBUS_TYPE_STRING, &path,
+ DBUS_TYPE_INVALID);
+
+ return send_message_and_unref(conn,
+ dbus_message_new_method_return(msg));
}
static DBusHandlerResult connect_service(DBusConnection *conn,