diff options
author | GMT 1998 Tony Gale <gale@gtk.org> | 1998-12-07 15:19:00 +0000 |
---|---|---|
committer | Tony Gale <gale@src.gnome.org> | 1998-12-07 15:19:00 +0000 |
commit | 337bdee253125b60eb38cab7e1d4916e8dd66d4f (patch) | |
tree | 4f4c6f771a02135a6796bd71c099059546e7f4d6 /examples/table | |
parent | 621beb8aaf93c8cfe234723d7001e114ac5a8345 (diff) | |
download | gtk+-337bdee253125b60eb38cab7e1d4916e8dd66d4f.tar.gz |
Start mass update for GTK 1.1 Look for the best version of awk Fix FD leak
Mon Dec 7 15:15:06 GMT 1998 Tony Gale <gale@gtk.org>
* docs/gtk_tut.sgml: Start mass update for GTK 1.1
* examples/extract.sh: Look for the best version of awk
* examples/extract.awk: Fix FD leak
* example/base: minimal example from Tutorial
Diffstat (limited to 'examples/table')
-rw-r--r-- | examples/table/table.c | 54 |
1 files changed, 29 insertions, 25 deletions
diff --git a/examples/table/table.c b/examples/table/table.c index e3fd182c4d..662450c0d4 100644 --- a/examples/table/table.c +++ b/examples/table/table.c @@ -1,22 +1,25 @@ -/* This file extracted from the GTK tutorial. */ +/* example-start table table.c */ -/* table.c */ #include <gtk/gtk.h> -/* our callback. - * the data passed to this function is printed to stdout */ -void callback (GtkWidget *widget, gpointer data) +/* Our callback. + * The data passed to this function is printed to stdout */ +void callback( GtkWidget *widget, + gpointer data ) { g_print ("Hello again - %s was pressed\n", (char *) data); } -/* this callback quits the program */ -void delete_event (GtkWidget *widget, GdkEvent *event, gpointer data) +/* This callback quits the program */ +void delete_event( GtkWidget *widget, + GdkEvent *event, + gpointer data ) { gtk_main_quit (); } -int main (int argc, char *argv[]) +int main( int argc, + char *argv[] ) { GtkWidget *window; GtkWidget *button; @@ -24,62 +27,62 @@ int main (int argc, char *argv[]) gtk_init (&argc, &argv); - /* create a new window */ + /* Create a new window */ window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - /* set the window title */ + /* Set the window title */ gtk_window_set_title (GTK_WINDOW (window), "Table"); - /* set a handler for delete_event that immediately + /* Set a handler for delete_event that immediately * exits GTK. */ gtk_signal_connect (GTK_OBJECT (window), "delete_event", GTK_SIGNAL_FUNC (delete_event), NULL); - /* sets the border width of the window. */ + /* Sets the border width of the window. */ gtk_container_border_width (GTK_CONTAINER (window), 20); - /* create a 2x2 table */ + /* Create a 2x2 table */ table = gtk_table_new (2, 2, TRUE); - /* put the table in the main window */ + /* Put the table in the main window */ gtk_container_add (GTK_CONTAINER (window), table); - /* create first button */ + /* Create first button */ button = gtk_button_new_with_label ("button 1"); - /* when the button is clicked, we call the "callback" function - * with a pointer to "button 1" as it's argument */ + /* When the button is clicked, we call the "callback" function + * with a pointer to "button 1" as its argument */ gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (callback), (gpointer) "button 1"); - /* insert button 1 into the upper left quadrant of the table */ + /* Insert button 1 into the upper left quadrant of the table */ gtk_table_attach_defaults (GTK_TABLE(table), button, 0, 1, 0, 1); gtk_widget_show (button); - /* create second button */ + /* Create second button */ button = gtk_button_new_with_label ("button 2"); - /* when the button is clicked, we call the "callback" function - * with a pointer to "button 2" as it's argument */ + /* When the button is clicked, we call the "callback" function + * with a pointer to "button 2" as its argument */ gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (callback), (gpointer) "button 2"); - /* insert button 2 into the upper right quadrant of the table */ + /* Insert button 2 into the upper right quadrant of the table */ gtk_table_attach_defaults (GTK_TABLE(table), button, 1, 2, 0, 1); gtk_widget_show (button); - /* create "Quit" button */ + /* Create "Quit" button */ button = gtk_button_new_with_label ("Quit"); - /* when the button is clicked, we call the "delete_event" function + /* When the button is clicked, we call the "delete_event" function * and the program exits */ gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (delete_event), NULL); - /* insert the quit button into the both + /* Insert the quit button into the both * lower quadrants of the table */ gtk_table_attach_defaults (GTK_TABLE(table), button, 0, 2, 1, 2); @@ -92,3 +95,4 @@ int main (int argc, char *argv[]) return 0; } +/* example-end */ |