Re: [Sugar-devel] Journal integration for Scratch

2009-01-24 Thread Philipp Kocher
You are right. It doesn't work like that, but the filename is quite
important to me. It is shown in the Scratch GUI and it is an important
marker to find the project, when save and not save as is used.
I wouldn't just take the object_id. What do you think John?

There is a bug in Scratch version 12. The symbolic link of the Project
directory doesn't get created (Open Projects shows Scratch.activity
folder instead). I checked the scripts (scratch-activity and
scratch-wrapper) but couldn't find where the link should get created.

Regards,
Philipp

Bert Freudenberg wrote:
> The script looks good, except for the name mangling magic (which is a 
> bit hard to understand because of mis-indentations). This wouldn't even 
> work with your XO's language set to non-English (which the majority of 
> XOs use).
> 
> I would simply name the file "$object_id.sb".
> 
> - Bert -
> 
> On 14.01.2009, at 07:04, Philipp Kocher wrote:
> 
>> Hi John
>>
>> Yes, we need the mimetypes.xml file as well (thanks Tomeu I forgot the 
>> USB flash drive use case). I have tested the attached mimetypes.xml. 
>> It is working fine. Put it in the activity directory.
>>
>> Furthermore we have to change the scratch-activity script, so the 
>> parameter with the scratch project object-id gets converted 
>> (copy-from-journal) in a file and passed on to scratch. See the 
>> attached scratch-activity script. I am not an expert with bash 
>> scripts, so please give feedback.
>>
>> I would like to extend the script so project files in the journal 
>> directory are copied back to the journal after exiting scratch, but 
>> for opening project it should work fine.
>>
>> Best regards,
>> Philipp
>>
>> John Maloney wrote:
>>> Hi, Phillip.
>>> Thanks for all your hard work in tracking this down. I had looked at 
>>> several other packages, including EToys, and couldn't figure out from 
>>> them how to do this.
>>> I will make these changes to the next XO Scratch bundle.
>>> Is that all I need to do? What about the mime types XML file similar 
>>> to the one added by Etoys? Does that turn out to be unnecessary?
>>>-- John
>>> On Jan 13, 2009, at 12:55 AM, Philipp Kocher wrote:
 Tomeu Vizoso wrote:
> On Mon, Jan 12, 2009 at 18:50, Bert Freudenberg 
>  wrote:
>> On 12.01.2009, at 18:11, Tomeu Vizoso wrote:
 So what would the Scratch activity have to do so files put into the
 Journal
 (maybe by downloading) are displayed using a Scratch icon rather 
 than the
 generic document icon?
>>> Shipping a mimetypes.xml file inside the bundle as explained here:
>>>
>>> http://wiki.laptop.org/go/Activity_bundles#Bundle_Structure
>>>
>>> Sugar will call update-mime-database and will merge that file 
>>> into the
>>> xdg mime database.
>>>
>>> I think that John is already trying this.
>>
>> Guess I'm confused then - I thought that's exactly what Philipp 
>> had done.
> I think he just changed the mime_types field in the .info file.
>> And I just checked and it does work with Etoys projects. When 
>> downloading
>> one it indeed gets an etoys icon (although at a smaller size - why 
>> is that?)
> No idea, though I think that the mime database is updated in the etoys
> rpm and not in the bundle, am I right?
> Regards,
> Tomeu

 Thanks Tomeu to lead me to the /home/olpc/.local directory. However, 
 the
 mimetypes.xml is not necessary to get the icon in the journal. I just
 had to copy the scratch icon file in the activity directory to
 "application-x-scratch-project.svg" (also in the scratch activity
 dirctory). The Memorize Activity is a good example for using that 
 feature.
 Sugar has to be restarted after installing Scratch to show the icon.

 John, could you please make the following changes in the next Scratch
 version:
 - add the line "mime_types = application/x-scratch-project" to the
 activity.info file
 - copy the scratch icon to "application-x-scratch-project.svg" in the
 activity directory

 Etoys gets configured by different packages. e.g. the rpm
 etoys-3.0.2153-1.noarch is adding the file
 /usr/share/mime/packges/etoys.xml and the rpm 
 sugar-artwork-0.82.3-1.olpc3 is
 adding the file
 /usr/share/icons/sugar/scalable/mimetypes/application-x-squake-project.svg.
  


 Regards,
 Philipp

>> 
>> http://www.freedesktop.org/standards/shared-mime-info";>
>>   
>> Scratch Project
>> 
>>   
>> 
>> #!/bin/sh
>> # Author: Bert Freudenberg
>> # Modified by: John Maloney
>> # Purpose: Run Scratch using the Squeak virtual machine
>>
>> echo "scratch-activity"
>> echo "$@"
>>
>> echo "$0" "$@"
>> echo
>>
>> # arguments are unordered, have to loop
>> args=""
>> while [ -n "$2" ] ; do
>>case "$1" in
>>  -b | --bundle-id)   bundle_id="$2"   ; args="$args BUNDLE_ID 
>> $2" ;;
>>  -a | --activit

Re: [Sugar-devel] Journal integration for Scratch

2009-01-24 Thread John Maloney
Ahh, that would explain it!

Maybe we need a couple of lines of shell script to check for the link  
and create it if it isn't there.

-- John

On Jan 15, 2009, at 7:56 AM, Bert Freudenberg wrote:
> On 15.01.2009, at 13:55, John Maloney wrote:
>
>> Hi, Phillip.
>>
>> Re:
>>> There is a bug in Scratch version 12. The symbolic link of the  
>>> Project
>>> directory doesn't get created (Open Projects shows Scratch.activity
>>> folder instead). I checked the scripts (scratch-activity and
>>> scratch-wrapper) but couldn't find where the link should get  
>>> created.
>>
>> In Scratch 11, a symbolic link was included in the .xo and  
>> unzipping re-created that link. Someone else helped me create that  
>> mechanism (sorry I can't quite remember who). But you are right, it  
>> no longer works in v12, either because I changed something about my  
>> process for creating the .xo file or perhaps because of a change in  
>> the XO software (less likely).
>>
>> I will look into this.
>
>
> Unless someone fixed this in the mean time, symbolic links in  
> bundles are not preserved:
>
> http://dev.laptop.org/ticket/4584
>
> - Bert -
>
>

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Journal integration for Scratch

2009-01-24 Thread John Maloney
Hi, Phillip.

Re:
> There is a bug in Scratch version 12. The symbolic link of the Project
> directory doesn't get created (Open Projects shows Scratch.activity
> folder instead). I checked the scripts (scratch-activity and
> scratch-wrapper) but couldn't find where the link should get created.

In Scratch 11, a symbolic link was included in the .xo and unzipping  
re-created that link. Someone else helped me create that mechanism  
(sorry I can't quite remember who). But you are right, it no longer  
works in v12, either because I changed something about my process for  
creating the .xo file or perhaps because of a change in the XO  
software (less likely).

I will look into this.

-- John


>
>
> Regards,
> Philipp
>
> Bert Freudenberg wrote:
>> The script looks good, except for the name mangling magic (which is  
>> a bit hard to understand because of mis-indentations). This  
>> wouldn't even work with your XO's language set to non-English  
>> (which the majority of XOs use).
>> I would simply name the file "$object_id.sb".
>> - Bert -
>> On 14.01.2009, at 07:04, Philipp Kocher wrote:
>>> Hi John
>>>
>>> Yes, we need the mimetypes.xml file as well (thanks Tomeu I forgot  
>>> the USB flash drive use case). I have tested the attached  
>>> mimetypes.xml. It is working fine. Put it in the activity directory.
>>>
>>> Furthermore we have to change the scratch-activity script, so the  
>>> parameter with the scratch project object-id gets converted (copy- 
>>> from-journal) in a file and passed on to scratch. See the attached  
>>> scratch-activity script. I am not an expert with bash scripts, so  
>>> please give feedback.
>>>
>>> I would like to extend the script so project files in the journal  
>>> directory are copied back to the journal after exiting scratch,  
>>> but for opening project it should work fine.
>>>
>>> Best regards,
>>> Philipp
>>>
>>> John Maloney wrote:
 Hi, Phillip.
 Thanks for all your hard work in tracking this down. I had looked  
 at several other packages, including EToys, and couldn't figure  
 out from them how to do this.
 I will make these changes to the next XO Scratch bundle.
 Is that all I need to do? What about the mime types XML file  
 similar to the one added by Etoys? Does that turn out to be  
 unnecessary?
   -- John
 On Jan 13, 2009, at 12:55 AM, Philipp Kocher wrote:
> Tomeu Vizoso wrote:
>> On Mon, Jan 12, 2009 at 18:50, Bert Freudenberg > > wrote:
>>> On 12.01.2009, at 18:11, Tomeu Vizoso wrote:
> So what would the Scratch activity have to do so files put  
> into the
> Journal
> (maybe by downloading) are displayed using a Scratch icon  
> rather than the
> generic document icon?
 Shipping a mimetypes.xml file inside the bundle as explained  
 here:

 http://wiki.laptop.org/go/Activity_bundles#Bundle_Structure

 Sugar will call update-mime-database and will merge that file  
 into the
 xdg mime database.

 I think that John is already trying this.
>>>
>>> Guess I'm confused then - I thought that's exactly what  
>>> Philipp had done.
>> I think he just changed the mime_types field in the .info file.
>>> And I just checked and it does work with Etoys projects. When  
>>> downloading
>>> one it indeed gets an etoys icon (although at a smaller size -  
>>> why is that?)
>> No idea, though I think that the mime database is updated in  
>> the etoys
>> rpm and not in the bundle, am I right?
>> Regards,
>> Tomeu
>
> Thanks Tomeu to lead me to the /home/olpc/.local directory.  
> However, the
> mimetypes.xml is not necessary to get the icon in the journal. I  
> just
> had to copy the scratch icon file in the activity directory to
> "application-x-scratch-project.svg" (also in the scratch activity
> dirctory). The Memorize Activity is a good example for using  
> that feature.
> Sugar has to be restarted after installing Scratch to show the  
> icon.
>
> John, could you please make the following changes in the next  
> Scratch
> version:
> - add the line "mime_types = application/x-scratch-project" to the
> activity.info file
> - copy the scratch icon to "application-x-scratch-project.svg"  
> in the
> activity directory
>
> Etoys gets configured by different packages. e.g. the rpm
> etoys-3.0.2153-1.noarch is adding the file
> /usr/share/mime/packges/etoys.xml and the rpm sugar- 
> artwork-0.82.3-1.olpc3 is
> adding the file
> /usr/share/icons/sugar/scalable/mimetypes/application-x-squake- 
> project.svg.
>
> Regards,
> Philipp
>
>>> 
>>> http://www.freedesktop.org/standards/shared-mime-info 
>>> ">
>>>  
>>>Scratch Project
>>>
>>>  
>>> 
>>> #!/bin/sh
>>> # Author: Bert Freudenberg
>>> # Mo

Re: [Sugar-devel] Journal integration for Scratch

2009-01-15 Thread Bert Freudenberg

On 15.01.2009, at 13:55, John Maloney wrote:

> Hi, Phillip.
>
> Re:
>> There is a bug in Scratch version 12. The symbolic link of the  
>> Project
>> directory doesn't get created (Open Projects shows Scratch.activity
>> folder instead). I checked the scripts (scratch-activity and
>> scratch-wrapper) but couldn't find where the link should get created.
>
> In Scratch 11, a symbolic link was included in the .xo and unzipping  
> re-created that link. Someone else helped me create that mechanism  
> (sorry I can't quite remember who). But you are right, it no longer  
> works in v12, either because I changed something about my process  
> for creating the .xo file or perhaps because of a change in the XO  
> software (less likely).
>
> I will look into this.


Unless someone fixed this in the mean time, symbolic links in bundles  
are not preserved:

http://dev.laptop.org/ticket/4584

- Bert -


___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Journal integration for Scratch

2009-01-14 Thread Philipp Kocher

Hi John

Yes, we need the mimetypes.xml file as well (thanks Tomeu I forgot the 
USB flash drive use case). I have tested the attached mimetypes.xml. It 
is working fine. Put it in the activity directory.


Furthermore we have to change the scratch-activity script, so the 
parameter with the scratch project object-id gets converted 
(copy-from-journal) in a file and passed on to scratch. See the attached 
scratch-activity script. I am not an expert with bash scripts, so please 
give feedback.


I would like to extend the script so project files in the journal 
directory are copied back to the journal after exiting scratch, but for 
opening project it should work fine.


Best regards,
Philipp

John Maloney wrote:

Hi, Phillip.

Thanks for all your hard work in tracking this down. I had looked at 
several other packages, including EToys, and couldn't figure out from 
them how to do this.


I will make these changes to the next XO Scratch bundle.

Is that all I need to do? What about the mime types XML file similar to 
the one added by Etoys? Does that turn out to be unnecessary?


-- John


On Jan 13, 2009, at 12:55 AM, Philipp Kocher wrote:

Tomeu Vizoso wrote:
On Mon, Jan 12, 2009 at 18:50, Bert Freudenberg 
 wrote:

On 12.01.2009, at 18:11, Tomeu Vizoso wrote:

So what would the Scratch activity have to do so files put into the
Journal
(maybe by downloading) are displayed using a Scratch icon rather 
than the

generic document icon?

Shipping a mimetypes.xml file inside the bundle as explained here:

http://wiki.laptop.org/go/Activity_bundles#Bundle_Structure

Sugar will call update-mime-database and will merge that file into the
xdg mime database.

I think that John is already trying this.


Guess I'm confused then - I thought that's exactly what Philipp had 
done.

I think he just changed the mime_types field in the .info file.
And I just checked and it does work with Etoys projects. When 
downloading
one it indeed gets an etoys icon (although at a smaller size - why 
is that?)

No idea, though I think that the mime database is updated in the etoys
rpm and not in the bundle, am I right?
Regards,
Tomeu


Thanks Tomeu to lead me to the /home/olpc/.local directory. However, the
mimetypes.xml is not necessary to get the icon in the journal. I just
had to copy the scratch icon file in the activity directory to
"application-x-scratch-project.svg" (also in the scratch activity
dirctory). The Memorize Activity is a good example for using that 
feature.

Sugar has to be restarted after installing Scratch to show the icon.

John, could you please make the following changes in the next Scratch
version:
- add the line "mime_types = application/x-scratch-project" to the
activity.info file
- copy the scratch icon to "application-x-scratch-project.svg" in the
activity directory

Etoys gets configured by different packages. e.g. the rpm
etoys-3.0.2153-1.noarch is adding the file
/usr/share/mime/packges/etoys.xml and the rpm 
sugar-artwork-0.82.3-1.olpc3 is

adding the file
/usr/share/icons/sugar/scalable/mimetypes/application-x-squake-project.svg. 



Regards,
Philipp




http://www.freedesktop.org/standards/shared-mime-info";>
   
 Scratch Project
 
   

#!/bin/sh
# Author: Bert Freudenberg
# Modified by: John Maloney
# Purpose: Run Scratch using the Squeak virtual machine

echo "scratch-activity"
echo "$@"

echo "$0" "$@"
echo

# arguments are unordered, have to loop
args=""
while [ -n "$2" ] ; do
case "$1" in
-b | --bundle-id)   bundle_id="$2"   ; args="$args BUNDLE_ID $2" ;;
-a | --activity-id) activity_id="$2" ; args="$args ACTIVITY_ID $2";;
-o | --object-id)   object_id="$2"   ; args="$args OBJECT_ID $2";;
-u | --uri) uri="$2" ; args="$args URI $2";;
*) echo unknown argument $1 $2 ;;
esac
shift;shift
done

# really need bundle id and activity id
if [ -z "$bundle_id" -o -z "$activity_id" ] ; then
  echo ERROR: bundle-id and activity-id arguments required
  echo Aborting
  exit 1
fi

# some debug output
echo launching $bundle_id instance $activity_id
[ -n "$object_id" ] && echo with journal obj $object_id
[ -n "$uri"   ] && echo loading uri $uri
echo

# do not crash on dbus errors
export DBUS_FATAL_WARNINGS=0

if [ -n "$object_id" ] ; then
JOURNAL_DIR="$SUGAR_ACTIVITY_ROOT/data/Journal"
mkdir -p "$JOURNAL_DIR"
temp_filename="$JOURNAL_DIR/temp.sb"
title=`copy-from-journal -o "$object_id" -m "$temp_filename" | grep 
"title "`
# title is something like this for files downloaded from server:
#   title -> File do_math_3.sb from 
http://schoolserver/Scratch/do_math_3.sb.
# or like this if copied from USB flash drive:
#   title -> do_math_3
title=${title#*"title -> "} #cut off description
echo "title: $title"

# workaround for copy-from-journal bug (adds another dot before 
fileextension)
if [ -f "$JOURNAL_DIR/temp..sb" ] ; then
   

Re: [Sugar-devel] Journal integration for Scratch

2009-01-14 Thread Philipp Kocher


Tomeu Vizoso wrote:
> On Mon, Jan 12, 2009 at 18:50, Bert Freudenberg  wrote:
>> On 12.01.2009, at 18:11, Tomeu Vizoso wrote:
 So what would the Scratch activity have to do so files put into the
 Journal
 (maybe by downloading) are displayed using a Scratch icon rather than the
 generic document icon?
>>> Shipping a mimetypes.xml file inside the bundle as explained here:
>>>
>>> http://wiki.laptop.org/go/Activity_bundles#Bundle_Structure
>>>
>>> Sugar will call update-mime-database and will merge that file into the
>>> xdg mime database.
>>>
>>> I think that John is already trying this.
>>
>> Guess I'm confused then - I thought that's exactly what Philipp had done.
> 
> I think he just changed the mime_types field in the .info file.
> 
>> And I just checked and it does work with Etoys projects. When downloading
>> one it indeed gets an etoys icon (although at a smaller size - why is that?)
> 
> No idea, though I think that the mime database is updated in the etoys
> rpm and not in the bundle, am I right?
> 
> Regards,
> 
> Tomeu
> 

Thanks Tomeu to lead me to the /home/olpc/.local directory. However, the
mimetypes.xml is not necessary to get the icon in the journal. I just
had to copy the scratch icon file in the activity directory to
"application-x-scratch-project.svg" (also in the scratch activity
dirctory). The Memorize Activity is a good example for using that feature.
Sugar has to be restarted after installing Scratch to show the icon.

John, could you please make the following changes in the next Scratch
version:
- add the line "mime_types = application/x-scratch-project" to the
activity.info file
- copy the scratch icon to "application-x-scratch-project.svg" in the
activity directory

Etoys gets configured by different packages. e.g. the rpm
etoys-3.0.2153-1.noarch is adding the file
/usr/share/mime/packges/etoys.xml and the rpm 
sugar-artwork-0.82.3-1.olpc3 is
adding the file
/usr/share/icons/sugar/scalable/mimetypes/application-x-squake-project.svg.

Regards,
Philipp

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Journal integration for Scratch

2009-01-14 Thread John Maloney
Hi, Phillip.

Thanks for all your hard work in tracking this down. I had looked at  
several other packages, including EToys, and couldn't figure out from  
them how to do this.

I will make these changes to the next XO Scratch bundle.

Is that all I need to do? What about the mime types XML file similar  
to the one added by Etoys? Does that turn out to be unnecessary?

-- John


On Jan 13, 2009, at 12:55 AM, Philipp Kocher wrote:
> Tomeu Vizoso wrote:
>> On Mon, Jan 12, 2009 at 18:50, Bert Freudenberg  
>>  wrote:
>>> On 12.01.2009, at 18:11, Tomeu Vizoso wrote:
> So what would the Scratch activity have to do so files put into  
> the
> Journal
> (maybe by downloading) are displayed using a Scratch icon rather  
> than the
> generic document icon?
 Shipping a mimetypes.xml file inside the bundle as explained here:

 http://wiki.laptop.org/go/Activity_bundles#Bundle_Structure

 Sugar will call update-mime-database and will merge that file  
 into the
 xdg mime database.

 I think that John is already trying this.
>>>
>>> Guess I'm confused then - I thought that's exactly what Philipp  
>>> had done.
>> I think he just changed the mime_types field in the .info file.
>>> And I just checked and it does work with Etoys projects. When  
>>> downloading
>>> one it indeed gets an etoys icon (although at a smaller size - why  
>>> is that?)
>> No idea, though I think that the mime database is updated in the  
>> etoys
>> rpm and not in the bundle, am I right?
>> Regards,
>> Tomeu
>
> Thanks Tomeu to lead me to the /home/olpc/.local directory. However,  
> the
> mimetypes.xml is not necessary to get the icon in the journal. I just
> had to copy the scratch icon file in the activity directory to
> "application-x-scratch-project.svg" (also in the scratch activity
> dirctory). The Memorize Activity is a good example for using that  
> feature.
> Sugar has to be restarted after installing Scratch to show the icon.
>
> John, could you please make the following changes in the next Scratch
> version:
> - add the line "mime_types = application/x-scratch-project" to the
> activity.info file
> - copy the scratch icon to "application-x-scratch-project.svg" in the
> activity directory
>
> Etoys gets configured by different packages. e.g. the rpm
> etoys-3.0.2153-1.noarch is adding the file
> /usr/share/mime/packges/etoys.xml and the rpm sugar- 
> artwork-0.82.3-1.olpc3 is
> adding the file
> /usr/share/icons/sugar/scalable/mimetypes/application-x-squake- 
> project.svg.
>
> Regards,
> Philipp
>

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Journal integration for Scratch

2009-01-14 Thread Bert Freudenberg
The script looks good, except for the name mangling magic (which is a  
bit hard to understand because of mis-indentations). This wouldn't  
even work with your XO's language set to non-English (which the  
majority of XOs use).

I would simply name the file "$object_id.sb".

- Bert -

On 14.01.2009, at 07:04, Philipp Kocher wrote:

> Hi John
>
> Yes, we need the mimetypes.xml file as well (thanks Tomeu I forgot  
> the USB flash drive use case). I have tested the attached  
> mimetypes.xml. It is working fine. Put it in the activity directory.
>
> Furthermore we have to change the scratch-activity script, so the  
> parameter with the scratch project object-id gets converted (copy- 
> from-journal) in a file and passed on to scratch. See the attached  
> scratch-activity script. I am not an expert with bash scripts, so  
> please give feedback.
>
> I would like to extend the script so project files in the journal  
> directory are copied back to the journal after exiting scratch, but  
> for opening project it should work fine.
>
> Best regards,
> Philipp
>
> John Maloney wrote:
>> Hi, Phillip.
>> Thanks for all your hard work in tracking this down. I had looked  
>> at several other packages, including EToys, and couldn't figure out  
>> from them how to do this.
>> I will make these changes to the next XO Scratch bundle.
>> Is that all I need to do? What about the mime types XML file  
>> similar to the one added by Etoys? Does that turn out to be  
>> unnecessary?
>>-- John
>> On Jan 13, 2009, at 12:55 AM, Philipp Kocher wrote:
>>> Tomeu Vizoso wrote:
 On Mon, Jan 12, 2009 at 18:50, Bert Freudenberg >>> > wrote:
> On 12.01.2009, at 18:11, Tomeu Vizoso wrote:
>>> So what would the Scratch activity have to do so files put  
>>> into the
>>> Journal
>>> (maybe by downloading) are displayed using a Scratch icon  
>>> rather than the
>>> generic document icon?
>> Shipping a mimetypes.xml file inside the bundle as explained  
>> here:
>>
>> http://wiki.laptop.org/go/Activity_bundles#Bundle_Structure
>>
>> Sugar will call update-mime-database and will merge that file  
>> into the
>> xdg mime database.
>>
>> I think that John is already trying this.
>
> Guess I'm confused then - I thought that's exactly what Philipp  
> had done.
 I think he just changed the mime_types field in the .info file.
> And I just checked and it does work with Etoys projects. When  
> downloading
> one it indeed gets an etoys icon (although at a smaller size -  
> why is that?)
 No idea, though I think that the mime database is updated in the  
 etoys
 rpm and not in the bundle, am I right?
 Regards,
 Tomeu
>>>
>>> Thanks Tomeu to lead me to the /home/olpc/.local directory.  
>>> However, the
>>> mimetypes.xml is not necessary to get the icon in the journal. I  
>>> just
>>> had to copy the scratch icon file in the activity directory to
>>> "application-x-scratch-project.svg" (also in the scratch activity
>>> dirctory). The Memorize Activity is a good example for using that  
>>> feature.
>>> Sugar has to be restarted after installing Scratch to show the icon.
>>>
>>> John, could you please make the following changes in the next  
>>> Scratch
>>> version:
>>> - add the line "mime_types = application/x-scratch-project" to the
>>> activity.info file
>>> - copy the scratch icon to "application-x-scratch-project.svg" in  
>>> the
>>> activity directory
>>>
>>> Etoys gets configured by different packages. e.g. the rpm
>>> etoys-3.0.2153-1.noarch is adding the file
>>> /usr/share/mime/packges/etoys.xml and the rpm sugar- 
>>> artwork-0.82.3-1.olpc3 is
>>> adding the file
>>> /usr/share/icons/sugar/scalable/mimetypes/application-x-squake- 
>>> project.svg.
>>>
>>> Regards,
>>> Philipp
>>>
> 
> http://www.freedesktop.org/standards/shared-mime-info 
> ">
>   
> Scratch Project
> 
>   
> 
> #!/bin/sh
> # Author: Bert Freudenberg
> # Modified by: John Maloney
> # Purpose: Run Scratch using the Squeak virtual machine
>
> echo "scratch-activity"
> echo "$@"
>
> echo "$0" "$@"
> echo
>
> # arguments are unordered, have to loop
> args=""
> while [ -n "$2" ] ; do
>case "$1" in
>   -b | --bundle-id)   bundle_id="$2"   ; args="$args BUNDLE_ID  
> $2" ;;
>   -a | --activity-id) activity_id="$2" ; args="$args ACTIVITY_ID  
> $2";;
>   -o | --object-id)   object_id="$2"   ; args="$args OBJECT_ID  
> $2";;
>   -u | --uri) uri="$2" ; args="$args URI $2";;
>   *) echo unknown argument $1 $2 ;;
>esac
>shift;shift
> done
>
> # really need bundle id and activity id
> if [ -z "$bundle_id" -o -z "$activity_id" ] ; then
>  echo ERROR: bundle-id and activity-id arguments required
>  echo Aborting
>  exit 1
> fi
>
> # some debug output
> echo launching $bundle_id instance $activity_id
> [ -n "$object_id" ] && echo with journal obj $object_id
> [ -n "$uri"   ] && echo loading uri $

Re: [Sugar-devel] Journal integration for Scratch

2009-01-13 Thread Bert Freudenberg

On 13.01.2009, at 19:14, Eben Eliason wrote:

> On Tue, Jan 13, 2009 at 12:49 PM, Bert Freudenberg  > wrote:
>>
>> On 13.01.2009, at 17:22, Eben Eliason wrote:
>>
> /usr/share/icons/sugar/scalable/mimetypes/application-x-squake-
> project.svg.

 Interesting ... thanks for the archaeology :)

 Eben: see, I did remember correctly there was an icon for the
 document
 independent of the activity ;)
>>>
>>> Indeed. However, that one's not mine, and I wasn't aware of it. I
>>> think it must have been copied before I or someone else (don't  
>>> recall)
>>> matched the Etoys icon to the spec.  I just checked the file you
>>> mention, and it clearly has a 75x75 pixel canvas, which is why it's
>>> being scaled down.
>>
>>
>> I see. So this is really really old, from before the icon dimensions
>> were changed. Someone who understood the system back then must have
>> taken the Etoys icon and checked it in as the mime type icon. Would
>> make sense to upgrade it to the current icon now :)
>
> Right. From my understanding of the conversation, this needs to be
> updated within the bundle, right?  This isn't something that should
> need to live in artwork.


What's the precedence of icons in the system vs the bundle?

- Bert -


___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Journal integration for Scratch

2009-01-13 Thread Eben Eliason
On Tue, Jan 13, 2009 at 12:49 PM, Bert Freudenberg  wrote:
>
> On 13.01.2009, at 17:22, Eben Eliason wrote:
>
 /usr/share/icons/sugar/scalable/mimetypes/application-x-squake-
 project.svg.
>>>
>>> Interesting ... thanks for the archaeology :)
>>>
>>> Eben: see, I did remember correctly there was an icon for the
>>> document
>>> independent of the activity ;)
>>
>> Indeed. However, that one's not mine, and I wasn't aware of it. I
>> think it must have been copied before I or someone else (don't recall)
>> matched the Etoys icon to the spec.  I just checked the file you
>> mention, and it clearly has a 75x75 pixel canvas, which is why it's
>> being scaled down.
>
>
> I see. So this is really really old, from before the icon dimensions
> were changed. Someone who understood the system back then must have
> taken the Etoys icon and checked it in as the mime type icon. Would
> make sense to upgrade it to the current icon now :)

Right. From my understanding of the conversation, this needs to be
updated within the bundle, right?  This isn't something that should
need to live in artwork.

- Eben


> - Bert -
>
> ___
> Sugar-devel mailing list
> Sugar-devel@lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Journal integration for Scratch

2009-01-13 Thread Bert Freudenberg

On 13.01.2009, at 17:22, Eben Eliason wrote:

>>> /usr/share/icons/sugar/scalable/mimetypes/application-x-squake-
>>> project.svg.
>>
>> Interesting ... thanks for the archaeology :)
>>
>> Eben: see, I did remember correctly there was an icon for the  
>> document
>> independent of the activity ;)
>
> Indeed. However, that one's not mine, and I wasn't aware of it. I
> think it must have been copied before I or someone else (don't recall)
> matched the Etoys icon to the spec.  I just checked the file you
> mention, and it clearly has a 75x75 pixel canvas, which is why it's
> being scaled down.


I see. So this is really really old, from before the icon dimensions  
were changed. Someone who understood the system back then must have  
taken the Etoys icon and checked it in as the mime type icon. Would  
make sense to upgrade it to the current icon now :)

- Bert -

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Journal integration for Scratch

2009-01-13 Thread Eben Eliason
On Tue, Jan 13, 2009 at 3:54 AM, Bert Freudenberg  wrote:
> On 13.01.2009, at 06:55, Philipp Kocher wrote:
>
>> Thanks Tomeu to lead me to the /home/olpc/.local directory. However,
>> the
>> mimetypes.xml is not necessary to get the icon in the journal. I just
>> had to copy the scratch icon file in the activity directory to
>> "application-x-scratch-project.svg" (also in the scratch activity
>> dirctory). The Memorize Activity is a good example for using that
>> feature.
>> Sugar has to be restarted after installing Scratch to show the icon.
>
> Thanks! This is not documented anywhere I know of. So I put it here:
>
> http://wiki.laptop.org/go/Activity_bundles#Bundle_Structure
>
> Hope someone can proof-read / confirm.
>
>> Etoys gets configured by different packages. e.g. the rpm
>> etoys-3.0.2153-1.noarch is adding the file
>> /usr/share/mime/packges/etoys.xml and the rpm sugar-
>> artwork-0.82.3-1.olpc3 is
>> adding the file
>> /usr/share/icons/sugar/scalable/mimetypes/application-x-squake-
>> project.svg.
>
>
> Interesting ... thanks for the archaeology :)
>
> Eben: see, I did remember correctly there was an icon for the document
> independent of the activity ;)

Indeed. However, that one's not mine, and I wasn't aware of it. I
think it must have been copied before I or someone else (don't recall)
matched the Etoys icon to the spec.  I just checked the file you
mention, and it clearly has a 75x75 pixel canvas, which is why it's
being scaled down.

- Eben

> That must be the smaller version.
>
> - Bert -
>
>
> ___
> Sugar-devel mailing list
> Sugar-devel@lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Journal integration for Scratch

2009-01-13 Thread Bert Freudenberg

On 13.01.2009, at 13:30, John Maloney wrote:

> Hi, Phillip.
>
> Thanks for all your hard work in tracking this down. I had looked at  
> several other packages, including EToys, and couldn't figure out  
> from them how to do this.
>
> I will make these changes to the next XO Scratch bundle.
>
> Is that all I need to do? What about the mime types XML file similar  
> to the one added by Etoys? Does that turn out to be unnecessary?

That file provides the mapping from file extensions to MIME types, so  
it is needed for Scratch bundles downloaded from the Web or a USB  
memory stick to be recognized as such.

- Bert -


>   -- John
>
>
> On Jan 13, 2009, at 12:55 AM, Philipp Kocher wrote:
>> Tomeu Vizoso wrote:
>>> On Mon, Jan 12, 2009 at 18:50, Bert Freudenberg >> > wrote:
 On 12.01.2009, at 18:11, Tomeu Vizoso wrote:
>> So what would the Scratch activity have to do so files put into  
>> the
>> Journal
>> (maybe by downloading) are displayed using a Scratch icon  
>> rather than the
>> generic document icon?
> Shipping a mimetypes.xml file inside the bundle as explained here:
>
> http://wiki.laptop.org/go/Activity_bundles#Bundle_Structure
>
> Sugar will call update-mime-database and will merge that file  
> into the
> xdg mime database.
>
> I think that John is already trying this.

 Guess I'm confused then - I thought that's exactly what Philipp  
 had done.
>>> I think he just changed the mime_types field in the .info file.
 And I just checked and it does work with Etoys projects. When  
 downloading
 one it indeed gets an etoys icon (although at a smaller size -  
 why is that?)
>>> No idea, though I think that the mime database is updated in the  
>>> etoys
>>> rpm and not in the bundle, am I right?
>>> Regards,
>>> Tomeu
>>
>> Thanks Tomeu to lead me to the /home/olpc/.local directory.  
>> However, the
>> mimetypes.xml is not necessary to get the icon in the journal. I just
>> had to copy the scratch icon file in the activity directory to
>> "application-x-scratch-project.svg" (also in the scratch activity
>> dirctory). The Memorize Activity is a good example for using that  
>> feature.
>> Sugar has to be restarted after installing Scratch to show the icon.
>>
>> John, could you please make the following changes in the next Scratch
>> version:
>> - add the line "mime_types = application/x-scratch-project" to the
>> activity.info file
>> - copy the scratch icon to "application-x-scratch-project.svg" in the
>> activity directory
>>
>> Etoys gets configured by different packages. e.g. the rpm
>> etoys-3.0.2153-1.noarch is adding the file
>> /usr/share/mime/packges/etoys.xml and the rpm sugar- 
>> artwork-0.82.3-1.olpc3 is
>> adding the file
>> /usr/share/icons/sugar/scalable/mimetypes/application-x-squake- 
>> project.svg.
>>
>> Regards,
>> Philipp
>>
>



___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Journal integration for Scratch

2009-01-13 Thread Tomeu Vizoso
On Tue, Jan 13, 2009 at 06:55, Philipp Kocher  wrote:
>
>
> Tomeu Vizoso wrote:
>>
>> On Mon, Jan 12, 2009 at 18:50, Bert Freudenberg 
>> wrote:
>>>
>>> On 12.01.2009, at 18:11, Tomeu Vizoso wrote:
>
> So what would the Scratch activity have to do so files put into the
> Journal
> (maybe by downloading) are displayed using a Scratch icon rather than
> the
> generic document icon?

 Shipping a mimetypes.xml file inside the bundle as explained here:

 http://wiki.laptop.org/go/Activity_bundles#Bundle_Structure

 Sugar will call update-mime-database and will merge that file into the
 xdg mime database.

 I think that John is already trying this.
>>>
>>> Guess I'm confused then - I thought that's exactly what Philipp had done.
>>
>> I think he just changed the mime_types field in the .info file.
>>
>>> And I just checked and it does work with Etoys projects. When downloading
>>> one it indeed gets an etoys icon (although at a smaller size - why is
>>> that?)
>>
>> No idea, though I think that the mime database is updated in the etoys
>> rpm and not in the bundle, am I right?
>>
>> Regards,
>>
>> Tomeu
>>
>
> Thanks Tomeu to lead me to the /home/olpc/.local directory. However, the
> mimetypes.xml is not necessary to get the icon in the journal. I just
> had to copy the scratch icon file in the activity directory to
> "application-x-scratch-project.svg" (also in the scratch activity
> dirctory). The Memorize Activity is a good example for using that feature.
> Sugar has to be restarted after installing Scratch to show the icon.

Yes, you are right in that you don't need to mess with mimetypes.xml
if you only want to set the icon for a mime type.

mimetype.xml also serves to associate a file extension with a mime
type, and Scratch might also want this so that scratch projects copied
from a removable files are correctly identified as such.

Thanks,

Tomeu

> John, could you please make the following changes in the next Scratch
> version:
> - add the line "mime_types = application/x-scratch-project" to the
> activity.info file
> - copy the scratch icon to "application-x-scratch-project.svg" in the
> activity directory
>
> Etoys gets configured by different packages. e.g. the rpm
> etoys-3.0.2153-1.noarch is adding the file
> /usr/share/mime/packges/etoys.xml and the rpm sugar-artwork-0.82.3-1.olpc3
> is
> adding the file
> /usr/share/icons/sugar/scalable/mimetypes/application-x-squake-project.svg.
>
> Regards,
> Philipp
>
>
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Journal integration for Scratch

2009-01-13 Thread Bert Freudenberg
On 13.01.2009, at 06:55, Philipp Kocher wrote:

> Thanks Tomeu to lead me to the /home/olpc/.local directory. However,  
> the
> mimetypes.xml is not necessary to get the icon in the journal. I just
> had to copy the scratch icon file in the activity directory to
> "application-x-scratch-project.svg" (also in the scratch activity
> dirctory). The Memorize Activity is a good example for using that  
> feature.
> Sugar has to be restarted after installing Scratch to show the icon.

Thanks! This is not documented anywhere I know of. So I put it here:

http://wiki.laptop.org/go/Activity_bundles#Bundle_Structure

Hope someone can proof-read / confirm.

> Etoys gets configured by different packages. e.g. the rpm
> etoys-3.0.2153-1.noarch is adding the file
> /usr/share/mime/packges/etoys.xml and the rpm sugar- 
> artwork-0.82.3-1.olpc3 is
> adding the file
> /usr/share/icons/sugar/scalable/mimetypes/application-x-squake- 
> project.svg.


Interesting ... thanks for the archaeology :)

Eben: see, I did remember correctly there was an icon for the document  
independent of the activity ;)

That must be the smaller version.

- Bert -


___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Journal integration for Scratch

2009-01-12 Thread Eben Eliason
On Mon, Jan 12, 2009 at 2:23 PM, Bert Freudenberg  wrote:
> On 12.01.2009, at 19:30, Tomeu Vizoso wrote:
>>
>>> And I just checked and it does work with Etoys projects. When downloading
>>> one it indeed gets an etoys icon (although at a smaller size - why is
>>> that?)
>>
>> No idea, though I think that the mime database is updated in the etoys
>> rpm and not in the bundle, am I right?
>
>
> Yes. Though I can't imagine how that would affect the icon size:
>
>
>
>
> Or is it intentional?

Definitely not intentional.

- Eben


>
> - Bert -
>
> ___
> Sugar-devel mailing list
> Sugar-devel@lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>
>
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Journal integration for Scratch

2009-01-12 Thread Bert Freudenberg

On 12.01.2009, at 19:30, Tomeu Vizoso wrote:


And I just checked and it does work with Etoys projects. When  
downloading
one it indeed gets an etoys icon (although at a smaller size - why  
is that?)


No idea, though I think that the mime database is updated in the etoys
rpm and not in the bundle, am I right?



Yes. Though I can't imagine how that would affect the icon size:

<>


Or is it intentional?


- Bert -
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Journal integration for Scratch

2009-01-12 Thread Tomeu Vizoso
On Mon, Jan 12, 2009 at 18:50, Bert Freudenberg  wrote:
> On 12.01.2009, at 18:11, Tomeu Vizoso wrote:
>>>
>>> So what would the Scratch activity have to do so files put into the
>>> Journal
>>> (maybe by downloading) are displayed using a Scratch icon rather than the
>>> generic document icon?
>>
>> Shipping a mimetypes.xml file inside the bundle as explained here:
>>
>> http://wiki.laptop.org/go/Activity_bundles#Bundle_Structure
>>
>> Sugar will call update-mime-database and will merge that file into the
>> xdg mime database.
>>
>> I think that John is already trying this.
>
>
> Guess I'm confused then - I thought that's exactly what Philipp had done.

I think he just changed the mime_types field in the .info file.

> And I just checked and it does work with Etoys projects. When downloading
> one it indeed gets an etoys icon (although at a smaller size - why is that?)

No idea, though I think that the mime database is updated in the etoys
rpm and not in the bundle, am I right?

Regards,

Tomeu
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Journal integration for Scratch

2009-01-12 Thread Bert Freudenberg
On 12.01.2009, at 18:11, Tomeu Vizoso wrote:
>>
>> So what would the Scratch activity have to do so files put into the  
>> Journal
>> (maybe by downloading) are displayed using a Scratch icon rather  
>> than the
>> generic document icon?
>
> Shipping a mimetypes.xml file inside the bundle as explained here:
>
> http://wiki.laptop.org/go/Activity_bundles#Bundle_Structure
>
> Sugar will call update-mime-database and will merge that file into the
> xdg mime database.
>
> I think that John is already trying this.


Guess I'm confused then - I thought that's exactly what Philipp had  
done.

And I just checked and it does work with Etoys projects. When  
downloading one it indeed gets an etoys icon (although at a smaller  
size - why is that?)

- Bert -


___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Journal integration for Scratch

2009-01-12 Thread Tomeu Vizoso
On Mon, Jan 12, 2009 at 18:16, Eben Eliason  wrote:
> On Mon, Jan 12, 2009 at 12:11 PM, Tomeu Vizoso  wrote:
>> On Mon, Jan 12, 2009 at 18:07, Bert Freudenberg  wrote:
>>>
>>> On 12.01.2009, at 17:55, Tomeu Vizoso wrote:
>>>
 On Mon, Jan 12, 2009 at 17:38, Bert Freudenberg 
 wrote:
>
> On 12.01.2009, at 17:03, Tomeu Vizoso wrote:
>
>> On Mon, Jan 12, 2009 at 16:52, Bert Freudenberg 
>> wrote:
>>>
>>> On 12.01.2009, at 10:16, Tomeu Vizoso wrote:
>>>
 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.
>>>
>>> Is there a way to assign icons for files other than by saving it in an
>>> activity?
>>
>> Currently, only by changing the mime-type.
>
>
> Maybe I misunderstood then. How is the icon for a mime type such as
> application/x-scratch-project found then?

 We are using the xdg mime database, the mimetypes.xml file contained
 in activities is added to that database. So that's the mechanism
 through which activities can associate icons to mime types.
>>>
>>>
>>> So what would the Scratch activity have to do so files put into the Journal
>>> (maybe by downloading) are displayed using a Scratch icon rather than the
>>> generic document icon?
>>
>> Shipping a mimetypes.xml file inside the bundle as explained here:
>>
>> http://wiki.laptop.org/go/Activity_bundles#Bundle_Structure
>>
>> Sugar will call update-mime-database and will merge that file into the
>> xdg mime database.
>
> What does this merge do with conflicts?  It seems we might need a way
> for the most recent activity which has used a given object to apply
> its own icon for it, which isn't covered by this case.  Would the most
> recently installed activity trump the rest?

Not sure about what we can do regarding this while not having to cook
our own mime info stuff. This is the spec implemented by the tools we
are using:

http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec

Regards,

Tomeu

> - Eben
>
>
>> I think that John is already trying this.
>>
>> Regards,
>>
>> Tomeu
>> ___
>> Sugar-devel mailing list
>> Sugar-devel@lists.sugarlabs.org
>> http://lists.sugarlabs.org/listinfo/sugar-devel
>>
>
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Journal integration for Scratch

2009-01-12 Thread Eben Eliason
On Mon, Jan 12, 2009 at 12:11 PM, Tomeu Vizoso  wrote:
> On Mon, Jan 12, 2009 at 18:07, Bert Freudenberg  wrote:
>>
>> On 12.01.2009, at 17:55, Tomeu Vizoso wrote:
>>
>>> On Mon, Jan 12, 2009 at 17:38, Bert Freudenberg 
>>> wrote:

 On 12.01.2009, at 17:03, Tomeu Vizoso wrote:

> On Mon, Jan 12, 2009 at 16:52, Bert Freudenberg 
> wrote:
>>
>> On 12.01.2009, at 10:16, Tomeu Vizoso wrote:
>>
>>> 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.
>>
>> Is there a way to assign icons for files other than by saving it in an
>> activity?
>
> Currently, only by changing the mime-type.


 Maybe I misunderstood then. How is the icon for a mime type such as
 application/x-scratch-project found then?
>>>
>>> We are using the xdg mime database, the mimetypes.xml file contained
>>> in activities is added to that database. So that's the mechanism
>>> through which activities can associate icons to mime types.
>>
>>
>> So what would the Scratch activity have to do so files put into the Journal
>> (maybe by downloading) are displayed using a Scratch icon rather than the
>> generic document icon?
>
> Shipping a mimetypes.xml file inside the bundle as explained here:
>
> http://wiki.laptop.org/go/Activity_bundles#Bundle_Structure
>
> Sugar will call update-mime-database and will merge that file into the
> xdg mime database.

What does this merge do with conflicts?  It seems we might need a way
for the most recent activity which has used a given object to apply
its own icon for it, which isn't covered by this case.  Would the most
recently installed activity trump the rest?

- Eben


> I think that John is already trying this.
>
> Regards,
>
> Tomeu
> ___
> Sugar-devel mailing list
> Sugar-devel@lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Journal integration for Scratch

2009-01-12 Thread Tomeu Vizoso
On Mon, Jan 12, 2009 at 18:07, Bert Freudenberg  wrote:
>
> On 12.01.2009, at 17:55, Tomeu Vizoso wrote:
>
>> On Mon, Jan 12, 2009 at 17:38, Bert Freudenberg 
>> wrote:
>>>
>>> On 12.01.2009, at 17:03, Tomeu Vizoso wrote:
>>>
 On Mon, Jan 12, 2009 at 16:52, Bert Freudenberg 
 wrote:
>
> On 12.01.2009, at 10:16, Tomeu Vizoso wrote:
>
>> 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.
>
> Is there a way to assign icons for files other than by saving it in an
> activity?

 Currently, only by changing the mime-type.
>>>
>>>
>>> Maybe I misunderstood then. How is the icon for a mime type such as
>>> application/x-scratch-project found then?
>>
>> We are using the xdg mime database, the mimetypes.xml file contained
>> in activities is added to that database. So that's the mechanism
>> through which activities can associate icons to mime types.
>
>
> So what would the Scratch activity have to do so files put into the Journal
> (maybe by downloading) are displayed using a Scratch icon rather than the
> generic document icon?

Shipping a mimetypes.xml file inside the bundle as explained here:

http://wiki.laptop.org/go/Activity_bundles#Bundle_Structure

Sugar will call update-mime-database and will merge that file into the
xdg mime database.

I think that John is already trying this.

Regards,

Tomeu
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Journal integration for Scratch

2009-01-12 Thread Bert Freudenberg

On 12.01.2009, at 17:55, Tomeu Vizoso wrote:

> On Mon, Jan 12, 2009 at 17:38, Bert Freudenberg  
>  wrote:
>>
>> On 12.01.2009, at 17:03, Tomeu Vizoso wrote:
>>
>>> On Mon, Jan 12, 2009 at 16:52, Bert Freudenberg >> >
>>> wrote:

 On 12.01.2009, at 10:16, Tomeu Vizoso wrote:

> 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.

 Is there a way to assign icons for files other than by saving it  
 in an
 activity?
>>>
>>> Currently, only by changing the mime-type.
>>
>>
>> Maybe I misunderstood then. How is the icon for a mime type such as
>> application/x-scratch-project found then?
>
> We are using the xdg mime database, the mimetypes.xml file contained
> in activities is added to that database. So that's the mechanism
> through which activities can associate icons to mime types.


So what would the Scratch activity have to do so files put into the  
Journal (maybe by downloading) are displayed using a Scratch icon  
rather than the generic document icon?

- Bert -


___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Journal integration for Scratch

2009-01-12 Thread Tomeu Vizoso
On Mon, Jan 12, 2009 at 17:38, Bert Freudenberg  wrote:
>
> On 12.01.2009, at 17:03, Tomeu Vizoso wrote:
>
>> On Mon, Jan 12, 2009 at 16:52, Bert Freudenberg 
>> wrote:
>>>
>>> On 12.01.2009, at 10:16, Tomeu Vizoso wrote:
>>>
 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.
>>>
>>> Is there a way to assign icons for files other than by saving it in an
>>> activity?
>>
>> Currently, only by changing the mime-type.
>
>
> Maybe I misunderstood then. How is the icon for a mime type such as
> application/x-scratch-project found then?

We are using the xdg mime database, the mimetypes.xml file contained
in activities is added to that database. So that's the mechanism
through which activities can associate icons to mime types.

In a python shell inside strace -e open:

>>> gio.content_type_get_icon('image/png')
open("/home/tomeu/.local/share//mime/mime.cache", O_RDONLY|O_LARGEFILE) = 3
open("/home/tomeu/sugar-jhbuild/install/share/mime/mime.cache",
O_RDONLY|O_LARGEFILE) = 3
open("/usr/share/mime/mime.cache", O_RDONLY|O_LARGEFILE) = 3
open("/usr/local/share//mime/aliases", O_RDONLY|O_LARGEFILE) = -1
ENOENT (No such file or directory)
open("/usr/local/share//mime/subclasses", O_RDONLY|O_LARGEFILE) = -1
ENOENT (No such file or directory)
open("/usr/local/share//mime/icons", O_RDONLY|O_LARGEFILE) = -1 ENOENT
(No such file or directory)
open("/usr/local/share//mime/generic-icons", O_RDONLY|O_LARGEFILE) =
-1 ENOENT (No such file or directory)
open("/usr/share//mime/mime.cache", O_RDONLY|O_LARGEFILE) = 3
open("/usr/share/gdm//mime/aliases", O_RDONLY|O_LARGEFILE) = -1 ENOENT
(No such file or directory)
open("/usr/share/gdm//mime/subclasses", O_RDONLY|O_LARGEFILE) = -1
ENOENT (No such file or directory)
open("/usr/share/gdm//mime/icons", O_RDONLY|O_LARGEFILE) = -1 ENOENT
(No such file or directory)
open("/usr/share/gdm//mime/generic-icons", O_RDONLY|O_LARGEFILE) = -1
ENOENT (No such file or directory)


Regards,

Tomeu
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Journal integration for Scratch

2009-01-12 Thread Bert Freudenberg

On 12.01.2009, at 17:03, Tomeu Vizoso wrote:

> On Mon, Jan 12, 2009 at 16:52, Bert Freudenberg  
>  wrote:
>> On 12.01.2009, at 10:16, Tomeu Vizoso wrote:
>>
>>> 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.
>>
>> Is there a way to assign icons for files other than by saving it in  
>> an
>> activity?
>
> Currently, only by changing the mime-type.


Maybe I misunderstood then. How is the icon for a mime type such as  
application/x-scratch-project found then?

- Bert -

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Journal integration for Scratch

2009-01-12 Thread Eben Eliason
This is something I've briefly discussed with Marco in the past.  It
seems a natural extension of the idea of "objects" as first class
citizens of Sugar to allow those objects to have custom icons and
identities.  Right now, we have no such support.

The most natural way (at least for me, as a Mac user) to visualize
this idea is in the form of type/creator associations, by which an
object would be assigned the icon for type t as defined by its creator
c. This scheme is nice because it makes the effort on the part of
activities rather simple (most importantly, static): define your set
of icons and the mime-types the represent within your activity bundle,
and the system will always apply the correct icons.

However, it seems this can't work for Sugar.  I suppose we could
simply allow an activity to assign an icon to a given object at will,
as you mention.  It might be the best way to achieve a similar effect,
albeit with more effort on the part of activities.

- Eben


On Mon, Jan 12, 2009 at 10:52 AM, Bert Freudenberg  wrote:
> On 12.01.2009, at 10:16, Tomeu Vizoso wrote:
>
>> 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.
>
> Is there a way to assign icons for files other than by saving it in an
> activity?
>
> - Bert -
>
>
> ___
> Sugar-devel mailing list
> Sugar-devel@lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Journal integration for Scratch

2009-01-12 Thread Tomeu Vizoso
On Mon, Jan 12, 2009 at 16:52, Bert Freudenberg  wrote:
> On 12.01.2009, at 10:16, Tomeu Vizoso wrote:
>
>> 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.
>
> Is there a way to assign icons for files other than by saving it in an
> activity?

Currently, only by changing the mime-type.

Regards,

Tomeu
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Journal integration for Scratch

2009-01-12 Thread Bert Freudenberg
On 12.01.2009, at 10:16, Tomeu Vizoso wrote:

> 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.

Is there a way to assign icons for files other than by saving it in an  
activity?

- Bert -


___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Journal integration for Scratch

2009-01-12 Thread Tomeu Vizoso
[adding sugar-devel to the cc list]

On Mon, Jan 12, 2009 at 09:42, Philipp Kocher  wrote:
>
>
> Tomeu Vizoso wrote:
>>
>> On Thu, Jan 8, 2009 at 04:50, Philipp Kocher 
>> 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
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel