Ticket #1241: sugar-1241-toolkit.2.patch

File sugar-1241-toolkit.2.patch, 1.5 KB (added by alsroot, 12 years ago)
  • src/sugar/datastore/datastore.py

    From 548774a91951e5ae83bd2717efa82eb87801647d Mon Sep 17 00:00:00 2001
    From: Aleksey Lim <alsroot@member.fsf.org>
    Date: Sun, 6 Sep 2009 07:32:49 +0000
    Subject: Some activities relies on existing of ds fields like 'title' #1241
    
    ---
     src/sugar/datastore/datastore.py |   17 ++++++++++++++++-
     1 files changed, 16 insertions(+), 1 deletions(-)
    
    diff --git a/src/sugar/datastore/datastore.py b/src/sugar/datastore/datastore.py
    index 81cda9c..0ad42b6 100644
    a b from datetime import datetime 
    2525import os
    2626import tempfile
    2727import gobject
     28import gconf
     29import gio
    2830
    2931from sugar import env
    3032from sugar.datastore import dbus_helpers
    class DSObject(object): 
    142144class RawObject(object):
    143145
    144146    def __init__(self, file_path):
     147        stat = os.stat(file_path)
     148        client = gconf.client_get_default()
     149        metadata = {
     150                'uid': file_path,
     151                'title': os.path.basename(file_path),
     152                'timestamp': stat.st_mtime,
     153                'mime_type': gio.content_type_guess(filename=file_path),
     154                'activity': '',
     155                'activity_id': '',
     156                'icon-color': client.get_string('/desktop/sugar/user/color'),
     157                'description': file_path,
     158                }
     159
    145160        self.object_id = file_path
    146         self._metadata = DSMetadata()
     161        self._metadata = DSMetadata(metadata)
    147162        self._file_path = None
    148163        self._destroyed = False
    149164