/* * tmp.c * * Copyright 2008 GonzaloF * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ #include static void destroy (GtkWidget*, gpointer); int main (int argc, char *argv[]) { GtkWidget *mainWin, *closeBtn; gtk_init (&argc, &argv); mainWin = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (mainWin), "Hello World"); gtk_container_set_border_width (GTK_CONTAINER (mainWin), 5); gtk_widget_set_size_request (mainWin, 300, 200); g_signal_connect (G_OBJECT (mainWin), "destroy", G_CALLBACK (destroy), NULL); closeBtn = gtk_button_new_from_stock (GTK_STOCK_CLOSE); gtk_container_add (GTK_CONTAINER (mainWin), closeBtn); g_signal_connect_swapped (G_OBJECT (closeBtn), "clicked", G_CALLBACK (gtk_widget_destroy), (gpointer) mainWin); gtk_widget_show_all (mainWin); gtk_main(); return 0; } static void destroy (GtkWidget *window, gpointer data) { gtk_main_quit(); }