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



Juan Pablo Ugarte wrote:
IIRC there is a bug in GtkBuilder

try using a custom autoconnect function like this one

void
autoconnect_custom (GtkBuilder *builder,
                                      GObject *object,
                                      const gchar *signal_name,
                                      const gchar *handler_name,
                                      GObject *connect_object,
                                      GConnectFlags flags,
                                      gpointer data)
{
      GCallback func;
      static GModule *module = NULL;
      
      if (!module) module = g_module_open (NULL, 0);
      
      if (!g_module_symbol (module, handler_name, (gpointer)&func))
      {
              g_warning ("could not find signal handler '%s'.", handler_name);
              return;
      }
      
      g_signal_connect (object, signal_name, func,
                                        (connect_object) ? connect_object : data);
}

and auto connect whit something like this

gtk_builder_connect_signals_full (builder, autoconnect_custom, NULL);


Thanks. I wish I understood :) Is this possible in pygtk at all?

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.

daniel






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