[hamster-applet] check if we are maybe switching to same activity



commit 4863b5dd782aa27b876fd58c743d657110633a3c
Author: Toms Bauģis <toms baugis gmail com>
Date:   Sun Jan 17 18:17:25 2010 +0000

    check if we are maybe switching to same activity

 hamster/applet.py |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/hamster/applet.py b/hamster/applet.py
index 8768e7b..8037d19 100755
--- a/hamster/applet.py
+++ b/hamster/applet.py
@@ -590,6 +590,14 @@ class HamsterApplet(object):
         if new in self.workspace_activities and self.workspace_activities[new]:
             activity = self.workspace_activities[new]
 
+            # check if maybe there is no need to switch, as field match:
+            if self.last_activity and \
+               self.last_activity['name'] == activity['name'] and \
+               self.last_activity['category'] == activity['category'] and \
+               self.last_activity['tags'] == activity['tags']:
+                return
+
+            # ok, switch
             runtime.storage.add_fact(activity['name'],
                                      ", ".join(activity['tags']),
                                      category_name = activity['category'],



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