From 871c4456961a38f46dfd205d7238b4e4b53bde0a Mon Sep 17 00:00:00 2001 From: Leonhard Date: Tue, 13 Feb 2024 01:56:10 +0100 Subject: [PATCH 1/3] Fix removing devices --- src/DeviceRow.vala | 1 - src/OutputPanel.vala | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/DeviceRow.vala b/src/DeviceRow.vala index 9ff7fecb..78ecaa12 100644 --- a/src/DeviceRow.vala +++ b/src/DeviceRow.vala @@ -74,7 +74,6 @@ public class Sound.DeviceRow : Gtk.ListBoxRow { device.bind_property ("display-name", name_label, "label"); device.bind_property ("description", description_label, "label"); - device.removed.connect (() => destroy ()); device.notify["is-default"].connect (() => { ignore_default = true; activate_radio.active = device.is_default; diff --git a/src/OutputPanel.vala b/src/OutputPanel.vala index 0ebcbeb4..b8e8eb32 100644 --- a/src/OutputPanel.vala +++ b/src/OutputPanel.vala @@ -277,6 +277,8 @@ public class Sound.OutputPanel : Gtk.Box { device_row.set_as_default.connect (() => { pam.set_default_device.begin (device); }); + + device.removed.connect (() => devices_listbox.remove (device_row)); } private void notify_change () { From c683f78e1d89aa14dc2796c45f106350b95fd7c2 Mon Sep 17 00:00:00 2001 From: Leonhard Date: Tue, 13 Feb 2024 01:56:55 +0100 Subject: [PATCH 2/3] Same for input panel --- src/InputPanel.vala | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/InputPanel.vala b/src/InputPanel.vala index 28a473c3..3fb0be1e 100644 --- a/src/InputPanel.vala +++ b/src/InputPanel.vala @@ -177,5 +177,7 @@ public class Sound.InputPanel : Gtk.Box { device_row.set_as_default.connect (() => { pam.set_default_device.begin (device); }); + + device.removed.connect (() => devices_listbox.remove (device_row)); } } From 47d26c2b0747496818c5014612bff0365f9d8689 Mon Sep 17 00:00:00 2001 From: Leonhard Date: Wed, 14 Feb 2024 21:30:59 +0100 Subject: [PATCH 3/3] Fix port selection --- src/PulseAudioManager.vala | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/PulseAudioManager.vala b/src/PulseAudioManager.vala index f721f04e..1f213ec0 100644 --- a/src/PulseAudioManager.vala +++ b/src/PulseAudioManager.vala @@ -466,8 +466,12 @@ public class Sound.PulseAudioManager : GLib.Object { device.card_source_index = (int)source.index; device.card_source_name = source.name; debug ("\t\t\tdevice.card_source_name: %s", device.card_source_name); - if (source.active_port != null && device.port_name == source.active_port.name) { + + if (source.active_port != null) { device.card_source_port_name = source.active_port.name; + } + + if (source.active_port != null && device.port_name == source.active_port.name) { device.source_name = source.name; debug ("\t\t\tdevice.source_name: %s", device.card_source_name); device.source_index = (int)source.index; @@ -535,8 +539,11 @@ public class Sound.PulseAudioManager : GLib.Object { device.card_sink_name = sink.name; debug ("\t\t\tdevice.card_sink_name: %s", device.card_sink_name); - if (sink.active_port != null && device.port_name == sink.active_port.name) { + if (sink.active_port != null) { device.card_sink_port_name = sink.active_port.name; + } + + if (sink.active_port != null && device.port_name == sink.active_port.name) { device.sink_name = sink.name; debug ("\t\t\tdevice.sink_name: %s", device.card_sink_name); device.sink_index = (int)sink.index;