Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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 + "<-"
    ret=Unity.ActivationResponse.new(Unity.HandledType.HIDE_DASH,'')
    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

share|improve this question
    
Bug 893688 has been reported on Launchpad concerning this issue. –  Mark Tully Nov 24 '11 at 12:58
add comment

2 Answers

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.

share|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
add comment

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='')
share|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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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