
The code is fairly straight forward and there are comments throughout. The project compiles on my system using:
gcc -o dialogs2 -Wall -g main.c `pkg-config gtk+-2.0 --cflags --libs `-I/usr/include/libglade-2.0 -lglade-2.0
However, you may need to adjust the include path for libglade based on your distribution/installation. The file gui.glade must reside in the same path as the executable.
GtkFontSelectionDialog
GtkColorSelectionDialog
Some notes about the code
gxml = glade_xml_new (GLADE_FILE, "window", NULL);Rather than passing NULL as the second parameter to glade_xml_new, I'm passing "window". This is the root node-- Only "window" and it's child widgets will be built by libglade. We don't want to build the dialogs until they are needed. Users may never even use the dialogs in a real world application, so why build them?
glade_xml_signal_connect_data (gxml, "on_color_button_clicked",
G_CALLBACK(on_color_button_clicked), label);
I'm using glade_xml_signal_connect_data() rather than glade_xml_signal_connect(). This allows me to pass the label widget to the callback function. The callback function can then manipulate that label based on the result of the dialog.
