GTK+开发第一篇

#include <gtk/gtk.h>

static void window_quit(GtkButton* button, gpointer func_data) {
	g_print("window quit : %s\n", (char *) func_data);
	gtk_main_quit();
}

gint main(int argc, char *argv[]) {
	GtkWidget * window;

	gtk_init(&argc, &argv);
	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);

	g_signal_connect(GTK_OBJECT(window), "destroy",
			GTK_SIGNAL_FUNC(window_quit), (void *) "Bye hello world!");

	gtk_widget_show(window);
	gtk_main();

	return 0;
}

Leave a Reply

Your email address will not be published.