app: Show spinner by default instead of greeter
This commit is contained in:
parent
6f8ead2d15
commit
953466029d
4 changed files with 55 additions and 37 deletions
|
@ -4,36 +4,8 @@
|
|||
<property name="focusable">true</property>
|
||||
<property name="child">
|
||||
<object class="GtkStack" id="stack">
|
||||
<property name="visible-child">loading</property>
|
||||
<property name="visible-child">content</property>
|
||||
<property name="transition-type">crossfade</property>
|
||||
<child>
|
||||
<object class="GtkWindowHandle" id="loading">
|
||||
<property name="child">
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkHeaderBar">
|
||||
<property name="show-title-buttons">True</property>
|
||||
<style>
|
||||
<class name="flat"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinner">
|
||||
<property name="spinning">True</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="vexpand">True</property>
|
||||
<style>
|
||||
<class name="session-loading-spinner"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwLeaflet" id="content">
|
||||
<property name="fold-threshold-policy">minimum</property>
|
||||
|
|
|
@ -16,8 +16,36 @@
|
|||
</child>
|
||||
<child>
|
||||
<object class="GtkStack" id="main_stack">
|
||||
<property name="visible-child">greeter</property>
|
||||
<property name="visible-child">loading</property>
|
||||
<property name="transition-type">crossfade</property>
|
||||
<child>
|
||||
<object class="GtkWindowHandle" id="loading">
|
||||
<property name="child">
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkHeaderBar">
|
||||
<property name="show-title-buttons">True</property>
|
||||
<style>
|
||||
<class name="flat"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinner">
|
||||
<property name="spinning">True</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="vexpand">True</property>
|
||||
<style>
|
||||
<class name="session-loading-spinner"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="Greeter" id="greeter"/>
|
||||
</child>
|
||||
|
|
|
@ -492,6 +492,9 @@ impl Session {
|
|||
let widget = SessionVerification::new(self);
|
||||
stack.add_named(&widget, Some("session-verification"));
|
||||
stack.set_visible_child(&widget);
|
||||
if let Some(window) = self.parent_window() {
|
||||
window.switch_to_sessions_page();
|
||||
}
|
||||
}
|
||||
|
||||
fn mark_ready(&self) {
|
||||
|
@ -529,6 +532,9 @@ impl Session {
|
|||
let handle = spawn_tokio!(async move { client.bootstrap_cross_signing(None).await });
|
||||
if handle.await.is_ok() {
|
||||
priv_.stack.set_visible_child(&*priv_.content);
|
||||
if let Some(window) = obj.parent_window() {
|
||||
window.switch_to_sessions_page();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -737,10 +743,12 @@ impl Session {
|
|||
/// Show the content of the session
|
||||
pub fn show_content(&self) {
|
||||
let priv_ = self.imp();
|
||||
|
||||
// FIXME: we should actually check if we have now the keys
|
||||
priv_.stack.set_visible_child(&*priv_.content);
|
||||
priv_.logout_on_dispose.set(false);
|
||||
if let Some(window) = self.parent_window() {
|
||||
window.switch_to_sessions_page();
|
||||
}
|
||||
|
||||
if let Some(session_verificiation) = priv_.stack.child_by_name("session-verification") {
|
||||
priv_.stack.remove(&session_verificiation);
|
||||
|
|
|
@ -22,6 +22,8 @@ mod imp {
|
|||
#[template_child]
|
||||
pub main_stack: TemplateChild<gtk::Stack>,
|
||||
#[template_child]
|
||||
pub loading: TemplateChild<gtk::WindowHandle>,
|
||||
#[template_child]
|
||||
pub greeter: TemplateChild<Greeter>,
|
||||
#[template_child]
|
||||
pub login: TemplateChild<Login>,
|
||||
|
@ -88,7 +90,7 @@ mod imp {
|
|||
self.login
|
||||
.connect_new_session(clone!(@weak obj => move |_login, session| {
|
||||
obj.add_session(&session);
|
||||
obj.switch_to_sessions_page();
|
||||
obj.switch_to_loading_page();
|
||||
}));
|
||||
|
||||
self.main_stack.connect_visible_child_notify(
|
||||
|
@ -171,11 +173,14 @@ impl Window {
|
|||
fn restore_sessions(&self) {
|
||||
match secret::restore_sessions() {
|
||||
Ok(sessions) => {
|
||||
for stored_session in sessions {
|
||||
let session = Session::new();
|
||||
session.login_with_previous_session(stored_session);
|
||||
self.add_session(&session);
|
||||
self.switch_to_sessions_page();
|
||||
if sessions.is_empty() {
|
||||
self.switch_to_greeter_page(false);
|
||||
} else {
|
||||
for stored_session in sessions {
|
||||
let session = Session::new();
|
||||
session.login_with_previous_session(stored_session);
|
||||
self.add_session(&session);
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(error) => {
|
||||
|
@ -234,6 +239,11 @@ impl Window {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn switch_to_loading_page(&self) {
|
||||
let priv_ = self.imp();
|
||||
priv_.main_stack.set_visible_child(&*priv_.loading);
|
||||
}
|
||||
|
||||
pub fn switch_to_sessions_page(&self) {
|
||||
let priv_ = self.imp();
|
||||
priv_.main_stack.set_visible_child(&priv_.sessions.get());
|
||||
|
|
Loading…
Reference in a new issue