From b9453ffad7590080ed67898062babd97bbea46af Mon Sep 17 00:00:00 2001 From: Ricky Kresslein Date: Fri, 10 Jun 2022 15:35:12 +0300 Subject: Center timer on empty (Issue #1) --- src/ui/window.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/ui/window.rs') diff --git a/src/ui/window.rs b/src/ui/window.rs index d02d1b5..5670696 100755 --- a/src/ui/window.rs +++ b/src/ui/window.rs @@ -52,6 +52,9 @@ mod imp { pub header_bar: TemplateChild, #[template_child] pub add_task: TemplateChild, + + #[template_child] + pub win_box: TemplateChild, #[template_child] pub watch: TemplateChild, #[template_child] @@ -162,15 +165,13 @@ impl FurtheranceWindow { fn setup_widgets(&self) { let imp = imp::FurtheranceWindow::from_instance(self); - // Set initial minimum height + // Set initial minimum height and alignment let is_saved_task: bool = match database::check_for_tasks() { Ok(_) => true, Err(_) => false, }; if is_saved_task { - self.set_height_request(300); - } else { - self.set_height_request(390); + self.vertical_align(gtk::Align::Start); } // Development mode @@ -910,6 +911,12 @@ impl FurtheranceWindow { dialog.show() } + + pub fn vertical_align(&self, align: gtk::Align) { + let imp = imp::FurtheranceWindow::from_instance(self); + imp.win_box.set_valign(align); + } + } impl Default for FurtheranceWindow { -- cgit 1.4.1