#include <gtk/gtk.h> // this callback is called whenever the button is pressed void pressed_cb (GtkWidget *widget, GConfClient *config) { // gconf_client_get_int () returns 0 if the key does not exist. Inthis case, we don't need to bother checking for errors. gint clicks = gconf_client_get_int (config, "/apps/gconf-test/clicks", NULL); clicks++; // set the value so that it will exist next time this function is called gconf_client_set_int (config, "/apps/gconf-test/clicks", clicks, NULL); g_print ("%d\n", clicks);}int main (int argc, char **argv){ GtkWidget *window; GtkWidget *button; GConfClient *config; // common gtk init gtk_init (&argc, &argv); // create the GConfClient config = gconf_client_get_default (); // create the window and make it quit when we want it to window = gtk_window_new (GTK_WINDOW_TOPLEVEL); g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK(gtk_main_quit), NULL); // and the button... button = gtk_button_new_with_label ("Press me"); // when it is pressed call our callback g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK(pressed_cb), config); gtk_container_add (GTK_CONTAINER (window), button); // some more common stuff gtk_widget_show_all (window); gtk_main (); return 0;}