[fractal/fractal-next] Add loading spinner while restoring session
- From: Julian Sparber <jsparber src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [fractal/fractal-next] Add loading spinner while restoring session
- Date: Wed, 8 Sep 2021 13:28:14 +0000 (UTC)
commit 99f13172777576e330cb334873b2f4da12b8910b
Author: Julian Sparber <julian sparber net>
Date: Wed Sep 8 15:15:41 2021 +0200
Add loading spinner while restoring session
data/resources/ui/window.ui | 31 ++++++++++++++++++++++++++++++-
src/window.rs | 11 ++++++++++-
2 files changed, 40 insertions(+), 2 deletions(-)
---
diff --git a/data/resources/ui/window.ui b/data/resources/ui/window.ui
index db6bdd19..0973a47e 100644
--- a/data/resources/ui/window.ui
+++ b/data/resources/ui/window.ui
@@ -8,14 +8,43 @@
<property name="visible-child">login</property>
<property name="transition-type">crossfade</property>
<child>
- <object class="Login" id="login" />
+ <object class="Login" id="login"/>
</child>
<child>
<object class="GtkStack" id="sessions">
<property name="transition-type">crossfade</property>
</object>
</child>
+ <child>
+ <object class="GtkWindowHandle" id="loading_page">
+ <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>
</object>
</child>
</template>
</interface>
+
diff --git a/src/window.rs b/src/window.rs
index d2148f5e..7e4e590f 100644
--- a/src/window.rs
+++ b/src/window.rs
@@ -25,6 +25,8 @@ mod imp {
pub login: TemplateChild<Login>,
#[template_child]
pub sessions: TemplateChild<gtk::Stack>,
+ #[template_child]
+ pub loading_page: TemplateChild<gtk::WindowHandle>,
}
#[glib::object_subclass]
@@ -134,7 +136,7 @@ impl Window {
}
if n > 0 {
- self.switch_to_sessions_page();
+ self.switch_to_loading_page();
}
}
Err(error) => warn!("Failed to restore previous sessions: {:?}", error),
@@ -181,6 +183,13 @@ impl Window {
priv_.main_stack.set_visible_child(&priv_.sessions.get());
}
+ pub fn switch_to_loading_page(&self) {
+ let priv_ = imp::Window::from_instance(self);
+ priv_
+ .main_stack
+ .set_visible_child(&priv_.loading_page.get());
+ }
+
pub fn switch_to_login_page(&self) {
let priv_ = imp::Window::from_instance(self);
priv_
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]