[fractal/split-main-stack] Split main_stack in login and sessions
- From: Alejandro Domínguez <aledomu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [fractal/split-main-stack] Split main_stack in login and sessions
- Date: Thu, 15 Jul 2021 14:46:30 +0000 (UTC)
commit b037db943e791167dd7eadeb54e4babc8d340683
Author: Alejandro Domínguez <adomu net-c com>
Date: Tue Jul 13 20:56:53 2021 +0200
Split main_stack in login and sessions
data/resources/ui/window.ui | 5 +++++
src/window.rs | 14 ++++++++++++--
2 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/data/resources/ui/window.ui b/data/resources/ui/window.ui
index d9ac02a1..db6bdd19 100644
--- a/data/resources/ui/window.ui
+++ b/data/resources/ui/window.ui
@@ -10,6 +10,11 @@
<child>
<object class="Login" id="login" />
</child>
+ <child>
+ <object class="GtkStack" id="sessions">
+ <property name="transition-type">crossfade</property>
+ </object>
+ </child>
</object>
</child>
</template>
diff --git a/src/window.rs b/src/window.rs
index 266d0b07..d51a4282 100644
--- a/src/window.rs
+++ b/src/window.rs
@@ -23,6 +23,8 @@ mod imp {
pub main_stack: TemplateChild<gtk::Stack>,
#[template_child]
pub login: TemplateChild<Login>,
+ #[template_child]
+ pub sessions: TemplateChild<gtk::Stack>,
}
#[glib::object_subclass]
@@ -35,6 +37,7 @@ mod imp {
Self {
main_stack: TemplateChild::default(),
login: TemplateChild::default(),
+ sessions: TemplateChild::default(),
}
}
@@ -102,8 +105,8 @@ impl Window {
fn add_session(&self, session: &Session) {
let priv_ = &imp::Window::from_instance(self);
- priv_.main_stack.add_child(session);
- priv_.main_stack.set_visible_child(session);
+ priv_.sessions.add_child(session);
+ priv_.sessions.set_visible_child(session);
self.install_session_actions(session);
}
@@ -132,6 +135,8 @@ impl Window {
session.login_with_previous_session(stored_session);
self.add_session(&session);
}
+
+ self.switch_to_sessions_page();
}
Err(error) => warn!("Failed to restore previous sessions: {:?}", error),
}
@@ -171,4 +176,9 @@ impl Window {
self.set_default_widget(gtk::NONE_WIDGET);
}
}
+
+ fn switch_to_sessions_page(&self) {
+ let priv_ = imp::Window::from_instance(self);
+ priv_.main_stack.set_visible_child(&priv_.sessions.get());
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]