Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar/activity
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@localhost.localdomain>2006-12-24 01:51:37 (GMT)
committer Marco Pesenti Gritti <marco@localhost.localdomain>2006-12-24 01:51:37 (GMT)
commitdce69ef995d6d8b86ea70d4d58d3d17b4b91860a (patch)
tree37bc6a6d7a238fe67328ea68d753d2f7bad4b5f5 /sugar/activity
parent5bd97cf5a16a5f3ae4a2c27f546aeed4be04509e (diff)
Refactor a bit to simply __init__
Diffstat (limited to 'sugar/activity')
-rw-r--r--sugar/activity/Activity.py28
1 files changed, 26 insertions, 2 deletions
diff --git a/sugar/activity/Activity.py b/sugar/activity/Activity.py
index 74f940e..8d71d03 100644
--- a/sugar/activity/Activity.py
+++ b/sugar/activity/Activity.py
@@ -22,8 +22,10 @@ import dbus
import dbus.service
import gtk
import gobject
+import datetime
from sugar.presence import PresenceService
+from sugar.datastore import datastore
from sugar import activity
from sugar import env
import sugar.util
@@ -95,11 +97,13 @@ class Activity(gtk.Window):
def __init__(self):
gtk.Window.__init__(self)
- self.connect('destroy', self.__destroy_cb)
+ self.connect('destroy', self._destroy_cb)
+ self.connect('notify::title', self._title_changed_cb)
self._shared = False
self._activity_id = None
self._service = None
+ self._journal_object = None
self._pservice = PresenceService.get_instance()
self.realize()
@@ -117,8 +121,20 @@ class Activity(gtk.Window):
return
self._activity_id = sugar.util.unique_id()
+
+ ds = datastore.get_instance()
+ self._journal_object = ds.create('', {}, self._activity_id)
+
+ date = datetime.datetime.now()
+ self._journal_jobject.set_properties({'date' : date,
+ 'title' : self.get_title()})
+
self.present()
+ def get_journal_object(self):
+ """Returns the journal object associated with the activity."""
+ return self._journal_object
+
def get_type(self):
"""Gets the activity type."""
return env.get_bundle_service_name()
@@ -158,6 +174,9 @@ class Activity(gtk.Window):
else:
logging.error('Cannot join the activity')
+ ds = datastore.get_instance()
+ self._journal_object = ds.get_activity_object(self._activity_id)
+
self.present()
def share(self):
@@ -172,9 +191,14 @@ class Activity(gtk.Window):
"""Execute the given command with args"""
return False
- def __destroy_cb(self, window):
+ def _destroy_cb(self, window):
if self._bus:
del self._bus
self._bus = None
if self._service:
self._pservice.unregister_service(self._service)
+
+ def _title_changed_cb(self, window, spec):
+ jobject = self.get_journal_object()
+ if jobject:
+ jobject.set_properties({'title' : self.props.title})