[Sugar-devel] Object Chooser

Bert Freudenberg bert at freudenbergs.de
Tue Jun 5 05:47:58 EDT 2012


On 05.06.2012, at 09:21, Sascha Silbe wrote:

> Bert Freudenberg <bert at freudenbergs.de> writes:
> 
>> On 04.06.2012, at 14:13, Bert Freudenberg wrote:
>> 
>>> So you're saying that in the response, the second argument would more
>>> properly be named object_id_or_full_path. And to distinguish the two
>>> cases, we have to look at its first character: if it is '/' then it's
>>> a path, otherwise an object id. 
> 
> Yes, exactly.
> 
> 
>> I now extended that documentation page with the object_id_or_full_path
>> argument discussion.
> 
> Thanks! Just one minor point (re. "this is a utf8-encoded absolute path
> to a file"): Unix paths are sequences of octets (binary strings), not
> character strings. In most cases the path will be the representation of
> a character string in some encoding (and Sugar only works with the UTF-8
> encoding). But it's never the other way around (the path itself getting
> UTF-8 encoded). However, you do have a point in that paths that are not
> a valid UTF-8 representation of some character string will cause the
> Object Chooser to break.

You're right. I removed the encoding part from the API doc.

>>> Are there any other places in the API where instead of an object id we have to expect a full path instead?
> 
> I would expect only the Journal D-Bus API to work this way. So
> org.laptop.Journal.ShowObject() should be the only other place where
> object_id or a full path is used (resp. supported).


Okay. I checked, ShowObject() indeed supports a full path. Which can be anywhere on the system, actually. Opening a file from there copies it to the Journal.

I will send a patch to rename object_id. That should alert future users that object_id might also be a path.

- Bert -




More information about the Sugar-devel mailing list