diff options
author | Luiz Augusto von Dentz <luiz.dentz@openbossa.org> | 2007-08-13 17:16:12 +0000 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.dentz@openbossa.org> | 2007-08-13 17:16:12 +0000 |
commit | 8f0de90a8fd518bc5a1b0c63a6b9d2357375a287 (patch) | |
tree | 3d54b32f1782a845bc1fa84c24ba390acbf9eb10 /audio/manager.c | |
parent | 6d48df39064d820d101653714211ea4eb2aa6282 (diff) |
Fix RemoveDevice bug that prevent its removal from storage.
Diffstat (limited to 'audio/manager.c')
-rw-r--r-- | audio/manager.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/audio/manager.c b/audio/manager.c index 7a650054..231af376 100644 --- a/audio/manager.c +++ b/audio/manager.c @@ -862,20 +862,19 @@ static DBusHandlerResult am_remove_device(DBusConnection *conn, return DBUS_HANDLER_RESULT_NEED_MEMORY; device = match->data; - remove_device(device); + device_remove_stored(device); - if (default_dev == device) { + /* Fallback to a valid default */ + if (default_dev == NULL) { const char *param; GSList *l; - default_dev = NULL; - - for (l = devices; l != NULL; l = l->next) { - device = l->data; + default_dev = manager_get_connected_device(); - if (device->headset) - default_dev = device; + if (!default_dev) { + l = devices; + default_dev = (g_slist_last(l))->data; } param = default_dev ? default_dev->path : ""; @@ -885,6 +884,14 @@ static DBusHandlerResult am_remove_device(DBusConnection *conn, "DefaultHeadsetChanged", DBUS_TYPE_STRING, ¶m, DBUS_TYPE_INVALID); + + dbus_connection_emit_signal(conn, AUDIO_MANAGER_PATH, + AUDIO_MANAGER_INTERFACE, + "DefaultDeviceChanged", + DBUS_TYPE_STRING, ¶m, + DBUS_TYPE_INVALID); + + device_store(default_dev, TRUE); } dbus_connection_emit_signal(conn, AUDIO_MANAGER_PATH, |