Bug 32524

Summary: Python version of text handler example
Product: Telepathy Reporter: Guillaume Desmottes <guillaume.desmottes>
Component: tp-glibAssignee: Telepathy bugs list <telepathy-bugs>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: enhancement    
Priority: medium CC: tomeu
Version: unspecifiedKeywords: patch
Hardware: Other   
OS: All   
URL: http://git.collabora.co.uk/?p=user/cassidy/telepathy-glib;a=shortlog;h=refs/heads/python-handler-32524
Whiteboard: review+
i915 platform: i915 features:
Bug Depends on: 32465    
Bug Blocks:    

Description Guillaume Desmottes 2010-12-20 05:50:23 UTC
In order to test TpTextChannel's gir support, I rewrote the text handler example in Python. I guess it could be useful to other people so it would be cool to include it.
Comment 2 Guillaume Desmottes 2010-12-20 23:53:27 UTC
Oh, Tomeu, I'm not really happy with this:
   channel.ack_messages_async(messages, lambda a, b, c: 0, None)

Is there a better way to pass no callback? Shouldn't pygi always allow None as a GAsyncReadyCallback ?
Comment 3 Tomeu Vizoso 2010-12-21 00:50:53 UTC
(In reply to comment #2)
> Oh, Tomeu, I'm not really happy with this:
>    channel.ack_messages_async(messages, lambda a, b, c: 0, None)
> 
> Is there a better way to pass no callback? Shouldn't pygi always allow None as
> a GAsyncReadyCallback ?

We surely could special-case it in pygobject or even in g-i-scanner, so all bindings benefit from it. But I wonder if in some cases API authors would like to make sure it's not None.
Comment 4 Tomeu Vizoso 2011-01-27 08:10:54 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > Oh, Tomeu, I'm not really happy with this:
> >    channel.ack_messages_async(messages, lambda a, b, c: 0, None)
> > 
> > Is there a better way to pass no callback? Shouldn't pygi always allow None as
> > a GAsyncReadyCallback ?
> 
> We surely could special-case it in pygobject or even in g-i-scanner, so all
> bindings benefit from it. But I wonder if in some cases API authors would like
> to make sure it's not None.

I think in this case it should be telepathy-glib to add (allow-none) annotations to those arguments, as nobody else can now if that code is ready to handle NULL callbacks. If that doesn't work for some reason, please file a bug for pygobject.
Comment 5 Guillaume Desmottes 2011-01-28 02:58:10 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > (In reply to comment #2)
> > > Oh, Tomeu, I'm not really happy with this:
> > >    channel.ack_messages_async(messages, lambda a, b, c: 0, None)
> > > 
> > > Is there a better way to pass no callback? Shouldn't pygi always allow None as
> > > a GAsyncReadyCallback ?
> > 
> > We surely could special-case it in pygobject or even in g-i-scanner, so all
> > bindings benefit from it. But I wonder if in some cases API authors would like
> > to make sure it's not None.
> 
> I think in this case it should be telepathy-glib to add (allow-none)
> annotations to those arguments, as nobody else can now if that code is ready to
> handle NULL callbacks. If that doesn't work for some reason, please file a bug
> for pygobject.

It doesn't work. I opened https://bugzilla.gnome.org/show_bug.cgi?id=640812

I added 2 small commits to the branch.
Comment 6 Guillaume Desmottes 2011-01-28 03:02:43 UTC
Merged to master; will be in 0.13.12

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.