[Sugar-devel] Journal-like activities (was: Re: [ASLO] Release Read ETexts-19)

James Simmons nicestep at gmail.com
Mon Mar 22 11:33:42 EDT 2010


Bert,

Thanks, that looks like what I needed.

James Simmons


On Mon, Mar 22, 2010 at 9:18 AM, Bert Freudenberg <bert at freudenbergs.de> wrote:
> I just had the same problem working on Scratch. I needed to filter out the USB files when listing Journal entries. I now do that by filtering on the mountpoint.
>
> To figure out the mountpoint of the Journal, I call the datastore's "mounts" method, and take the one with an URI starting with "/home". The USB ones start with "/media":
>
> entries
>        self journalMountpoint ifNotNilDo: [:mountpoint |
>                "Filter out USB entries on Sugar 0.82"
>                query at: 'mountpoints' put: {mountpoint}].
>        ^ self datastore find: query with: #('uid' 'title' 'mime_type' 'timestamp')].
>
> journalMountpoint
>        "If the datastore mounted multiple volumes (e.g. USB drive), answer the id of the user's Journal, otherwise return nil."
>        | mounts uri |
>        mounts := [self datastore mounts] ifError: [^ nil].
>        mounts size > 1 ifFalse: [^ nil].
>        mounts do: [:mount |
>                uri := mount at: 'uri' ifAbsent: ['/'].
>                (uri beginsWith: '/home')
>                        ifTrue: [^ mount at: 'id' ifAbsent: [nil]]].
>        ^ nil
>
> See
> http://wiki.sugarlabs.org/go/Development_Team/Low-level_Activity_API#Mount_Points
>
> - Bert -


More information about the Sugar-devel mailing list