[Glade-users] glade 3.6 and user data in callback function



On Sat, May 9, 2009 at 5:02 PM, daniel <drmartens at gnu.univ.gda.pl> wrote:
[...]
I have just found out, that if I use "user data" column in glade, the
object is passed, but not as a (last) user_data argument, but a widget
argument. Is this the bug you meant?

I mean, if I have a cellrenderertoggle callback like
def toggled(self, cell, path):

The cell argument would not hold a cellrenderer that fired the signal,
but actually the object I defined as user data in glade.

Now I wonder, if this is gtkbuilder or pygtk issue.

There are 2 issues at hand:
  1.) Glade doesnt do a good job of letting the user know what is
       happening with user data.

  2.) it swaps the user_data with the widget for historical reasons,
       libglade worked that way and I cant recall exactly where the
       decision was made but I suppose by default it just does the
       same as libglade to avoid complications in conversions etc.

The reason why it was originally like this dates back to
gtk_signal_connect_object()
which by default swaps the user data; letting you do funky things from Glade
such as connecting symbols from GTK+ to objects without writing code
(i.e. pass "gtk_widget_hide" to a signal with user data as the widget
you want to hide
when the signal is emitted).

Cheers,
                  -Tristan




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]