[sugar] Sharing data between activities.

Carlos Neves cn
Thu Aug 23 19:20:31 EDT 2007


The context I'm presenting was discussed a few days ago, and involved 
the existence of Launchers. But as this subject is discussed upstream, 
let me ask about one specific problem with the upcoming security 
framework, that is closely related to the Launcher activity (for our 
particular case).

I am sharing common, static code and data between activities. These are 
helper widgets and images that, to avoid using up more space and extra 
sync'ing effort,  exist within one single activity that does not 
actually use them.

The way I am sharing these now is based on the assumption that the 
Launcher is always run before the activity, and it will create a file 
under ~olpc/.sugar/default/$(OUR_PREFIX).$(OUR_FILE) that has the path 
to the shared base (the activity installation path). Then, with an 
append to sys.path, activities can import code from there and list files 
in there. Also, we have a notion of 'My Own Image', which are user 
selected images on the filesystem, that get linked in directory 
following the same structure.

This 'My Own Image' should not pose problems in the future, but the 
shared stuff in the activity will, because activities will no longer 
have access to other activity dirs, right?

So, my solution would be to add some post installation script for the 
code sharing activity (that might end up being just a placeholder 
activity, always invisible) and have that create hard links on some 
~olpc/.sugar/default/$(OUR_PREFIX} directory.
Would this work? Can I assume the activities will have access to 
~olpc/.sugar? Will they have write access to all of it or will there be 
another place to write files on the filesystem? I'm sure I can cook a 
'My Own Picture' solution using the datastore, but can I do this for now?


Carlos Neves
cn at sueste.net

More information about the Sugar-devel mailing list