Merge branch 'master' of git+ssh://dev.laptop.org/git/sugar

This commit is contained in:
Marco Pesenti Gritti
2007-07-11 11:45:43 +02:00
5 changed files with 79 additions and 37 deletions
+2
View File
@@ -312,6 +312,8 @@ class Activity(Window, gtk.Container):
def _get_preview(self):
preview_pixbuf = self.get_canvas_screenshot()
if preview_pixbuf is None:
return None
preview_pixbuf = preview_pixbuf.scale_simple(units.grid_to_pixels(4),
units.grid_to_pixels(3),
gtk.gdk.INTERP_BILINEAR)
+34
View File
@@ -20,6 +20,9 @@ import logging
import gobject
from sugar.datastore import dbus_helpers
from sugar import activity
from sugar.activity.bundle import Bundle
from sugar.activity import activityfactory
class DSMetadata(gobject.GObject):
__gsignals__ = {
@@ -85,6 +88,37 @@ class DSObject:
file_path = property(get_file_path, set_file_path)
def get_activities(self):
activities = []
if self.metadata['activity']:
activity_info = activity.get_registry().get_activity(self.metadata['activity'])
activities.append(activity_info)
mime_type = self.metadata['mime_type']
if mime_type:
activities_info = activity.get_registry().get_activities_for_type(mime_type)
for activity_info in activities_info:
if activity_info.service_name != self.metadata['activity']:
activities.append(activity_info)
return activities
def is_bundle(self):
return self.metadata['mime_type'] == 'application/vnd.olpc-x-sugar'
def resume(self):
if self.is_bundle():
bundle = Bundle(self.file_path)
if not bundle.is_installed():
bundle.install()
activityfactory.create(bundle.get_service_name())
else:
activity_info = self.get_activities()[0]
activityfactory.create_with_object_id(activity_info.service_name,
self.object_id)
def get(object_id):
logging.debug('datastore.get')
metadata = dbus_helpers.get_properties(object_id)
+11
View File
@@ -166,6 +166,17 @@ class Activity(gobject.GObject):
(bus_name, connection, channels) = self._activity.GetChannels()
return bus_name, connection, channels
def _leave_cb(self):
# XXX Is this the right thing to do?
self.emit("joined", False, "left activity")
def _leave_error_cb(self, err):
# XXX We are closing down anyway
pass
def leave(self):
"""Leave this shared activity"""
# FIXME
self._joined = False
self._activity.Leave(reply_handler=self._leave_cb,
error_handler=self._leave_error_cb)