← Back to team overview

unity-dev team mailing list archive

Re: [Ayatana-dev] Unity Lens: results model and items with no valid URI

 

On Tue, 2011-04-12 at 02:13 +0200, Johannes H. Jensen wrote:
> Greetings,
> 
> I'm writing a Unity Lens for Tomboy Notes. Reading through the docs, I
> find that each item in the results model needs a "uri" which is to be
> opened when the item is activated by the user. However, tomboy notes
> only have an internal URI, one which is not recognized by GNOME or
> Unity.
> 
> A a note can be opened with a simple D-Bus call to Tomboy, but how can
> the activation of an item in the results model be used to trigger such
> a call? As far as I can see, there exists no signal for this
> purpose...

Hi Johannes,

This sounds awesome :-)

For these cases Unity has an "Activation" API that can trigger callbacks
back to the daemon when the user clicks a result. It's described here
https://wiki.ubuntu.com/Unity/Lenses#Activation%20Hooks. The Apps place
use it to open the Software Center on the correct app when you click one
in the Apps Available for Download group. Check out
lp:unity-place-applications to see a working example of this.

The usual way of doing this is to construct some private URI scheme like
unity-tomboy://$internal_tomboy_uri and register activation for that
with an entry like the following in your .place file:

[Activation]
URIPattern=unity-tomboy://.+

You must hen implement the Unity.Activation interface from libunity and
register it to your Unity.PlaceController. The registration is easy as
the activation backend is just a property on the controller. So it's
just ctrl.activation = my_activation_instance.

Honestly, I am not exactly sure how to implement Unity.Activation from
Python, but from Vala or C it should be straight forward.

Cheers,
Mikkel




Follow ups

References