gtktoolbar.c (gtk_toolbar_insert_element): Test for presence of both callback and user_data?




Several of the foreign language bindings for gtk+ utilize the
global_marshaller function to provide a single entry point for all
callbacks. The usual idiom for these languages is then

    gtk_signal_connect(gtkobject, "signal_name", NULL, func_data)

and then the handler functions fall through to the global_marshaler.

However, the various gtk_toolbar_insert functions also accept a
callback parameter, which they bind to the "clicked" action if the
callback is not NULL.

This means that the foreign language bindings either have to set up an
alternative entry point for gtk_toolbar items, or explicitly connect the
"clicked" signal of the returned object.  I propose that the signal be
connected if either the callback or the user_data fields are non-NULL.

--- gtktoolbar.c.orig   Sat Oct 10 10:21:13 1998
+++ gtktoolbar.c        Sat Oct 10 10:21:52 1998
@@ -785,7 +785,7 @@
 
       GTK_WIDGET_UNSET_FLAGS (child->widget, GTK_CAN_FOCUS);
 
-      if (callback)
+      if (callback || user_data)
        gtk_signal_connect (GTK_OBJECT (child->widget), "clicked",
                            callback, user_data);

--
Paul Janzen



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