about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorRicky Kresslein <rk@lakoliu.com>2022-06-07 14:39:24 +0300
committerRicky Kresslein <rk@lakoliu.com>2022-06-07 14:39:24 +0300
commitaf3f7b2473f1206f1a9ecb429084670cc4661923 (patch)
tree2bf5e95422d66d7295b5a099f689fddb88f30af5 /src
parent374bd69f6d5aa46ce9b4d7f4f2acb871b1d2426b (diff)
downloadFurtherance-af3f7b2473f1206f1a9ecb429084670cc4661923.tar.zst
Button to restart tasks
Diffstat (limited to 'src')
-rwxr-xr-xsrc/application.rs1
-rwxr-xr-xsrc/gtk/preferences_window.ui1
-rwxr-xr-xsrc/gtk/task_row.ui26
-rwxr-xr-xsrc/ui/preferences_window.rs1
-rwxr-xr-xsrc/ui/task_row.rs9
-rwxr-xr-xsrc/ui/window.rs3
6 files changed, 30 insertions, 11 deletions
diff --git a/src/application.rs b/src/application.rs
index 6050af3..ad6ee51 100755
--- a/src/application.rs
+++ b/src/application.rs
@@ -302,3 +302,4 @@ impl Default for FurtheranceApplication {
     }
 }
 
+
diff --git a/src/gtk/preferences_window.ui b/src/gtk/preferences_window.ui
index be331b7..e6fd65b 100755
--- a/src/gtk/preferences_window.ui
+++ b/src/gtk/preferences_window.ui
@@ -210,3 +210,4 @@
     </child>
   </template>
 </interface>
+
diff --git a/src/gtk/task_row.ui b/src/gtk/task_row.ui
index f5de3a5..7184bc3 100755
--- a/src/gtk/task_row.ui
+++ b/src/gtk/task_row.ui
@@ -4,8 +4,8 @@
     <child>
       <object class="GtkBox" id="row_box">
         <property name="orientation">horizontal</property>
-        <property name="margin_top">10</property>
-        <property name="margin_bottom">10</property>
+        <property name="margin_top">5</property>
+        <property name="margin_bottom">5</property>
         <property name="margin_end">12</property>
         <property name="margin_start">12</property>
         <property name="hexpand">True</property>
@@ -40,13 +40,23 @@
           </object>
         </child>
         <child>
-          <object class="GtkLabel" id="total_time_label">
+          <object class="GtkBox">
             <property name="halign">end</property>
-            <property name="label" translatable="yes">Time</property>
-            <property name="single_line_mode">True</property>
-            <style>
-              <class name="numeric"/>
-            </style>
+            <child>
+              <object class="GtkLabel" id="total_time_label">
+                <property name="label" translatable="yes">Time</property>
+                <property name="single_line_mode">True</property>
+                <style>
+                  <class name="numeric"/>
+                </style>
+              </object>
+            </child>
+            <child>
+              <object class="GtkButton" id="restart_task_btn">
+                <property name="icon-name">view-refresh-symbolic</property>
+                <property name="has-frame">false</property>
+              </object>
+            </child>
           </object>
         </child>
       </object>
diff --git a/src/ui/preferences_window.rs b/src/ui/preferences_window.rs
index d034a9f..d9495fd 100755
--- a/src/ui/preferences_window.rs
+++ b/src/ui/preferences_window.rs
@@ -253,3 +253,4 @@ impl FurPreferencesWindow {
     }
 }
 
+
diff --git a/src/ui/task_row.rs b/src/ui/task_row.rs
index 0e46d81..cccc827 100755
--- a/src/ui/task_row.rs
+++ b/src/ui/task_row.rs
@@ -42,6 +42,8 @@ mod imp {
         pub task_tags_label: TemplateChild<gtk::Label>,
         #[template_child]
         pub total_time_label: TemplateChild<gtk::Label>,
+        #[template_child]
+        pub restart_task_btn: TemplateChild<gtk::Button>,
 
         pub tasks: Lazy<Mutex<Vec<Task>>>,
         pub total_time: RefCell<i64>,
@@ -116,8 +118,6 @@ impl FurTaskRow {
         } else {
             let task_tags = format!("#{}", task_list[0].tags);
             imp.task_tags_label.set_text(&task_tags);
-            imp.row_box.set_margin_top(5);
-            imp.row_box.set_margin_bottom(5);
         }
 
         // Create right-click gesture
@@ -131,6 +131,11 @@ impl FurTaskRow {
 
         self.add_controller(&gesture);
 
+        imp.restart_task_btn.connect_clicked(clone!(@strong task_list => move |_| {
+            let window = FurtheranceWindow::default();
+            window.duplicate_task(task_list[0].clone());
+        }));
+
         // Add up all durations for task of said name to create total_time
         for task in &task_list {
             if task.task_name == task.task_name {
diff --git a/src/ui/window.rs b/src/ui/window.rs
index 5b7d647..992bc9f 100755
--- a/src/ui/window.rs
+++ b/src/ui/window.rs
@@ -752,7 +752,7 @@ impl FurtheranceWindow {
         }
     }
 
-    pub fn refresh_timer (&self) {
+    pub fn refresh_timer(&self) {
         let imp = imp::FurtheranceWindow::from_instance(self);
         if settings_manager::get_bool("pomodoro") {
             let mut mins = settings_manager::get_int("pomodoro-time");
@@ -778,3 +778,4 @@ impl Default for FurtheranceWindow {
             .unwrap()
     }
 }
+