Improve output step with individual operation summary rows
Replace single-line arrow-delimited summary with a proper ListBox showing each enabled operation as its own row with check icons. Dynamically rebuilt when navigating to the output step. Also make walk_widgets public for cross-module use.
This commit is contained in:
@@ -2518,25 +2518,30 @@ fn update_output_summary(ui: &WizardUi) {
|
||||
}
|
||||
}
|
||||
|
||||
let summary_text = if ops.is_empty() {
|
||||
"No operations configured".to_string()
|
||||
} else {
|
||||
ops.join(" -> ")
|
||||
};
|
||||
|
||||
// Find the ops-summary-list ListBox and populate it
|
||||
walk_widgets(&page.child(), &|widget| {
|
||||
if let Some(row) = widget.downcast_ref::<adw::ActionRow>() {
|
||||
let subtitle_str = row.subtitle().unwrap_or_default();
|
||||
if row.title().as_str() == "No operations configured"
|
||||
|| subtitle_str.contains("->")
|
||||
|| subtitle_str.contains("configured")
|
||||
{
|
||||
if ops.is_empty() {
|
||||
row.set_title("No operations configured");
|
||||
row.set_subtitle("Go back and configure your workflow settings");
|
||||
} else {
|
||||
row.set_title(&format!("{} operations", ops.len()));
|
||||
row.set_subtitle(&summary_text);
|
||||
if let Some(list_box) = widget.downcast_ref::<gtk::ListBox>()
|
||||
&& list_box.widget_name().as_str() == "ops-summary-list"
|
||||
{
|
||||
// Clear existing rows
|
||||
while let Some(child) = list_box.first_child() {
|
||||
list_box.remove(&child);
|
||||
}
|
||||
|
||||
if ops.is_empty() {
|
||||
let row = adw::ActionRow::builder()
|
||||
.title("No operations configured")
|
||||
.subtitle("Go back and configure your workflow settings")
|
||||
.build();
|
||||
row.add_prefix(>k::Image::from_icon_name("dialog-information-symbolic"));
|
||||
list_box.append(&row);
|
||||
} else {
|
||||
for op in &ops {
|
||||
let row = adw::ActionRow::builder()
|
||||
.title(op.as_str())
|
||||
.build();
|
||||
row.add_prefix(>k::Image::from_icon_name("emblem-ok-symbolic"));
|
||||
list_box.append(&row);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2568,7 +2573,7 @@ fn find_widget_by_type<T: IsA<gtk::Widget>>(page: &adw::NavigationPage) -> Optio
|
||||
result.into_inner()
|
||||
}
|
||||
|
||||
fn walk_widgets(widget: &Option<gtk::Widget>, f: &dyn Fn(>k::Widget)) {
|
||||
pub fn walk_widgets(widget: &Option<gtk::Widget>, f: &dyn Fn(>k::Widget)) {
|
||||
let Some(w) = widget else { return };
|
||||
f(w);
|
||||
let mut child = w.first_child();
|
||||
|
||||
Reference in New Issue
Block a user