Address several nitpicks from Marco

This commit is contained in:
Tomeu Vizoso 2010-08-17 12:00:45 +02:00
parent 56679a3de6
commit 1af1bc9713
5 changed files with 34 additions and 26 deletions

View File

@ -317,9 +317,9 @@ class Activity(Window, gtk.Container):
self._client_handler = _ClientHandler( self._client_handler = _ClientHandler(
self.get_bundle_id(), self.get_bundle_id(),
partial(self.__got_channel_cb, wait_loop)) partial(self.__got_channel_cb, wait_loop))
# The current API requires that self.shared_activity is set before # FIXME: The current API requires that self.shared_activity is set
# exiting from __init__, so we wait until we have got the shared # before exiting from __init__, so we wait until we have got the
# activity. # shared activity. http://bugs.sugarlabs.org/ticket/2168
wait_loop.run() wait_loop.run()
else: else:
pservice = presenceservice.get_instance() pservice = presenceservice.get_instance()
@ -329,27 +329,35 @@ class Activity(Window, gtk.Container):
if handle.object_id is None and create_jobject: if handle.object_id is None and create_jobject:
logging.debug('Creating a jobject.') logging.debug('Creating a jobject.')
self._jobject = datastore.create() self._jobject = self._initialize_journal_object()
title = _('%s Activity') % get_bundle_name()
self._jobject.metadata['title'] = title
self.set_title(self._jobject.metadata['title']) self.set_title(self._jobject.metadata['title'])
self._jobject.metadata['title_set_by_user'] = '0'
self._jobject.metadata['activity'] = self.get_bundle_id() def _initialize_journal_object(self):
self._jobject.metadata['activity_id'] = self.get_id() title = _('%s Activity') % get_bundle_name()
self._jobject.metadata['keep'] = '0'
self._jobject.metadata['preview'] = ''
self._jobject.metadata['share-scope'] = SCOPE_PRIVATE
if self.shared_activity is not None: if self.shared_activity is not None:
icon_color = self.shared_activity.props.color icon_color = self.shared_activity.props.color
else: else:
client = gconf.client_get_default() client = gconf.client_get_default()
icon_color = client.get_string('/desktop/sugar/user/color') icon_color = client.get_string('/desktop/sugar/user/color')
self._jobject.metadata['icon-color'] = icon_color
self._jobject.file_path = '' jobject = datastore.create()
# Cannot call datastore.write async for creates: jobject.metadata['title'] = title
# https://dev.laptop.org/ticket/3071 jobject.metadata['title_set_by_user'] = '0'
datastore.write(self._jobject) jobject.metadata['activity'] = self.get_bundle_id()
jobject.metadata['activity_id'] = self.get_id()
jobject.metadata['keep'] = '0'
jobject.metadata['preview'] = ''
jobject.metadata['share-scope'] = SCOPE_PRIVATE
jobject.metadata['icon-color'] = icon_color
jobject.file_path = ''
# FIXME: We should be able to get an ID synchronously from the DS,
# then call async the actual create.
# http://bugs.sugarlabs.org/ticket/2169
datastore.write(jobject)
return jobject
def _set_up_sharing(self, mesh_instance, share_scope): def _set_up_sharing(self, mesh_instance, share_scope):
# handle activity share/join # handle activity share/join

View File

@ -3,8 +3,8 @@ sugar_PYTHON = \
__init__.py \ __init__.py \
activity.py \ activity.py \
buddy.py \ buddy.py \
connectionmanager.py \
sugartubeconn.py \ sugartubeconn.py \
tubeconn.py \ tubeconn.py \
presenceservice.py \ presenceservice.py
util.py

View File

@ -31,7 +31,7 @@ from telepathy.interfaces import CONNECTION, \
CONNECTION_INTERFACE_CONTACTS CONNECTION_INTERFACE_CONTACTS
from telepathy.constants import HANDLE_TYPE_CONTACT from telepathy.constants import HANDLE_TYPE_CONTACT
from sugar.presence.util import get_connection_manager from sugar.presence.connectionmanager import get_connection_manager
ACCOUNT_MANAGER_SERVICE = 'org.freedesktop.Telepathy.AccountManager' ACCOUNT_MANAGER_SERVICE = 'org.freedesktop.Telepathy.AccountManager'
CONN_INTERFACE_BUDDY_INFO = 'org.laptop.Telepathy.BuddyInfo' CONN_INTERFACE_BUDDY_INFO = 'org.laptop.Telepathy.BuddyInfo'

View File

@ -31,7 +31,7 @@ from dbus import PROPERTIES_IFACE
from sugar.presence.buddy import Buddy, Owner from sugar.presence.buddy import Buddy, Owner
from sugar.presence.activity import Activity from sugar.presence.activity import Activity
from sugar.presence.util import get_connection_manager from sugar.presence.connectionmanager import get_connection_manager
from telepathy.interfaces import ACCOUNT, \ from telepathy.interfaces import ACCOUNT, \
ACCOUNT_MANAGER, \ ACCOUNT_MANAGER, \