[gnome-todo] unscheduled-tasks: fix task count logic



commit 2f7a5ecb695e12c1a44d69e7b3ab200cba0500ba
Author: Mohammed Sadiq <sadiq sadiqpk org>
Date:   Sat Sep 24 11:32:11 2016 +0530

    unscheduled-tasks: fix task count logic
    
    the task count for unscheduled-task was shown wrong.
    
    This is because the task count function was not taking care
    if the task is completed or not.
    Also, the plugin wasn't notifying for title changes when the task
    count changed.
    
    This commit fixes task count by counting only non completed unsheduled
    tasks and notifying the application to change title on task count change.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=771906

 .../unscheduled-panel/__init__.py                  |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/plugins/unscheduled-panel/unscheduled-panel/__init__.py 
b/plugins/unscheduled-panel/unscheduled-panel/__init__.py
index 63269f6..81efa65 100644
--- a/plugins/unscheduled-panel/unscheduled-panel/__init__.py
+++ b/plugins/unscheduled-panel/unscheduled-panel/__init__.py
@@ -64,11 +64,13 @@ class UnscheduledPanel(Gtk.Box, Gtd.Panel):
 
         for tasklist in manager.get_task_lists():
             for task in tasklist.get_tasks():
-                if not task in current_tasks and task.get_due_date() is None:
-                    self.tasklist.save_task(task)
-                    self.task_counter += 1
+                if task.get_due_date() is None:
+                    if not task in current_tasks:
+                        self.tasklist.save_task(task)
+                    if not task.get_complete():
+                        self.task_counter += 1
 
-        if previous_task_counter == self.task_counter:
+        if previous_task_counter != self.task_counter:
             self.notify("title")
 
     def do_get_header_widgets(self):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]