[Sugar-devel] View Source
Bert Freudenberg
bert
Tue Nov 25 11:16:45 EST 2008
On 22.11.2008, at 16:35, Simon Schampijer wrote:
> Some great work has been going into this release regarding the 'View
> source' support. The source of all the activities can be shown, and
> browse does still support showing the source of the document.
>
> === sugar-toolkit ===
> * Add view-source-related methods HandleViewSource and GetDocumentPath
>
> === sugar ===
> * Implement a global handler for the view source key
Since I could not find any discussion, let alone documentation about
this, I (again) got out my rusty Emacs, fed it with some grep'ed
source files, and reverse-engineered the whole thing. My findings are
here:
http://wiki.laptop.org/go/Low-level_Activity_API#D-Bus_Methods
I like the idea so far, but here are the issues I have with the
current implementation:
1. HandleViewSource should return a boolean to indicate whether the
request was handled or not.
This would also get rid of the Python-specific dbus error handling
code in viewsource.py because handle_view_source in activity.py could
simply answer False.
2. GetDocumentPath is a poor name for what it does.
It should contain "source" because it's not the document that is
viewed, but its source. How about GetSourcePath()?
Also, this file is deleted unconditionally when the source view is
closed. I'd add a boolean "transfer_ownership" flag to indicate that
it's okay to delete (similar to the datastore API).
Also, what kinds of source does this support? I noticed the
Browser's HTML source was highlighted. Is that determined by the file
name extension?
On a more general note, activityservice.py should be annotated with
the actual DBus signatures.
- Bert -
More information about the Sugar-devel
mailing list