Skip to content

Commit fb6db3a

Browse files
authored
feat: switch to placeholder page after error (#204)
When the user clicks on the "Continue Regardless" button, show the placeholder page instead of showing a random color.
1 parent 913d7f7 commit fb6db3a

3 files changed

Lines changed: 14 additions & 1 deletion

File tree

data/resources/ui/window.blp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ template $AppWindow: Adw.ApplicationWindow {
116116
label: _("_Continue Regardless");
117117
use-underline: true;
118118
halign: center;
119-
action-name: "app.random-color";
119+
action-name: "app.placeholder";
120120

121121
styles [
122122
"pill",

src/application.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,20 @@ impl App {
165165
})
166166
.build();
167167

168+
// Switch to placeholder page
169+
let action_placeholder = gio::ActionEntry::builder("placeholder")
170+
.activate(|app: &Self, _, _| {
171+
app.main_window().show_placeholder_page();
172+
})
173+
.build();
174+
168175
self.add_action_entries([
169176
action_clear_history,
170177
action_random_color,
171178
action_preferences,
172179
action_quit,
173180
action_about,
181+
action_placeholder,
174182
]);
175183
}
176184

src/window.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,4 +541,9 @@ impl AppWindow {
541541
self.set_color(color);
542542
self.imp().edit_sheet.set_open(false);
543543
}
544+
545+
/// Shows the placeholder page.
546+
pub fn show_placeholder_page(&self) {
547+
self.imp().stack.set_visible_child_name("placeholder");
548+
}
544549
}

0 commit comments

Comments
 (0)