[hamster-applet] new dbus method getCurrentActivity that returns just the name and category of the ongoing activity



commit 9217a86bb45cb49101f64cfbf2f5b45f44abe5db
Author: Ashton Kemerling <ashtonkemerling gmail com>
Date:   Wed Nov 4 09:06:01 2009 +0000

    new dbus method getCurrentActivity that returns just the name and category of the ongoing activity

 hamster/hamsterdbus.py |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/hamster/hamsterdbus.py b/hamster/hamsterdbus.py
index fd63722..7e1ec48 100644
--- a/hamster/hamsterdbus.py
+++ b/hamster/hamsterdbus.py
@@ -140,6 +140,20 @@ class HamsterDbusController(dbus.service.Object):
             activities.append((act['name'] or '', act['category'] or ''))
         return activities
 
+    @dbus.service.method(HAMSTER_URI, out_signature='ss')
+    def GetCurrentActivity(self):
+	"""Returns the Activity currently being used, or blanks if Hamster is not tracking currently
+	s activity: Activity name
+	s category: Category name
+	"""
+	last_activity = runtime.storage.get_last_activity()
+	if last_activity:
+		return (last_activity['name'] or '', last_activity['category'] or '')
+	else:
+		return ('', '')
+	
+	
+
     @dbus.service.method(HAMSTER_URI, out_signature='as')
     def GetCategories(self):
         """Gets all defined categories



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