I'm trying to develop a lens for unity in ubuntu 11.10 and I can not get activate_uri signal working. This is an extract of my code:

def _on_activate_uri (self, scop, uri):
    print "----> " + uri + "<-"
    return ret

and this is what I get back:

TypeError: can't convert return value to desired type ../lens/appslens.py:230: Warning: g_object_get_qdata: assertion G_IS_OBJECT (object)' failed GObject.MainLoop().run() ../lens/appslens.py:230: Warning: g_object_set_qdata_full: assertionG_IS_OBJECT (object)' failed GObject.MainLoop().run() ../lens/appslens.py:230: Warning: g_object_unref: assertion `G_IS_OBJECT (object)' failed GObject.MainLoop().run()

Does anyone has an idea where is my mistake ?

Thanks in advance for your help

  • Bug 893688 has been reported on Launchpad concerning this issue. – Mark Tully Nov 24 '11 at 12:58

I have the same problem and don't know how to avoid the error. However, if you can live with the ugly error message spamming the console, you can work around it:

At the time the error is thrown, the _on_activate_uri has been executed, thus everything you might want to do there (print, in your example) should have happened. It certainly works that way for me.

Basically, by choosing the URI scheme for the model resources wisely, we can emulate either HIDE_DASH or the default fallback (use installed application suitable for the uri scheme) behaviour.

In my case, and in your example, we want HIDE_DASH behaviour. When the error is thrown, apparently unity tries to deal with the situation by opening the URI with a suitable application. Thus, to make it behave as in HIDE_DASH, we just have to make sure to give our model resources URIs with a scheme that no installed application can handle. In my case, that would make the URIs start with "pidgin-lens://".

If your URIs begin with "http://", the browser will be opened after _on_activate_uri has run, so that behaviour (NOT_HANDELED/GOTO_DASH_URI) is easily emulated, too.

SHOW_DASH probably can't be emulated.

|improve this answer|||||
  • I do not understand what you mean by "give our model resources URIs with a scheme that no installed application can handle." I have selected "lens-run-cmd://" that is only know by _on_activate_uri, and the dash is not closing. did you manage to do it ? – pub.david Nov 20 '11 at 17:00
  • @pub.david: Please have a look at my code on launchpad - when I run it, the dash simply closes. I don't think I did anything special though. – Wolfgang Groiss Nov 20 '11 at 21:54

Seems to be a bug either in the Unity gir file, or in python-gobject. Anyway as a workaround this seems to work:

ret = Unity.ActivationResponse(handled=Unity.HandledType.HIDE_DASH,goto_uri='')
|improve this answer|||||
  • GREAT it works ! thanks for your advice I hope this solution will help many other developpers... – pub.david Dec 15 '11 at 4:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.