summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-12-20 09:57:00 +0100
committerMarcel Holtmann <marcel@holtmann.org>2008-12-20 09:57:00 +0100
commit92e0a18ae86c7a0c57291b52e218c575357b51a5 (patch)
tree5715aca804c9ec569fc49d254fa1c47e01f66597 /src
parent1b09f16734254d423730310502fe353c5ec8759f (diff)
Send PropertyChanged signal for added or removed adapters
Diffstat (limited to 'src')
-rw-r--r--src/manager.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/manager.c b/src/manager.c
index 9714dfa3..6a365306 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -403,16 +403,37 @@ GSList *manager_get_adapters(void)
return adapters;
}
+static void manager_update_adapters(void)
+{
+ GSList *list;
+ char **array;
+ int i;
+
+ array = g_new0(char *, g_slist_length(adapters) + 1);
+ for (i = 0, list = adapters; list; list = list->next, i++) {
+ struct btd_adapter *adapter = list->data;
+ array[i] = (char *) adapter_get_path(adapter);
+ }
+
+ emit_array_property_changed(connection, "/",
+ MANAGER_INTERFACE, "Adpaters",
+ DBUS_TYPE_OBJECT_PATH, &array);
+
+ g_free(array);
+}
+
static void manager_add_adapter(struct btd_adapter *adapter)
{
const gchar *path = adapter_get_path(adapter);
+ adapters = g_slist_append(adapters, adapter);
+
g_dbus_emit_signal(connection, "/",
MANAGER_INTERFACE, "AdapterAdded",
DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_INVALID);
- adapters = g_slist_append(adapters, adapter);
+ manager_update_adapters();
if (default_adapter_id < 0) {
int new_default = hci_get_route(NULL);
@@ -431,6 +452,8 @@ static void manager_remove_adapter(struct btd_adapter *adapter)
DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_INVALID);
+ manager_update_adapters();
+
if (default_adapter_id == dev_id || default_adapter_id < 0) {
int new_default = hci_get_route(NULL);