Add Ctrl+A and Ctrl+Shift+A keyboard shortcuts for select/deselect all
- Register select-all-images and deselect-all-images actions - Wire Ctrl+A to clear exclusion set, Ctrl+Shift+A to exclude all - Both shortcuts update checkbox state and count label in images step - Make set_all_checkboxes_in public for cross-module access
This commit is contained in:
@@ -437,7 +437,7 @@ fn build_loaded_state(state: &AppState) -> gtk::Box {
|
||||
&& let Some(stack) = parent.downcast_ref::<gtk::Stack>()
|
||||
&& let Some(loaded_widget) = stack.child_by_name("loaded")
|
||||
{
|
||||
set_all_checkboxes(&loaded_widget, true);
|
||||
set_all_checkboxes_in(&loaded_widget, true);
|
||||
update_count_label(&loaded_widget, &loaded, &excl);
|
||||
}
|
||||
});
|
||||
@@ -459,7 +459,7 @@ fn build_loaded_state(state: &AppState) -> gtk::Box {
|
||||
&& let Some(stack) = parent.downcast_ref::<gtk::Stack>()
|
||||
&& let Some(loaded_widget) = stack.child_by_name("loaded")
|
||||
{
|
||||
set_all_checkboxes(&loaded_widget, false);
|
||||
set_all_checkboxes_in(&loaded_widget, false);
|
||||
update_count_label(&loaded_widget, &loaded, &excl);
|
||||
}
|
||||
});
|
||||
@@ -498,14 +498,14 @@ fn build_loaded_state(state: &AppState) -> gtk::Box {
|
||||
}
|
||||
|
||||
/// Set all CheckButton widgets within a container to a given state
|
||||
fn set_all_checkboxes(widget: >k::Widget, active: bool) {
|
||||
pub fn set_all_checkboxes_in(widget: >k::Widget, active: bool) {
|
||||
if let Some(check) = widget.downcast_ref::<gtk::CheckButton>() {
|
||||
check.set_active(active);
|
||||
return; // Don't recurse into CheckButton children
|
||||
}
|
||||
let mut child = widget.first_child();
|
||||
while let Some(c) = child {
|
||||
set_all_checkboxes(&c, active);
|
||||
set_all_checkboxes_in(&c, active);
|
||||
child = c.next_sibling();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user