From eaf4fbf240cb96f69d62cf0b96b03161fffa292a Mon Sep 17 00:00:00 2001 From: FineFindus Date: Fri, 19 Jul 2024 22:32:34 +0200 Subject: [PATCH] feat(window): use illustration for portal error page --- .../illustrations/shattered-picker.svg | 1227 +++++++++++++++++ data/resources/resources.gresource.xml | 2 +- data/resources/ui/window.blp | 77 +- src/widgets/about_window.rs | 4 +- 4 files changed, 1293 insertions(+), 17 deletions(-) create mode 100644 data/resources/illustrations/shattered-picker.svg diff --git a/data/resources/illustrations/shattered-picker.svg b/data/resources/illustrations/shattered-picker.svg new file mode 100644 index 0000000..4f00267 --- /dev/null +++ b/data/resources/illustrations/shattered-picker.svg @@ -0,0 +1,1227 @@ + + + + diff --git a/data/resources/resources.gresource.xml b/data/resources/resources.gresource.xml index 91b9b3c..0a828e4 100644 --- a/data/resources/resources.gresource.xml +++ b/data/resources/resources.gresource.xml @@ -1,7 +1,7 @@ - + illustrations/shattered-picker.svg ui/shortcuts.ui ui/window.ui ui/palette-window.ui diff --git a/data/resources/ui/window.blp b/data/resources/ui/window.blp index 2525821..297f2f8 100644 --- a/data/resources/ui/window.blp +++ b/data/resources/ui/window.blp @@ -32,23 +32,26 @@ menu primary_menu { } } -template $AppWindow : Adw.ApplicationWindow { +template $AppWindow: Adw.ApplicationWindow { content: Adw.ToastOverlay toast_overlay { child: Stack stack { transition-type: crossfade; StackPage { name: "placeholder"; + child: $AdwToolbarView { [top] Adw.HeaderBar {} content: WindowHandle { vexpand: true; + child: Adw.StatusPage { icon-name: "color-select-symbolic"; title: _("No Color"); description: _("Select a color from the screen to get started"); + child: Button { label: _("_Pick a Color"); use-underline: true; @@ -73,20 +76,64 @@ template $AppWindow : Adw.ApplicationWindow { content: WindowHandle { vexpand: true; - child: Adw.StatusPage { - icon-name: "portal-missing-symbolic"; - title: _("Color Picker not available"); - description: _("The system is not properly configured to allow for color picking"); - child: Button { - label: _("_Continue regardless"); - use-underline: true; - halign: center; - action-name: "app.random_color"; + child: Adw.Bin { + css-name: "statuspage"; + + ScrolledWindow { + hscrollbar-policy: never; + + Box { + orientation: vertical; + valign: center; + + Adw.Clamp { + Box { + orientation: vertical; + + Box { + halign: center; + + Picture { + can-shrink: false; + margin-bottom: 25; + file: "resource:///com/github/finefindus/eyedropper/shattered-picker.svg"; + } + } + + Label { + label: _("Color Picker not Available"); + wrap: true; + justify: center; + + styles [ + "title-1", + ] + } + + Label { + label: _("The system is not properly configured to allow for color picking"); + wrap: true; + justify: center; + + styles [ + "body", + ] + } + } + } - styles [ - "pill", - ] - }; + Button { + label: _("_Continue Regardless"); + use-underline: true; + halign: center; + action-name: "app.random_color"; + + styles [ + "pill", + ] + } + } + } }; }; }; @@ -94,6 +141,7 @@ template $AppWindow : Adw.ApplicationWindow { StackPage { name: "main"; + child: $AdwToolbarView { [top] Adw.HeaderBar headerbar { @@ -131,6 +179,7 @@ template $AppWindow : Adw.ApplicationWindow { orientation: vertical; tightening-threshold: 35; maximum-size: 50; + child: Button { tooltip-text: C_("Tooltip of the palette button", "Open Palette Window"); margin-top: 12; diff --git a/src/widgets/about_window.rs b/src/widgets/about_window.rs index 5cd8456..03800cd 100644 --- a/src/widgets/about_window.rs +++ b/src/widgets/about_window.rs @@ -14,7 +14,7 @@ pub const WEBSITE: &str = "https://github.com/finefindus/eyedropper/"; pub const ISSUE_TRACKER: &str = "https://github.com/finefindus/eyedropper/issues/new/choose"; pub const DEVELOPERS: &[&str] = &["FineFindus https://github.com/FineFindus"]; pub const DESIGNERS: &[&str] = &["FineFindus https://github.com/FineFindus"]; -pub const ARTISTS: &[&str] = &["bertob https://github.com/bertob"]; +pub const ARTISTS: &[&str] = &["bertob https://github.com/bertob", "Brage Fuglseth"]; #[derive(Debug)] pub struct EyedropperAbout; @@ -170,7 +170,7 @@ impl EyedropperAbout { /// Returns info about the sandbox the app is using. /// /// If it is running inside the flatpak sandbox, info about it is returned, otherwise only - /// the information if the `GTK_USE_PORTAL` environment is set to `1`. + /// the information if the `GTK_USE_PORTAL` environment is set to `1`. fn sandbox_info() -> String { let mut info = String::new(); if Path::new("/.flatpak-info").exists() {