[Pkg-sugar-commit] [sugar-toolkit] 52/118: Some activities relies on existing of ds fields like 'title' #1241

Jonas Smedegaard dr at jones.dk
Thu Apr 16 18:49:40 UTC 2015


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag debian/0.84.10-1
in repository sugar-toolkit.

commit a428022a2718a813ad88f5334341a16a07eaacf9
Author: Aleksey Lim <alsroot at member.fsf.org>
Date:   Sun Sep 6 09:44:52 2009 +0000

    Some activities relies on existing of ds fields like 'title' #1241
---
 src/sugar/datastore/datastore.py | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/sugar/datastore/datastore.py b/src/sugar/datastore/datastore.py
index 8e8f361..d84a7f4 100644
--- a/src/sugar/datastore/datastore.py
+++ b/src/sugar/datastore/datastore.py
@@ -25,6 +25,8 @@ from datetime import datetime
 import os
 import tempfile
 import gobject
+import gconf
+import gio
 
 from sugar import env
 from sugar.datastore import dbus_helpers
@@ -140,8 +142,21 @@ class DSObject(object):
 class RawObject(object):
 
     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._metadata = DSMetadata()
+        self._metadata = DSMetadata(metadata)
         self._file_path = None
         self._destroyed = False
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-sugar/sugar-toolkit.git



More information about the pkg-sugar-commit mailing list