Some activities relies on existing of ds fields like 'title' #1241

This commit is contained in:
Aleksey Lim 2009-09-06 09:44:52 +00:00
parent 192ed1bc06
commit dc0701dacf

View File

@ -25,6 +25,8 @@ from datetime import datetime
import os import os
import tempfile import tempfile
import gobject import gobject
import gconf
import gio
from sugar import env from sugar import env
from sugar.datastore import dbus_helpers from sugar.datastore import dbus_helpers
@ -142,8 +144,21 @@ class DSObject(object):
class RawObject(object): class RawObject(object):
def __init__(self, file_path): def __init__(self, file_path):
stat = os.stat(file_path)
client = gconf.client_get_default()
metadata = {
'uid': file_path,
'title': os.path.basename(file_path),
'timestamp': stat.st_mtime,
'mime_type': gio.content_type_guess(filename=file_path),
'activity': '',
'activity_id': '',
'icon-color': client.get_string('/desktop/sugar/user/color'),
'description': file_path,
}
self.object_id = file_path self.object_id = file_path
self._metadata = DSMetadata() self._metadata = DSMetadata(metadata)
self._file_path = None self._file_path = None
self._destroyed = False self._destroyed = False