diff --git a/meson.build b/meson.build
index 982f0531..1d5a516e 100644
--- a/meson.build
+++ b/meson.build
@@ -2,10 +2,11 @@ project('fractal',
'rust',
version: '12',
license: 'GPL-3.0-or-later',
- meson_version: '>= 1.1')
+ meson_version: '>= 1.2')
-i18n = import('i18n')
+fs = import('fs')
gnome = import('gnome')
+i18n = import('i18n')
base_id = 'org.gnome.Fractal'
application_id = base_id
@@ -50,12 +51,17 @@ glib_compile_resources = find_program('glib-compile-resources', required: true)
glib_compile_schemas = find_program('glib-compile-schemas', required: true)
desktop_file_validate = find_program('desktop-file-validate', required: false)
appstreamcli = find_program('appstreamcli', required: false)
+
cargo = find_program('cargo', required: true)
cargo_version = run_command(cargo, '--version', check: true).stdout().strip()
message(cargo_version)
rustc_version = run_command('rustc', '--version', check: true).stdout().strip()
message(rustc_version)
+blueprint_compiler = find_program('blueprint-compiler', required: true)
+blueprint_compiler_version = run_command('blueprint-compiler', '--version', check: true).stdout().strip()
+message('blueprint-compiler ' + blueprint_compiler_version)
+
prefix = get_option('prefix')
bindir = prefix / get_option('bindir')
localedir = prefix / get_option('localedir')
diff --git a/po/POTFILES.in b/po/POTFILES.in
index a66e12f5..07eab809 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -4,10 +4,10 @@ data/org.gnome.Fractal.desktop.in.in
data/org.gnome.Fractal.gschema.xml.in
data/org.gnome.Fractal.metainfo.xml.in.in
-src/account_chooser_dialog/mod.ui
-src/account_switcher/account_switcher_button.ui
-src/account_switcher/account_switcher_popover.ui
-src/account_switcher/session_item.ui
+src/account_chooser_dialog/mod.blp
+src/account_switcher/account_switcher_button.blp
+src/account_switcher/account_switcher_popover.blp
+src/account_switcher/session_item.blp
src/application.rs
src/components/action_button.ui
src/components/avatar/editable.rs
@@ -37,8 +37,8 @@ src/components/rows/loading_row.ui
src/components/user_page.rs
src/components/user_page.ui
src/contrib/qr_code.rs
+src/error_page.blp
src/error_page.rs
-src/error_page.ui
src/identity_verification_view/accept_request_page.rs
src/identity_verification_view/accept_request_page.ui
src/identity_verification_view/cancelled_page.rs
@@ -205,4 +205,4 @@ src/utils/matrix/media_message.rs
src/utils/matrix/mod.rs
src/utils/media/image/mod.rs
src/utils/media/mod.rs
-src/window.ui
+src/window.blp
diff --git a/src/account_chooser_dialog/account_row.blp b/src/account_chooser_dialog/account_row.blp
new file mode 100644
index 00000000..40d084dc
--- /dev/null
+++ b/src/account_chooser_dialog/account_row.blp
@@ -0,0 +1,56 @@
+using Gtk 4.0;
+using Adw 1;
+
+template $AccountChooserDialogRow: Gtk.ListBoxRow {
+ selectable: false;
+
+ Gtk.Box {
+ spacing: 10;
+
+ $Avatar avatar {
+ size: "40";
+ }
+
+ Gtk.Box {
+ spacing: 3;
+ orientation: vertical;
+
+ Gtk.Label display_name {
+ xalign: 0.0;
+ hexpand: true;
+ }
+
+ Gtk.Label user_id {
+ xalign: 0.0;
+ hexpand: true;
+
+ styles [
+ "dimmed",
+ "caption",
+ ]
+ }
+ }
+
+ Gtk.Stack state_stack {
+ Gtk.StackPage {
+ name: "loading";
+
+ child: Adw.Spinner {
+ width-request: 24;
+ };
+ }
+
+ Gtk.StackPage {
+ name: "error";
+
+ child: Gtk.Image error_image {
+ icon-name: "error-symbolic";
+
+ styles [
+ "error",
+ ]
+ };
+ }
+ }
+ }
+}
diff --git a/src/account_chooser_dialog/account_row.ui b/src/account_chooser_dialog/account_row.ui
deleted file mode 100644
index 151c6cb5..00000000
--- a/src/account_chooser_dialog/account_row.ui
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
-
- false
-
-
-
-
-
diff --git a/src/account_chooser_dialog/mod.blp b/src/account_chooser_dialog/mod.blp
new file mode 100644
index 00000000..0a891379
--- /dev/null
+++ b/src/account_chooser_dialog/mod.blp
@@ -0,0 +1,77 @@
+using Gtk 4.0;
+using Adw 1;
+
+template $AccountChooserDialog: Adw.Dialog {
+ title: _("Select an Account");
+ content-width: 360;
+ content-height: 360;
+
+ styles [
+ "account-chooser",
+ ]
+
+ child: Adw.ToolbarView {
+ [top]
+ Adw.HeaderBar {
+ show-title: false;
+ }
+
+ [top]
+ Adw.Clamp {
+ hexpand: true;
+
+ child: Gtk.Box {
+ orientation: vertical;
+ spacing: 18;
+ margin-start: 12;
+ margin-end: 12;
+
+ Gtk.Label heading {
+ wrap: true;
+ wrap-mode: word_char;
+ max-width-chars: 20;
+ justify: center;
+ xalign: 0.5;
+ label: _("Select an Account");
+
+ styles [
+ "title-2",
+ ]
+ }
+ };
+ }
+
+ content: Gtk.ScrolledWindow {
+ hscrollbar-policy: never;
+ propagate-natural-height: true;
+
+ child: Adw.Clamp {
+ margin-top: 24;
+ margin-bottom: 12;
+ margin-start: 12;
+ margin-end: 12;
+
+ child: Gtk.Box {
+ orientation: vertical;
+ spacing: 24;
+
+ Gtk.Label {
+ wrap: true;
+ wrap-mode: word_char;
+ justify: center;
+ label: _("Select the account you want to open the URI with");
+
+ styles [
+ "body",
+ ]
+ }
+
+ Gtk.ListBox accounts {
+ activate-on-single-click: true;
+ row-activated => $select_row() swapped;
+ }
+ };
+ };
+ };
+ };
+}
diff --git a/src/account_chooser_dialog/mod.ui b/src/account_chooser_dialog/mod.ui
deleted file mode 100644
index 74f6808e..00000000
--- a/src/account_chooser_dialog/mod.ui
+++ /dev/null
@@ -1,83 +0,0 @@
-
-
-
- Select an Account
- 360
- 360
-
-
-
-
-
-
-
-
- True
-
-
- vertical
- 18
- 12
- 12
-
-
- True
- word-char
- 20
- center
- 0.5
- Select an Account
-
-
-
-
-
-
-
-
-
- never
- True
-
-
- 24
- 24
- 12
- 12
-
-
- vertical
- 24
-
-
- True
- word-char
- center
- Select the account you want to open the URI with
-
-
-
-
-
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/account_switcher/account_switcher_button.blp b/src/account_switcher/account_switcher_button.blp
new file mode 100644
index 00000000..0c8fa1f3
--- /dev/null
+++ b/src/account_switcher/account_switcher_button.blp
@@ -0,0 +1,23 @@
+using Gtk 4.0;
+
+template $AccountSwitcherButton: Gtk.ToggleButton {
+ visible: bind $invert_boolean(template.root as <$Window>.session-selection as <$FixedSelection>.is-empty) as ;
+ tooltip-text: bind template.root as <$Window>.session-selection as <$FixedSelection>.selected-item as <$SessionInfo>.user-id-string;
+ toggled => $toggle_popover() swapped;
+
+ accessibility {
+ description: _("Switch Accounts");
+ has-popup: true;
+ }
+
+ styles [
+ "image-button",
+ "circular",
+ ]
+
+ child: $Avatar {
+ size: "24";
+ data: bind template.root as <$Window>.session-selection as <$FixedSelection>.selected-item as <$SessionInfo>.avatar-data;
+ accessible-role: "presentation";
+ };
+}
diff --git a/src/account_switcher/account_switcher_button.ui b/src/account_switcher/account_switcher_button.ui
deleted file mode 100644
index c61aa617..00000000
--- a/src/account_switcher/account_switcher_button.ui
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
-
-
-
-
- AccountSwitcherButton
-
-
-
-
-
-
-
-
- AccountSwitcherButton
-
-
-
-
-
- Switch Accounts
- True
-
-
-
-
- 24
-
-
-
-
- AccountSwitcherButton
-
-
-
-
- presentation
-
-
-
-
diff --git a/src/account_switcher/account_switcher_popover.blp b/src/account_switcher/account_switcher_popover.blp
new file mode 100644
index 00000000..a617282f
--- /dev/null
+++ b/src/account_switcher/account_switcher_popover.blp
@@ -0,0 +1,45 @@
+using Gtk 4.0;
+
+template $AccountSwitcherPopover: Gtk.Popover {
+ styles [
+ "account-switcher",
+ ]
+
+ Gtk.Box {
+ orientation: vertical;
+ spacing: 6;
+
+ Gtk.ListBox sessions {
+ activate-on-single-click: true;
+ row-activated => $select_row() swapped;
+ }
+
+ Gtk.Separator {}
+
+ Gtk.Button {
+ action-name: "win.new-session";
+
+ child: Gtk.Box {
+ spacing: 10;
+
+ Gtk.Image {
+ name: "new-login-icon";
+ icon-name: "add-symbolic";
+ pixel-size: 16;
+ accessible-role: presentation;
+ }
+
+ Gtk.Label {
+ use-underline: true;
+ ellipsize: end;
+ label: _("_Add Account");
+ }
+ };
+
+ styles [
+ "account-switcher-row",
+ "flat",
+ ]
+ }
+ }
+}
diff --git a/src/account_switcher/account_switcher_popover.ui b/src/account_switcher/account_switcher_popover.ui
deleted file mode 100644
index 854537ff..00000000
--- a/src/account_switcher/account_switcher_popover.ui
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
-
-
-
-
- vertical
- 6
-
-
- true
-
-
-
-
-
-
-
-
- win.new-session
-
-
- 10
-
-
- new-login-icon
- add-symbolic
- 16
- presentation
-
-
-
-
- true
- end
- _Add Account
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/account_switcher/avatar_with_selection.blp b/src/account_switcher/avatar_with_selection.blp
new file mode 100644
index 00000000..a107cd39
--- /dev/null
+++ b/src/account_switcher/avatar_with_selection.blp
@@ -0,0 +1,23 @@
+using Gtk 4.0;
+using Adw 1;
+
+template $AvatarWithSelection: Adw.Bin {
+ accessible-role: presentation;
+
+ child: Gtk.Overlay {
+ $Avatar child_avatar {}
+
+ [overlay]
+ Gtk.Image checkmark {
+ visible: false;
+ halign: end;
+ valign: end;
+ icon-name: "checkmark-symbolic";
+ pixel-size: 11;
+
+ styles [
+ "blue-checkmark",
+ ]
+ }
+ };
+}
diff --git a/src/account_switcher/avatar_with_selection.ui b/src/account_switcher/avatar_with_selection.ui
deleted file mode 100644
index ad82016d..00000000
--- a/src/account_switcher/avatar_with_selection.ui
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
- presentation
-
-
-
-
-
-
-
- false
- end
- end
- checkmark-symbolic
- 11
-
-
-
-
-
-
-
diff --git a/src/account_switcher/session_item.blp b/src/account_switcher/session_item.blp
new file mode 100644
index 00000000..11bd0c7a
--- /dev/null
+++ b/src/account_switcher/session_item.blp
@@ -0,0 +1,81 @@
+using Gtk 4.0;
+using Adw 1;
+
+template $SessionItemRow: Gtk.ListBoxRow {
+ selectable: false;
+
+ styles [
+ "account-switcher-row",
+ ]
+
+ Gtk.Box {
+ spacing: 10;
+
+ $AvatarWithSelection avatar {
+ size: "40";
+ }
+
+ Gtk.Box {
+ spacing: 3;
+ orientation: vertical;
+
+ Gtk.Label display_name {
+ xalign: 0.0;
+ hexpand: true;
+ ellipsize: end;
+ }
+
+ Gtk.Label user_id {
+ xalign: 0.0;
+ hexpand: true;
+ ellipsize: end;
+
+ styles [
+ "dimmed",
+ "caption",
+ ]
+ }
+ }
+
+ Gtk.Stack state_stack {
+ Gtk.StackPage {
+ name: "loading";
+
+ child: Adw.Spinner {
+ valign: center;
+ halign: center;
+ height-request: 24;
+ };
+ }
+
+ Gtk.StackPage {
+ name: "settings";
+
+ child: Gtk.Button {
+ icon-name: "settings-symbolic";
+ valign: center;
+ halign: center;
+ tooltip-text: _("Account Settings");
+ clicked => $show_account_settings() swapped;
+
+ styles [
+ "circular",
+ "raised",
+ ]
+ };
+ }
+
+ Gtk.StackPage {
+ name: "error";
+
+ child: Gtk.Image error_image {
+ icon-name: "error-symbolic";
+
+ styles [
+ "error",
+ ]
+ };
+ }
+ }
+ }
+}
diff --git a/src/account_switcher/session_item.ui b/src/account_switcher/session_item.ui
deleted file mode 100644
index 5f6106cc..00000000
--- a/src/account_switcher/session_item.ui
+++ /dev/null
@@ -1,90 +0,0 @@
-
-
-
- false
-
-
-
- 10
-
-
- 40
-
-
-
-
- 3
- vertical
-
-
- 0.0
- True
- end
-
-
-
-
- 0.0
- True
- end
-
-
-
-
-
-
-
-
-
- loading
-
-
- center
- center
- 24
-
-
-
-
-
-
- settings
-
-
- settings-symbolic
- center
- center
- Account Settings
-
-
-
-
-
-
-
-
- error
-
-
- error-symbolic
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/blp-resources.gresource.xml.in b/src/blp-resources.gresource.xml.in
new file mode 100644
index 00000000..442a6fca
--- /dev/null
+++ b/src/blp-resources.gresource.xml.in
@@ -0,0 +1,5 @@
+
+
+ @UI_FILES@
+
+
diff --git a/src/blp-resources.in b/src/blp-resources.in
new file mode 100644
index 00000000..c7d87ce0
--- /dev/null
+++ b/src/blp-resources.in
@@ -0,0 +1,10 @@
+# List of Blueprint files to compile.
+# Please keep this file sorted alphabetically.
+account_chooser_dialog/account_row.blp
+account_chooser_dialog/mod.blp
+account_switcher/account_switcher_button.blp
+account_switcher/account_switcher_popover.blp
+account_switcher/avatar_with_selection.blp
+account_switcher/session_item.blp
+error_page.blp
+window.blp
diff --git a/src/config.rs.in b/src/config.rs.in
index 4fba8461..f4bbfc90 100644
--- a/src/config.rs.in
+++ b/src/config.rs.in
@@ -1,6 +1,7 @@
use crate::application::AppProfile;
pub const APP_ID: &str = @APP_ID@;
+pub const BLUEPRINT_RESOURCES_FILE: &str = concat!(@PKGDATADIR@, "/blp-resources.gresource");
pub const DISABLE_GLYCIN_SANDBOX: bool = @DISABLE_GLYCIN_SANDBOX@;
pub const GETTEXT_PACKAGE: &str = @GETTEXT_PACKAGE@;
pub const LOCALEDIR: &str = @LOCALEDIR@;
diff --git a/src/error_page.blp b/src/error_page.blp
new file mode 100644
index 00000000..3fbc7b8e
--- /dev/null
+++ b/src/error_page.blp
@@ -0,0 +1,205 @@
+using Gtk 4.0;
+using Adw 1;
+
+template $ErrorPage: Adw.Bin {
+ Adw.ToolbarView {
+ [top]
+ Adw.HeaderBar {
+ title-widget: Adw.WindowTitle {
+ title: _("Error");
+ };
+
+ [start]
+ $AccountSwitcherButton account_switcher {}
+
+ [start]
+ Gtk.Button {
+ visible: bind account_switcher.visible inverted;
+ action-name: "app.about";
+ tooltip-text: _("About Fractal");
+ icon-name: "about-symbolic";
+
+ accessibility {
+ label: _("About Fractal");
+ }
+ }
+
+ [end]
+ Gtk.Button {
+ visible: bind account_switcher.visible;
+ action-name: "app.about";
+ tooltip-text: _("About Fractal");
+ icon-name: "about-symbolic";
+
+ accessibility {
+ label: _("About Fractal");
+ }
+ }
+ }
+
+ content: Gtk.Stack stack {
+ Gtk.StackPage {
+ name: "secret";
+
+ child: Adw.StatusPage secret_error_page {
+ title: _("Secret Portal Error");
+ icon-name: "key-symbolic";
+ vexpand: true;
+
+ Adw.Clamp linux_secret_instructions {
+ Gtk.Box {
+ orientation: vertical;
+ spacing: 12;
+
+ Gtk.Label {
+ wrap: true;
+ wrap-mode: word_char;
+ xalign: 0.0;
+ label: _("Fractal relies on a Secret Portal to manage your sensitive session information and an error occurred while we were trying to restore your sessions.");
+
+ styles [
+ "body",
+ ]
+ }
+
+ Gtk.Box {
+ orientation: vertical;
+ spacing: 12;
+
+ Gtk.Label {
+ wrap: true;
+ wrap-mode: word_char;
+ xalign: 0.0;
+ label: _("Here are a few things that might help you fix issues with the Secret Portal:");
+
+ styles [
+ "body",
+ ]
+ }
+
+ Gtk.Box {
+ spacing: 6;
+
+ Gtk.Label {
+ valign: start;
+ label: "•";
+ }
+
+ Gtk.Label {
+ wrap: true;
+ wrap-mode: word_char;
+ xalign: 0.0;
+ label: _("Make sure you have a Secret Portal Backend Provider installed, like gnome-keyring.");
+
+ styles [
+ "body",
+ ]
+ }
+ }
+
+ Gtk.Box {
+ spacing: 6;
+
+ Gtk.Label {
+ valign: start;
+ label: "•";
+ }
+
+ Gtk.Box {
+ orientation: vertical;
+ spacing: 12;
+
+ Gtk.Label {
+ wrap: true;
+ wrap-mode: word_char;
+ xalign: 0.0;
+ label: _("If you prefer to use a Secret Service Provider instead, you need to allow Fractal to interact with it, like this:");
+
+ styles [
+ "body",
+ ]
+ }
+
+ Gtk.Box {
+ Gtk.ScrolledWindow {
+ vscrollbar-policy: never;
+
+ child: Gtk.Label secret_service_override_command {
+ xalign: 0.0;
+ hexpand: true;
+ selectable: true;
+ margin-start: 10;
+ margin-end: 10;
+ };
+ }
+
+ Gtk.Button {
+ icon-name: "copy-symbolic";
+ tooltip-text: _("Copy Command");
+ valign: center;
+ halign: end;
+ margin-start: 3;
+ clicked => $copy_secret_service_override_command() swapped;
+
+ styles [
+ "flat",
+ ]
+ }
+
+ styles [
+ "card",
+ "linked",
+ "command",
+ ]
+ }
+ }
+ }
+
+ Gtk.Box {
+ spacing: 6;
+
+ Gtk.Label {
+ valign: start;
+ label: "•";
+ }
+
+ Gtk.Label {
+ wrap: true;
+ wrap-mode: word_char;
+ xalign: 0.0;
+ label: _("Check that you have a default keyring and that it is unlocked.");
+
+ styles [
+ "body",
+ ]
+ }
+ }
+ }
+
+ Gtk.Label {
+ wrap: true;
+ wrap-mode: word_char;
+ xalign: 0.0;
+ label: _("Check the application logs and your distribution’s documentation for more details.");
+
+ styles [
+ "body",
+ ]
+ }
+ }
+ }
+ };
+ }
+
+ Gtk.StackPage {
+ name: "session";
+
+ child: Adw.StatusPage session_error_page {
+ title: _("Could Not Initialize Session");
+ icon-name: "warning-symbolic";
+ vexpand: true;
+ };
+ }
+ };
+ }
+}
diff --git a/src/error_page.ui b/src/error_page.ui
deleted file mode 100644
index 5a06e13f..00000000
--- a/src/error_page.ui
+++ /dev/null
@@ -1,228 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- secret
-
-
- Secret Portal Error
- key-symbolic
- true
-
-
-
-
- vertical
- 12
-
-
- true
- word-char
- 0.0
- Fractal relies on a Secret Portal to manage your sensitive session information and an error occurred while we were trying to restore your sessions.
-
-
-
-
-
- vertical
- 12
-
-
- true
- word-char
- 0.0
- Here are a few things that might help you fix issues with the Secret Portal:
-
-
-
-
-
- 6
-
-
- start
- •
-
-
-
-
- true
- word-char
- 0.0
- Make sure you have a Secret Portal Backend Provider installed, like gnome-keyring.
-
-
-
-
-
-
-
- 6
-
-
- start
- •
-
-
-
-
- vertical
- 12
-
-
- true
- word-char
- 0.0
- If you prefer to use a Secret Service Provider instead, you need to allow Fractal to interact with it, like this:
-
-
-
-
-
-
-
- never
-
-
- 0.0
- True
- True
- 10
- 10
-
-
-
-
-
-
- copy-symbolic
- Copy Command
- center
- end
- 3
-
-
-
-
-
-
-
-
-
-
-
-
-
- 6
-
-
- start
- •
-
-
-
-
- true
- word-char
- 0.0
- Check that you have a default keyring and that it is unlocked.
-
-
-
-
-
-
-
-
-
- true
- word-char
- 0.0
- Check the application logs and your distribution’s documentation for more details.
-
-
-
-
-
-
-
-
-
-
-
-
-
- session
-
-
- Could Not Initialize Session
- warning-symbolic
- true
-
-
-
-
-
-
-
-
-
-
diff --git a/src/main.rs b/src/main.rs
index 439b8380..9b390b13 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -63,6 +63,9 @@ fn main() {
let res = gio::Resource::load(RESOURCES_FILE).expect("Could not load gresource file");
gio::resources_register(&res);
+ let blp_res = gio::Resource::load(BLUEPRINT_RESOURCES_FILE)
+ .expect("Could not load Blueprint gresource file");
+ gio::resources_register(&blp_res);
let ui_res = gio::Resource::load(UI_RESOURCES_FILE).expect("Could not load UI gresource file");
gio::resources_register(&ui_res);
diff --git a/src/meson.build b/src/meson.build
index 4f7c3c2b..d01c4596 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,4 +1,40 @@
-# UI resources
+# Compile Blueprint resources
+blp_files = []
+foreach line : fs.read('blp-resources.in').splitlines()
+ if not line.startswith('#') and line.strip() != ''
+ blp_files += line
+ endif
+endforeach
+
+blueprints = custom_target(
+ 'blueprints',
+ input: blp_files,
+ output: '.',
+ command: [blueprint_compiler, 'batch-compile', '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'],
+)
+
+# Populate the GResource file for the compiled Blueprint files dynamically,
+# using the same file list
+compiled_ui_files = ''
+foreach file : blp_files
+ compiled_ui_files += '\n ' + file.replace('.blp', '.ui') + ''
+endforeach
+blp_resources_xml = configure_file(
+ input: 'blp-resources.gresource.xml.in',
+ output: 'blp-resources.gresource.xml',
+ configuration: { 'UI_FILES': compiled_ui_files }
+)
+
+blp_resources = gnome.compile_resources(
+ 'blp-resources',
+ blp_resources_xml,
+ gresource_bundle: true,
+ install: true,
+ install_dir: pkgdatadir,
+ dependencies: [blueprints, blp_resources_xml],
+)
+
+# Compile UI resources
ui_resources = gnome.compile_resources(
'ui-resources',
'ui-resources.gresource.xml',
@@ -7,6 +43,7 @@ ui_resources = gnome.compile_resources(
install_dir: pkgdatadir,
)
+# Generate config.rs
global_conf = configuration_data()
global_conf.set_quoted('APP_ID', application_id)
global_conf.set('DISABLE_GLYCIN_SANDBOX', get_option('disable-glycin-sandbox').to_string())
@@ -20,7 +57,6 @@ config = configure_file(
output: 'config.rs',
configuration: global_conf
)
-# Copy the config.rs output to the source directory.
run_command(
'cp',
meson.project_build_root() / 'src' / 'config.rs',
@@ -28,6 +64,7 @@ run_command(
check: true
)
+# Build binary with cargo
cargo_options = [ '--manifest-path', meson.project_source_root() / 'Cargo.toml' ]
cargo_options += [ '--target-dir', meson.project_build_root() / 'src' ]
@@ -45,7 +82,7 @@ cargo_env = [ 'CARGO_HOME=' + meson.project_build_root() / 'cargo-home' ]
if build_env_only
depends = []
else
- depends = [resources, ui_resources]
+ depends = [resources, blp_resources, ui_resources]
endif
custom_target(
@@ -67,6 +104,7 @@ custom_target(
]
)
+# Build docs with rustdoc
rustdoc_flags = ' '.join([
'-Zunstable-options',
'--enable-index-page',
diff --git a/src/ui-resources.gresource.xml b/src/ui-resources.gresource.xml
index 64a95168..aa3857ac 100644
--- a/src/ui-resources.gresource.xml
+++ b/src/ui-resources.gresource.xml
@@ -1,12 +1,6 @@
- account_chooser_dialog/account_row.ui
- account_chooser_dialog/mod.ui
- account_switcher/account_switcher_button.ui
- account_switcher/account_switcher_popover.ui
- account_switcher/avatar_with_selection.ui
- account_switcher/session_item.ui
components/action_button.ui
components/avatar/editable.ui
components/avatar/mod.ui
@@ -42,7 +36,6 @@
components/rows/substring_entry_row.ui
components/rows/switch_loading_row.ui
components/user_page.ui
- error_page.ui
identity_verification_view/accept_request_page.ui
identity_verification_view/cancelled_page.ui
identity_verification_view/choose_method_page.ui
@@ -147,6 +140,5 @@
session/view/sidebar/section_row.ui
session/view/sidebar/verification_row.ui
shortcuts.ui
- window.ui
diff --git a/src/window.blp b/src/window.blp
new file mode 100644
index 00000000..d7a1866e
--- /dev/null
+++ b/src/window.blp
@@ -0,0 +1,101 @@
+using Gtk 4.0;
+using Adw 1;
+
+template $Window: Adw.ApplicationWindow {
+ default-width: 900;
+ default-height: 850;
+ width-request: 360;
+ height-request: 294;
+ title: _("Fractal");
+
+ content: Adw.ToastOverlay toast_overlay {
+ Gtk.Stack main_stack {
+ transition-type: crossfade;
+
+ Gtk.StackPage {
+ name: "loading";
+ title: _("Loading");
+
+ child: Gtk.WindowHandle loading {
+ child: Adw.ToolbarView {
+ [top]
+ Adw.HeaderBar {
+ [start]
+ $AccountSwitcherButton {}
+
+ [end]
+ Gtk.Button {
+ action-name: "app.about";
+ tooltip-text: _("About Fractal");
+ icon-name: "about-symbolic";
+
+ accessibility {
+ label: _("About Fractal");
+ }
+ }
+ }
+
+ content: Gtk.Box {
+ orientation: vertical;
+
+ $OfflineBanner {}
+
+ Gtk.Box {
+ orientation: vertical;
+ valign: center;
+ vexpand: true;
+ spacing: 24;
+
+ Adw.Spinner {
+ height-request: 64;
+ width-request: 64;
+ }
+
+ Gtk.Label {
+ halign: center;
+ justify: center;
+ wrap: true;
+ wrap-mode: word_char;
+ label: _("Fetching Account Data…");
+
+ styles [
+ "title-2",
+ ]
+ }
+ }
+ };
+ };
+ };
+ }
+
+ Gtk.StackPage {
+ name: "login";
+ title: _("Log In");
+
+ child: $Login login {};
+ }
+
+ Gtk.StackPage {
+ name: "session";
+ title: _("Session");
+
+ child: $SessionView session_view {};
+ }
+
+ Gtk.StackPage {
+ name: "error";
+ title: _("Error");
+
+ child: $ErrorPage error_page {};
+ }
+ }
+ };
+
+ Adw.Breakpoint {
+ condition ("max-width: 600sp")
+
+ setters {
+ template.compact: "True";
+ }
+ }
+}
diff --git a/src/window.ui b/src/window.ui
deleted file mode 100644
index a85e52ea..00000000
--- a/src/window.ui
+++ /dev/null
@@ -1,117 +0,0 @@
-
-
-
- 900
- 850
- 360
- 294
- Fractal
-
-
-
-
- crossfade
-
-
- loading
- Loading
-
-
-
-
-
-
-
-
-
- vertical
-
-
-
-
-
- vertical
- center
- True
- 24
-
-
- 64
- 64
-
-
-
-
- center
- center
- True
- word-char
- Fetching Account Data…
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- login
- Log In
-
-
-
-
-
-
-
- session
- Session
-
-
-
-
-
-
-
- error
- Error
-
-
-
-
-
-
-
-
-
-
-
- max-width: 600sp
- True
-
-
-
-