[fractal/multi-account: 7/10] Connect button to open login page
- From: Alejandro Domínguez <aledomu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [fractal/multi-account: 7/10] Connect button to open login page
- Date: Fri, 27 Aug 2021 01:14:15 +0000 (UTC)
commit 45a0e2d87b9dfa75ee32e7a3e08df887708912c7
Author: Alejandro Domínguez <adomu net-c com>
Date: Tue Jul 13 21:16:49 2021 +0200
Connect button to open login page
src/application.rs | 8 ++++++++
src/session/sidebar/account_switcher/mod.rs | 3 +++
src/window.rs | 5 +++++
3 files changed, 16 insertions(+)
---
diff --git a/src/application.rs b/src/application.rs
index 82ec6f89..0f86a436 100644
--- a/src/application.rs
+++ b/src/application.rs
@@ -120,6 +120,14 @@ impl Application {
app.show_about_dialog();
})
);
+
+ action!(
+ self,
+ "new-login",
+ clone!(@weak self as app => move |_, _| {
+ app.get_main_window().switch_to_login_page();
+ })
+ );
}
/// Sets up keyboard shortcuts for application and window actions.
diff --git a/src/session/sidebar/account_switcher/mod.rs b/src/session/sidebar/account_switcher/mod.rs
index 224e979d..d35fa04e 100644
--- a/src/session/sidebar/account_switcher/mod.rs
+++ b/src/session/sidebar/account_switcher/mod.rs
@@ -59,6 +59,9 @@ mod imp {
.unwrap()
.set_visible_child(&session_widget);
}
+ AccountSwitcherItem::AddAccount => {
+ list_view.activate_action("app.new-login", None);
+ }
_ => {}
});
});
diff --git a/src/window.rs b/src/window.rs
index 7e6f25da..be2c512d 100644
--- a/src/window.rs
+++ b/src/window.rs
@@ -180,4 +180,9 @@ impl Window {
let priv_ = imp::Window::from_instance(self);
priv_.main_stack.set_visible_child(&priv_.sessions.get());
}
+
+ pub fn switch_to_login_page(&self) {
+ let priv_ = imp::Window::from_instance(self);
+ priv_.main_stack.set_visible_child(&priv_.login.get());
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]