tags:

views:

159

answers:

2

I'm using Glade-3 for my GUI design, but I keep hitting this problem. I don't see anything in the GTK+ documentation mapping signals to events or in Glade-3 (3.4.5). Is there a place in the GTK+ source code to find this information?

Note: It is important in this question to recognize that events and signals are NOT the same thing in GTK.

Example:

I have an eventbox that requires the following events in order to receive the following signals. How do I determine what events are required by a given signal?

Events: GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_STRUCTURE_MASK
Signals: leave_notify_event, enter_notify_event
+1  A: 

Assuming that I have interpreted your question correctly you are wanting to connect the signals you specified in the Glade file to the functions in the source code. How you do this depends if you are using libglade to load the files generate or GtkBuilder, both are similar but I will give samples in C just to be complete.

Using libglade you would do it like so:

GladeXml *xml = glade_xml_new(filename, NULL, NULL); // Load the file
glade_xml_signal_autoconnect(xml); // Connect the signals

Using GtkBuilder it would be like this:

GtkBuilder *xml = gtk_builder_new();
gtk_builder_add_from_file(xml, filename, NULL); // Load the file
gtk_builder_connect_signals(xml, NULL); // Connect the signals

When using GtkBuilder the second parameter in signal connect function can be replaced with a pointer to data which will then be passed to the signal handlers.

Going forward I would suggest using GtkBuilder as libglade is on its way to being deprecated.

Links

Here are the links to the relevent documentation about the two functions mentioned above

Mike Lowen
This is a great answer, but it wasn't the answer to my question. I'm going to update the question since it is obviously unclear.
Harvey
+1  A: 

Ok, I think I know what you mean now, I found this table matching up the gtk signals and gdk events. Here it is.

DoR