diff options
author | Paulo Borges <paulo.borges@openbossa.org> | 2013-03-20 19:26:36 -0300 |
---|---|---|
committer | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2013-03-24 13:22:03 +0100 |
commit | 92c1273507a481ccff659a0e10b310da2348f834 (patch) | |
tree | 4536aacd47e2d5ea0996f66225446cb623cef986 /dundee | |
parent | 2226e57dfa7233172a6cab8dd0bad676c0d343a2 (diff) | |
download | ofono-92c1273507a481ccff659a0e10b310da2348f834.tar.bz2 |
dundee: Listen to devices property changes
When a bluetooth device property change and this property is Alias,
we need to refresh our representation of this device.
Diffstat (limited to 'dundee')
-rw-r--r-- | dundee/bluez5.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/dundee/bluez5.c b/dundee/bluez5.c index 90808480..d9114fae 100644 --- a/dundee/bluez5.c +++ b/dundee/bluez5.c @@ -133,6 +133,20 @@ static gboolean has_dun_uuid(DBusMessageIter *array) return FALSE; } +static void alias_changed(GDBusProxy *proxy, const char *name, + DBusMessageIter *iter, void *user_data) +{ + const char *alias; + struct bluetooth_device *bt_device = user_data; + + if (!g_str_equal("Alias", name)) + return; + + dbus_message_iter_get_basic(iter, &alias); + + bt_device->name = g_strdup(alias); +} + static void bluetooth_device_removed(GDBusProxy *proxy, void *user_data) { struct bluetooth_device *bt_device = user_data; @@ -161,6 +175,7 @@ static void proxy_added(GDBusProxy *proxy, void *user_data) return; bt_device = bluetooth_device_register(proxy); + g_dbus_proxy_set_property_watch(proxy, alias_changed, bt_device); g_dbus_proxy_set_removed_watch(proxy, bluetooth_device_removed, bt_device); } |