fix: Use break instead of return in audio boxes

This commit is contained in:
dashie 2023-12-16 16:15:32 +00:00
parent 02fb844160
commit 383d4bf61d
6 changed files with 12 additions and 8 deletions

View file

@ -81,6 +81,7 @@ impl OutputStreamEntry {
for entry in 0..*index {
if model_list.string(entry) == Some(name.2.clone().into()) {
imp.reset_source_selection.set_selected(entry);
break;
}
}
} else {
@ -92,6 +93,7 @@ impl OutputStreamEntry {
for entry in 0..*index {
if model_list.string(entry) == Some(name.alias.clone().into()) {
imp.reset_source_selection.set_selected(entry);
break;
}
}
}

View file

@ -166,7 +166,7 @@ pub fn populate_sources(input_box: Arc<SourceBox>) {
for entry in 0..*index {
if model_list.string(entry) == Some(name.alias.clone().into()) {
input_box_imp.reset_source_dropdown.set_selected(entry);
return;
break;
}
}
input_box_imp.reset_source_dropdown.connect_selected_notify(
@ -261,7 +261,7 @@ pub fn refresh_default_source(new_source: Source, input_box: Arc<SourceBox>, ent
for entry in 0..*imp.reset_model_index.read().unwrap() {
if model_list.string(entry) == Some(new_source.alias.clone().into()) {
imp.reset_source_dropdown.set_selected(entry);
return;
break;
}
}
}
@ -471,7 +471,7 @@ pub fn start_input_box_listener(conn: Connection, source_box: Arc<SourceBox>) ->
for entry in 0..*index {
if model_list.string(entry) == Some(alias.clone().into()) {
model_list.remove(entry);
return;
break;
}
}
if *index > 1 {
@ -612,6 +612,7 @@ pub fn start_input_box_listener(conn: Connection, source_box: Arc<SourceBox>) ->
for entry in 0..*index {
if model_list.string(entry) == Some(alias.clone().into()) {
imp.reset_source_selection.set_selected(entry);
break;
}
}
});

View file

@ -90,6 +90,7 @@ impl InputStreamEntry {
for entry in 0..*index {
if model_list.string(entry) == Some(name.2.clone().into()) {
imp.reset_sink_selection.set_selected(entry);
break;
}
}
} else {
@ -101,6 +102,7 @@ impl InputStreamEntry {
for entry in 0..*index {
if model_list.string(entry) == Some(name.alias.clone().into()) {
imp.reset_sink_selection.set_selected(entry);
break;
}
}
}

View file

@ -1,4 +1,3 @@
pub mod audio_box;
pub mod input_stream_entry;
pub mod input_stream_entry_impl;
pub mod sink_box;

View file

@ -169,7 +169,7 @@ pub fn populate_sinks(output_box: Arc<SinkBox>) {
for entry in 0..*index {
if model_list.string(entry) == Some(name.alias.clone().into()) {
output_box_imp.reset_sink_dropdown.set_selected(entry);
return;
break;
}
}
output_box_imp.reset_sink_dropdown.connect_selected_notify(
@ -265,7 +265,7 @@ pub fn refresh_default_sink(new_sink: Sink, output_box: Arc<SinkBox>, entry: boo
for entry in 0..*index {
if model_list.string(entry) == Some(new_sink.alias.clone().into()) {
imp.reset_sink_dropdown.set_selected(entry);
return;
break;
}
}
}
@ -474,7 +474,7 @@ pub fn start_output_box_listener(conn: Connection, sink_box: Arc<SinkBox>) -> Co
for entry in 0..*index {
if model_list.string(entry) == Some(alias.clone().into()) {
model_list.remove(entry);
return;
break;
}
}
if *index > 1 {
@ -611,7 +611,7 @@ pub fn start_output_box_listener(conn: Connection, sink_box: Arc<SinkBox>) -> Co
for entry in 0..*index {
if model_list.string(entry) == Some(alias.clone().into()) {
imp.reset_sink_selection.set_selected(entry);
return;
break;
}
}
});