about summary refs log tree commit diff
path: root/src/ui/window.rs
diff options
context:
space:
mode:
authorRicky Kresslein <rk@lakoliu.com>2022-06-10 15:35:12 +0300
committerRicky Kresslein <rk@lakoliu.com>2022-06-10 15:35:12 +0300
commitb9453ffad7590080ed67898062babd97bbea46af (patch)
tree2487ac15721a12081a1e8e5fdbc17639e054d081 /src/ui/window.rs
parentd7099a4d98744481e8f7ecce4e9233e66af1fd44 (diff)
downloadFurtherance-b9453ffad7590080ed67898062babd97bbea46af.tar.zst
Center timer on empty (Issue #1)
Diffstat (limited to 'src/ui/window.rs')
-rwxr-xr-xsrc/ui/window.rs15
1 files changed, 11 insertions, 4 deletions
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<adw::HeaderBar>,
         #[template_child]
         pub add_task: TemplateChild<gtk::Button>,
+
+        #[template_child]
+        pub win_box: TemplateChild<gtk::Box>,
         #[template_child]
         pub watch: TemplateChild<gtk::Label>,
         #[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 {