[Sugar-devel] Journal integration for Scratch

Tomeu Vizoso tomeu at sugarlabs.org
Mon Jan 12 04:16:49 EST 2009


[adding sugar-devel to the cc list]

On Mon, Jan 12, 2009 at 09:42, Philipp Kocher <philipp.kocher at gmx.net> wrote:
>
>
> Tomeu Vizoso wrote:
>>
>> On Thu, Jan 8, 2009 at 04:50, Philipp Kocher <philipp.kocher at gmx.net>
>> wrote:
>>>
>>> Bert Freudenberg wrote:
>>>>
>>>> On 18.12.2008, at 08:08, Philipp Kocher wrote:
>>>>>
>>>>> One more thing, the scratch icon is not shown in the journal for files
>>>>> with the scratch mimetype. I think the file
>>>>> /usr/share/sugar/data/mime.defaults has to be adapted to include the
>>>>> scratch-mimetype.
>>>>
>>>> It just has to be listed in the activity bundle's info file:
>>>>
>>>> http://wiki.laptop.org/go/Activity_bundles#.info_File_Format
>>>>
>>>> - Bert -
>>>>
>>>>
>>> I added the mime_types attribute to the activities.info file and the
>>> icon attribute is set as well. But still the Scratch icon is not shown
>>> in the Journal (the default octet-stream icon is shown) even so the
>>> Scratch mime-type is set in the metadata file in the datastore.
>>>
>>> I think the problem is connected to the gtk theme (gtk-update-icon-cache
>>> and update-mime-database). e.g. etoys has file etoys.xml in
>>> /usr/share/mime/packages and probably the icon in the icon cache.
>>>
>>> How can I put the icon in the icon-cache?
>>
>> Hi, Sugar will put it there for you when the .xo bundle is installed.
>> That means that if the activity bundle gets installed from outside
>> Sugar, the mime db won't be updated.
>>
>> So, I would recommend you to uninstall Scratch from Sugar, then
>> installing the .xo bundle by downloading it with Browse or by copying
>> it into the journal from an usb stick.
>>
>> HTH,
>>
>> Tomeu
>>
>
> Thanks for the input, but I wasn't successful.
>
> I tried the following:
> 1. Extracted the files of "Scratch-12.xo"
> 2. Added the line "mime_types = application/x-scratch-project" to the
> activity.info file
> 2. Created a new archive file "Scratch-12_mime.xo" with the change
> 3. Erased activity Scratch on the XO
> 4. Copied the file "Scratch-12_mime.xo" to the Journal
> 5. Started/Installed "Scratch-12_mime.xo"
> 6. Copied Scratch project to the Journal with "copy-to-journal test.sb -m
> 'application/x-scratch-project' -t test.sb"

Ok, what you just did will tell Sugar that Scratch is able to open
files with the mime type 'application/x-scratch-project'. But this
will not affect the icon of those files.

> test.sb still has the standard icon and not the Scratch cat icon in the
> Journal.
>
> Which activity is using the mime db update feature?

Don't know myself :/

> I would expect a new
> timestamp for the file /usr/share/mime/mime.cache after installing the
> activity.

Well, activities are installed by a normal user so that file won't be
modified. Instead, the cache will live in ~/.local/share/mime

> Can I execute the mime db update on the command line?

Yes: update-mime-database ~/.local/share/mime

If you want to get the details and fully understand how this is done,
you can check this code:

http://git.sugarlabs.org/projects/sugar-toolkit/repos/mainline/blobs/master/src/sugar/bundle/activitybundle.py#line318

That gets executed when a bundle is unpacked and registered in the
shell. As you can see, if a file activity/mimetypes.xml is found in
the exploded dir, a symlink will be made to this file form the mime
dir and the updater script will be run.

HTH,

Tomeu


More information about the Sugar-devel mailing list