about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
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_details.rs24
-rwxr-xr-xsrc/ui/task_row.rs9
-rwxr-xr-xsrc/ui/window.rs3
7 files changed, 42 insertions, 23 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_details.rs b/src/ui/task_details.rs
index 0ca40ce..37eced3 100755
--- a/src/ui/task_details.rs
+++ b/src/ui/task_details.rs
@@ -113,7 +113,7 @@ impl FurTaskDetails {
 
         imp.task_name_label.set_text(&task_group[0].task_name);
         let this_day_str = DateTime::parse_from_rfc3339(&task_group[0].start_time).unwrap();
-        *imp.this_day.borrow_mut() = this_day_str.format("%h %d %Y").to_string();
+        *imp.this_day.borrow_mut() = this_day_str.format("%x").to_string();
         *imp.orig_tags.borrow_mut() = task_group[0].tags.clone();
 
         for task in task_group.clone() {
@@ -193,13 +193,13 @@ impl FurTaskDetails {
                 let times_box = gtk::Box::new(gtk::Orientation::Horizontal, 5);
                 times_box.set_homogeneous(true);
 
-                let mut start_time_w_year = start_time.format("%h %d %Y %H:%M:%S").to_string();
+                let mut start_time_w_year = start_time.format("%x %H:%M:%S").to_string();
                 if !settings_manager::get_bool("show-seconds") {
-                    start_time_w_year = start_time.format("%h %d %Y %H:%M").to_string();
+                    start_time_w_year = start_time.format("%x %H:%M").to_string();
                 }
-                let mut stop_time_w_year = stop_time.format("%h %d %Y %H:%M:%S").to_string();
+                let mut stop_time_w_year = stop_time.format("%x %H:%M:%S").to_string();
                 if !settings_manager::get_bool("show-seconds") {
-                    stop_time_w_year = stop_time.format("%h %d %Y %H:%M").to_string();
+                    stop_time_w_year = stop_time.format("%x %H:%M").to_string();
                 }
                 let start_time_edit = gtk::Entry::new();
                 start_time_edit.set_text(&start_time_w_year);
@@ -207,9 +207,9 @@ impl FurTaskDetails {
                 stop_time_edit.set_text(&stop_time_w_year);
 
                 let instructions = gtk::Label::new(Some(
-                    &gettext("*Use the format MMM DD YYYY HH:MM:SS")));
+                    &gettext("*Use your local format XX/XX/XX HH:MM:SS")));
                 if !settings_manager::get_bool("show-seconds") {
-                    instructions.set_text(&gettext("*Use the format MMM DD YYYY HH:MM"));
+                    instructions.set_text(&gettext("*Use your local format XX/XX/XX HH:MM"));
                 }
                 instructions.set_visible(false);
                 instructions.add_css_class("error_message");
@@ -309,11 +309,11 @@ impl FurTaskDetails {
                                 if settings_manager::get_bool("show-seconds") {
                                     new_start_time = NaiveDateTime::parse_from_str(
                                                         &new_start_time_str,
-                                                        "%h %d %Y %H:%M:%S");
+                                                        "%x %H:%M:%S");
                                 } else {
                                     new_start_time = NaiveDateTime::parse_from_str(
                                                             &new_start_time_str,
-                                                            "%h %d %Y %H:%M");
+                                                            "%x %H:%M");
                                 }
                                 if let Err(_) = new_start_time {
                                     instructions.set_visible(true);
@@ -330,11 +330,11 @@ impl FurTaskDetails {
                                 if settings_manager::get_bool("show-seconds") {
                                     new_stop_time = NaiveDateTime::parse_from_str(
                                                         &new_stop_time_str,
-                                                        "%h %d %Y %H:%M:%S");
+                                                        "%x %H:%M:%S");
                                 } else {
                                     new_stop_time = NaiveDateTime::parse_from_str(
                                                             &new_stop_time_str,
-                                                            "%h %d %Y %H:%M");
+                                                            "%x %H:%M");
                                 }
                                 if let Err(_) = new_stop_time {
                                     instructions.set_visible(true);
@@ -435,7 +435,7 @@ impl FurTaskDetails {
         updated_list.retain(|task| {
             let delete = {
                 let start_time = DateTime::parse_from_rfc3339(&task.start_time).unwrap();
-                let start_time_str = start_time.format("%h %d %Y").to_string();
+                let start_time_str = start_time.format("%x").to_string();
                 if imp.this_day.borrow().to_string() != start_time_str
                     || imp.task_name_label.text() != task.task_name
                     || imp.orig_tags.borrow().to_string() != task.tags {
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()
     }
 }
+