diff --git a/po/POTFILES.in b/po/POTFILES.in index d4201d12..c99301ca 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -62,17 +62,17 @@ src/identity_verification_view/scan_qr_code_page.rs src/identity_verification_view/scan_qr_code_page.blp src/identity_verification_view/wait_for_other_page.rs src/identity_verification_view/wait_for_other_page.blp -src/login/advanced_dialog.ui -src/login/greeter.ui +src/login/advanced_dialog.blp +src/login/greeter.blp src/login/homeserver_page.rs -src/login/homeserver_page.ui +src/login/homeserver_page.blp src/login/in_browser_page.rs -src/login/in_browser_page.ui +src/login/in_browser_page.blp src/login/method_page.rs -src/login/method_page.ui +src/login/method_page.blp src/login/mod.rs -src/login/mod.ui -src/login/session_setup_view.ui +src/login/mod.blp +src/login/session_setup_view.blp src/login/sso_idp_button.rs src/secret/linux.rs src/session/model/session.rs diff --git a/src/blp-resources.in b/src/blp-resources.in index 46abda2e..dae2407b 100644 --- a/src/blp-resources.in +++ b/src/blp-resources.in @@ -55,4 +55,12 @@ identity_verification_view/sas_emoji.blp identity_verification_view/sas_page.blp identity_verification_view/scan_qr_code_page.blp identity_verification_view/wait_for_other_page.blp +login/advanced_dialog.blp +login/greeter.blp +login/homeserver_page.blp +login/in_browser_page.blp +login/method_page.blp +login/mod.blp +login/session_setup_view.blp +login/sso_idp_button.blp window.blp diff --git a/src/login/advanced_dialog.blp b/src/login/advanced_dialog.blp new file mode 100644 index 00000000..47b5bbe5 --- /dev/null +++ b/src/login/advanced_dialog.blp @@ -0,0 +1,20 @@ +using Gtk 4.0; +using Adw 1; + +template $LoginAdvancedDialog: Adw.PreferencesDialog { + title: _("Homeserver Discovery"); + content-width: 500; + content-height: 300; + + Adw.PreferencesPage { + Adw.PreferencesGroup { + description: _("Auto-discovery, also known as “well-known lookup”, allows to discover the URL of a Matrix homeserver from a domain name. This should only be disabled if your homeserver doesn’t support auto-discovery or if you want to provide the URL yourself."); + + Adw.SwitchRow { + title: _("_Auto-Discovery"); + use-underline: true; + active: bind template.autodiscovery bidirectional; + } + } + } +} diff --git a/src/login/advanced_dialog.ui b/src/login/advanced_dialog.ui deleted file mode 100644 index b347d7a9..00000000 --- a/src/login/advanced_dialog.ui +++ /dev/null @@ -1,24 +0,0 @@ - - - - diff --git a/src/login/greeter.blp b/src/login/greeter.blp new file mode 100644 index 00000000..23c5a0fd --- /dev/null +++ b/src/login/greeter.blp @@ -0,0 +1,138 @@ +using Gtk 4.0; +using Adw 1; + +template $Greeter: Adw.NavigationPage { + tag: "greeter"; + title: _("Welcome to Fractal"); + + child: Adw.ToolbarView { + [top] + Adw.HeaderBar { + [start] + Gtk.Button back_button { + action-name: "win.show-session"; + visible: bind back_button.sensitive; + icon-name: "go-previous-symbolic"; + tooltip-text: _("Back"); + + accessibility { + label: _("Back"); + } + } + + [start] + Gtk.Button { + visible: bind back_button.visible inverted; + action-name: "app.about"; + tooltip-text: _("About Fractal"); + icon-name: "about-symbolic"; + + accessibility { + label: _("About Fractal"); + } + } + + [end] + Gtk.Button { + visible: bind back_button.visible; + action-name: "app.about"; + tooltip-text: _("About Fractal"); + icon-name: "about-symbolic"; + + accessibility { + label: _("About Fractal"); + } + } + } + + content: Gtk.ScrolledWindow { + hscrollbar-policy: never; + propagate-natural-height: true; + vexpand: true; + + child: Gtk.Box { + orientation: vertical; + + $OfflineBanner {} + + Adw.Clamp { + maximum-size: 440; + tightening-threshold: 340; + margin-top: 0; + margin-bottom: 24; + margin-start: 24; + margin-end: 24; + vexpand: true; + + child: Gtk.Box { + orientation: vertical; + valign: center; + spacing: 24; + + Adw.Clamp { + maximum-size: 360; + + child: Gtk.Box { + orientation: vertical; + valign: center; + spacing: 24; + + Gtk.Picture { + file: "resource:///org/gnome/Fractal/assets/welcome.svg"; + height-request: 120; + } + + Gtk.Label title { + wrap: true; + wrap-mode: word_char; + justify: center; + label: _("Welcome to Fractal"); + + styles [ + "title-1", + ] + } + }; + } + + Adw.Clamp { + maximum-size: 260; + margin-top: 10; + + child: Gtk.Box { + orientation: vertical; + valign: center; + spacing: 16; + + Gtk.Button login_button { + styles [ + "pill", + "suggested-action", + ] + + can-shrink: true; + label: _("_Log In"); + use-underline: true; + action-name: "navigation.push"; + action-target: "'homeserver'"; + } + + Gtk.Button { + styles [ + "pill", + ] + + visible: false; + can-shrink: true; + label: _("_Create Account"); + use-underline: true; + action-name: "app.create-account"; + } + }; + } + }; + } + }; + }; + }; +} diff --git a/src/login/greeter.ui b/src/login/greeter.ui deleted file mode 100644 index 880a3c8b..00000000 --- a/src/login/greeter.ui +++ /dev/null @@ -1,150 +0,0 @@ - - - - diff --git a/src/login/homeserver_page.blp b/src/login/homeserver_page.blp new file mode 100644 index 00000000..c353c278 --- /dev/null +++ b/src/login/homeserver_page.blp @@ -0,0 +1,125 @@ +using Gtk 4.0; +using Adw 1; + +template $LoginHomeserverPage: Adw.NavigationPage { + tag: "homeserver"; + title: _("Homeserver"); + + child: Adw.ToolbarView { + [top] + Adw.HeaderBar { + show-title: false; + } + + content: Gtk.Box { + orientation: vertical; + + $OfflineBanner {} + + Gtk.ScrolledWindow scrolled_window { + hscrollbar-policy: never; + propagate-natural-height: true; + vexpand: true; + + child: Adw.Clamp { + maximum-size: 360; + margin-top: 24; + margin-bottom: 24; + margin-start: 12; + margin-end: 12; + + child: Gtk.Box { + orientation: vertical; + valign: center; + spacing: 24; + accessible-role: form; + + accessibility { + labelled-by: [ + title, + ]; + } + + Gtk.Label title { + label: _("Homeserver"); + wrap: true; + justify: center; + accessible-role: heading; + + accessibility { + level: 1; + } + + styles [ + "title-1", + ] + } + + Gtk.Picture { + file: "resource:///org/gnome/Fractal/assets/homeserver.svg"; + accessible-role: presentation; + } + + Gtk.Box { + orientation: vertical; + spacing: 6; + + Gtk.ListBox { + accessible-role: group; + + styles [ + "boxed-list", + ] + + Adw.EntryRow homeserver_entry { + selectable: false; + changed => $update_next_state() swapped; + entry-activated => $check_homeserver() swapped; + + accessibility { + described-by: [ + homeserver_help, + ]; + } + } + } + + Gtk.Label homeserver_help { + styles [ + "caption", + "dimmed", + ] + + justify: left; + xalign: 0.0; + margin-start: 6; + margin-end: 6; + wrap: true; + use-markup: true; + } + } + + $LoadingButton next_button { + content-label: _("Next"); + halign: center; + clicked => $check_homeserver() swapped; + + styles [ + "suggested-action", + "standalone-button", + "pill", + ] + } + + Gtk.Button { + can-shrink: true; + halign: center; + label: _("Advanced…"); + action-name: "login.open-advanced"; + } + }; + }; + } + }; + }; +} diff --git a/src/login/homeserver_page.ui b/src/login/homeserver_page.ui deleted file mode 100644 index dd9b73b8..00000000 --- a/src/login/homeserver_page.ui +++ /dev/null @@ -1,130 +0,0 @@ - - - - diff --git a/src/login/in_browser_page.blp b/src/login/in_browser_page.blp new file mode 100644 index 00000000..b110566a --- /dev/null +++ b/src/login/in_browser_page.blp @@ -0,0 +1,95 @@ +using Gtk 4.0; +using Adw 1; + +template $LoginInBrowserPage: Adw.NavigationPage { + tag: "in-browser"; + title: _("Authentication"); + + child: Adw.ToolbarView { + [top] + Adw.HeaderBar { + show-title: false; + } + + content: Gtk.Box { + orientation: vertical; + + $OfflineBanner {} + + Gtk.ScrolledWindow scrolled_window { + hscrollbar-policy: never; + propagate-natural-height: true; + vexpand: true; + + child: Adw.Clamp { + margin-top: 24; + margin-bottom: 24; + margin-start: 12; + margin-end: 12; + + child: Gtk.Box { + orientation: vertical; + spacing: 36; + valign: center; + + Gtk.Label title { + wrap: true; + wrap-mode: word_char; + justify: center; + label: _("Authentication"); + accessible-role: heading; + + accessibility { + level: 1; + } + + styles [ + "title-1", + ] + } + + Gtk.Label instructions { + wrap: true; + wrap-mode: word_char; + justify: center; + label: _("Click on the button below and follow the steps in the browser"); + + styles [ + "body", + ] + } + + Gtk.Button continue_btn { + styles [ + "suggested-action", + "standalone-button", + "image-text-button", + "pill", + ] + + child: Gtk.Box { + halign: center; + + Gtk.Label { + label: _("Contin_ue"); + use-underline: true; + ellipsize: end; + mnemonic-widget: continue_btn; + } + + Gtk.Image { + icon-name: "external-link-symbolic"; + accessible-role: presentation; + valign: center; + } + }; + + halign: center; + clicked => $launch_url() swapped; + } + }; + }; + } + }; + }; +} diff --git a/src/login/in_browser_page.ui b/src/login/in_browser_page.ui deleted file mode 100644 index 2e4c813a..00000000 --- a/src/login/in_browser_page.ui +++ /dev/null @@ -1,104 +0,0 @@ - - - - diff --git a/src/login/method_page.blp b/src/login/method_page.blp new file mode 100644 index 00000000..b32c8f6e --- /dev/null +++ b/src/login/method_page.blp @@ -0,0 +1,156 @@ +using Gtk 4.0; +using Adw 1; + +template $LoginMethodPage: Adw.NavigationPage { + tag: "method"; + title: _("Log In"); + + child: Adw.ToolbarView { + [top] + Adw.HeaderBar { + show-title: false; + } + + content: Gtk.Box { + orientation: vertical; + + $OfflineBanner {} + + Gtk.ScrolledWindow scrolled_window { + hscrollbar-policy: never; + propagate-natural-height: true; + vexpand: true; + + child: Adw.Clamp { + maximum-size: 360; + margin-top: 24; + margin-bottom: 24; + margin-start: 12; + margin-end: 12; + + child: Gtk.Box { + orientation: vertical; + valign: center; + spacing: 30; + accessible-role: form; + + accessibility { + labelled-by: [ + title, + ]; + + described-by: [ + homeserver_url, + ]; + } + + Gtk.Box { + orientation: vertical; + spacing: 12; + halign: center; + + Gtk.Label title { + styles [ + "title-1", + ] + + wrap: true; + justify: center; + accessible-role: heading; + + accessibility { + level: 1; + } + } + + Gtk.Box { + spacing: 6; + halign: center; + tooltip-text: _("Homeserver URL"); + + Gtk.Image { + icon-name: "home-symbolic"; + accessible-role: presentation; + } + + Gtk.Label homeserver_url { + styles [ + "body", + ] + + ellipsize: end; + } + } + } + + Gtk.ListBox { + accessible-role: group; + + styles [ + "boxed-list", + ] + + Adw.EntryRow username_entry { + title: _("Matrix Username"); + selectable: false; + changed => $update_next_state() swapped; + entry-activated => $login_with_password() swapped; + } + } + + Gtk.ListBox { + accessible-role: group; + + styles [ + "boxed-list", + ] + + Adw.PasswordEntryRow password_entry { + title: _("Password"); + selectable: false; + changed => $update_next_state() swapped; + entry-activated => $login_with_password() swapped; + } + } + + Gtk.Box sso_idp_box { + visible: false; + spacing: 12; + homogeneous: true; + hexpand: true; + vexpand: true; + + accessibility { + label: _("Single Sign-On Providers"); + } + } + + Gtk.Button more_sso_btn { + styles [ + "standalone-button", + "pill", + ] + + can-shrink: true; + halign: center; + action-name: "login.sso"; + action-target: "@ms nothing"; + } + + $LoadingButton next_button { + content-label: _("Next"); + halign: center; + clicked => $login_with_password() swapped; + + styles [ + "suggested-action", + "standalone-button", + "pill", + ] + } + }; + }; + } + }; + }; +} diff --git a/src/login/method_page.ui b/src/login/method_page.ui deleted file mode 100644 index d4c80f96..00000000 --- a/src/login/method_page.ui +++ /dev/null @@ -1,161 +0,0 @@ - - - - diff --git a/src/login/mod.blp b/src/login/mod.blp new file mode 100644 index 00000000..16e154c9 --- /dev/null +++ b/src/login/mod.blp @@ -0,0 +1,100 @@ +using Gtk 4.0; +using Adw 1; + +template $Login: Adw.Bin { + child: Adw.NavigationView navigation { + $Greeter greeter {} + + $LoginHomeserverPage homeserver_page { + login: template; + } + + $LoginMethodPage method_page { + login: template; + } + + $LoginInBrowserPage in_browser_page { + login: template; + } + + Adw.NavigationPage { + tag: "completed"; + title: _("Login Complete"); + can-pop: false; + + child: Adw.ToolbarView { + [top] + Adw.HeaderBar { + show-title: false; + } + + content: Gtk.Box { + orientation: vertical; + + $OfflineBanner {} + + Gtk.ScrolledWindow { + hscrollbar-policy: never; + propagate-natural-height: true; + vexpand: true; + + child: Adw.Clamp { + maximum-size: 400; + tightening-threshold: 300; + + child: Gtk.Box { + orientation: vertical; + spacing: 18; + valign: center; + + Gtk.Label { + wrap: true; + wrap-mode: word_char; + justify: center; + label: _("Login Complete"); + accessible-role: heading; + + accessibility { + level: 1; + } + + styles [ + "title-1", + ] + } + + Gtk.Picture { + file: "resource:///org/gnome/Fractal/assets/setup-complete.svg"; + accessible-role: presentation; + } + + Gtk.Label { + wrap: true; + wrap-mode: word_char; + justify: center; + label: _("This session is ready to send and receive secure messages"); + + styles [ + "body", + ] + } + + Gtk.Button done_button { + can-shrink: true; + label: _("Start Chatting"); + halign: center; + clicked => $finish_login() swapped; + + styles [ + "suggested-action", + "pill", + ] + } + }; + }; + } + }; + }; + } + }; +} diff --git a/src/login/mod.ui b/src/login/mod.ui deleted file mode 100644 index 76ebe2d7..00000000 --- a/src/login/mod.ui +++ /dev/null @@ -1,115 +0,0 @@ - - - - diff --git a/src/login/session_setup_view.blp b/src/login/session_setup_view.blp new file mode 100644 index 00000000..04416830 --- /dev/null +++ b/src/login/session_setup_view.blp @@ -0,0 +1,58 @@ +using Gtk 4.0; +using Adw 1; + +template $SessionSetupView: Adw.NavigationPage { + tag: "session-setup"; + title: _("Session Setup"); + shown => $focus_default_widget() swapped; + + child: Gtk.Stack stack { + transition-type: slide_left; + vexpand: true; + notify::transition-running => $focus_default_widget() swapped; + + Gtk.StackPage { + name: "loading"; + title: _("Loading"); + + child: Adw.ToolbarView { + [top] + Adw.HeaderBar { + title-widget: Adw.WindowTitle { + title: _("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", + ] + } + } + }; + }; + } + }; +} diff --git a/src/login/session_setup_view.ui b/src/login/session_setup_view.ui deleted file mode 100644 index f5619812..00000000 --- a/src/login/session_setup_view.ui +++ /dev/null @@ -1,68 +0,0 @@ - - - - diff --git a/src/login/sso_idp_button.blp b/src/login/sso_idp_button.blp new file mode 100644 index 00000000..a6c1b9c2 --- /dev/null +++ b/src/login/sso_idp_button.blp @@ -0,0 +1,10 @@ +using Gtk 4.0; + +template $SsoIdpButton: Gtk.Button { + styles [ + "card", + "sso-button", + ] + + action-name: "login.sso"; +} diff --git a/src/login/sso_idp_button.ui b/src/login/sso_idp_button.ui deleted file mode 100644 index f5942f94..00000000 --- a/src/login/sso_idp_button.ui +++ /dev/null @@ -1,10 +0,0 @@ - - - - diff --git a/src/ui-resources.gresource.xml b/src/ui-resources.gresource.xml index 947191f3..5b61965c 100644 --- a/src/ui-resources.gresource.xml +++ b/src/ui-resources.gresource.xml @@ -1,14 +1,6 @@ - login/advanced_dialog.ui - login/greeter.ui - login/homeserver_page.ui - login/in_browser_page.ui - login/method_page.ui - login/mod.ui - login/session_setup_view.ui - login/sso_idp_button.ui session/view/account_settings/encryption_page/import_export_keys_subpage.ui session/view/account_settings/encryption_page/mod.ui session/view/account_settings/general_page/change_password_subpage.ui