Bug 32524 - Python version of text handler example
Summary: Python version of text handler example
Status: RESOLVED FIXED
Alias: None
Product: Telepathy
Classification: Unclassified
Component: tp-glib (show other bugs)
Version: unspecified
Hardware: Other All
: medium enhancement
Assignee: Telepathy bugs list
QA Contact: Telepathy bugs list
URL: http://git.collabora.co.uk/?p=user/ca...
Whiteboard: review+
Keywords: patch
Depends on: 32465
Blocks:
  Show dependency treegraph
 
Reported: 2010-12-20 05:50 UTC by Guillaume Desmottes
Modified: 2011-01-28 03:02 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

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.