From b3d5f148e6c0e2cb688403655c7800b762e33602 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 16 Feb 2002 23:52:30 +0000 Subject: [PATCH] More work on #71430. * examples/*/Makefile (CFLAGS): add deprecation guards. * docs/tutorial/gtk-tut.sgml, examples/*/*.c: make most examples deprecation-clean; the major offenders right now are the examples that make heavy use of completely deprecated or broken widgets: list, tree, text, pixmap, paned and progressbar. These will have to be redone from scratch. * demos/Makefile.am (INCLUDES): add -DGDK_PIXBUF_DISABLE_DEPRECATED. --- ChangeLog | 16 + ChangeLog.pre-2-0 | 16 + ChangeLog.pre-2-10 | 16 + ChangeLog.pre-2-2 | 16 + ChangeLog.pre-2-4 | 16 + ChangeLog.pre-2-6 | 16 + ChangeLog.pre-2-8 | 16 + demos/Makefile.am | 1 + docs/tutorial/gtk-tut.sgml | 732 +++++++++++---------- examples/arrow/Makefile | 8 +- examples/arrow/arrow.c | 2 - examples/aspectframe/Makefile | 8 +- examples/aspectframe/aspectframe.c | 8 +- examples/base/Makefile | 8 +- examples/base/base.c | 2 - examples/buttonbox/Makefile | 8 +- examples/buttonbox/buttonbox.c | 12 +- examples/buttons/Makefile | 8 +- examples/buttons/buttons.c | 20 +- examples/calendar/Makefile | 8 +- examples/calendar/calendar.c | 114 ++-- examples/clist/Makefile | 8 +- examples/clist/clist.c | 4 +- examples/entry/Makefile | 8 +- examples/entry/entry.c | 39 +- examples/eventbox/Makefile | 8 +- examples/eventbox/eventbox.c | 15 +- examples/filesel/Makefile | 8 +- examples/filesel/filesel.c | 14 +- examples/fixed/Makefile | 8 +- examples/fixed/fixed.c | 8 +- examples/frame/Makefile | 10 +- examples/frame/frame.c | 10 +- examples/gtkdial/Makefile | 10 +- examples/gtkdial/dial_test.c | 28 +- examples/gtkdial/gtkdial.c | 68 +- examples/gtkdial/gtkdial.h | 4 +- examples/helloworld/Makefile | 8 +- examples/helloworld/helloworld.c | 12 +- examples/helloworld2/Makefile | 8 +- examples/helloworld2/helloworld2.c | 14 +- examples/label/Makefile | 8 +- examples/label/label.c | 6 +- examples/list/Makefile | 10 +- examples/list/list.c | 18 +- examples/menu/Makefile | 10 +- examples/menu/itemfactory.c | 10 +- examples/menu/menu.c | 17 +- examples/notebook/Makefile | 8 +- examples/notebook/notebook.c | 43 +- examples/packbox/Makefile | 8 +- examples/packbox/packbox.c | 14 +- examples/paned/Makefile | 10 +- examples/paned/paned.c | 9 +- examples/pixmap/Makefile | 10 +- examples/pixmap/pixmap.c | 2 - examples/progressbar/Makefile | 10 +- examples/progressbar/progressbar.c | 22 +- examples/radiobuttons/Makefile | 8 +- examples/radiobuttons/radiobuttons.c | 16 +- examples/rangewidgets/Makefile | 8 +- examples/rangewidgets/rangewidgets.c | 36 +- examples/rulers/Makefile | 8 +- examples/rulers/rulers.c | 22 +- examples/scribble-simple/Makefile | 8 +- examples/scribble-simple/scribble-simple.c | 26 +- examples/scribble-xinput/Makefile | 8 +- examples/scribble-xinput/scribble-xinput.c | 77 +-- examples/scrolledwin/Makefile | 8 +- examples/scrolledwin/scrolledwin.c | 11 +- examples/selection/Makefile | 10 +- examples/selection/gettargets.c | 11 +- examples/selection/setselection.c | 13 +- examples/spinbutton/Makefile | 8 +- examples/spinbutton/spinbutton.c | 31 +- examples/statusbar/Makefile | 8 +- examples/statusbar/statusbar.c | 22 +- examples/table/Makefile | 8 +- examples/table/table.c | 12 +- examples/text/Makefile | 8 +- examples/text/text.c | 5 +- examples/tictactoe/Makefile | 10 +- examples/tictactoe/tictactoe.c | 55 +- examples/tictactoe/tictactoe.h | 4 +- examples/tictactoe/ttt_test.c | 9 +- examples/tree/Makefile | 8 +- examples/tree/tree.c | 7 +- examples/wheelbarrow/Makefile | 8 +- examples/wheelbarrow/wheelbarrow.c | 12 +- 89 files changed, 1163 insertions(+), 880 deletions(-) diff --git a/ChangeLog b/ChangeLog index 28d873989a..99eba46d53 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2002-02-17 Matthias Clasen + + More work on #71430. + + * examples/*/Makefile (CFLAGS): add deprecation guards. + + * docs/tutorial/gtk-tut.sgml, examples/*/*.c: make most examples + deprecation-clean; the major offenders right now are the examples + that make heavy use of completely deprecated or broken widgets: + list, tree, text, pixmap, paned and progressbar. These will have + to be redone from scratch. + Sun Feb 17 00:13:06 2002 Kristian Rietveld This commit lands the 'dy patch'. @@ -7,6 +19,10 @@ Sun Feb 17 00:13:06 2002 Kristian Rietveld (gtk_tree_view_row_changed): update top_row or dy, (gtk_tree_view_rows_reordered): update top_row +2002-02-16 Matthias Clasen + + * demos/Makefile.am (INCLUDES): add -DGDK_PIXBUF_DISABLE_DEPRECATED. + 2002-02-16 Matthias Clasen * examples/extract.awk: rearrange rules to not emit the example diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 28d873989a..99eba46d53 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,15 @@ +2002-02-17 Matthias Clasen + + More work on #71430. + + * examples/*/Makefile (CFLAGS): add deprecation guards. + + * docs/tutorial/gtk-tut.sgml, examples/*/*.c: make most examples + deprecation-clean; the major offenders right now are the examples + that make heavy use of completely deprecated or broken widgets: + list, tree, text, pixmap, paned and progressbar. These will have + to be redone from scratch. + Sun Feb 17 00:13:06 2002 Kristian Rietveld This commit lands the 'dy patch'. @@ -7,6 +19,10 @@ Sun Feb 17 00:13:06 2002 Kristian Rietveld (gtk_tree_view_row_changed): update top_row or dy, (gtk_tree_view_rows_reordered): update top_row +2002-02-16 Matthias Clasen + + * demos/Makefile.am (INCLUDES): add -DGDK_PIXBUF_DISABLE_DEPRECATED. + 2002-02-16 Matthias Clasen * examples/extract.awk: rearrange rules to not emit the example diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 28d873989a..99eba46d53 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,15 @@ +2002-02-17 Matthias Clasen + + More work on #71430. + + * examples/*/Makefile (CFLAGS): add deprecation guards. + + * docs/tutorial/gtk-tut.sgml, examples/*/*.c: make most examples + deprecation-clean; the major offenders right now are the examples + that make heavy use of completely deprecated or broken widgets: + list, tree, text, pixmap, paned and progressbar. These will have + to be redone from scratch. + Sun Feb 17 00:13:06 2002 Kristian Rietveld This commit lands the 'dy patch'. @@ -7,6 +19,10 @@ Sun Feb 17 00:13:06 2002 Kristian Rietveld (gtk_tree_view_row_changed): update top_row or dy, (gtk_tree_view_rows_reordered): update top_row +2002-02-16 Matthias Clasen + + * demos/Makefile.am (INCLUDES): add -DGDK_PIXBUF_DISABLE_DEPRECATED. + 2002-02-16 Matthias Clasen * examples/extract.awk: rearrange rules to not emit the example diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 28d873989a..99eba46d53 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,15 @@ +2002-02-17 Matthias Clasen + + More work on #71430. + + * examples/*/Makefile (CFLAGS): add deprecation guards. + + * docs/tutorial/gtk-tut.sgml, examples/*/*.c: make most examples + deprecation-clean; the major offenders right now are the examples + that make heavy use of completely deprecated or broken widgets: + list, tree, text, pixmap, paned and progressbar. These will have + to be redone from scratch. + Sun Feb 17 00:13:06 2002 Kristian Rietveld This commit lands the 'dy patch'. @@ -7,6 +19,10 @@ Sun Feb 17 00:13:06 2002 Kristian Rietveld (gtk_tree_view_row_changed): update top_row or dy, (gtk_tree_view_rows_reordered): update top_row +2002-02-16 Matthias Clasen + + * demos/Makefile.am (INCLUDES): add -DGDK_PIXBUF_DISABLE_DEPRECATED. + 2002-02-16 Matthias Clasen * examples/extract.awk: rearrange rules to not emit the example diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 28d873989a..99eba46d53 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,15 @@ +2002-02-17 Matthias Clasen + + More work on #71430. + + * examples/*/Makefile (CFLAGS): add deprecation guards. + + * docs/tutorial/gtk-tut.sgml, examples/*/*.c: make most examples + deprecation-clean; the major offenders right now are the examples + that make heavy use of completely deprecated or broken widgets: + list, tree, text, pixmap, paned and progressbar. These will have + to be redone from scratch. + Sun Feb 17 00:13:06 2002 Kristian Rietveld This commit lands the 'dy patch'. @@ -7,6 +19,10 @@ Sun Feb 17 00:13:06 2002 Kristian Rietveld (gtk_tree_view_row_changed): update top_row or dy, (gtk_tree_view_rows_reordered): update top_row +2002-02-16 Matthias Clasen + + * demos/Makefile.am (INCLUDES): add -DGDK_PIXBUF_DISABLE_DEPRECATED. + 2002-02-16 Matthias Clasen * examples/extract.awk: rearrange rules to not emit the example diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 28d873989a..99eba46d53 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,15 @@ +2002-02-17 Matthias Clasen + + More work on #71430. + + * examples/*/Makefile (CFLAGS): add deprecation guards. + + * docs/tutorial/gtk-tut.sgml, examples/*/*.c: make most examples + deprecation-clean; the major offenders right now are the examples + that make heavy use of completely deprecated or broken widgets: + list, tree, text, pixmap, paned and progressbar. These will have + to be redone from scratch. + Sun Feb 17 00:13:06 2002 Kristian Rietveld This commit lands the 'dy patch'. @@ -7,6 +19,10 @@ Sun Feb 17 00:13:06 2002 Kristian Rietveld (gtk_tree_view_row_changed): update top_row or dy, (gtk_tree_view_rows_reordered): update top_row +2002-02-16 Matthias Clasen + + * demos/Makefile.am (INCLUDES): add -DGDK_PIXBUF_DISABLE_DEPRECATED. + 2002-02-16 Matthias Clasen * examples/extract.awk: rearrange rules to not emit the example diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 28d873989a..99eba46d53 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,15 @@ +2002-02-17 Matthias Clasen + + More work on #71430. + + * examples/*/Makefile (CFLAGS): add deprecation guards. + + * docs/tutorial/gtk-tut.sgml, examples/*/*.c: make most examples + deprecation-clean; the major offenders right now are the examples + that make heavy use of completely deprecated or broken widgets: + list, tree, text, pixmap, paned and progressbar. These will have + to be redone from scratch. + Sun Feb 17 00:13:06 2002 Kristian Rietveld This commit lands the 'dy patch'. @@ -7,6 +19,10 @@ Sun Feb 17 00:13:06 2002 Kristian Rietveld (gtk_tree_view_row_changed): update top_row or dy, (gtk_tree_view_rows_reordered): update top_row +2002-02-16 Matthias Clasen + + * demos/Makefile.am (INCLUDES): add -DGDK_PIXBUF_DISABLE_DEPRECATED. + 2002-02-16 Matthias Clasen * examples/extract.awk: rearrange rules to not emit the example diff --git a/demos/Makefile.am b/demos/Makefile.am index 1555c0433d..307b91c6e2 100644 --- a/demos/Makefile.am +++ b/demos/Makefile.am @@ -7,6 +7,7 @@ INCLUDES = @STRIP_BEGIN@ \ -I$(top_builddir)/gdk \ -DG_DISABLE_DEPRECATED \ -DGDK_DISABLE_DEPRECATED \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ -DGTK_DISABLE_DEPRECATED \ @GTK_DEBUG_FLAGS@ \ @GTK_DEP_CFLAGS@ \ diff --git a/docs/tutorial/gtk-tut.sgml b/docs/tutorial/gtk-tut.sgml index 264f291f72..306d4fad00 100755 --- a/docs/tutorial/gtk-tut.sgml +++ b/docs/tutorial/gtk-tut.sgml @@ -296,13 +296,13 @@ int main( int argc, * titlebar), we ask it to call the delete_event () function * as defined above. The data passed to the callback * function is NULL and is ignored in the callback function. */ - gtk_signal_connect (GTK_OBJECT (window), "delete_event", + g_signal_connect (GTK_OBJECT (window), "delete_event", GTK_SIGNAL_FUNC (delete_event), NULL); /* Here we connect the "destroy" event to a signal handler. * This event occurs when we call gtk_widget_destroy() on the window, * or if we return FALSE in the "delete_event" callback. */ - gtk_signal_connect (GTK_OBJECT (window), "destroy", + g_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (destroy), NULL); /* Sets the border width of the window. */ @@ -314,13 +314,13 @@ int main( int argc, /* When the button receives the "clicked" signal, it will call the * function hello() passing it NULL as its argument. The hello() * function is defined above. */ - gtk_signal_connect (GTK_OBJECT (button), "clicked", + g_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (hello), NULL); /* This will cause the window to be destroyed by calling * gtk_widget_destroy(window) when "clicked". Again, the destroy * signal could come from here, or the window manager. */ - gtk_signal_connect_object (GTK_OBJECT (button), "clicked", + g_signal_connect_swapped (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT (window)); @@ -338,7 +338,7 @@ int main( int argc, * mouse event). */ gtk_main (); - return(0); + return 0; } @@ -997,7 +997,7 @@ int main( int argc, /* Here we just set a handler for delete_event that immediately * exits GTK. */ - gtk_signal_connect (GTK_OBJECT (window), "delete_event", + g_signal_connect (GTK_OBJECT (window), "delete_event", GTK_SIGNAL_FUNC (delete_event), NULL); /* Sets the border width of the window. */ @@ -1016,7 +1016,7 @@ int main( int argc, /* Now 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", + g_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (callback), (gpointer) "button 1"); /* Instead of gtk_container_add, we pack this button into the invisible @@ -1032,7 +1032,7 @@ int main( int argc, /* Call the same callback function with a different argument, * passing a pointer to "button 2" instead. */ - gtk_signal_connect (GTK_OBJECT (button), "clicked", + g_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (callback), (gpointer) "button 2"); gtk_box_pack_start(GTK_BOX(box1), button, TRUE, TRUE, 0); @@ -1048,7 +1048,7 @@ int main( int argc, /* Rest in gtk_main and wait for the fun to begin! */ gtk_main (); - return(0); + return 0; } @@ -1212,7 +1212,7 @@ gint delete_event( GtkWidget *widget, gpointer data ) { gtk_main_quit(); - return(FALSE); + return FALSE; } /* Make a new hbox filled with button-labels. Arguments for the @@ -1288,7 +1288,7 @@ int main( int argc, if (argc != 2) { fprintf (stderr, "usage: packbox num, where num is 1, 2, or 3.\n"); /* This just does cleanup in GTK and exits with an exit status of 1. */ - gtk_exit (1); + exit (1); } which = atoi (argv[1]); @@ -1299,7 +1299,7 @@ int main( int argc, /* You should always remember to connect the delete_event signal * to the main window. This is very important for proper intuitive * behavior */ - gtk_signal_connect (GTK_OBJECT (window), "delete_event", + g_signal_connect (GTK_OBJECT (window), "delete_event", GTK_SIGNAL_FUNC (delete_event), NULL); gtk_container_set_border_width (GTK_CONTAINER (window), 10); @@ -1449,7 +1449,7 @@ int main( int argc, * and the "end" label will be separated from the other labels in the * hbox. Otherwise, all the widgets in the hbox would be packed as * close together as possible. */ - gtk_widget_set_usize (separator, 400, 5); + gtk_widget_set_size_request (separator, 400, 5); /* pack the separator into the vbox (box1) created near the start * of main() */ gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 5); @@ -1463,7 +1463,7 @@ int main( int argc, button = gtk_button_new_with_label ("Quit"); /* Setup the signal to terminate the program when the button is clicked */ - gtk_signal_connect_object (GTK_OBJECT (button), "clicked", + g_signal_connect_swapped (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (gtk_main_quit), GTK_OBJECT (window)); /* Pack the button into the quitbox. @@ -1491,7 +1491,7 @@ int main( int argc, /* Control returns here when gtk_main_quit() is called, but not when * gtk_exit is used. */ - return(0); + return 0; } @@ -1686,7 +1686,7 @@ gint delete_event( GtkWidget *widget, gpointer data ) { gtk_main_quit (); - return(FALSE); + return FALSE; } int main( int argc, @@ -1706,7 +1706,7 @@ int main( int argc, /* Set a handler for delete_event that immediately * exits GTK. */ - gtk_signal_connect (GTK_OBJECT (window), "delete_event", + g_signal_connect (GTK_OBJECT (window), "delete_event", GTK_SIGNAL_FUNC (delete_event), NULL); /* Sets the border width of the window. */ @@ -1723,7 +1723,7 @@ int main( int argc, /* 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", + g_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (callback), (gpointer) "button 1"); @@ -1738,7 +1738,7 @@ int main( int argc, /* 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", + g_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (callback), (gpointer) "button 2"); /* Insert button 2 into the upper right quadrant of the table */ gtk_table_attach_defaults (GTK_TABLE(table), button, 1, 2, 0, 1); @@ -1750,7 +1750,7 @@ int main( int argc, /* When the button is clicked, we call the "delete_event" function * and the program exits */ - gtk_signal_connect (GTK_OBJECT (button), "clicked", + g_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (delete_event), NULL); /* Insert the quit button into the both @@ -2019,6 +2019,7 @@ examples of using pixmaps later in the tutorial. +#include <stdlib.h> #include <gtk/gtk.h> /* Create a new hbox with an image and a label packed into it @@ -2047,7 +2048,7 @@ GtkWidget *xpm_label_box( GtkWidget *parent, pixmap = gdk_pixmap_create_from_xpm (parent->window, &mask, &style->bg[GTK_STATE_NORMAL], xpm_filename); - pixmapwid = gtk_pixmap_new (pixmap, mask); + pixmapwid = gtk_image_new_from_file (xpm_filename); /* Create a label for the button */ label = gtk_label_new (label_text); @@ -2086,12 +2087,14 @@ int main( int argc, gtk_window_set_title (GTK_WINDOW (window), "Pixmap'd Buttons!"); +#if 1 /* It's a good idea to do this for all windows. */ - gtk_signal_connect (GTK_OBJECT (window), "destroy", - GTK_SIGNAL_FUNC (gtk_exit), NULL); + g_signal_connect (GTK_OBJECT (window), "destroy", + GTK_SIGNAL_FUNC (exit), NULL); - gtk_signal_connect (GTK_OBJECT (window), "delete_event", - GTK_SIGNAL_FUNC (gtk_exit), NULL); + g_signal_connect (GTK_OBJECT (window), "delete_event", + GTK_SIGNAL_FUNC (exit), NULL); +#endif /* Sets the border width of the window. */ gtk_container_set_border_width (GTK_CONTAINER (window), 10); @@ -2101,8 +2104,8 @@ int main( int argc, button = gtk_button_new (); /* Connect the "clicked" signal of the button to our callback */ - gtk_signal_connect (GTK_OBJECT (button), "clicked", - GTK_SIGNAL_FUNC (callback), (gpointer) "cool button"); + g_signal_connect (GTK_OBJECT (button), "clicked", + GTK_SIGNAL_FUNC (callback), (gpointer) "cool button"); /* This calls our box creating function */ box1 = xpm_label_box(window, "info.xpm", "cool button"); @@ -2334,15 +2337,15 @@ the second will emit its "toggled" signal (to report becoming active). -#include <gtk/gtk.h> #include <glib.h> +#include <gtk/gtk.h> gint close_application( GtkWidget *widget, GdkEvent *event, gpointer data ) { gtk_main_quit(); - return(FALSE); + return FALSE; } int main( int argc, @@ -2359,7 +2362,7 @@ int main( int argc, window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_signal_connect (GTK_OBJECT (window), "delete_event", + g_signal_connect (GTK_OBJECT (window), "delete_event", GTK_SIGNAL_FUNC(close_application), NULL); @@ -2379,14 +2382,14 @@ int main( int argc, gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); gtk_widget_show (button); - group = gtk_radio_button_group (GTK_RADIO_BUTTON (button)); + group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)); button = gtk_radio_button_new_with_label(group, "button2"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); gtk_widget_show (button); button = gtk_radio_button_new_with_label( - gtk_radio_button_group (GTK_RADIO_BUTTON (button)), + gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)), "button3"); gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); gtk_widget_show (button); @@ -2401,7 +2404,7 @@ int main( int argc, gtk_widget_show (box2); button = gtk_button_new_with_label ("close"); - gtk_signal_connect_object (GTK_OBJECT (button), "clicked", + g_signal_connect_swapped (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC(close_application), GTK_OBJECT (window)); gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); @@ -2412,7 +2415,7 @@ int main( int argc, gtk_main(); - return(0); + return 0; } @@ -2997,7 +3000,7 @@ void cb_page_size( GtkAdjustment *get, set->page_increment = get->value; /* Now emit the "changed" signal to reconfigure all the widgets that * are attached to this adjustment */ - gtk_signal_emit_by_name (GTK_OBJECT (set), "changed"); + g_signal_emit_by_name (GTK_OBJECT (set), "changed"); } void cb_draw_value( GtkToggleButton *button ) @@ -3017,11 +3020,11 @@ GtkWidget *make_menu_item( gchar *name, GtkWidget *item; item = gtk_menu_item_new_with_label (name); - gtk_signal_connect (GTK_OBJECT (item), "activate", + g_signal_connect (GTK_OBJECT (item), "activate", callback, data); gtk_widget_show (item); - return(item); + return item; } void scale_set_default_values( GtkScale *scale ) @@ -3049,7 +3052,7 @@ void create_range_controls( void ) /* Standard window-creating stuff */ window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_signal_connect (GTK_OBJECT (window), "destroy", + g_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC(gtk_main_quit), NULL); gtk_window_set_title (GTK_WINDOW (window), "range controls"); @@ -3080,7 +3083,7 @@ void create_range_controls( void ) /* Reuse the same adjustment */ hscale = gtk_hscale_new (GTK_ADJUSTMENT (adj1)); - gtk_widget_set_usize (GTK_WIDGET (hscale), 200, 30); + gtk_widget_set_size_request (GTK_WIDGET (hscale), 200, 30); scale_set_default_values (GTK_SCALE (hscale)); gtk_box_pack_start (GTK_BOX (box3), hscale, TRUE, TRUE, 0); gtk_widget_show (hscale); @@ -3102,7 +3105,7 @@ void create_range_controls( void ) /* A checkbutton to control whether the value is displayed or not */ button = gtk_check_button_new_with_label("Display value on scale widgets"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); - gtk_signal_connect (GTK_OBJECT (button), "toggled", + g_signal_connect (GTK_OBJECT (button), "toggled", GTK_SIGNAL_FUNC(cb_draw_value), NULL); gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); gtk_widget_show (button); @@ -3121,19 +3124,19 @@ void create_range_controls( void ) item = make_menu_item ("Top", GTK_SIGNAL_FUNC(cb_pos_menu_select), GINT_TO_POINTER (GTK_POS_TOP)); - gtk_menu_append (GTK_MENU (menu), item); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); item = make_menu_item ("Bottom", GTK_SIGNAL_FUNC (cb_pos_menu_select), GINT_TO_POINTER (GTK_POS_BOTTOM)); - gtk_menu_append (GTK_MENU (menu), item); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); item = make_menu_item ("Left", GTK_SIGNAL_FUNC (cb_pos_menu_select), GINT_TO_POINTER (GTK_POS_LEFT)); - gtk_menu_append (GTK_MENU (menu), item); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); item = make_menu_item ("Right", GTK_SIGNAL_FUNC (cb_pos_menu_select), GINT_TO_POINTER (GTK_POS_RIGHT)); - gtk_menu_append (GTK_MENU (menu), item); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_option_menu_set_menu (GTK_OPTION_MENU (opt), menu); gtk_box_pack_start (GTK_BOX (box2), opt, TRUE, TRUE, 0); @@ -3157,17 +3160,17 @@ void create_range_controls( void ) item = make_menu_item ("Continuous", GTK_SIGNAL_FUNC (cb_update_menu_select), GINT_TO_POINTER (GTK_UPDATE_CONTINUOUS)); - gtk_menu_append (GTK_MENU (menu), item); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); item = make_menu_item ("Discontinuous", GTK_SIGNAL_FUNC (cb_update_menu_select), GINT_TO_POINTER (GTK_UPDATE_DISCONTINUOUS)); - gtk_menu_append (GTK_MENU (menu), item); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); item = make_menu_item ("Delayed", GTK_SIGNAL_FUNC (cb_update_menu_select), GINT_TO_POINTER (GTK_UPDATE_DELAYED)); - gtk_menu_append (GTK_MENU (menu), item); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_option_menu_set_menu (GTK_OPTION_MENU (opt), menu); gtk_box_pack_start (GTK_BOX (box2), opt, TRUE, TRUE, 0); @@ -3186,7 +3189,7 @@ void create_range_controls( void ) gtk_widget_show (label); adj2 = gtk_adjustment_new (1.0, 0.0, 5.0, 1.0, 1.0, 0.0); - gtk_signal_connect (GTK_OBJECT (adj2), "value_changed", + g_signal_connect (GTK_OBJECT (adj2), "value_changed", GTK_SIGNAL_FUNC (cb_digits_scale), NULL); scale = gtk_hscale_new (GTK_ADJUSTMENT (adj2)); gtk_scale_set_digits (GTK_SCALE (scale), 0); @@ -3206,7 +3209,7 @@ void create_range_controls( void ) gtk_widget_show (label); adj2 = gtk_adjustment_new (1.0, 1.0, 101.0, 1.0, 1.0, 0.0); - gtk_signal_connect (GTK_OBJECT (adj2), "value_changed", + g_signal_connect (GTK_OBJECT (adj2), "value_changed", GTK_SIGNAL_FUNC (cb_page_size), adj1); scale = gtk_hscale_new (GTK_ADJUSTMENT (adj2)); gtk_scale_set_digits (GTK_SCALE (scale), 0); @@ -3226,7 +3229,7 @@ void create_range_controls( void ) gtk_widget_show (box2); button = gtk_button_new_with_label ("Quit"); - gtk_signal_connect_object (GTK_OBJECT (button), "clicked", + g_signal_connect_swapped (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC(gtk_main_quit), NULL); gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); @@ -3246,7 +3249,7 @@ int main( int argc, gtk_main(); - return(0); + return 0; } @@ -3368,7 +3371,7 @@ int main( int argc, gtk_init(&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_signal_connect (GTK_OBJECT (window), "destroy", + g_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC(gtk_main_quit), NULL); @@ -3450,7 +3453,7 @@ int main( int argc, gtk_main (); - return(0); + return 0; } @@ -3920,7 +3923,7 @@ gint progress_timeout( gpointer data ) /* As this is a timeout function, return TRUE so that it * continues to get called */ - return(TRUE); + return TRUE; } /* Callback that toggles the text display within the progress @@ -3988,9 +3991,9 @@ int main( int argc, pdata = g_malloc( sizeof(ProgressData) ); pdata->window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_policy (GTK_WINDOW (pdata->window), FALSE, FALSE, TRUE); + gtk_window_set_resizable (GTK_WINDOW (pdata->window), TRUE); - gtk_signal_connect (GTK_OBJECT (pdata->window), "destroy", + g_signal_connect (GTK_OBJECT (pdata->window), "destroy", GTK_SIGNAL_FUNC (destroy_progress), pdata); gtk_window_set_title (GTK_WINDOW (pdata->window), "GtkProgressBar"); @@ -4041,7 +4044,7 @@ int main( int argc, gtk_table_attach (GTK_TABLE (table), check, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 5, 5); - gtk_signal_connect (GTK_OBJECT (check), "clicked", + g_signal_connect (GTK_OBJECT (check), "clicked", GTK_SIGNAL_FUNC (toggle_show_text), pdata); gtk_widget_show(check); @@ -4051,7 +4054,7 @@ int main( int argc, gtk_table_attach (GTK_TABLE (table), check, 0, 1, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 5, 5); - gtk_signal_connect (GTK_OBJECT (check), "clicked", + g_signal_connect (GTK_OBJECT (check), "clicked", GTK_SIGNAL_FUNC (toggle_activity_mode), pdata); gtk_widget_show(check); @@ -4067,19 +4070,19 @@ int main( int argc, gtk_table_attach (GTK_TABLE (table), button, 2, 3, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 5, 5); - gtk_signal_connect (GTK_OBJECT (button), "clicked", + g_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (set_continuous_mode), pdata); gtk_widget_show (button); /* Add a radio button to select discrete display mode */ button = gtk_radio_button_new_with_label( - gtk_radio_button_group (GTK_RADIO_BUTTON (button)), + gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)), "Discrete"); gtk_table_attach (GTK_TABLE (table), button, 2, 3, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 5, 5); - gtk_signal_connect (GTK_OBJECT (button), "clicked", + g_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (set_discrete_mode), pdata); gtk_widget_show (button); @@ -4090,7 +4093,7 @@ int main( int argc, /* Add a button to exit the program */ button = gtk_button_new_with_label ("close"); - gtk_signal_connect_object (GTK_OBJECT (button), "clicked", + g_signal_connect_swapped (GTK_OBJECT (button), "clicked", (GtkSignalFunc) gtk_widget_destroy, GTK_OBJECT (pdata->window)); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); @@ -4107,7 +4110,7 @@ int main( int argc, gtk_main (); - return(0); + return 0; } @@ -4592,7 +4595,7 @@ int main (int argc, * since we're making it a popup. */ gtk_init (&argc, &argv); window = gtk_window_new( GTK_WINDOW_POPUP ); - gtk_signal_connect (GTK_OBJECT (window), "delete_event", + g_signal_connect (GTK_OBJECT (window), "delete_event", GTK_SIGNAL_FUNC (close_application), NULL); gtk_widget_show (window); @@ -4602,12 +4605,12 @@ int main (int argc, gdk_pixmap = gdk_pixmap_create_from_xpm_d( window->window, &mask, &style->bg[GTK_STATE_NORMAL], WheelbarrowFull_xpm ); - pixmap = gtk_pixmap_new( gdk_pixmap, mask ); + pixmap = gtk_image_new_from_pixmap (gdk_pixmap, mask); gtk_widget_show( pixmap ); /* To display the pixmap, we use a fixed widget to place the pixmap */ fixed = gtk_fixed_new(); - gtk_widget_set_usize( fixed, 200, 200 ); + gtk_widget_set_size_request (fixed, 200, 200); gtk_fixed_put( GTK_FIXED(fixed), pixmap, 0, 0 ); gtk_container_add( GTK_CONTAINER(window), fixed ); gtk_widget_show( fixed ); @@ -4616,11 +4619,11 @@ int main (int argc, gtk_widget_shape_combine_mask( window, mask, 0, 0 ); /* show the window */ - gtk_widget_set_uposition( window, 20, 400 ); + /*gtk_widget_set_uposition( window, 20, 400 );*/ gtk_widget_show( window ); gtk_main (); - return(0); + return 0; } @@ -4743,7 +4746,7 @@ gint close_application( GtkWidget *widget, gpointer data ) { gtk_main_quit(); - return(FALSE); + return FALSE; } /* The main routine */ @@ -4755,7 +4758,7 @@ int main( int argc, gtk_init( &argc, &argv ); window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_signal_connect (GTK_OBJECT (window), "delete_event", + g_signal_connect (GTK_OBJECT (window), "delete_event", GTK_SIGNAL_FUNC( close_application ), NULL); gtk_container_set_border_width (GTK_CONTAINER (window), 10); @@ -4764,7 +4767,7 @@ int main( int argc, gtk_container_add( GTK_CONTAINER(window), table ); area = gtk_drawing_area_new(); - gtk_drawing_area_size( (GtkDrawingArea *)area, XSIZE, YSIZE ); + gtk_widget_set_size_request (GTK_WIDGET (area), XSIZE, YSIZE); gtk_table_attach( GTK_TABLE(table), area, 1, 2, 1, 2, GTK_EXPAND|GTK_FILL, GTK_FILL, 0, 0 ); gtk_widget_set_events( area, GDK_POINTER_MOTION_MASK | @@ -4776,7 +4779,7 @@ int main( int argc, hrule = gtk_hruler_new(); gtk_ruler_set_metric( GTK_RULER(hrule), GTK_PIXELS ); gtk_ruler_set_range( GTK_RULER(hrule), 7, 13, 0, 20 ); - gtk_signal_connect_object( GTK_OBJECT(area), "motion_notify_event", + g_signal_connect_swapped( GTK_OBJECT(area), "motion_notify_event", (GtkSignalFunc)EVENT_METHOD(hrule, motion_notify_event), GTK_OBJECT(hrule) ); @@ -4789,7 +4792,7 @@ int main( int argc, vrule = gtk_vruler_new(); gtk_ruler_set_metric( GTK_RULER(vrule), GTK_PIXELS ); gtk_ruler_set_range( GTK_RULER(vrule), 0, YSIZE, 10, YSIZE ); - gtk_signal_connect_object( GTK_OBJECT(area), "motion_notify_event", + g_signal_connect_swapped( GTK_OBJECT(area), "motion_notify_event", (GtkSignalFunc)EVENT_METHOD(vrule, motion_notify_event), GTK_OBJECT(vrule) ); @@ -4804,7 +4807,7 @@ int main( int argc, gtk_widget_show( window ); gtk_main(); - return(0); + return 0; } @@ -4870,6 +4873,7 @@ back off. +#include <stdlib.h> #include <gtk/gtk.h> #include <glib.h> @@ -4908,10 +4912,10 @@ int main( int argc, /* create a new window */ window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_widget_set_usize( GTK_WIDGET (window), 200, 100); + gtk_widget_set_size_request (GTK_WIDGET (window), 200, 100); gtk_window_set_title(GTK_WINDOW (window), "GTK Statusbar Example"); - gtk_signal_connect(GTK_OBJECT (window), "delete_event", - (GtkSignalFunc) gtk_exit, NULL); + g_signal_connect(GTK_OBJECT (window), "delete_event", + GTK_SIGNAL_FUNC (exit), NULL); vbox = gtk_vbox_new(FALSE, 1); gtk_container_add(GTK_CONTAINER(window), vbox); @@ -4925,25 +4929,18 @@ int main( int argc, GTK_STATUSBAR(status_bar), "Statusbar example"); button = gtk_button_new_with_label("push item"); - gtk_signal_connect(GTK_OBJECT(button), "clicked", + g_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC (push_item), GINT_TO_POINTER(context_id) ); gtk_box_pack_start(GTK_BOX(vbox), button, TRUE, TRUE, 2); gtk_widget_show(button); button = gtk_button_new_with_label("pop last item"); - gtk_signal_connect(GTK_OBJECT(button), "clicked", + g_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC (pop_item), GINT_TO_POINTER(context_id) ); gtk_box_pack_start(GTK_BOX(vbox), button, TRUE, TRUE, 2); gtk_widget_show(button); /* always display the window as the last step so it all splashes on - * the screen at once. */ - gtk_widget_show(window); - - gtk_main (); - - return 0; -} @@ -5047,6 +5044,7 @@ removed. #include <stdio.h> +#include <stdlib.h> #include <gtk/gtk.h> void enter_callback( GtkWidget *widget, @@ -5060,8 +5058,8 @@ void enter_callback( GtkWidget *widget, void entry_toggle_editable( GtkWidget *checkbutton, GtkWidget *entry ) { - gtk_entry_set_editable(GTK_ENTRY(entry), - GTK_TOGGLE_BUTTON(checkbutton)->active); + gtk_editable_set_editable (GTK_EDITABLE (entry), + GTK_TOGGLE_BUTTON (checkbutton)->active); } void entry_toggle_visibility( GtkWidget *checkbutton, @@ -5080,28 +5078,31 @@ int main( int argc, GtkWidget *entry; GtkWidget *button; GtkWidget *check; + gint tmp_pos; gtk_init (&argc, &argv); /* create a new window */ window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_widget_set_usize( GTK_WIDGET (window), 200, 100); + gtk_widget_set_size_request (GTK_WIDGET (window), 200, 100); gtk_window_set_title(GTK_WINDOW (window), "GTK Entry"); - gtk_signal_connect(GTK_OBJECT (window), "delete_event", - (GtkSignalFunc) gtk_exit, NULL); + g_signal_connect(GTK_OBJECT (window), "delete_event", + (GtkSignalFunc) exit, NULL); vbox = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (window), vbox); gtk_widget_show (vbox); - entry = gtk_entry_new_with_max_length (50); - gtk_signal_connect(GTK_OBJECT(entry), "activate", + entry = gtk_entry_new (); + gtk_entry_set_max_length (GTK_ENTRY (entry), 50); + g_signal_connect(GTK_OBJECT(entry), "activate", GTK_SIGNAL_FUNC(enter_callback), entry); gtk_entry_set_text (GTK_ENTRY (entry), "hello"); - gtk_entry_append_text (GTK_ENTRY (entry), " world"); - gtk_entry_select_region (GTK_ENTRY (entry), - 0, GTK_ENTRY(entry)->text_length); + tmp_pos = GTK_ENTRY (entry)->text_length; + gtk_editable_insert_text (GTK_EDITABLE (entry), " world", -1, &tmp_pos); + gtk_editable_select_region (GTK_EDITABLE (entry), + 0, GTK_ENTRY(entry)->text_length); gtk_box_pack_start (GTK_BOX (vbox), entry, TRUE, TRUE, 0); gtk_widget_show (entry); @@ -5111,21 +5112,21 @@ int main( int argc, check = gtk_check_button_new_with_label("Editable"); gtk_box_pack_start (GTK_BOX (hbox), check, TRUE, TRUE, 0); - gtk_signal_connect (GTK_OBJECT(check), "toggled", + g_signal_connect (GTK_OBJECT(check), "toggled", GTK_SIGNAL_FUNC(entry_toggle_editable), entry); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), TRUE); gtk_widget_show (check); check = gtk_check_button_new_with_label("Visible"); gtk_box_pack_start (GTK_BOX (hbox), check, TRUE, TRUE, 0); - gtk_signal_connect (GTK_OBJECT(check), "toggled", + g_signal_connect (GTK_OBJECT(check), "toggled", GTK_SIGNAL_FUNC(entry_toggle_visibility), entry); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), TRUE); gtk_widget_show (check); button = gtk_button_new_with_label ("Close"); - gtk_signal_connect_object (GTK_OBJECT (button), "clicked", - GTK_SIGNAL_FUNC(gtk_exit), + g_signal_connect_swapped (GTK_OBJECT (button), "clicked", + GTK_SIGNAL_FUNC(exit), GTK_OBJECT (window)); gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0); GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); @@ -5135,7 +5136,7 @@ int main( int argc, gtk_widget_show(window); gtk_main(); - return(0); + return 0; } @@ -5416,12 +5417,12 @@ void get_value( GtkWidget *widget, GtkSpinButton *spin; spin = GTK_SPIN_BUTTON (spinner1); - label = GTK_LABEL (gtk_object_get_user_data (GTK_OBJECT (widget))); + label = GTK_LABEL (g_object_get_data (G_OBJECT (widget), "user_data")); if (GPOINTER_TO_INT (data) == 1) sprintf (buf, "%d", gtk_spin_button_get_value_as_int (spin)); else sprintf (buf, "%0.*f", spin->digits, - gtk_spin_button_get_value_as_float (spin)); + gtk_spin_button_get_value (spin)); gtk_label_set_text (label, buf); } @@ -5447,7 +5448,7 @@ int main( int argc, window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_signal_connect (GTK_OBJECT (window), "destroy", + g_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (gtk_main_quit), NULL); @@ -5506,7 +5507,7 @@ int main( int argc, 1.0, 100.0, 0.0); spinner = gtk_spin_button_new (adj, 0, 0); gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spinner), FALSE); - gtk_widget_set_usize (spinner, 55, 0); + gtk_widget_set_size_request (spinner, 55, -1); gtk_box_pack_start (GTK_BOX (vbox2), spinner, FALSE, TRUE, 0); frame = gtk_frame_new ("Accelerated"); @@ -5530,7 +5531,7 @@ int main( int argc, 0.5, 100.0, 0.0); spinner1 = gtk_spin_button_new (adj, 1.0, 2); gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spinner1), TRUE); - gtk_widget_set_usize (spinner1, 100, 0); + gtk_widget_set_size_request (spinner1, 100, -1); gtk_box_pack_start (GTK_BOX (vbox2), spinner1, FALSE, TRUE, 0); vbox2 = gtk_vbox_new (FALSE, 0); @@ -5543,7 +5544,7 @@ int main( int argc, adj = (GtkAdjustment *) gtk_adjustment_new (2, 1, 5, 1, 1, 0); spinner2 = gtk_spin_button_new (adj, 0.0, 0); gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spinner2), TRUE); - gtk_signal_connect (GTK_OBJECT (adj), "value_changed", + g_signal_connect (GTK_OBJECT (adj), "value_changed", GTK_SIGNAL_FUNC (change_digits), (gpointer) spinner2); gtk_box_pack_start (GTK_BOX (vbox2), spinner2, FALSE, TRUE, 0); @@ -5552,14 +5553,14 @@ int main( int argc, gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 5); button = gtk_check_button_new_with_label ("Snap to 0.5-ticks"); - gtk_signal_connect (GTK_OBJECT (button), "clicked", + g_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (toggle_snap), spinner1); gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); button = gtk_check_button_new_with_label ("Numeric only input mode"); - gtk_signal_connect (GTK_OBJECT (button), "clicked", + g_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (toggle_numeric), spinner1); gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0); @@ -5570,15 +5571,15 @@ int main( int argc, hbox = gtk_hbox_new (FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 5); button = gtk_button_new_with_label ("Value as Int"); - gtk_object_set_user_data (GTK_OBJECT (button), val_label); - gtk_signal_connect (GTK_OBJECT (button), "clicked", + g_object_set_data (G_OBJECT (button), "user_data", val_label); + g_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (get_value), GINT_TO_POINTER (1)); gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 5); button = gtk_button_new_with_label ("Value as Float"); - gtk_object_set_user_data (GTK_OBJECT (button), val_label); - gtk_signal_connect (GTK_OBJECT (button), "clicked", + g_object_set_data (G_OBJECT (button), "user_data", val_label); + g_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (get_value), GINT_TO_POINTER (2)); gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 5); @@ -5590,7 +5591,7 @@ int main( int argc, gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, TRUE, 0); button = gtk_button_new_with_label ("Close"); - gtk_signal_connect_object (GTK_OBJECT (button), "clicked", + g_signal_connect_swapped (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT (window)); gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 5); @@ -5600,7 +5601,7 @@ int main( int argc, /* Enter the event loop */ gtk_main (); - return(0); + return 0; } @@ -6013,14 +6014,14 @@ void calendar_date_to_string( CalendarData *data, void calendar_set_signal_strings( char *sig_str, CalendarData *data) { - gchar *prev_sig; + const gchar *prev_sig; - gtk_label_get (GTK_LABEL (data->prev_sig), &prev_sig); - gtk_label_set (GTK_LABEL (data->prev2_sig), prev_sig); + prev_sig = gtk_label_get_text (GTK_LABEL (data->prev_sig)); + gtk_label_set_text (GTK_LABEL (data->prev2_sig), prev_sig); - gtk_label_get (GTK_LABEL (data->last_sig), &prev_sig); - gtk_label_set (GTK_LABEL (data->prev_sig), prev_sig); - gtk_label_set (GTK_LABEL (data->last_sig), sig_str); + prev_sig = gtk_label_get_text (GTK_LABEL (data->last_sig)); + gtk_label_set_text (GTK_LABEL (data->prev_sig), prev_sig); + gtk_label_set_text (GTK_LABEL (data->last_sig), sig_str); } void calendar_month_changed( GtkWidget *widget, @@ -6131,17 +6132,17 @@ void calendar_font_selection_ok( GtkWidget *button, CalendarData *calendar ) { GtkStyle *style; - GdkFont *font; + PangoFontDescription *font_desc; calendar->font = gtk_font_selection_dialog_get_font_name( GTK_FONT_SELECTION_DIALOG (calendar->font_dialog)); if (calendar->window) { - font = gtk_font_selection_dialog_get_font(GTK_FONT_SELECTION_DIALOG(calendar->font_dialog)); - if (font) + font_desc = pango_font_description_from_string (calendar->font); + if (font_desc) { style = gtk_style_copy (gtk_widget_get_style (calendar->window)); - gtk_style_set_font (style, font); + style->font_desc = font_desc; gtk_widget_set_style (calendar->window, style); } } @@ -6157,19 +6158,19 @@ void calendar_select_font( GtkWidget *button, g_return_if_fail(GTK_IS_FONT_SELECTION_DIALOG(window)); calendar->font_dialog = window; - gtk_window_position (GTK_WINDOW (window), GTK_WIN_POS_MOUSE); + gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_MOUSE); - gtk_signal_connect (GTK_OBJECT (window), "destroy", - GTK_SIGNAL_FUNC (gtk_widget_destroyed), - &calendar->font_dialog); + g_signal_connect (GTK_OBJECT (window), "destroy", + GTK_SIGNAL_FUNC (gtk_widget_destroyed), + &calendar->font_dialog); - gtk_signal_connect (GTK_OBJECT (GTK_FONT_SELECTION_DIALOG (window)->ok_button), - "clicked", GTK_SIGNAL_FUNC(calendar_font_selection_ok), - calendar); - gtk_signal_connect_object (GTK_OBJECT (GTK_FONT_SELECTION_DIALOG (window)->cancel_button), - "clicked", - GTK_SIGNAL_FUNC (gtk_widget_destroy), - GTK_OBJECT (calendar->font_dialog)); + g_signal_connect (GTK_OBJECT (GTK_FONT_SELECTION_DIALOG (window)->ok_button), + "clicked", GTK_SIGNAL_FUNC(calendar_font_selection_ok), + calendar); + g_signal_connect_swapped (GTK_OBJECT (GTK_FONT_SELECTION_DIALOG (window)->cancel_button), + "clicked", + GTK_SIGNAL_FUNC (gtk_widget_destroy), + GTK_OBJECT (calendar->font_dialog)); } window=calendar->font_dialog; if (!GTK_WIDGET_VISIBLE (window)) @@ -6217,15 +6218,15 @@ void create_calendar() window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(window), "GtkCalendar Example"); - gtk_container_border_width (GTK_CONTAINER (window), 5); - gtk_signal_connect(GTK_OBJECT(window), "destroy", - GTK_SIGNAL_FUNC(gtk_main_quit), - NULL); - gtk_signal_connect(GTK_OBJECT(window), "delete-event", - GTK_SIGNAL_FUNC(gtk_false), - NULL); + gtk_container_set_border_width (GTK_CONTAINER (window), 5); + g_signal_connect(GTK_OBJECT(window), "destroy", + GTK_SIGNAL_FUNC(gtk_main_quit), + NULL); + g_signal_connect(GTK_OBJECT(window), "delete-event", + GTK_SIGNAL_FUNC(gtk_false), + NULL); - gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, TRUE); + gtk_window_set_resizable (GTK_WINDOW (window), FALSE); vbox = gtk_vbox_new(FALSE, DEF_PAD); gtk_container_add (GTK_CONTAINER (window), vbox); @@ -6239,7 +6240,7 @@ void create_calendar() hbbox = gtk_hbutton_box_new(); gtk_box_pack_start(GTK_BOX(hbox), hbbox, FALSE, FALSE, DEF_PAD); gtk_button_box_set_layout(GTK_BUTTON_BOX(hbbox), GTK_BUTTONBOX_SPREAD); - gtk_button_box_set_spacing(GTK_BUTTON_BOX(hbbox), 5); + gtk_box_set_spacing (GTK_BOX (hbbox), 5); /* Calendar widget */ frame = gtk_frame_new("Calendar"); @@ -6249,27 +6250,27 @@ void create_calendar() calendar_set_flags(&calendar_data); gtk_calendar_mark_day ( GTK_CALENDAR(calendar), 19); gtk_container_add( GTK_CONTAINER( frame), calendar); - gtk_signal_connect (GTK_OBJECT (calendar), "month_changed", - GTK_SIGNAL_FUNC (calendar_month_changed), - &calendar_data); - gtk_signal_connect (GTK_OBJECT (calendar), "day_selected", - GTK_SIGNAL_FUNC (calendar_day_selected), - &calendar_data); - gtk_signal_connect (GTK_OBJECT (calendar), "day_selected_double_click", - GTK_SIGNAL_FUNC (calendar_day_selected_double_click), - &calendar_data); - gtk_signal_connect (GTK_OBJECT (calendar), "prev_month", - GTK_SIGNAL_FUNC (calendar_prev_month), - &calendar_data); - gtk_signal_connect (GTK_OBJECT (calendar), "next_month", - GTK_SIGNAL_FUNC (calendar_next_month), - &calendar_data); - gtk_signal_connect (GTK_OBJECT (calendar), "prev_year", - GTK_SIGNAL_FUNC (calendar_prev_year), - &calendar_data); - gtk_signal_connect (GTK_OBJECT (calendar), "next_year", - GTK_SIGNAL_FUNC (calendar_next_year), - &calendar_data); + g_signal_connect (GTK_OBJECT (calendar), "month_changed", + GTK_SIGNAL_FUNC (calendar_month_changed), + &calendar_data); + g_signal_connect (GTK_OBJECT (calendar), "day_selected", + GTK_SIGNAL_FUNC (calendar_day_selected), + &calendar_data); + g_signal_connect (GTK_OBJECT (calendar), "day_selected_double_click", + GTK_SIGNAL_FUNC (calendar_day_selected_double_click), + &calendar_data); + g_signal_connect (GTK_OBJECT (calendar), "prev_month", + GTK_SIGNAL_FUNC (calendar_prev_month), + &calendar_data); + g_signal_connect (GTK_OBJECT (calendar), "next_month", + GTK_SIGNAL_FUNC (calendar_next_month), + &calendar_data); + g_signal_connect (GTK_OBJECT (calendar), "prev_year", + GTK_SIGNAL_FUNC (calendar_prev_year), + &calendar_data); + g_signal_connect (GTK_OBJECT (calendar), "next_year", + GTK_SIGNAL_FUNC (calendar_next_year), + &calendar_data); separator = gtk_vseparator_new (); @@ -6288,7 +6289,7 @@ void create_calendar() for (i = 0; i < 5; i++) { toggle = gtk_check_button_new_with_label(flags[i].label); - gtk_signal_connect (GTK_OBJECT (toggle), + g_signal_connect (GTK_OBJECT (toggle), "toggled", GTK_SIGNAL_FUNC(calendar_toggle_flag), &calendar_data); @@ -6297,7 +6298,7 @@ void create_calendar() } /* Build the right font-button */ button = gtk_button_new_with_label("Font..."); - gtk_signal_connect (GTK_OBJECT (button), + g_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC(calendar_select_font), &calendar_data); @@ -6339,7 +6340,7 @@ void create_calendar() gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); button = gtk_button_new_with_label ("Close"); - gtk_signal_connect (GTK_OBJECT (button), "clicked", + g_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (gtk_main_quit), NULL); gtk_container_add (GTK_CONTAINER (bbox), button); @@ -6353,14 +6354,13 @@ void create_calendar() int main(int argc, char *argv[] ) { - gtk_set_locale (); gtk_init (&argc, &argv); create_calendar(); gtk_main(); - return(0); + return 0; } @@ -6596,11 +6596,11 @@ gint main( gint argc, drawingarea = gtk_drawing_area_new (); - gtk_drawing_area_size (GTK_DRAWING_AREA(drawingarea), 200, 200); + gtk_widget_set_size_request (GTK_WIDGET (drawingarea), 200, 200); gtk_widget_set_events (drawingarea, GDK_BUTTON_PRESS_MASK); - gtk_signal_connect (GTK_OBJECT(drawingarea), "event", + g_signal_connect (GTK_OBJECT (drawingarea), "event", (GtkSignalFunc)area_event, (gpointer)drawingarea); /* Add drawingarea to window, then show them both */ @@ -6702,16 +6702,16 @@ int main( int argc, /* Create a new file selection widget */ filew = gtk_file_selection_new ("File selection"); - gtk_signal_connect (GTK_OBJECT (filew), "destroy", - (GtkSignalFunc) destroy, &filew); + g_signal_connect (GTK_OBJECT (filew), "destroy", + GTK_SIGNAL_FUNC (destroy), &filew); /* Connect the ok_button to file_ok_sel function */ - gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (filew)->ok_button), - "clicked", (GtkSignalFunc) file_ok_sel, filew ); + g_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (filew)->ok_button), + "clicked", GTK_SIGNAL_FUNC (file_ok_sel), filew ); /* Connect the cancel_button to destroy the widget */ - gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION + g_signal_connect_swapped (GTK_OBJECT (GTK_FILE_SELECTION (filew)->cancel_button), - "clicked", (GtkSignalFunc) gtk_widget_destroy, + "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT (filew)); /* Lets set the filename, as if this were a save dialog, and we are giving @@ -6774,6 +6774,7 @@ window reveals varying amounts of the label. +#include <stdlib.h> #include <gtk/gtk.h> int main( int argc, @@ -6789,8 +6790,8 @@ int main( int argc, gtk_window_set_title (GTK_WINDOW (window), "Event Box"); - gtk_signal_connect (GTK_OBJECT (window), "destroy", - GTK_SIGNAL_FUNC (gtk_exit), NULL); + g_signal_connect (GTK_OBJECT (window), "destroy", + GTK_SIGNAL_FUNC (exit), NULL); gtk_container_set_border_width (GTK_CONTAINER (window), 10); @@ -6807,12 +6808,12 @@ int main( int argc, gtk_widget_show (label); /* Clip it short. */ - gtk_widget_set_usize (label, 110, 20); + gtk_widget_set_size_request (label, 110, 20); /* And bind an action to it */ gtk_widget_set_events (event_box, GDK_BUTTON_PRESS_MASK); - gtk_signal_connect (GTK_OBJECT(event_box), "button_press_event", - GTK_SIGNAL_FUNC (gtk_exit), NULL); + g_signal_connect (GTK_OBJECT(event_box), "button_press_event", + GTK_SIGNAL_FUNC (exit), NULL); /* Yet one more thing you need an X window for ... */ @@ -6823,7 +6824,7 @@ int main( int argc, gtk_main (); - return(0); + return 0; } @@ -6948,7 +6949,7 @@ int main( int argc, gtk_window_set_title(GTK_WINDOW(window), "Fixed Container"); /* Here we connect the "destroy" event to a signal handler */ - gtk_signal_connect (GTK_OBJECT (window), "destroy", + g_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (gtk_main_quit), NULL); /* Sets the border width of the window. */ @@ -6966,7 +6967,7 @@ int main( int argc, /* When the button receives the "clicked" signal, it will call the * function move_button() passing it the Fixed Container as its * argument. */ - gtk_signal_connect (GTK_OBJECT (button), "clicked", + g_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (move_button), fixed); /* This packs the button into the fixed containers window. */ @@ -6982,7 +6983,7 @@ int main( int argc, /* Enter the event loop */ gtk_main (); - return(0); + return 0; } @@ -7134,8 +7135,6 @@ int main( int argc, /* GtkWidget is the storage type for widgets */ GtkWidget *window; GtkWidget *frame; - GtkWidget *button; - gint i; /* Initialise GTK */ gtk_init(&argc, &argv); @@ -7145,10 +7144,10 @@ int main( int argc, gtk_window_set_title(GTK_WINDOW(window), "Frame Example"); /* Here we connect the "destroy" event to a signal handler */ - gtk_signal_connect (GTK_OBJECT (window), "destroy", + g_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (gtk_main_quit), NULL); - gtk_widget_set_usize(window, 300, 300); + gtk_widget_set_size_request (window, 300, 300); /* Sets the border width of the window. */ gtk_container_set_border_width (GTK_CONTAINER (window), 10); @@ -7173,7 +7172,7 @@ int main( int argc, /* Enter the event loop */ gtk_main (); - return(0); + return 0; } @@ -7236,8 +7235,8 @@ int main( int argc, window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (window), "Aspect Frame"); - gtk_signal_connect (GTK_OBJECT (window), "destroy", - GTK_SIGNAL_FUNC (gtk_main_quit), NULL); + g_signal_connect (GTK_OBJECT (window), "destroy", + GTK_SIGNAL_FUNC (gtk_main_quit), NULL); gtk_container_set_border_width (GTK_CONTAINER (window), 10); /* Create an aspect_frame and add it to our toplevel window */ @@ -7257,7 +7256,7 @@ int main( int argc, /* Ask for a 200x200 window, but the AspectFrame will give us a 200x100 * window since we are forcing a 2x1 aspect ratio */ - gtk_widget_set_usize (drawing_area, 200, 200); + gtk_widget_set_size_request (drawing_area, 200, 200); gtk_container_add (GTK_CONTAINER(aspect_frame), drawing_area); gtk_widget_show (drawing_area); @@ -7318,7 +7317,6 @@ window. -#define GTK_ENABLE_BROKEN #include <stdio.h> #include <gtk/gtk.h> @@ -7433,7 +7431,7 @@ int main( int argc, gtk_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (gtk_main_quit), NULL); gtk_container_set_border_width (GTK_CONTAINER (window), 10); - gtk_widget_set_usize (GTK_WIDGET(window), 450, 400); + gtk_widget_set_size_request (GTK_WIDGET (window), 450, 400); /* create a vpaned widget and add it to our toplevel window */ @@ -7592,11 +7590,11 @@ int main( int argc, /* Create a new dialog window for the scrolled window to be * packed into. */ window = gtk_dialog_new (); - gtk_signal_connect (GTK_OBJECT (window), "destroy", + g_signal_connect (GTK_OBJECT (window), "destroy", (GtkSignalFunc) destroy, NULL); gtk_window_set_title (GTK_WINDOW (window), "GtkScrolledWindow example"); gtk_container_set_border_width (GTK_CONTAINER (window), 0); - gtk_widget_set_usize(window, 300, 300); + gtk_widget_set_size_request (window, 300, 300); /* create a new scrolled window. */ scrolled_window = gtk_scrolled_window_new (NULL, NULL); @@ -7640,7 +7638,7 @@ int main( int argc, /* Add a "close" button to the bottom of the dialog */ button = gtk_button_new_with_label ("close"); - gtk_signal_connect_object (GTK_OBJECT (button), "clicked", + g_signal_connect_swapped (GTK_OBJECT (button), "clicked", (GtkSignalFunc) gtk_widget_destroy, GTK_OBJECT (window)); @@ -7658,13 +7656,13 @@ int main( int argc, gtk_main(); - return(0); + return 0; } Try playing with resizing the window. You'll notice how the scrollbars -react. You may also wish to use the gtk_widget_set_usize() call to set +react. You may also wish to use the gtk_widget_set_size_request() call to set the default size of the window or other widgets. @@ -7766,8 +7764,8 @@ GtkWidget *create_bbox( gint horizontal, /* Set the appearance of the Button Box */ gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), layout); - gtk_button_box_set_spacing (GTK_BUTTON_BOX (bbox), spacing); - gtk_button_box_set_child_size (GTK_BUTTON_BOX (bbox), child_w, child_h); + gtk_box_set_spacing (GTK_BOX (bbox), spacing); + /*gtk_button_box_set_child_size (GTK_BUTTON_BOX (bbox), child_w, child_h);*/ button = gtk_button_new_with_label ("OK"); gtk_container_add (GTK_CONTAINER (bbox), button); @@ -7797,9 +7795,9 @@ int main( int argc, window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (window), "Button Boxes"); - gtk_signal_connect (GTK_OBJECT (window), "destroy", - GTK_SIGNAL_FUNC(gtk_main_quit), - NULL); + g_signal_connect (GTK_OBJECT (window), "destroy", + GTK_SIGNAL_FUNC(gtk_main_quit), + NULL); gtk_container_set_border_width (GTK_CONTAINER (window), 10); @@ -8067,12 +8065,12 @@ int main (int argc, char *argv[]) /* create a new window with a given title, and nice size */ dialog = gtk_dialog_new (); gtk_window_set_title ( GTK_WINDOW ( dialog ) , "GTKToolbar Tutorial"); - gtk_widget_set_usize( GTK_WIDGET ( dialog ) , 600 , 300 ); + gtk_widget_set_size_request (GTK_WIDGET (dialog), 600, 300); GTK_WINDOW ( dialog ) ->allow_shrink = TRUE; /* typically we quit if someone tries to close us */ - gtk_signal_connect ( GTK_OBJECT ( dialog ), "delete_event", - GTK_SIGNAL_FUNC ( delete_event ), NULL); + g_signal_connect ( GTK_OBJECT ( dialog ), "delete_event", + GTK_SIGNAL_FUNC ( delete_event ), NULL); /* we need to realize the window because we use pixmaps for * items on the toolbar in the context of it */ @@ -8491,15 +8489,15 @@ void remove_book( GtkButton *button, gtk_notebook_remove_page (notebook, page); /* Need to refresh the widget -- This forces the widget to redraw itself. */ - gtk_widget_draw(GTK_WIDGET(notebook), NULL); + gtk_widget_queue_draw (GTK_WIDGET (notebook)); } gint delete( GtkWidget *widget, GtkWidget *event, gpointer data ) { - gtk_main_quit(); - return(FALSE); + gtk_main_quit (); + return FALSE; } int main( int argc, @@ -8520,7 +8518,7 @@ int main( int argc, window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_signal_connect (GTK_OBJECT (window), "delete_event", + g_signal_connect (GTK_OBJECT (window), "delete_event", GTK_SIGNAL_FUNC (delete), NULL); gtk_container_set_border_width (GTK_CONTAINER (window), 10); @@ -8541,7 +8539,7 @@ int main( int argc, frame = gtk_frame_new (bufferf); gtk_container_set_border_width (GTK_CONTAINER (frame), 10); - gtk_widget_set_usize (frame, 100, 75); + gtk_widget_set_size_request (frame, 100, 75); gtk_widget_show (frame); label = gtk_label_new (bufferf); @@ -8554,7 +8552,7 @@ int main( int argc, /* Now let's add a page to a specific spot */ checkbutton = gtk_check_button_new_with_label ("Check me please!"); - gtk_widget_set_usize(checkbutton, 100, 75); + gtk_widget_set_size_request (checkbutton, 100, 75); gtk_widget_show (checkbutton); label = gtk_label_new ("Add page"); @@ -8567,7 +8565,7 @@ int main( int argc, frame = gtk_frame_new (bufferf); gtk_container_set_border_width (GTK_CONTAINER (frame), 10); - gtk_widget_set_usize (frame, 100, 75); + gtk_widget_set_size_request (frame, 100, 75); gtk_widget_show (frame); label = gtk_label_new (bufferf); @@ -8579,46 +8577,46 @@ int main( int argc, } /* Set what page to start at (page 4) */ - gtk_notebook_set_page (GTK_NOTEBOOK(notebook), 3); + gtk_notebook_set_current_page (GTK_NOTEBOOK(notebook), 3); /* Create a bunch of buttons */ button = gtk_button_new_with_label ("close"); - gtk_signal_connect_object (GTK_OBJECT (button), "clicked", + g_signal_connect_swapped (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (delete), NULL); gtk_table_attach_defaults(GTK_TABLE(table), button, 0,1,1,2); gtk_widget_show(button); button = gtk_button_new_with_label ("next page"); - gtk_signal_connect_object (GTK_OBJECT (button), "clicked", - (GtkSignalFunc) gtk_notebook_next_page, + g_signal_connect_swapped (GTK_OBJECT (button), "clicked", + GTK_SIGNAL_FUNC (gtk_notebook_next_page), GTK_OBJECT (notebook)); gtk_table_attach_defaults(GTK_TABLE(table), button, 1,2,1,2); gtk_widget_show(button); button = gtk_button_new_with_label ("prev page"); - gtk_signal_connect_object (GTK_OBJECT (button), "clicked", - (GtkSignalFunc) gtk_notebook_prev_page, + g_signal_connect_swapped (GTK_OBJECT (button), "clicked", + GTK_SIGNAL_FUNC (gtk_notebook_prev_page), GTK_OBJECT (notebook)); gtk_table_attach_defaults(GTK_TABLE(table), button, 2,3,1,2); gtk_widget_show(button); button = gtk_button_new_with_label ("tab position"); - gtk_signal_connect (GTK_OBJECT (button), "clicked", - (GtkSignalFunc) rotate_book, + g_signal_connect (GTK_OBJECT (button), "clicked", + GTK_SIGNAL_FUNC (rotate_book), GTK_OBJECT(notebook)); gtk_table_attach_defaults(GTK_TABLE(table), button, 3,4,1,2); gtk_widget_show(button); button = gtk_button_new_with_label ("tabs/border on/off"); - gtk_signal_connect (GTK_OBJECT (button), "clicked", - (GtkSignalFunc) tabsborder_book, + g_signal_connect (GTK_OBJECT (button), "clicked", + GTK_SIGNAL_FUNC (tabsborder_book), GTK_OBJECT (notebook)); gtk_table_attach_defaults(GTK_TABLE(table), button, 4,5,1,2); gtk_widget_show(button); button = gtk_button_new_with_label ("remove page"); - gtk_signal_connect (GTK_OBJECT (button), "clicked", - (GtkSignalFunc) remove_book, + g_signal_connect (GTK_OBJECT (button), "clicked", + GTK_SIGNAL_FUNC (remove_book), GTK_OBJECT(notebook)); gtk_table_attach_defaults(GTK_TABLE(table), button, 5,6,1,2); gtk_widget_show(button); @@ -8628,7 +8626,7 @@ int main( int argc, gtk_main (); - return(0); + return 0; } @@ -9306,7 +9304,7 @@ int main( int argc, gtk_init(&argc, &argv); window=gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_widget_set_usize(GTK_WIDGET(window), 300, 150); + gtk_widget_set_size_request (GTK_WIDGET (window), 300, 150); gtk_window_set_title(GTK_WINDOW(window), "GtkCList Example"); gtk_signal_connect(GTK_OBJECT(window), @@ -9677,7 +9675,7 @@ GtkWidget *gtk_tree_new( void ); Like the CList widget, a Tree will simply keep growing as more items are added to it, as well as when subtrees are expanded. For this reason, they are almost always packed into a -ScrolledWindow. You might want to use gtk_widget_set_usize() on the +ScrolledWindow. You might want to use gtk_widget_set_size_request() on the scrolled window to ensure that it is big enough to see the tree's items, as the default size for ScrolledWindow is quite small. @@ -10382,7 +10380,7 @@ int main( int argc, gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_widget_set_usize (scrolled_win, 150, 200); + gtk_widget_set_size_request (scrolled_win, 150, 200); gtk_container_add (GTK_CONTAINER(window), scrolled_win); gtk_widget_show (scrolled_win); @@ -10758,9 +10756,9 @@ int main( int argc, /* create a new window */ window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_widget_set_usize (GTK_WIDGET (window), 200, 100); + gtk_widget_set_size_request (GTK_WIDGET (window), 200, 100); gtk_window_set_title (GTK_WINDOW (window), "GTK Menu Test"); - gtk_signal_connect (GTK_OBJECT (window), "delete_event", + g_signal_connect (GTK_OBJECT (window), "delete_event", (GtkSignalFunc) gtk_main_quit, NULL); /* Init the menu-widget, and remember -- never @@ -10784,10 +10782,10 @@ int main( int argc, menu_items = gtk_menu_item_new_with_label (buf); /* ...and add it to the menu. */ - gtk_menu_append (GTK_MENU (menu), menu_items); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items); /* Do something interesting when the menuitem is selected */ - gtk_signal_connect_object (GTK_OBJECT (menu_items), "activate", + g_signal_connect_swapped (GTK_OBJECT (menu_items), "activate", GTK_SIGNAL_FUNC (menuitem_response), (gpointer) g_strdup (buf)); /* Show the widget */ @@ -10817,14 +10815,14 @@ int main( int argc, /* Create a button to which to attach menu as a popup */ button = gtk_button_new_with_label ("press me"); - gtk_signal_connect_object (GTK_OBJECT (button), "event", + g_signal_connect_swapped (GTK_OBJECT (button), "event", GTK_SIGNAL_FUNC (button_press), GTK_OBJECT (menu)); gtk_box_pack_end (GTK_BOX (vbox), button, TRUE, TRUE, 2); gtk_widget_show (button); /* And finally we append the menu-item to the menu-bar -- this is the * "root" menu-item I have been raving about =) */ - gtk_menu_bar_append (GTK_MENU_BAR (menu_bar), root_menu); + gtk_menu_shell_append (GTK_MENU_SHELL (menu_bar), root_menu); /* always display the window as the last step so it all splashes on * the screen at once. */ @@ -10832,7 +10830,7 @@ int main( int argc, gtk_main (); - return(0); + return 0; } /* Respond to a button-press by posting a menu passed in as widget. @@ -10982,14 +10980,14 @@ int main( int argc, gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_signal_connect (GTK_OBJECT (window), "destroy", + g_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (gtk_main_quit), "WM destroy"); gtk_window_set_title (GTK_WINDOW(window), "Item Factory"); - gtk_widget_set_usize (GTK_WIDGET(window), 300, 200); + gtk_widget_set_size_request (GTK_WIDGET (window), 300, 200); main_vbox = gtk_vbox_new (FALSE, 1); - gtk_container_border_width (GTK_CONTAINER (main_vbox), 1); + gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 1); gtk_container_add (GTK_CONTAINER (window), main_vbox); gtk_widget_show (main_vbox); @@ -11000,7 +10998,7 @@ int main( int argc, gtk_widget_show (window); gtk_main (); - return(0); + return 0; } @@ -11334,7 +11332,7 @@ int main( int argc, gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_widget_set_usize (window, 600, 500); + gtk_widget_set_size_request (window, 600, 500); gtk_window_set_policy (GTK_WINDOW(window), TRUE, TRUE, FALSE); gtk_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC(close_application), @@ -12036,9 +12034,9 @@ void gtk_widget_set_uposition( GtkWidget *widget, gint x, gint y ); -void gtk_widget_set_usize( GtkWidget *widget, - gint width, - gint height ); +void gtk_widget_set_size_request ( GtkWidget *widget, + gint width, + gint height ); void gtk_widget_grab_focus( GtkWidget *widget ); @@ -12464,6 +12462,7 @@ converted. +#include <stdlib.h> #include <gtk/gtk.h> void selection_received( GtkWidget *widget, @@ -12538,17 +12537,17 @@ int main( int argc, gtk_window_set_title (GTK_WINDOW (window), "Event Box"); gtk_container_set_border_width (GTK_CONTAINER (window), 10); - gtk_signal_connect (GTK_OBJECT (window), "destroy", - GTK_SIGNAL_FUNC (gtk_exit), NULL); + g_signal_connect (GTK_OBJECT (window), "destroy", + GTK_SIGNAL_FUNC (exit), NULL); /* Create a button the user can click to get targets */ button = gtk_button_new_with_label ("Get Targets"); gtk_container_add (GTK_CONTAINER (window), button); - gtk_signal_connect (GTK_OBJECT(button), "clicked", + g_signal_connect (GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC (get_targets), NULL); - gtk_signal_connect (GTK_OBJECT(button), "selection_received", + g_signal_connect (GTK_OBJECT(button), "selection_received", GTK_SIGNAL_FUNC (selection_received), NULL); gtk_widget_show (button); @@ -12633,6 +12632,7 @@ string representation of the time is returned. +#include <stdlib.h> #include <gtk/gtk.h> #include <time.h> @@ -12710,8 +12710,8 @@ int main( int argc, gtk_window_set_title (GTK_WINDOW (window), "Event Box"); gtk_container_set_border_width (GTK_CONTAINER (window), 10); - gtk_signal_connect (GTK_OBJECT (window), "destroy", - GTK_SIGNAL_FUNC (gtk_exit), NULL); + g_signal_connect (GTK_OBJECT (window), "destroy", + GTK_SIGNAL_FUNC (exit), NULL); /* Create a toggle button to act as the selection */ @@ -12719,16 +12719,16 @@ int main( int argc, gtk_container_add (GTK_CONTAINER (window), selection_button); gtk_widget_show (selection_button); - gtk_signal_connect (GTK_OBJECT(selection_button), "toggled", + g_signal_connect (GTK_OBJECT(selection_button), "toggled", GTK_SIGNAL_FUNC (selection_toggled), &have_selection); - gtk_signal_connect (GTK_OBJECT(selection_button), "selection_clear_event", + g_signal_connect (GTK_OBJECT(selection_button), "selection_clear_event", GTK_SIGNAL_FUNC (selection_clear), &have_selection); gtk_selection_add_target (selection_button, GDK_SELECTION_PRIMARY, GDK_SELECTION_TYPE_STRING, 1); - gtk_signal_connect (GTK_OBJECT(selection_button), "selection_get", + g_signal_connect (GTK_OBJECT(selection_button), "selection_get", GTK_SIGNAL_FUNC (selection_handle), &have_selection); gtk_widget_show (selection_button); @@ -13940,7 +13940,7 @@ if an object is a Tictactoe widget respectively. Here is the complete header file: -/* tictactoe.h */ + #ifndef __TICTACTOE_H__ #define __TICTACTOE_H__ @@ -13974,7 +13974,7 @@ struct _TictactoeClass void (* tictactoe) (Tictactoe *ttt); }; -GtkType tictactoe_get_type (void); +GType tictactoe_get_type (void); GtkWidget* tictactoe_new (void); void tictactoe_clear (Tictactoe *ttt); @@ -13983,6 +13983,7 @@ void tictactoe_clear (Tictactoe *ttt); #endif /* __cplusplus */ #endif /* __TICTACTOE_H__ */ + @@ -14217,7 +14218,7 @@ tictactoe_init (Tictactoe *ttt) i, i+1, j, j+1); gtk_signal_connect (GTK_OBJECT (ttt->buttons[i][j]), "toggled", GTK_SIGNAL_FUNC (tictactoe_toggle), ttt); - gtk_widget_set_usize (ttt->buttons[i][j], 20, 20); + gtk_widget_set_size_request (ttt->buttons[i][j], 20, 20); gtk_widget_show (ttt->buttons[i][j]); } } @@ -15527,7 +15528,7 @@ void gtk_drawing_area_size (GtkDrawingArea *darea, This default size can be overridden, as is true for all widgets, -by calling gtk_widget_set_usize(), and that, in turn, can +by calling gtk_widget_set_size_request(), and that, in turn, can be overridden if the user manually resizes the the window containing the drawing area. @@ -17595,26 +17596,27 @@ static void tictactoe_toggle (GtkWidget *widget, Tictactoe *ttt); static gint tictactoe_signals[LAST_SIGNAL] = { 0 }; -GtkType +GType tictactoe_get_type () { - static GtkType ttt_type = 0; + static GType ttt_type = 0; if (!ttt_type) { - GtkTypeInfo ttt_info = + static const GTypeInfo ttt_info = { - "Tictactoe", - sizeof (Tictactoe), sizeof (TictactoeClass), - (GtkClassInitFunc) tictactoe_class_init, - (GtkObjectInitFunc) tictactoe_init, - /* reserved_1 */ NULL, - /* reserved_1 */ NULL, - (GtkClassInitFunc) NULL + NULL, + NULL, + (GClassInitFunc) tictactoe_class_init, + NULL, + NULL, + sizeof (Tictactoe), + 0, + (GInstanceInitFunc) tictactoe_init, }; - ttt_type = gtk_type_unique (gtk_vbox_get_type (), &ttt_info); + ttt_type = g_type_register_static (GTK_TYPE_VBOX, "Tictactoe", &ttt_info, 0); } return ttt_type; @@ -17627,13 +17629,14 @@ tictactoe_class_init (TictactoeClass *class) object_class = (GtkObjectClass*) class; - tictactoe_signals[TICTACTOE_SIGNAL] = gtk_signal_new ("tictactoe", - GTK_RUN_FIRST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (TictactoeClass, - tictactoe), - gtk_signal_default_marshaller, - GTK_TYPE_NONE, 0); + tictactoe_signals[TICTACTOE_SIGNAL] = g_signal_new ("tictactoe", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_FIRST, + 0, + NULL, + NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0, NULL); class->tictactoe = NULL; @@ -17655,9 +17658,9 @@ tictactoe_init (Tictactoe *ttt) ttt->buttons[i][j] = gtk_toggle_button_new (); gtk_table_attach_defaults (GTK_TABLE(table), ttt->buttons[i][j], i, i+1, j, j+1); - gtk_signal_connect (GTK_OBJECT (ttt->buttons[i][j]), "toggled", + g_signal_connect (GTK_OBJECT (ttt->buttons[i][j]), "toggled", GTK_SIGNAL_FUNC (tictactoe_toggle), ttt); - gtk_widget_set_usize (ttt->buttons[i][j], 20, 20); + gtk_widget_set_size_request (ttt->buttons[i][j], 20, 20); gtk_widget_show (ttt->buttons[i][j]); } } @@ -17665,7 +17668,7 @@ tictactoe_init (Tictactoe *ttt) GtkWidget* tictactoe_new () { - return GTK_WIDGET ( gtk_type_new (tictactoe_get_type ())); + return GTK_WIDGET (g_object_new (tictactoe_get_type (), NULL)); } void @@ -17676,10 +17679,10 @@ tictactoe_clear (Tictactoe *ttt) for (i=0;i<3;i++) for (j=0;j<3;j++) { - gtk_signal_handler_block_by_data (GTK_OBJECT(ttt->buttons[i][j]), ttt); + g_signal_handlers_block_by_func (GTK_OBJECT(ttt->buttons[i][j]), NULL, ttt); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ttt->buttons[i][j]), FALSE); - gtk_signal_handler_unblock_by_data (GTK_OBJECT(ttt->buttons[i][j]), ttt); + g_signal_handlers_unblock_by_func (GTK_OBJECT(ttt->buttons[i][j]), NULL, ttt); } } @@ -17712,8 +17715,8 @@ tictactoe_toggle (GtkWidget *widget, Tictactoe *ttt) if (success && found) { - gtk_signal_emit (GTK_OBJECT (ttt), - tictactoe_signals[TICTACTOE_SIGNAL]); + g_signal_emit (GTK_OBJECT (ttt), + tictactoe_signals[TICTACTOE_SIGNAL], 0); break; } } @@ -17731,6 +17734,7 @@ tictactoe_toggle (GtkWidget *widget, Tictactoe *ttt) +#include <stdlib.h> #include <gtk/gtk.h> #include "tictactoe.h" @@ -17753,8 +17757,8 @@ int main( int argc, gtk_window_set_title (GTK_WINDOW (window), "Aspect Frame"); - gtk_signal_connect (GTK_OBJECT (window), "destroy", - GTK_SIGNAL_FUNC (gtk_exit), NULL); + g_signal_connect (GTK_OBJECT (window), "destroy", + GTK_SIGNAL_FUNC (exit), NULL); gtk_container_set_border_width (GTK_CONTAINER (window), 10); @@ -17763,7 +17767,7 @@ int main( int argc, gtk_container_add (GTK_CONTAINER (window), ttt); gtk_widget_show (ttt); - gtk_signal_connect (GTK_OBJECT (ttt), "tictactoe", + g_signal_connect (GTK_OBJECT (ttt), "tictactoe", GTK_SIGNAL_FUNC (win), NULL); gtk_widget_show (window); @@ -17951,26 +17955,27 @@ static void gtk_dial_adjustment_value_changed (GtkAdjustment *adjustment, static GtkWidgetClass *parent_class = NULL; -GtkType +GType gtk_dial_get_type () { - static GtkType dial_type = 0; + static GType dial_type = 0; if (!dial_type) { - GtkTypeInfo dial_info = + static const GTypeInfo dial_info = { - "GtkDial", - sizeof (GtkDial), sizeof (GtkDialClass), - (GtkClassInitFunc) gtk_dial_class_init, - (GtkObjectInitFunc) gtk_dial_init, - /* reserved_1 */ NULL, - /* reserved_1 */ NULL, - (GtkClassInitFunc) NULL + NULL, + NULL, + (GClassInitFunc) gtk_dial_class_init, + NULL, + NULL, + sizeof (GtkDial), + 0, + (GInstanceInitFunc) gtk_dial_init, }; - dial_type = gtk_type_unique (GTK_TYPE_WIDGET, &dial_info); + dial_type = g_type_register_static (GTK_TYPE_WIDGET, "GtkDial", &dial_info, 0); } return dial_type; @@ -18018,7 +18023,7 @@ gtk_dial_new (GtkAdjustment *adjustment) { GtkDial *dial; - dial = gtk_type_new (gtk_dial_get_type ()); + dial = g_object_new (gtk_dial_get_type (), NULL); if (!adjustment) adjustment = (GtkAdjustment*) gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0); @@ -18039,7 +18044,7 @@ gtk_dial_destroy (GtkObject *object) dial = GTK_DIAL (object); if (dial->adjustment) - gtk_object_unref (GTK_OBJECT (dial->adjustment)); + g_object_unref (GTK_OBJECT (dial->adjustment)); if (GTK_OBJECT_CLASS (parent_class)->destroy) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); @@ -18073,18 +18078,18 @@ gtk_dial_set_adjustment (GtkDial *dial, if (dial->adjustment) { - gtk_signal_disconnect_by_data (GTK_OBJECT (dial->adjustment), (gpointer) dial); - gtk_object_unref (GTK_OBJECT (dial->adjustment)); + g_signal_handlers_disconnect_by_func (GTK_OBJECT (dial->adjustment), NULL, (gpointer) dial); + g_object_unref (GTK_OBJECT (dial->adjustment)); } dial->adjustment = adjustment; - gtk_object_ref (GTK_OBJECT (dial->adjustment)); + g_object_ref (GTK_OBJECT (dial->adjustment)); - gtk_signal_connect (GTK_OBJECT (adjustment), "changed", - (GtkSignalFunc) gtk_dial_adjustment_changed, + g_signal_connect (GTK_OBJECT (adjustment), "changed", + GTK_SIGNAL_FUNC (gtk_dial_adjustment_changed), (gpointer) dial); - gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed", - (GtkSignalFunc) gtk_dial_adjustment_value_changed, + g_signal_connect (GTK_OBJECT (adjustment), "value_changed", + GTK_SIGNAL_FUNC (gtk_dial_adjustment_value_changed), (gpointer) dial); dial->old_value = adjustment->value; @@ -18224,20 +18229,23 @@ gtk_dial_expose (GtkWidget *widget, blankstyle->black_gc = widget->style->bg_gc[GTK_STATE_NORMAL]; - gtk_draw_polygon (blankstyle, + gtk_paint_polygon (blankstyle, widget->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT, + NULL, + widget, + NULL, points, 5, FALSE); - gtk_style_unref(blankstyle); + g_object_unref(blankstyle); /* Draw ticks */ if ((upper - lower) == 0) - return; + return FALSE; increment = (100*M_PI)/(dial->radius*dial->radius); @@ -18286,10 +18294,13 @@ gtk_dial_expose (GtkWidget *widget, points[4].y = points[0].y; - gtk_draw_polygon (widget->style, + gtk_paint_polygon (widget->style, widget->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT, + NULL, + widget, + NULL, points, 5, TRUE); @@ -18363,7 +18374,7 @@ gtk_dial_button_release (GtkWidget *widget, if ((dial->policy != GTK_UPDATE_CONTINUOUS) && (dial->old_value != dial->adjustment->value)) - gtk_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed"); + g_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed"); } return FALSE; @@ -18421,7 +18432,7 @@ gtk_dial_timer (GtkDial *dial) g_return_val_if_fail (GTK_IS_DIAL (dial), FALSE); if (dial->policy == GTK_UPDATE_DELAYED) - gtk_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed"); + g_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed"); return FALSE; } @@ -18457,11 +18468,11 @@ gtk_dial_update_mouse (GtkDial *dial, gint x, gint y) { if (dial->policy == GTK_UPDATE_CONTINUOUS) { - gtk_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed"); + g_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed"); } else { - gtk_widget_draw (GTK_WIDGET(dial), NULL); + gtk_widget_queue_draw (GTK_WIDGET (dial)); if (dial->policy == GTK_UPDATE_DELAYED) { @@ -18495,13 +18506,13 @@ gtk_dial_update (GtkDial *dial) if (new_value != dial->adjustment->value) { dial->adjustment->value = new_value; - gtk_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed"); + g_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed"); } dial->angle = 7.*M_PI/6. - (new_value - dial->adjustment->lower) * 4.*M_PI/3. / (dial->adjustment->upper - dial->adjustment->lower); - gtk_widget_draw (GTK_WIDGET(dial), NULL); + gtk_widget_queue_draw (GTK_WIDGET (dial)); } static void @@ -18555,7 +18566,9 @@ gtk_dial_adjustment_value_changed (GtkAdjustment *adjustment, dial_test.c + #include <stdio.h> +#include <stdlib.h> #include <gtk/gtk.h> #include "gtkdial.h" @@ -18565,7 +18578,7 @@ void value_changed( GtkAdjustment *adjustment, char buffer[16]; sprintf(buffer,"%4.2f",adjustment->value); - gtk_label_set (GTK_LABEL (label), buffer); + gtk_label_set_text (GTK_LABEL (label), buffer); } int main( int argc, @@ -18584,10 +18597,10 @@ int main( int argc, gtk_window_set_title (GTK_WINDOW (window), "Dial"); - gtk_signal_connect (GTK_OBJECT (window), "destroy", - GTK_SIGNAL_FUNC (gtk_exit), NULL); + g_signal_connect (GTK_OBJECT (window), "destroy", + GTK_SIGNAL_FUNC (exit), NULL); - gtk_container_border_width (GTK_CONTAINER (window), 10); + gtk_container_set_border_width (GTK_CONTAINER (window), 10); vbox = gtk_vbox_new (FALSE, 5); gtk_container_add (GTK_CONTAINER (window), vbox); @@ -18602,7 +18615,7 @@ int main( int argc, dial = gtk_dial_new(adjustment); gtk_dial_set_update_policy (GTK_DIAL(dial), GTK_UPDATE_DELAYED); - /* gtk_widget_set_usize (dial, 100, 100); */ + /* gtk_widget_set_size_request (dial, 100, 100); */ gtk_container_add (GTK_CONTAINER (frame), dial); gtk_widget_show (dial); @@ -18611,7 +18624,7 @@ int main( int argc, gtk_box_pack_end (GTK_BOX(vbox), label, 0, 0, 0); gtk_widget_show (label); - gtk_signal_connect (GTK_OBJECT(adjustment), "value_changed", + g_signal_connect (GTK_OBJECT(adjustment), "value_changed", GTK_SIGNAL_FUNC (value_changed), label); gtk_widget_show (window); @@ -18620,6 +18633,7 @@ int main( int argc, return 0; } + @@ -18665,7 +18679,7 @@ static gint configure_event( GtkWidget *widget, GdkEventConfigure *event ) { if (pixmap) - gdk_pixmap_unref(pixmap); + g_object_unref(pixmap); pixmap = gdk_pixmap_new(widget->window, widget->allocation.width, @@ -18685,7 +18699,7 @@ static gint configure_event( GtkWidget *widget, static gint expose_event( GtkWidget *widget, GdkEventExpose *event ) { - gdk_draw_pixmap(widget->window, + gdk_draw_drawable(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE (widget)], pixmap, event->area.x, event->area.y, @@ -18711,7 +18725,9 @@ static void draw_brush( GtkWidget *widget, TRUE, update_rect.x, update_rect.y, update_rect.width, update_rect.height); - gtk_widget_draw (widget, &update_rect); + gtk_widget_queue_draw_area (widget, + update_rect.x, update_rect.y, + update_rect.width, update_rect.height); } static gint button_press_event( GtkWidget *widget, @@ -18746,7 +18762,7 @@ static gint motion_notify_event( GtkWidget *widget, void quit () { - gtk_exit (0); + exit (0); } int main( int argc, @@ -18767,29 +18783,29 @@ int main( int argc, gtk_container_add (GTK_CONTAINER (window), vbox); gtk_widget_show (vbox); - gtk_signal_connect (GTK_OBJECT (window), "destroy", + g_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (quit), NULL); /* Create the drawing area */ drawing_area = gtk_drawing_area_new (); - gtk_drawing_area_size (GTK_DRAWING_AREA (drawing_area), 200, 200); + gtk_widget_set_size_request (GTK_WIDGET (drawing_area), 200, 200); gtk_box_pack_start (GTK_BOX (vbox), drawing_area, TRUE, TRUE, 0); gtk_widget_show (drawing_area); /* Signals used to handle backing pixmap */ - gtk_signal_connect (GTK_OBJECT (drawing_area), "expose_event", + g_signal_connect (GTK_OBJECT (drawing_area), "expose_event", (GtkSignalFunc) expose_event, NULL); - gtk_signal_connect (GTK_OBJECT(drawing_area),"configure_event", + g_signal_connect (GTK_OBJECT(drawing_area),"configure_event", (GtkSignalFunc) configure_event, NULL); /* Event signals */ - gtk_signal_connect (GTK_OBJECT (drawing_area), "motion_notify_event", + g_signal_connect (GTK_OBJECT (drawing_area), "motion_notify_event", (GtkSignalFunc) motion_notify_event, NULL); - gtk_signal_connect (GTK_OBJECT (drawing_area), "button_press_event", + g_signal_connect (GTK_OBJECT (drawing_area), "button_press_event", (GtkSignalFunc) button_press_event, NULL); gtk_widget_set_events (drawing_area, GDK_EXPOSURE_MASK @@ -18802,7 +18818,7 @@ int main( int argc, button = gtk_button_new_with_label ("Quit"); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); - gtk_signal_connect_object (GTK_OBJECT (button), "clicked", + g_signal_connect_swapped (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT (window)); gtk_widget_show (button); @@ -18854,7 +18870,7 @@ static gint configure_event (GtkWidget *widget, GdkEventConfigure *event) { if (pixmap) - gdk_pixmap_unref(pixmap); + g_object_unref(pixmap); pixmap = gdk_pixmap_new(widget->window, widget->allocation.width, @@ -18874,7 +18890,7 @@ configure_event (GtkWidget *widget, GdkEventConfigure *event) static gint expose_event (GtkWidget *widget, GdkEventExpose *event) { - gdk_draw_pixmap(widget->window, + gdk_draw_drawable(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE (widget)], pixmap, event->area.x, event->area.y, @@ -18915,7 +18931,9 @@ draw_brush (GtkWidget *widget, GdkInputSource source, gdk_draw_rectangle (pixmap, gc, TRUE, update_rect.x, update_rect.y, update_rect.width, update_rect.height); - gtk_widget_draw (widget, &update_rect); + gtk_widget_queue_draw_area (widget, + update_rect.x, update_rect.y, + update_rect.width, update_rect.height); } static void @@ -18981,9 +18999,9 @@ create_input_dialog () { inputd = gtk_input_dialog_new(); - gtk_signal_connect (GTK_OBJECT(inputd), "destroy", + g_signal_connect (GTK_OBJECT(inputd), "destroy", (GtkSignalFunc)input_dialog_destroy, &inputd); - gtk_signal_connect_object (GTK_OBJECT(GTK_INPUT_DIALOG(inputd)->close_button), + g_signal_connect_swapped (GTK_OBJECT(GTK_INPUT_DIALOG(inputd)->close_button), "clicked", (GtkSignalFunc)gtk_widget_hide, GTK_OBJECT(inputd)); @@ -19003,7 +19021,7 @@ create_input_dialog () void quit () { - gtk_exit (0); + exit (0); } int @@ -19024,29 +19042,29 @@ main (int argc, char *argv[]) gtk_container_add (GTK_CONTAINER (window), vbox); gtk_widget_show (vbox); - gtk_signal_connect (GTK_OBJECT (window), "destroy", + g_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (quit), NULL); /* Create the drawing area */ drawing_area = gtk_drawing_area_new (); - gtk_drawing_area_size (GTK_DRAWING_AREA (drawing_area), 200, 200); + gtk_widget_set_size_request (GTK_WIDGET (drawing_area), 200, 200); gtk_box_pack_start (GTK_BOX (vbox), drawing_area, TRUE, TRUE, 0); gtk_widget_show (drawing_area); /* Signals used to handle backing pixmap */ - gtk_signal_connect (GTK_OBJECT (drawing_area), "expose_event", + g_signal_connect (GTK_OBJECT (drawing_area), "expose_event", (GtkSignalFunc) expose_event, NULL); - gtk_signal_connect (GTK_OBJECT(drawing_area),"configure_event", + g_signal_connect (GTK_OBJECT(drawing_area),"configure_event", (GtkSignalFunc) configure_event, NULL); /* Event signals */ - gtk_signal_connect (GTK_OBJECT (drawing_area), "motion_notify_event", + g_signal_connect (GTK_OBJECT (drawing_area), "motion_notify_event", (GtkSignalFunc) motion_notify_event, NULL); - gtk_signal_connect (GTK_OBJECT (drawing_area), "button_press_event", + g_signal_connect (GTK_OBJECT (drawing_area), "button_press_event", (GtkSignalFunc) button_press_event, NULL); gtk_widget_set_events (drawing_area, GDK_EXPOSURE_MASK @@ -19063,14 +19081,14 @@ main (int argc, char *argv[]) button = gtk_button_new_with_label ("Input Dialog"); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); - gtk_signal_connect (GTK_OBJECT (button), "clicked", + g_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (create_input_dialog), NULL); gtk_widget_show (button); button = gtk_button_new_with_label ("Quit"); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); - gtk_signal_connect_object (GTK_OBJECT (button), "clicked", + g_signal_connect_swapped (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT (window)); gtk_widget_show (button); @@ -19387,7 +19405,7 @@ gint main( int argc, */ window=gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(window), "GtkList Example"); - gtk_signal_connect(GTK_OBJECT(window), + g_signal_connect(GTK_OBJECT(window), "destroy", GTK_SIGNAL_FUNC(gtk_main_quit), NULL); @@ -19396,13 +19414,13 @@ gint main( int argc, /* Inside the window we need a box to arrange the widgets * vertically */ vbox=gtk_vbox_new(FALSE, 5); - gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); + gtk_container_set_border_width (GTK_CONTAINER (vbox), 5); gtk_container_add(GTK_CONTAINER(window), vbox); gtk_widget_show(vbox); /* This is the scrolled window to put the List widget inside */ scrolled_window=gtk_scrolled_window_new(NULL, NULL); - gtk_widget_set_usize(scrolled_window, 250, 150); + gtk_widget_set_size_request (scrolled_window, 250, 150); gtk_container_add(GTK_CONTAINER(vbox), scrolled_window); gtk_widget_show(scrolled_window); @@ -19422,8 +19440,8 @@ gint main( int argc, /* We create a "Prison" to put a list item in ;) */ frame=gtk_frame_new("Prison"); - gtk_widget_set_usize(frame, 200, 50); - gtk_container_set_border_width(GTK_CONTAINER(frame), 5); + gtk_widget_set_size_request (frame, 200, 50); + gtk_container_set_border_width (GTK_CONTAINER (frame), 5); gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_OUT); gtk_container_add(GTK_CONTAINER(vbox), frame); gtk_widget_show(frame); @@ -19602,7 +19620,7 @@ void sigh_print_selection( GtkWidget *gtklist, gchar *item_data_string; list_item=GTK_OBJECT(dlist->data); - item_data_string=gtk_object_get_data(list_item, + item_data_string=g_object_get_data(G_OBJECT (list_item), list_item_data_key); g_print("%s ", item_data_string); diff --git a/examples/arrow/Makefile b/examples/arrow/Makefile index 34904d491b..08afc28ca6 100644 --- a/examples/arrow/Makefile +++ b/examples/arrow/Makefile @@ -1,8 +1,14 @@ CC = gcc +CFLAGS = -Wall \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED + arrow: arrow.c - $(CC) `pkg-config --cflags gtk+-2.0` arrow.c -o arrow `pkg-config --libs gtk+-2.0` + $(CC) arrow.c -o arrow $(DEPRECTATED) `pkg-config gtk+-2.0 --cflags --libs` clean: rm -f *.o arrow diff --git a/examples/arrow/arrow.c b/examples/arrow/arrow.c index 69cb49c434..884bc4752f 100644 --- a/examples/arrow/arrow.c +++ b/examples/arrow/arrow.c @@ -1,4 +1,3 @@ -/* example-start arrow arrow.c */ #include @@ -71,4 +70,3 @@ int main( int argc, return(0); } -/* example-end */ diff --git a/examples/aspectframe/Makefile b/examples/aspectframe/Makefile index 1e7f3f5688..10fc747fb3 100644 --- a/examples/aspectframe/Makefile +++ b/examples/aspectframe/Makefile @@ -1,8 +1,14 @@ CC = gcc +CFLAGS = -Wall \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED + aspectframe: aspectframe.c - $(CC) `pkg-config --cflags gtk+-2.0` aspectframe.c -o aspectframe `pkg-config --libs gtk+-2.0` + $(CC) aspectframe.c -o aspectframe $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs` clean: rm -f *.o aspectframe diff --git a/examples/aspectframe/aspectframe.c b/examples/aspectframe/aspectframe.c index c1201fbbe7..6f231188f6 100644 --- a/examples/aspectframe/aspectframe.c +++ b/examples/aspectframe/aspectframe.c @@ -1,4 +1,3 @@ -/* example-start aspectframe aspectframe.c */ #include @@ -12,8 +11,8 @@ int main( int argc, window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (window), "Aspect Frame"); - gtk_signal_connect (GTK_OBJECT (window), "destroy", - GTK_SIGNAL_FUNC (gtk_main_quit), NULL); + g_signal_connect (GTK_OBJECT (window), "destroy", + GTK_SIGNAL_FUNC (gtk_main_quit), NULL); gtk_container_set_border_width (GTK_CONTAINER (window), 10); /* Create an aspect_frame and add it to our toplevel window */ @@ -33,7 +32,7 @@ int main( int argc, /* Ask for a 200x200 window, but the AspectFrame will give us a 200x100 * window since we are forcing a 2x1 aspect ratio */ - gtk_widget_set_usize (drawing_area, 200, 200); + gtk_widget_set_size_request (drawing_area, 200, 200); gtk_container_add (GTK_CONTAINER(aspect_frame), drawing_area); gtk_widget_show (drawing_area); @@ -41,4 +40,3 @@ int main( int argc, gtk_main (); return 0; } -/* example-end */ diff --git a/examples/base/Makefile b/examples/base/Makefile index 6865097f54..dbb54890e7 100644 --- a/examples/base/Makefile +++ b/examples/base/Makefile @@ -1,8 +1,14 @@ CC = gcc +CFLAGS = -Wall \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED + base: base.c - $(CC) `pkg-config --cflags gtk+-2.0` base.c -o base `pkg-config --libs gtk+-2.0` + $(CC) base.c -o base $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs` clean: rm -f *.o base diff --git a/examples/base/base.c b/examples/base/base.c index d0e9d8daa6..94b5360ff5 100644 --- a/examples/base/base.c +++ b/examples/base/base.c @@ -1,4 +1,3 @@ -/* example-start base base.c */ #include @@ -16,4 +15,3 @@ int main( int argc, return(0); } -/* example-end */ diff --git a/examples/buttonbox/Makefile b/examples/buttonbox/Makefile index d28bd8d9a4..0863978842 100644 --- a/examples/buttonbox/Makefile +++ b/examples/buttonbox/Makefile @@ -1,8 +1,14 @@ CC = gcc +CFLAGS = -Wall \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED + buttonbox: buttonbox.c - $(CC) `pkg-config --cflags gtk+-2.0` buttonbox.c -o buttonbox `pkg-config --libs gtk+-2.0` + $(CC) buttonbox.c -o buttonbox $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs` clean: rm -f *.o buttonbox diff --git a/examples/buttonbox/buttonbox.c b/examples/buttonbox/buttonbox.c index 18346403ac..45e71c94f5 100644 --- a/examples/buttonbox/buttonbox.c +++ b/examples/buttonbox/buttonbox.c @@ -1,4 +1,3 @@ -/* example-start buttonbox buttonbox.c */ #include @@ -26,8 +25,8 @@ GtkWidget *create_bbox( gint horizontal, /* Set the appearance of the Button Box */ gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), layout); - gtk_button_box_set_spacing (GTK_BUTTON_BOX (bbox), spacing); - gtk_button_box_set_child_size (GTK_BUTTON_BOX (bbox), child_w, child_h); + gtk_box_set_spacing (GTK_BOX (bbox), spacing); + /*gtk_button_box_set_child_size (GTK_BUTTON_BOX (bbox), child_w, child_h);*/ button = gtk_button_new_with_label ("OK"); gtk_container_add (GTK_CONTAINER (bbox), button); @@ -57,9 +56,9 @@ int main( int argc, window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (window), "Button Boxes"); - gtk_signal_connect (GTK_OBJECT (window), "destroy", - GTK_SIGNAL_FUNC(gtk_main_quit), - NULL); + g_signal_connect (GTK_OBJECT (window), "destroy", + GTK_SIGNAL_FUNC(gtk_main_quit), + NULL); gtk_container_set_border_width (GTK_CONTAINER (window), 10); @@ -119,4 +118,3 @@ int main( int argc, return(0); } -/* example-end */ diff --git a/examples/buttons/Makefile b/examples/buttons/Makefile index a8474ae2d2..9a9d2af64f 100644 --- a/examples/buttons/Makefile +++ b/examples/buttons/Makefile @@ -1,8 +1,14 @@ CC = gcc +CFLAGS = -Wall \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED + buttons: buttons.c - $(CC) `pkg-config --cflags gtk+-2.0` buttons.c -o buttons `pkg-config --libs gtk+-2.0` + $(CC) buttons.c -o buttons $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs` clean: rm -f *.o buttons diff --git a/examples/buttons/buttons.c b/examples/buttons/buttons.c index 82bc5069ea..0f7864afa5 100644 --- a/examples/buttons/buttons.c +++ b/examples/buttons/buttons.c @@ -1,5 +1,5 @@ -/* example-start buttons buttons.c */ +#include #include /* Create a new hbox with an image and a label packed into it @@ -28,7 +28,7 @@ GtkWidget *xpm_label_box( GtkWidget *parent, pixmap = gdk_pixmap_create_from_xpm (parent->window, &mask, &style->bg[GTK_STATE_NORMAL], xpm_filename); - pixmapwid = gtk_pixmap_new (pixmap, mask); + pixmapwid = gtk_image_new_from_file (xpm_filename); /* Create a label for the button */ label = gtk_label_new (label_text); @@ -52,7 +52,6 @@ void callback( GtkWidget *widget, g_print ("Hello again - %s was pressed\n", (char *) data); } - int main( int argc, char *argv[] ) { @@ -68,12 +67,14 @@ int main( int argc, gtk_window_set_title (GTK_WINDOW (window), "Pixmap'd Buttons!"); +#if 1 /* It's a good idea to do this for all windows. */ - gtk_signal_connect (GTK_OBJECT (window), "destroy", - GTK_SIGNAL_FUNC (gtk_exit), NULL); + g_signal_connect (GTK_OBJECT (window), "destroy", + GTK_SIGNAL_FUNC (exit), NULL); - gtk_signal_connect (GTK_OBJECT (window), "delete_event", - GTK_SIGNAL_FUNC (gtk_exit), NULL); + g_signal_connect (GTK_OBJECT (window), "delete_event", + GTK_SIGNAL_FUNC (exit), NULL); +#endif /* Sets the border width of the window. */ gtk_container_set_border_width (GTK_CONTAINER (window), 10); @@ -83,8 +84,8 @@ int main( int argc, button = gtk_button_new (); /* Connect the "clicked" signal of the button to our callback */ - gtk_signal_connect (GTK_OBJECT (button), "clicked", - GTK_SIGNAL_FUNC (callback), (gpointer) "cool button"); + g_signal_connect (GTK_OBJECT (button), "clicked", + GTK_SIGNAL_FUNC (callback), (gpointer) "cool button"); /* This calls our box creating function */ box1 = xpm_label_box(window, "info.xpm", "cool button"); @@ -105,4 +106,3 @@ int main( int argc, return(0); } -/* example-end */ diff --git a/examples/calendar/Makefile b/examples/calendar/Makefile index e260fa07dc..a27b6a7940 100644 --- a/examples/calendar/Makefile +++ b/examples/calendar/Makefile @@ -1,8 +1,14 @@ CC = gcc +CFLAGS = -Wall \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED + calendar: calendar.c - $(CC) `pkg-config --cflags gtk+-2.0` calendar.c -o calendar `pkg-config --libs gtk+-2.0` + $(CC) calendar.c -o calendar $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs` clean: rm -f calendar diff --git a/examples/calendar/calendar.c b/examples/calendar/calendar.c index c3dfc4c177..5e395b9150 100644 --- a/examples/calendar/calendar.c +++ b/examples/calendar/calendar.c @@ -1,4 +1,3 @@ -/* example-start calendar calendar.c */ /* * Copyright (C) 1998 Cesar Miquel, Shawn T. Amundson, Mattias Grönlund * Copyright (C) 2000 Tony Gale @@ -70,14 +69,14 @@ void calendar_date_to_string( CalendarData *data, void calendar_set_signal_strings( char *sig_str, CalendarData *data) { - gchar *prev_sig; + const gchar *prev_sig; - gtk_label_get (GTK_LABEL (data->prev_sig), &prev_sig); - gtk_label_set (GTK_LABEL (data->prev2_sig), prev_sig); + prev_sig = gtk_label_get_text (GTK_LABEL (data->prev_sig)); + gtk_label_set_text (GTK_LABEL (data->prev2_sig), prev_sig); - gtk_label_get (GTK_LABEL (data->last_sig), &prev_sig); - gtk_label_set (GTK_LABEL (data->prev_sig), prev_sig); - gtk_label_set (GTK_LABEL (data->last_sig), sig_str); + prev_sig = gtk_label_get_text (GTK_LABEL (data->last_sig)); + gtk_label_set_text (GTK_LABEL (data->prev_sig), prev_sig); + gtk_label_set_text (GTK_LABEL (data->last_sig), sig_str); } void calendar_month_changed( GtkWidget *widget, @@ -188,19 +187,17 @@ void calendar_font_selection_ok( GtkWidget *button, CalendarData *calendar ) { GtkStyle *style; - GdkFont *font; + PangoFontDescription *font_desc; calendar->font = gtk_font_selection_dialog_get_font_name( GTK_FONT_SELECTION_DIALOG (calendar->font_dialog)); if (calendar->window) { - font = gtk_font_selection_dialog_get_font(GTK_FONT_SELECTION_DIALOG(calendar->font_dialog)); - if (font) + font_desc = pango_font_description_from_string (calendar->font); + if (font_desc) { style = gtk_style_copy (gtk_widget_get_style (calendar->window)); - gdk_font_unref (style->font); - style->font = font; - gdk_font_ref (style->font); + style->font_desc = font_desc; gtk_widget_set_style (calendar->window, style); } } @@ -216,19 +213,19 @@ void calendar_select_font( GtkWidget *button, g_return_if_fail(GTK_IS_FONT_SELECTION_DIALOG(window)); calendar->font_dialog = window; - gtk_window_position (GTK_WINDOW (window), GTK_WIN_POS_MOUSE); + gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_MOUSE); - gtk_signal_connect (GTK_OBJECT (window), "destroy", - GTK_SIGNAL_FUNC (gtk_widget_destroyed), - &calendar->font_dialog); + g_signal_connect (GTK_OBJECT (window), "destroy", + GTK_SIGNAL_FUNC (gtk_widget_destroyed), + &calendar->font_dialog); - gtk_signal_connect (GTK_OBJECT (GTK_FONT_SELECTION_DIALOG (window)->ok_button), - "clicked", GTK_SIGNAL_FUNC(calendar_font_selection_ok), - calendar); - gtk_signal_connect_object (GTK_OBJECT (GTK_FONT_SELECTION_DIALOG (window)->cancel_button), - "clicked", - GTK_SIGNAL_FUNC (gtk_widget_destroy), - GTK_OBJECT (calendar->font_dialog)); + g_signal_connect (GTK_OBJECT (GTK_FONT_SELECTION_DIALOG (window)->ok_button), + "clicked", GTK_SIGNAL_FUNC(calendar_font_selection_ok), + calendar); + g_signal_connect_swapped (GTK_OBJECT (GTK_FONT_SELECTION_DIALOG (window)->cancel_button), + "clicked", + GTK_SIGNAL_FUNC (gtk_widget_destroy), + GTK_OBJECT (calendar->font_dialog)); } window=calendar->font_dialog; if (!GTK_WIDGET_VISIBLE (window)) @@ -276,15 +273,15 @@ void create_calendar() window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(window), "GtkCalendar Example"); - gtk_container_border_width (GTK_CONTAINER (window), 5); - gtk_signal_connect(GTK_OBJECT(window), "destroy", - GTK_SIGNAL_FUNC(gtk_main_quit), - NULL); - gtk_signal_connect(GTK_OBJECT(window), "delete-event", - GTK_SIGNAL_FUNC(gtk_false), - NULL); + gtk_container_set_border_width (GTK_CONTAINER (window), 5); + g_signal_connect(GTK_OBJECT(window), "destroy", + GTK_SIGNAL_FUNC(gtk_main_quit), + NULL); + g_signal_connect(GTK_OBJECT(window), "delete-event", + GTK_SIGNAL_FUNC(gtk_false), + NULL); - gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, TRUE); + gtk_window_set_resizable (GTK_WINDOW (window), FALSE); vbox = gtk_vbox_new(FALSE, DEF_PAD); gtk_container_add (GTK_CONTAINER (window), vbox); @@ -298,7 +295,7 @@ void create_calendar() hbbox = gtk_hbutton_box_new(); gtk_box_pack_start(GTK_BOX(hbox), hbbox, FALSE, FALSE, DEF_PAD); gtk_button_box_set_layout(GTK_BUTTON_BOX(hbbox), GTK_BUTTONBOX_SPREAD); - gtk_button_box_set_spacing(GTK_BUTTON_BOX(hbbox), 5); + gtk_box_set_spacing (GTK_BOX (hbbox), 5); /* Calendar widget */ frame = gtk_frame_new("Calendar"); @@ -308,27 +305,27 @@ void create_calendar() calendar_set_flags(&calendar_data); gtk_calendar_mark_day ( GTK_CALENDAR(calendar), 19); gtk_container_add( GTK_CONTAINER( frame), calendar); - gtk_signal_connect (GTK_OBJECT (calendar), "month_changed", - GTK_SIGNAL_FUNC (calendar_month_changed), - &calendar_data); - gtk_signal_connect (GTK_OBJECT (calendar), "day_selected", - GTK_SIGNAL_FUNC (calendar_day_selected), - &calendar_data); - gtk_signal_connect (GTK_OBJECT (calendar), "day_selected_double_click", - GTK_SIGNAL_FUNC (calendar_day_selected_double_click), - &calendar_data); - gtk_signal_connect (GTK_OBJECT (calendar), "prev_month", - GTK_SIGNAL_FUNC (calendar_prev_month), - &calendar_data); - gtk_signal_connect (GTK_OBJECT (calendar), "next_month", - GTK_SIGNAL_FUNC (calendar_next_month), - &calendar_data); - gtk_signal_connect (GTK_OBJECT (calendar), "prev_year", - GTK_SIGNAL_FUNC (calendar_prev_year), - &calendar_data); - gtk_signal_connect (GTK_OBJECT (calendar), "next_year", - GTK_SIGNAL_FUNC (calendar_next_year), - &calendar_data); + g_signal_connect (GTK_OBJECT (calendar), "month_changed", + GTK_SIGNAL_FUNC (calendar_month_changed), + &calendar_data); + g_signal_connect (GTK_OBJECT (calendar), "day_selected", + GTK_SIGNAL_FUNC (calendar_day_selected), + &calendar_data); + g_signal_connect (GTK_OBJECT (calendar), "day_selected_double_click", + GTK_SIGNAL_FUNC (calendar_day_selected_double_click), + &calendar_data); + g_signal_connect (GTK_OBJECT (calendar), "prev_month", + GTK_SIGNAL_FUNC (calendar_prev_month), + &calendar_data); + g_signal_connect (GTK_OBJECT (calendar), "next_month", + GTK_SIGNAL_FUNC (calendar_next_month), + &calendar_data); + g_signal_connect (GTK_OBJECT (calendar), "prev_year", + GTK_SIGNAL_FUNC (calendar_prev_year), + &calendar_data); + g_signal_connect (GTK_OBJECT (calendar), "next_year", + GTK_SIGNAL_FUNC (calendar_next_year), + &calendar_data); separator = gtk_vseparator_new (); @@ -347,7 +344,7 @@ void create_calendar() for (i = 0; i < 5; i++) { toggle = gtk_check_button_new_with_label(flags[i].label); - gtk_signal_connect (GTK_OBJECT (toggle), + g_signal_connect (GTK_OBJECT (toggle), "toggled", GTK_SIGNAL_FUNC(calendar_toggle_flag), &calendar_data); @@ -356,7 +353,7 @@ void create_calendar() } /* Build the right font-button */ button = gtk_button_new_with_label("Font..."); - gtk_signal_connect (GTK_OBJECT (button), + g_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC(calendar_select_font), &calendar_data); @@ -398,7 +395,7 @@ void create_calendar() gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); button = gtk_button_new_with_label ("Close"); - gtk_signal_connect (GTK_OBJECT (button), "clicked", + g_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (gtk_main_quit), NULL); gtk_container_add (GTK_CONTAINER (bbox), button); @@ -418,6 +415,5 @@ int main(int argc, gtk_main(); - return(0); + return 0; } -/* example-end */ diff --git a/examples/clist/Makefile b/examples/clist/Makefile index cdb294811c..1e45050dfd 100644 --- a/examples/clist/Makefile +++ b/examples/clist/Makefile @@ -1,8 +1,14 @@ CC = gcc +CFLAGS = -Wall \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED + clist: clist.c - $(CC) `pkg-config --cflags gtk+-2.0` clist.c -o clist `pkg-config --libs gtk+-2.0` + $(CC) clist.c -o clist `pkg-config gtk+-2.0 --cflags --libs` clean: rm -f *.o clist diff --git a/examples/clist/clist.c b/examples/clist/clist.c index 9bb4d22a03..1a2f25b97e 100644 --- a/examples/clist/clist.c +++ b/examples/clist/clist.c @@ -1,4 +1,3 @@ -/* example-start clist clist.c */ #include @@ -90,7 +89,7 @@ int main( int argc, gtk_init(&argc, &argv); window=gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_widget_set_usize(GTK_WIDGET(window), 300, 150); + gtk_widget_set_size_request (GTK_WIDGET (window), 300, 150); gtk_window_set_title(GTK_WINDOW(window), "GtkCList Example"); gtk_signal_connect(GTK_OBJECT(window), @@ -171,4 +170,3 @@ int main( int argc, return(0); } -/* example-end */ diff --git a/examples/entry/Makefile b/examples/entry/Makefile index ef5b67ef79..78984e64d7 100644 --- a/examples/entry/Makefile +++ b/examples/entry/Makefile @@ -1,8 +1,14 @@ CC = gcc +CFLAGS = -Wall \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED + entry: entry.c - $(CC) `pkg-config --cflags gtk+-2.0` entry.c -o entry `pkg-config --libs gtk+-2.0` + $(CC) entry.c -o entry $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs` clean: rm -f *.o entry diff --git a/examples/entry/entry.c b/examples/entry/entry.c index b53a9f9a32..4de30711d8 100644 --- a/examples/entry/entry.c +++ b/examples/entry/entry.c @@ -1,11 +1,12 @@ -/* example-start entry entry.c */ +#include +#include #include void enter_callback( GtkWidget *widget, GtkWidget *entry ) { - gchar *entry_text; + const gchar *entry_text; entry_text = gtk_entry_get_text(GTK_ENTRY(entry)); printf("Entry contents: %s\n", entry_text); } @@ -13,8 +14,8 @@ void enter_callback( GtkWidget *widget, void entry_toggle_editable( GtkWidget *checkbutton, GtkWidget *entry ) { - gtk_entry_set_editable(GTK_ENTRY(entry), - GTK_TOGGLE_BUTTON(checkbutton)->active); + gtk_editable_set_editable (GTK_EDITABLE (entry), + GTK_TOGGLE_BUTTON (checkbutton)->active); } void entry_toggle_visibility( GtkWidget *checkbutton, @@ -33,28 +34,31 @@ int main( int argc, GtkWidget *entry; GtkWidget *button; GtkWidget *check; + gint tmp_pos; gtk_init (&argc, &argv); /* create a new window */ window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_widget_set_usize( GTK_WIDGET (window), 200, 100); + gtk_widget_set_size_request (GTK_WIDGET (window), 200, 100); gtk_window_set_title(GTK_WINDOW (window), "GTK Entry"); - gtk_signal_connect(GTK_OBJECT (window), "delete_event", - (GtkSignalFunc) gtk_exit, NULL); + g_signal_connect(GTK_OBJECT (window), "delete_event", + (GtkSignalFunc) exit, NULL); vbox = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (window), vbox); gtk_widget_show (vbox); - entry = gtk_entry_new_with_max_length (50); - gtk_signal_connect(GTK_OBJECT(entry), "activate", + entry = gtk_entry_new (); + gtk_entry_set_max_length (GTK_ENTRY (entry), 50); + g_signal_connect(GTK_OBJECT(entry), "activate", GTK_SIGNAL_FUNC(enter_callback), entry); gtk_entry_set_text (GTK_ENTRY (entry), "hello"); - gtk_entry_append_text (GTK_ENTRY (entry), " world"); - gtk_entry_select_region (GTK_ENTRY (entry), - 0, GTK_ENTRY(entry)->text_length); + tmp_pos = GTK_ENTRY (entry)->text_length; + gtk_editable_insert_text (GTK_EDITABLE (entry), " world", -1, &tmp_pos); + gtk_editable_select_region (GTK_EDITABLE (entry), + 0, GTK_ENTRY(entry)->text_length); gtk_box_pack_start (GTK_BOX (vbox), entry, TRUE, TRUE, 0); gtk_widget_show (entry); @@ -64,21 +68,21 @@ int main( int argc, check = gtk_check_button_new_with_label("Editable"); gtk_box_pack_start (GTK_BOX (hbox), check, TRUE, TRUE, 0); - gtk_signal_connect (GTK_OBJECT(check), "toggled", + g_signal_connect (GTK_OBJECT(check), "toggled", GTK_SIGNAL_FUNC(entry_toggle_editable), entry); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), TRUE); gtk_widget_show (check); check = gtk_check_button_new_with_label("Visible"); gtk_box_pack_start (GTK_BOX (hbox), check, TRUE, TRUE, 0); - gtk_signal_connect (GTK_OBJECT(check), "toggled", + g_signal_connect (GTK_OBJECT(check), "toggled", GTK_SIGNAL_FUNC(entry_toggle_visibility), entry); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), TRUE); gtk_widget_show (check); button = gtk_button_new_with_label ("Close"); - gtk_signal_connect_object (GTK_OBJECT (button), "clicked", - GTK_SIGNAL_FUNC(gtk_exit), + g_signal_connect_swapped (GTK_OBJECT (button), "clicked", + GTK_SIGNAL_FUNC(exit), GTK_OBJECT (window)); gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0); GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); @@ -88,6 +92,5 @@ int main( int argc, gtk_widget_show(window); gtk_main(); - return(0); + return 0; } -/* example-end */ diff --git a/examples/eventbox/Makefile b/examples/eventbox/Makefile index 3eb24d5ce4..96b4f5c24b 100644 --- a/examples/eventbox/Makefile +++ b/examples/eventbox/Makefile @@ -1,8 +1,14 @@ CC = gcc +CFLAGS = -Wall \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED + eventbox: eventbox.c - $(CC) `pkg-config --cflags gtk+-2.0` eventbox.c -o eventbox `pkg-config --libs gtk+-2.0` + $(CC) eventbox.c -o eventbox $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs` clean: rm -f *.o eventbox diff --git a/examples/eventbox/eventbox.c b/examples/eventbox/eventbox.c index ac1e524897..85a886f913 100644 --- a/examples/eventbox/eventbox.c +++ b/examples/eventbox/eventbox.c @@ -1,5 +1,5 @@ -/* example-start eventbox eventbox.c */ +#include #include int main( int argc, @@ -15,8 +15,8 @@ int main( int argc, gtk_window_set_title (GTK_WINDOW (window), "Event Box"); - gtk_signal_connect (GTK_OBJECT (window), "destroy", - GTK_SIGNAL_FUNC (gtk_exit), NULL); + g_signal_connect (GTK_OBJECT (window), "destroy", + GTK_SIGNAL_FUNC (exit), NULL); gtk_container_set_border_width (GTK_CONTAINER (window), 10); @@ -33,12 +33,12 @@ int main( int argc, gtk_widget_show (label); /* Clip it short. */ - gtk_widget_set_usize (label, 110, 20); + gtk_widget_set_size_request (label, 110, 20); /* And bind an action to it */ gtk_widget_set_events (event_box, GDK_BUTTON_PRESS_MASK); - gtk_signal_connect (GTK_OBJECT(event_box), "button_press_event", - GTK_SIGNAL_FUNC (gtk_exit), NULL); + g_signal_connect (GTK_OBJECT(event_box), "button_press_event", + GTK_SIGNAL_FUNC (exit), NULL); /* Yet one more thing you need an X window for ... */ @@ -49,6 +49,5 @@ int main( int argc, gtk_main (); - return(0); + return 0; } -/* example-end */ diff --git a/examples/filesel/Makefile b/examples/filesel/Makefile index fe13786831..92d5e3d003 100644 --- a/examples/filesel/Makefile +++ b/examples/filesel/Makefile @@ -1,8 +1,14 @@ CC = gcc +CFLAGS = -Wall \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED + filesel: filesel.c - $(CC) `pkg-config --cflags gtk+-2.0` filesel.c -o filesel `pkg-config --libs gtk+-2.0` + $(CC) filesel.c -o filesel $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs` clean: rm -f *.o filesel diff --git a/examples/filesel/filesel.c b/examples/filesel/filesel.c index 1e1fcaad40..87daf12645 100644 --- a/examples/filesel/filesel.c +++ b/examples/filesel/filesel.c @@ -1,4 +1,3 @@ -/* example-start filesel filesel.c */ #include @@ -25,16 +24,16 @@ int main( int argc, /* Create a new file selection widget */ filew = gtk_file_selection_new ("File selection"); - gtk_signal_connect (GTK_OBJECT (filew), "destroy", - (GtkSignalFunc) destroy, &filew); + g_signal_connect (GTK_OBJECT (filew), "destroy", + GTK_SIGNAL_FUNC (destroy), &filew); /* Connect the ok_button to file_ok_sel function */ - gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (filew)->ok_button), - "clicked", (GtkSignalFunc) file_ok_sel, filew ); + g_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (filew)->ok_button), + "clicked", GTK_SIGNAL_FUNC (file_ok_sel), filew ); /* Connect the cancel_button to destroy the widget */ - gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION + g_signal_connect_swapped (GTK_OBJECT (GTK_FILE_SELECTION (filew)->cancel_button), - "clicked", (GtkSignalFunc) gtk_widget_destroy, + "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT (filew)); /* Lets set the filename, as if this were a save dialog, and we are giving @@ -46,4 +45,3 @@ int main( int argc, gtk_main (); return 0; } -/* example-end */ diff --git a/examples/fixed/Makefile b/examples/fixed/Makefile index 4fe88024bd..941531b20e 100644 --- a/examples/fixed/Makefile +++ b/examples/fixed/Makefile @@ -1,8 +1,14 @@ CC = gcc +CFLAGS = -Wall \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED + fixed: fixed.c - $(CC) `pkg-config --cflags gtk+-2.0` fixed.c -o fixed `pkg-config --libs gtk+-2.0` + $(CC) fixed.c -o fixed $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs` clean: rm -f *.o fixed diff --git a/examples/fixed/fixed.c b/examples/fixed/fixed.c index 645f976cff..83d6990d79 100644 --- a/examples/fixed/fixed.c +++ b/examples/fixed/fixed.c @@ -1,4 +1,3 @@ -/* example-start fixed fixed.c */ #include @@ -35,7 +34,7 @@ int main( int argc, gtk_window_set_title(GTK_WINDOW(window), "Fixed Container"); /* Here we connect the "destroy" event to a signal handler */ - gtk_signal_connect (GTK_OBJECT (window), "destroy", + g_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (gtk_main_quit), NULL); /* Sets the border width of the window. */ @@ -53,7 +52,7 @@ int main( int argc, /* When the button receives the "clicked" signal, it will call the * function move_button() passing it the Fixed Container as its * argument. */ - gtk_signal_connect (GTK_OBJECT (button), "clicked", + g_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (move_button), fixed); /* This packs the button into the fixed containers window. */ @@ -69,6 +68,5 @@ int main( int argc, /* Enter the event loop */ gtk_main (); - return(0); + return 0; } -/* example-end */ diff --git a/examples/frame/Makefile b/examples/frame/Makefile index b8e389ab7d..049b8c40a2 100644 --- a/examples/frame/Makefile +++ b/examples/frame/Makefile @@ -1,8 +1,14 @@ CC = gcc -frame: frame.c - $(CC) `pkg-config --cflags gtk+-2.0` frame.c -o frame `pkg-config --libs gtk+-2.0` +CFLAGS = -Wall \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED + +frame: frame.c + $(CC) frame.c -o frame $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs` clean: rm -f *.o frame diff --git a/examples/frame/frame.c b/examples/frame/frame.c index e2cb09a39a..05afcd4762 100644 --- a/examples/frame/frame.c +++ b/examples/frame/frame.c @@ -1,4 +1,3 @@ -/* example-start frame frame.c */ #include @@ -8,8 +7,6 @@ int main( int argc, /* GtkWidget is the storage type for widgets */ GtkWidget *window; GtkWidget *frame; - GtkWidget *button; - gint i; /* Initialise GTK */ gtk_init(&argc, &argv); @@ -19,10 +16,10 @@ int main( int argc, gtk_window_set_title(GTK_WINDOW(window), "Frame Example"); /* Here we connect the "destroy" event to a signal handler */ - gtk_signal_connect (GTK_OBJECT (window), "destroy", + g_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (gtk_main_quit), NULL); - gtk_widget_set_usize(window, 300, 300); + gtk_widget_set_size_request (window, 300, 300); /* Sets the border width of the window. */ gtk_container_set_border_width (GTK_CONTAINER (window), 10); @@ -47,6 +44,5 @@ int main( int argc, /* Enter the event loop */ gtk_main (); - return(0); + return 0; } -/* example-end */ diff --git a/examples/gtkdial/Makefile b/examples/gtkdial/Makefile index 1c388104e2..0f83a9df03 100644 --- a/examples/gtkdial/Makefile +++ b/examples/gtkdial/Makefile @@ -1,14 +1,20 @@ CC = gcc +CFLAGS = -Wall \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED + dial_test: gtkdial.o dial_test.o $(CC) dial_test.o gtkdial.o -o dial_test `pkg-config --libs gtk+-2.0` dial_test.o: dial_test.c gtkdial.h - $(CC) `pkg-config --cflags gtk+-2.0` -c dial_test.c -o dial_test.o + $(CC) -c dial_test.c -o dial_test.o $(CFLAGS) `pkg-config gtk+-2.0 --cflags` gtkdial.o: gtkdial.c gtkdial.h - $(CC) `pkg-config --cflags gtk+-2.0` -c gtkdial.c -o gtkdial.o + $(CC) -c gtkdial.c -o gtkdial.o $(CFLAGS) `pkg-config gtk+-2.0 --cflags` clean: rm -f *.o dial_test diff --git a/examples/gtkdial/dial_test.c b/examples/gtkdial/dial_test.c index ebcea0c7d9..e753cc1986 100644 --- a/examples/gtkdial/dial_test.c +++ b/examples/gtkdial/dial_test.c @@ -1,17 +1,19 @@ +#include +#include #include #include "gtkdial.h" -void -value_changed (GtkAdjustment *adjustment, GtkWidget *label) +void value_changed( GtkAdjustment *adjustment, + GtkWidget *label ) { char buffer[16]; sprintf(buffer,"%4.2f",adjustment->value); - gtk_label_set (GTK_LABEL (label), buffer); + gtk_label_set_text (GTK_LABEL (label), buffer); } -int -main (int argc, char *argv[]) +int main( int argc, + char *argv[]) { GtkWidget *window; GtkAdjustment *adjustment; @@ -26,10 +28,10 @@ main (int argc, char *argv[]) gtk_window_set_title (GTK_WINDOW (window), "Dial"); - gtk_signal_connect (GTK_OBJECT (window), "destroy", - GTK_SIGNAL_FUNC (gtk_exit), NULL); + g_signal_connect (GTK_OBJECT (window), "destroy", + GTK_SIGNAL_FUNC (exit), NULL); - gtk_container_border_width (GTK_CONTAINER (window), 10); + gtk_container_set_border_width (GTK_CONTAINER (window), 10); vbox = gtk_vbox_new (FALSE, 5); gtk_container_add (GTK_CONTAINER (window), vbox); @@ -37,23 +39,23 @@ main (int argc, char *argv[]) frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN); - gtk_box_pack_start (GTK_BOX(vbox), frame, TRUE, TRUE, 0); + gtk_container_add (GTK_CONTAINER (vbox), frame); gtk_widget_show (frame); - adjustment = GTK_ADJUSTMENT(gtk_adjustment_new (0, -1.0, 1.0, 0.01, 0.1, 0)); + adjustment = GTK_ADJUSTMENT(gtk_adjustment_new (0, 0, 100, 0.01, 0.1, 0)); dial = gtk_dial_new(adjustment); gtk_dial_set_update_policy (GTK_DIAL(dial), GTK_UPDATE_DELAYED); - /* gtk_widget_set_usize (dial, 100, 100); */ + /* gtk_widget_set_size_request (dial, 100, 100); */ gtk_container_add (GTK_CONTAINER (frame), dial); gtk_widget_show (dial); label = gtk_label_new("0.00"); - gtk_box_pack_start (GTK_BOX(vbox), label, TRUE, TRUE, 0); + gtk_box_pack_end (GTK_BOX(vbox), label, 0, 0, 0); gtk_widget_show (label); - gtk_signal_connect (GTK_OBJECT(adjustment), "value_changed", + g_signal_connect (GTK_OBJECT(adjustment), "value_changed", GTK_SIGNAL_FUNC (value_changed), label); gtk_widget_show (window); diff --git a/examples/gtkdial/gtkdial.c b/examples/gtkdial/gtkdial.c index 51e70d2d67..0bd89fd13b 100644 --- a/examples/gtkdial/gtkdial.c +++ b/examples/gtkdial/gtkdial.c @@ -1,4 +1,3 @@ -/* example-start gtkdial gtkdial.c */ /* GTK - The GIMP Toolkit * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald @@ -59,25 +58,27 @@ static void gtk_dial_adjustment_value_changed (GtkAdjustment *adjustment, static GtkWidgetClass *parent_class = NULL; -guint +GType gtk_dial_get_type () { - static guint dial_type = 0; + static GType dial_type = 0; if (!dial_type) { - GtkTypeInfo dial_info = + static const GTypeInfo dial_info = { - "GtkDial", - sizeof (GtkDial), sizeof (GtkDialClass), - (GtkClassInitFunc) gtk_dial_class_init, - (GtkObjectInitFunc) gtk_dial_init, - (GtkArgSetFunc) NULL, - (GtkArgGetFunc) NULL, + NULL, + NULL, + (GClassInitFunc) gtk_dial_class_init, + NULL, + NULL, + sizeof (GtkDial), + 0, + (GInstanceInitFunc) gtk_dial_init, }; - dial_type = gtk_type_unique (gtk_widget_get_type (), &dial_info); + dial_type = g_type_register_static (GTK_TYPE_WIDGET, "GtkDial", &dial_info, 0); } return dial_type; @@ -125,7 +126,7 @@ gtk_dial_new (GtkAdjustment *adjustment) { GtkDial *dial; - dial = gtk_type_new (gtk_dial_get_type ()); + dial = g_object_new (gtk_dial_get_type (), NULL); if (!adjustment) adjustment = (GtkAdjustment*) gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0); @@ -146,7 +147,7 @@ gtk_dial_destroy (GtkObject *object) dial = GTK_DIAL (object); if (dial->adjustment) - gtk_object_unref (GTK_OBJECT (dial->adjustment)); + g_object_unref (GTK_OBJECT (dial->adjustment)); if (GTK_OBJECT_CLASS (parent_class)->destroy) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); @@ -180,18 +181,18 @@ gtk_dial_set_adjustment (GtkDial *dial, if (dial->adjustment) { - gtk_signal_disconnect_by_data (GTK_OBJECT (dial->adjustment), (gpointer) dial); - gtk_object_unref (GTK_OBJECT (dial->adjustment)); + g_signal_handlers_disconnect_by_func (GTK_OBJECT (dial->adjustment), NULL, (gpointer) dial); + g_object_unref (GTK_OBJECT (dial->adjustment)); } dial->adjustment = adjustment; - gtk_object_ref (GTK_OBJECT (dial->adjustment)); + g_object_ref (GTK_OBJECT (dial->adjustment)); - gtk_signal_connect (GTK_OBJECT (adjustment), "changed", - (GtkSignalFunc) gtk_dial_adjustment_changed, + g_signal_connect (GTK_OBJECT (adjustment), "changed", + GTK_SIGNAL_FUNC (gtk_dial_adjustment_changed), (gpointer) dial); - gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed", - (GtkSignalFunc) gtk_dial_adjustment_value_changed, + g_signal_connect (GTK_OBJECT (adjustment), "value_changed", + GTK_SIGNAL_FUNC (gtk_dial_adjustment_value_changed), (gpointer) dial); dial->old_value = adjustment->value; @@ -331,20 +332,23 @@ gtk_dial_expose (GtkWidget *widget, blankstyle->black_gc = widget->style->bg_gc[GTK_STATE_NORMAL]; - gtk_draw_polygon (blankstyle, + gtk_paint_polygon (blankstyle, widget->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT, + NULL, + widget, + NULL, points, 5, FALSE); - gtk_style_unref(blankstyle); + g_object_unref(blankstyle); /* Draw ticks */ if ((upper - lower) == 0) - return; + return FALSE; increment = (100*M_PI)/(dial->radius*dial->radius); @@ -393,10 +397,13 @@ gtk_dial_expose (GtkWidget *widget, points[4].y = points[0].y; - gtk_draw_polygon (widget->style, + gtk_paint_polygon (widget->style, widget->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT, + NULL, + widget, + NULL, points, 5, TRUE); @@ -470,7 +477,7 @@ gtk_dial_button_release (GtkWidget *widget, if ((dial->policy != GTK_UPDATE_CONTINUOUS) && (dial->old_value != dial->adjustment->value)) - gtk_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed"); + g_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed"); } return FALSE; @@ -528,7 +535,7 @@ gtk_dial_timer (GtkDial *dial) g_return_val_if_fail (GTK_IS_DIAL (dial), FALSE); if (dial->policy == GTK_UPDATE_DELAYED) - gtk_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed"); + g_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed"); return FALSE; } @@ -564,11 +571,11 @@ gtk_dial_update_mouse (GtkDial *dial, gint x, gint y) { if (dial->policy == GTK_UPDATE_CONTINUOUS) { - gtk_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed"); + g_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed"); } else { - gtk_widget_draw (GTK_WIDGET(dial), NULL); + gtk_widget_queue_draw (GTK_WIDGET (dial)); if (dial->policy == GTK_UPDATE_DELAYED) { @@ -602,13 +609,13 @@ gtk_dial_update (GtkDial *dial) if (new_value != dial->adjustment->value) { dial->adjustment->value = new_value; - gtk_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed"); + g_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed"); } dial->angle = 7.*M_PI/6. - (new_value - dial->adjustment->lower) * 4.*M_PI/3. / (dial->adjustment->upper - dial->adjustment->lower); - gtk_widget_draw (GTK_WIDGET(dial), NULL); + gtk_widget_queue_draw (GTK_WIDGET (dial)); } static void @@ -652,4 +659,3 @@ gtk_dial_adjustment_value_changed (GtkAdjustment *adjustment, dial->old_value = adjustment->value; } } -/* example-end */ diff --git a/examples/gtkdial/gtkdial.h b/examples/gtkdial/gtkdial.h index 781943548a..850d7ea1e0 100644 --- a/examples/gtkdial/gtkdial.h +++ b/examples/gtkdial/gtkdial.h @@ -1,4 +1,3 @@ -/* example-start gtkdial gtkdial.h */ /* GTK - The GIMP Toolkit * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald @@ -77,7 +76,7 @@ struct _GtkDialClass GtkWidget* gtk_dial_new (GtkAdjustment *adjustment); -guint gtk_dial_get_type (void); +GtkType gtk_dial_get_type (void); GtkAdjustment* gtk_dial_get_adjustment (GtkDial *dial); void gtk_dial_set_update_policy (GtkDial *dial, GtkUpdateType policy); @@ -90,4 +89,3 @@ void gtk_dial_set_adjustment (GtkDial *dial, #endif /* __GTK_DIAL_H__ */ -/* example-end */ diff --git a/examples/helloworld/Makefile b/examples/helloworld/Makefile index 1a60bc6e4d..0e3d0559d6 100644 --- a/examples/helloworld/Makefile +++ b/examples/helloworld/Makefile @@ -1,8 +1,14 @@ CC = gcc +CFLAGS = -Wall \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED + helloworld: helloworld.c - $(CC) `pkg-config --cflags gtk+-2.0` helloworld.c -o helloworld `pkg-config --libs gtk+-2.0` + $(CC) helloworld.c -o helloworld $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs` clean: rm -f *.o helloworld diff --git a/examples/helloworld/helloworld.c b/examples/helloworld/helloworld.c index eaa56fb327..64ac0f6bb1 100644 --- a/examples/helloworld/helloworld.c +++ b/examples/helloworld/helloworld.c @@ -1,4 +1,3 @@ -/* example-start helloworld helloworld.c */ #include @@ -54,13 +53,13 @@ int main( int argc, * titlebar), we ask it to call the delete_event () function * as defined above. The data passed to the callback * function is NULL and is ignored in the callback function. */ - gtk_signal_connect (GTK_OBJECT (window), "delete_event", + g_signal_connect (GTK_OBJECT (window), "delete_event", GTK_SIGNAL_FUNC (delete_event), NULL); /* Here we connect the "destroy" event to a signal handler. * This event occurs when we call gtk_widget_destroy() on the window, * or if we return FALSE in the "delete_event" callback. */ - gtk_signal_connect (GTK_OBJECT (window), "destroy", + g_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (destroy), NULL); /* Sets the border width of the window. */ @@ -72,13 +71,13 @@ int main( int argc, /* When the button receives the "clicked" signal, it will call the * function hello() passing it NULL as its argument. The hello() * function is defined above. */ - gtk_signal_connect (GTK_OBJECT (button), "clicked", + g_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (hello), NULL); /* This will cause the window to be destroyed by calling * gtk_widget_destroy(window) when "clicked". Again, the destroy * signal could come from here, or the window manager. */ - gtk_signal_connect_object (GTK_OBJECT (button), "clicked", + g_signal_connect_swapped (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT (window)); @@ -96,6 +95,5 @@ int main( int argc, * mouse event). */ gtk_main (); - return(0); + return 0; } -/* example-end */ diff --git a/examples/helloworld2/Makefile b/examples/helloworld2/Makefile index d1433bcb95..d574f2e4bb 100644 --- a/examples/helloworld2/Makefile +++ b/examples/helloworld2/Makefile @@ -1,8 +1,14 @@ CC = gcc +CFLAGS = -Wall \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED + helloworld2: helloworld2.c - $(CC) `pkg-config --cflags gtk+-2.0` helloworld2.c -o helloworld2 `pkg-config --libs gtk+-2.0` + $(CC) helloworld2.c -o helloworld2 $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs` clean: rm -f *.o helloworld2 diff --git a/examples/helloworld2/helloworld2.c b/examples/helloworld2/helloworld2.c index ae41fd15f8..79bbd039d6 100644 --- a/examples/helloworld2/helloworld2.c +++ b/examples/helloworld2/helloworld2.c @@ -1,4 +1,3 @@ -/* example-start helloworld2 helloworld2.c */ #include @@ -40,7 +39,7 @@ int main( int argc, /* Here we just set a handler for delete_event that immediately * exits GTK. */ - gtk_signal_connect (GTK_OBJECT (window), "delete_event", + g_signal_connect (GTK_OBJECT (window), "delete_event", GTK_SIGNAL_FUNC (delete_event), NULL); /* Sets the border width of the window. */ @@ -56,10 +55,10 @@ int main( int argc, /* Creates a new button with the label "Button 1". */ button = gtk_button_new_with_label ("Button 1"); - + /* Now 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", + g_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (callback), (gpointer) "button 1"); /* Instead of gtk_container_add, we pack this button into the invisible @@ -75,7 +74,7 @@ int main( int argc, /* Call the same callback function with a different argument, * passing a pointer to "button 2" instead. */ - gtk_signal_connect (GTK_OBJECT (button), "clicked", + g_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (callback), (gpointer) "button 2"); gtk_box_pack_start(GTK_BOX(box1), button, TRUE, TRUE, 0); @@ -87,10 +86,9 @@ int main( int argc, gtk_widget_show(box1); gtk_widget_show (window); - + /* Rest in gtk_main and wait for the fun to begin! */ gtk_main (); - return(0); + return 0; } -/* example-end */ diff --git a/examples/label/Makefile b/examples/label/Makefile index 3cf6d95736..f59b4bb1d1 100644 --- a/examples/label/Makefile +++ b/examples/label/Makefile @@ -1,8 +1,14 @@ CC = gcc +CFLAGS = -Wall \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED + label: label.c - $(CC) `pkg-config --cflags gtk+-2.0` label.c -o label `pkg-config --libs gtk+-2.0` + $(CC) label.c -o label $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs` clean: rm -f *.o label diff --git a/examples/label/label.c b/examples/label/label.c index 5711a4c98f..66420166ae 100644 --- a/examples/label/label.c +++ b/examples/label/label.c @@ -1,4 +1,3 @@ -/* example-start label label.c */ #include @@ -15,7 +14,7 @@ int main( int argc, gtk_init(&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_signal_connect (GTK_OBJECT (window), "destroy", + g_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC(gtk_main_quit), NULL); @@ -97,6 +96,5 @@ int main( int argc, gtk_main (); - return(0); + return 0; } -/* example-end */ diff --git a/examples/list/Makefile b/examples/list/Makefile index 33e5765b85..59cc93aa49 100644 --- a/examples/list/Makefile +++ b/examples/list/Makefile @@ -1,8 +1,16 @@ CC = gcc +#CFLAGS = -Wall \ +# -DG_DISABLE_DEPRECATED \ +# -DGDK_DISABLE_DEPRECATED \ +# -DGDK_PIXBUF_DISABLE_DEPRECATED \ +# -DGTK_DISABLE_DEPRECATED + +CFLAGS = + list: list.c - $(CC) `pkg-config --cflags gtk+-2.0` list.c -o list `pkg-config --libs gtk+-2.0` + $(CC) list.c -o list $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs` clean: rm -f *.o list diff --git a/examples/list/list.c b/examples/list/list.c index 812786bdc0..d797ae3313 100644 --- a/examples/list/list.c +++ b/examples/list/list.c @@ -1,10 +1,9 @@ -/* example-start list list.c */ /* Include the GTK header files * Include stdio.h, we need that for the printf() function */ -#include -#include +#include +#include /* This is our data identification string to store * data in list items @@ -52,7 +51,7 @@ gint main( int argc, */ window=gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(window), "GtkList Example"); - gtk_signal_connect(GTK_OBJECT(window), + g_signal_connect(GTK_OBJECT(window), "destroy", GTK_SIGNAL_FUNC(gtk_main_quit), NULL); @@ -61,13 +60,13 @@ gint main( int argc, /* Inside the window we need a box to arrange the widgets * vertically */ vbox=gtk_vbox_new(FALSE, 5); - gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); + gtk_container_set_border_width (GTK_CONTAINER (vbox), 5); gtk_container_add(GTK_CONTAINER(window), vbox); gtk_widget_show(vbox); /* This is the scrolled window to put the List widget inside */ scrolled_window=gtk_scrolled_window_new(NULL, NULL); - gtk_widget_set_usize(scrolled_window, 250, 150); + gtk_widget_set_size_request (scrolled_window, 250, 150); gtk_container_add(GTK_CONTAINER(vbox), scrolled_window); gtk_widget_show(scrolled_window); @@ -87,8 +86,8 @@ gint main( int argc, /* We create a "Prison" to put a list item in ;) */ frame=gtk_frame_new("Prison"); - gtk_widget_set_usize(frame, 200, 50); - gtk_container_set_border_width(GTK_CONTAINER(frame), 5); + gtk_widget_set_size_request (frame, 200, 50); + gtk_container_set_border_width (GTK_CONTAINER (frame), 5); gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_OUT); gtk_container_add(GTK_CONTAINER(vbox), frame); gtk_widget_show(frame); @@ -267,7 +266,7 @@ void sigh_print_selection( GtkWidget *gtklist, gchar *item_data_string; list_item=GTK_OBJECT(dlist->data); - item_data_string=gtk_object_get_data(list_item, + item_data_string=g_object_get_data(G_OBJECT (list_item), list_item_data_key); g_print("%s ", item_data_string); @@ -275,4 +274,3 @@ void sigh_print_selection( GtkWidget *gtklist, } g_print("\n"); } -/* example-end */ diff --git a/examples/menu/Makefile b/examples/menu/Makefile index 8c4489ce40..290ac17922 100644 --- a/examples/menu/Makefile +++ b/examples/menu/Makefile @@ -1,13 +1,19 @@ CC = gcc +CFLAGS = -Wall \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED + all: menu itemfactory menu: menu.c - $(CC) `pkg-config --cflags gtk+-2.0` menu.c -o menu `pkg-config --libs gtk+-2.0` + $(CC) menu.c -o menu $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs` itemfactory: itemfactory.c - $(CC) `pkg-config --cflags gtk+-2.0` itemfactory.c -o itemfactory `pkg-config --libs gtk+-2.0` + $(CC) itemfactory.c -o itemfactory $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs` clean: rm -f *.o menu itemfactory diff --git a/examples/menu/itemfactory.c b/examples/menu/itemfactory.c index d1239baff2..e8932f37c8 100644 --- a/examples/menu/itemfactory.c +++ b/examples/menu/itemfactory.c @@ -1,4 +1,3 @@ -/* example-start menu itemfactory.c */ #include #include @@ -91,14 +90,14 @@ int main( int argc, gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_signal_connect (GTK_OBJECT (window), "destroy", + g_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (gtk_main_quit), "WM destroy"); gtk_window_set_title (GTK_WINDOW(window), "Item Factory"); - gtk_widget_set_usize (GTK_WIDGET(window), 300, 200); + gtk_widget_set_size_request (GTK_WIDGET (window), 300, 200); main_vbox = gtk_vbox_new (FALSE, 1); - gtk_container_border_width (GTK_CONTAINER (main_vbox), 1); + gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 1); gtk_container_add (GTK_CONTAINER (window), main_vbox); gtk_widget_show (main_vbox); @@ -109,6 +108,5 @@ int main( int argc, gtk_widget_show (window); gtk_main (); - return(0); + return 0; } -/* example-end */ diff --git a/examples/menu/menu.c b/examples/menu/menu.c index e1420e80aa..c8479097c5 100644 --- a/examples/menu/menu.c +++ b/examples/menu/menu.c @@ -1,5 +1,5 @@ -/* example-start menu menu.c */ +#include #include static gint button_press (GtkWidget *, GdkEvent *); @@ -23,9 +23,9 @@ int main( int argc, /* create a new window */ window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_widget_set_usize (GTK_WIDGET (window), 200, 100); + gtk_widget_set_size_request (GTK_WIDGET (window), 200, 100); gtk_window_set_title (GTK_WINDOW (window), "GTK Menu Test"); - gtk_signal_connect (GTK_OBJECT (window), "delete_event", + g_signal_connect (GTK_OBJECT (window), "delete_event", (GtkSignalFunc) gtk_main_quit, NULL); /* Init the menu-widget, and remember -- never @@ -49,10 +49,10 @@ int main( int argc, menu_items = gtk_menu_item_new_with_label (buf); /* ...and add it to the menu. */ - gtk_menu_append (GTK_MENU (menu), menu_items); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items); /* Do something interesting when the menuitem is selected */ - gtk_signal_connect_object (GTK_OBJECT (menu_items), "activate", + g_signal_connect_swapped (GTK_OBJECT (menu_items), "activate", GTK_SIGNAL_FUNC (menuitem_response), (gpointer) g_strdup (buf)); /* Show the widget */ @@ -82,14 +82,14 @@ int main( int argc, /* Create a button to which to attach menu as a popup */ button = gtk_button_new_with_label ("press me"); - gtk_signal_connect_object (GTK_OBJECT (button), "event", + g_signal_connect_swapped (GTK_OBJECT (button), "event", GTK_SIGNAL_FUNC (button_press), GTK_OBJECT (menu)); gtk_box_pack_end (GTK_BOX (vbox), button, TRUE, TRUE, 2); gtk_widget_show (button); /* And finally we append the menu-item to the menu-bar -- this is the * "root" menu-item I have been raving about =) */ - gtk_menu_bar_append (GTK_MENU_BAR (menu_bar), root_menu); + gtk_menu_shell_append (GTK_MENU_SHELL (menu_bar), root_menu); /* always display the window as the last step so it all splashes on * the screen at once. */ @@ -97,7 +97,7 @@ int main( int argc, gtk_main (); - return(0); + return 0; } /* Respond to a button-press by posting a menu passed in as widget. @@ -130,4 +130,3 @@ static void menuitem_response( gchar *string ) { printf ("%s\n", string); } -/* example-end */ diff --git a/examples/notebook/Makefile b/examples/notebook/Makefile index fcfda957f8..7ab745a7da 100644 --- a/examples/notebook/Makefile +++ b/examples/notebook/Makefile @@ -1,8 +1,14 @@ CC = gcc +CFLAGS = -Wall \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED + notebook: notebook.c - $(CC) `pkg-config --cflags gtk+-2.0` notebook.c -o notebook `pkg-config --libs gtk+-2.0` + $(CC) notebook.c -o notebook $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs` clean: rm -f *.o notebook diff --git a/examples/notebook/notebook.c b/examples/notebook/notebook.c index 79c4bc4148..3a5808fcb6 100644 --- a/examples/notebook/notebook.c +++ b/examples/notebook/notebook.c @@ -1,5 +1,5 @@ -/* example-start notebook notebook.c */ +#include #include /* This function rotates the position of the tabs */ @@ -34,15 +34,15 @@ void remove_book( GtkButton *button, gtk_notebook_remove_page (notebook, page); /* Need to refresh the widget -- This forces the widget to redraw itself. */ - gtk_widget_draw(GTK_WIDGET(notebook), NULL); + gtk_widget_queue_draw (GTK_WIDGET (notebook)); } gint delete( GtkWidget *widget, GtkWidget *event, gpointer data ) { - gtk_main_quit(); - return(FALSE); + gtk_main_quit (); + return FALSE; } int main( int argc, @@ -63,7 +63,7 @@ int main( int argc, window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_signal_connect (GTK_OBJECT (window), "delete_event", + g_signal_connect (GTK_OBJECT (window), "delete_event", GTK_SIGNAL_FUNC (delete), NULL); gtk_container_set_border_width (GTK_CONTAINER (window), 10); @@ -84,7 +84,7 @@ int main( int argc, frame = gtk_frame_new (bufferf); gtk_container_set_border_width (GTK_CONTAINER (frame), 10); - gtk_widget_set_usize (frame, 100, 75); + gtk_widget_set_size_request (frame, 100, 75); gtk_widget_show (frame); label = gtk_label_new (bufferf); @@ -97,7 +97,7 @@ int main( int argc, /* Now let's add a page to a specific spot */ checkbutton = gtk_check_button_new_with_label ("Check me please!"); - gtk_widget_set_usize(checkbutton, 100, 75); + gtk_widget_set_size_request (checkbutton, 100, 75); gtk_widget_show (checkbutton); label = gtk_label_new ("Add page"); @@ -110,7 +110,7 @@ int main( int argc, frame = gtk_frame_new (bufferf); gtk_container_set_border_width (GTK_CONTAINER (frame), 10); - gtk_widget_set_usize (frame, 100, 75); + gtk_widget_set_size_request (frame, 100, 75); gtk_widget_show (frame); label = gtk_label_new (bufferf); @@ -122,46 +122,46 @@ int main( int argc, } /* Set what page to start at (page 4) */ - gtk_notebook_set_page (GTK_NOTEBOOK(notebook), 3); + gtk_notebook_set_current_page (GTK_NOTEBOOK(notebook), 3); /* Create a bunch of buttons */ button = gtk_button_new_with_label ("close"); - gtk_signal_connect_object (GTK_OBJECT (button), "clicked", + g_signal_connect_swapped (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (delete), NULL); gtk_table_attach_defaults(GTK_TABLE(table), button, 0,1,1,2); gtk_widget_show(button); button = gtk_button_new_with_label ("next page"); - gtk_signal_connect_object (GTK_OBJECT (button), "clicked", - (GtkSignalFunc) gtk_notebook_next_page, + g_signal_connect_swapped (GTK_OBJECT (button), "clicked", + GTK_SIGNAL_FUNC (gtk_notebook_next_page), GTK_OBJECT (notebook)); gtk_table_attach_defaults(GTK_TABLE(table), button, 1,2,1,2); gtk_widget_show(button); button = gtk_button_new_with_label ("prev page"); - gtk_signal_connect_object (GTK_OBJECT (button), "clicked", - (GtkSignalFunc) gtk_notebook_prev_page, + g_signal_connect_swapped (GTK_OBJECT (button), "clicked", + GTK_SIGNAL_FUNC (gtk_notebook_prev_page), GTK_OBJECT (notebook)); gtk_table_attach_defaults(GTK_TABLE(table), button, 2,3,1,2); gtk_widget_show(button); button = gtk_button_new_with_label ("tab position"); - gtk_signal_connect (GTK_OBJECT (button), "clicked", - (GtkSignalFunc) rotate_book, + g_signal_connect (GTK_OBJECT (button), "clicked", + GTK_SIGNAL_FUNC (rotate_book), GTK_OBJECT(notebook)); gtk_table_attach_defaults(GTK_TABLE(table), button, 3,4,1,2); gtk_widget_show(button); button = gtk_button_new_with_label ("tabs/border on/off"); - gtk_signal_connect (GTK_OBJECT (button), "clicked", - (GtkSignalFunc) tabsborder_book, + g_signal_connect (GTK_OBJECT (button), "clicked", + GTK_SIGNAL_FUNC (tabsborder_book), GTK_OBJECT (notebook)); gtk_table_attach_defaults(GTK_TABLE(table), button, 4,5,1,2); gtk_widget_show(button); button = gtk_button_new_with_label ("remove page"); - gtk_signal_connect (GTK_OBJECT (button), "clicked", - (GtkSignalFunc) remove_book, + g_signal_connect (GTK_OBJECT (button), "clicked", + GTK_SIGNAL_FUNC (remove_book), GTK_OBJECT(notebook)); gtk_table_attach_defaults(GTK_TABLE(table), button, 5,6,1,2); gtk_widget_show(button); @@ -171,6 +171,5 @@ int main( int argc, gtk_main (); - return(0); + return 0; } -/* example-end */ diff --git a/examples/packbox/Makefile b/examples/packbox/Makefile index b61a8fc8d5..b837519d75 100644 --- a/examples/packbox/Makefile +++ b/examples/packbox/Makefile @@ -1,8 +1,14 @@ CC = gcc +CFLAGS = -Wall \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED + packbox: packbox.c - $(CC) `pkg-config --cflags gtk+-2.0` packbox.c -o packbox `pkg-config --libs gtk+-2.0` + $(CC) packbox.c -o packbox $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs` clean: rm -f *.o packbox diff --git a/examples/packbox/packbox.c b/examples/packbox/packbox.c index 637836d30a..ed7fa7219a 100644 --- a/examples/packbox/packbox.c +++ b/examples/packbox/packbox.c @@ -1,4 +1,3 @@ -/* example-start packbox packbox.c */ #include #include @@ -9,7 +8,7 @@ gint delete_event( GtkWidget *widget, gpointer data ) { gtk_main_quit(); - return(FALSE); + return FALSE; } /* Make a new hbox filled with button-labels. Arguments for the @@ -85,7 +84,7 @@ int main( int argc, if (argc != 2) { fprintf (stderr, "usage: packbox num, where num is 1, 2, or 3.\n"); /* This just does cleanup in GTK and exits with an exit status of 1. */ - gtk_exit (1); + exit (1); } which = atoi (argv[1]); @@ -96,7 +95,7 @@ int main( int argc, /* You should always remember to connect the delete_event signal * to the main window. This is very important for proper intuitive * behavior */ - gtk_signal_connect (GTK_OBJECT (window), "delete_event", + g_signal_connect (GTK_OBJECT (window), "delete_event", GTK_SIGNAL_FUNC (delete_event), NULL); gtk_container_set_border_width (GTK_CONTAINER (window), 10); @@ -246,7 +245,7 @@ int main( int argc, * and the "end" label will be separated from the other labels in the * hbox. Otherwise, all the widgets in the hbox would be packed as * close together as possible. */ - gtk_widget_set_usize (separator, 400, 5); + gtk_widget_set_size_request (separator, 400, 5); /* pack the separator into the vbox (box1) created near the start * of main() */ gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 5); @@ -260,7 +259,7 @@ int main( int argc, button = gtk_button_new_with_label ("Quit"); /* Setup the signal to terminate the program when the button is clicked */ - gtk_signal_connect_object (GTK_OBJECT (button), "clicked", + g_signal_connect_swapped (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (gtk_main_quit), GTK_OBJECT (window)); /* Pack the button into the quitbox. @@ -288,6 +287,5 @@ int main( int argc, /* Control returns here when gtk_main_quit() is called, but not when * gtk_exit is used. */ - return(0); + return 0; } -/* example-end */ diff --git a/examples/paned/Makefile b/examples/paned/Makefile index dc894a2898..857e53fe26 100644 --- a/examples/paned/Makefile +++ b/examples/paned/Makefile @@ -1,8 +1,16 @@ CC = gcc +#CFLAGS = -Wall \ +# -DG_DISABLE_DEPRECATED \ +# -DGDK_DISABLE_DEPRECATED \ +# -DGDK_PIXBUF_DISABLE_DEPRECATED \ +# -DGTK_DISABLE_DEPRECATED + +CFLAGS = -DGTK_ENABLE_BROKEN + paned: paned.c - $(CC) `pkg-config --cflags gtk+-2.0` paned.c -o paned `pkg-config --libs gtk+-2.0` + $(CC) paned.c -o paned $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs` clean: rm -f *.o paned diff --git a/examples/paned/paned.c b/examples/paned/paned.c index 7fafb33ad5..ce19ea6c86 100644 --- a/examples/paned/paned.c +++ b/examples/paned/paned.c @@ -1,5 +1,5 @@ -/* example-start paned paned.c */ +#include #include /* Create the list of "messages" */ @@ -113,16 +113,12 @@ int main( int argc, gtk_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (gtk_main_quit), NULL); gtk_container_set_border_width (GTK_CONTAINER (window), 10); - gtk_widget_set_usize (GTK_WIDGET(window), 450, 400); + gtk_widget_set_size_request (GTK_WIDGET (window), 450, 400); /* create a vpaned widget and add it to our toplevel window */ vpaned = gtk_vpaned_new (); gtk_container_add (GTK_CONTAINER(window), vpaned); - gtk_paned_set_handle_size (GTK_PANED(vpaned), - 10); - gtk_paned_set_gutter_size (GTK_PANED(vpaned), - 15); gtk_widget_show (vpaned); /* Now create the contents of the two halves of the window */ @@ -138,4 +134,3 @@ int main( int argc, gtk_main (); return 0; } -/* example-end */ diff --git a/examples/pixmap/Makefile b/examples/pixmap/Makefile index 7e421f7cb5..34c625ed6d 100644 --- a/examples/pixmap/Makefile +++ b/examples/pixmap/Makefile @@ -1,8 +1,16 @@ CC = gcc +#CFLAGS = -Wall \ +# -DG_DISABLE_DEPRECATED \ +# -DGDK_DISABLE_DEPRECATED \ +# -DGDK_PIXBUF_DISABLE_DEPRECATED \ +# -DGTK_DISABLE_DEPRECATED + +CFLAGS = + pixmap: pixmap.c - $(CC) `pkg-config --cflags gtk+-2.0` pixmap.c -o pixmap `pkg-config --libs gtk+-2.0` + $(CC) pixmap.c -o pixmap $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs` clean: rm -f *.o pixmap diff --git a/examples/pixmap/pixmap.c b/examples/pixmap/pixmap.c index 8834c9e2b3..71af08e58e 100644 --- a/examples/pixmap/pixmap.c +++ b/examples/pixmap/pixmap.c @@ -1,4 +1,3 @@ -/* example-start pixmap pixmap.c */ #include @@ -87,4 +86,3 @@ int main( int argc, return 0; } -/* example-end */ diff --git a/examples/progressbar/Makefile b/examples/progressbar/Makefile index 4190416192..f13f5ef620 100644 --- a/examples/progressbar/Makefile +++ b/examples/progressbar/Makefile @@ -1,8 +1,16 @@ CC = gcc +#CFLAGS = -Wall \ +# -DG_DISABLE_DEPRECATED \ +# -DGDK_DISABLE_DEPRECATED \ +# -DGDK_PIXBUF_DISABLE_DEPRECATED \ +# -DGTK_DISABLE_DEPRECATED + +CFLAGS = + progressbar: progressbar.c - $(CC) `pkg-config --cflags gtk+-2.0` progressbar.c -o progressbar `pkg-config --libs gtk+-2.0` + $(CC) progressbar.c -o progressbar $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs` clean: rm -f *.o progressbar diff --git a/examples/progressbar/progressbar.c b/examples/progressbar/progressbar.c index 1a824e2869..089df14049 100644 --- a/examples/progressbar/progressbar.c +++ b/examples/progressbar/progressbar.c @@ -1,4 +1,3 @@ -/* example-start progressbar progressbar.c */ #include @@ -29,7 +28,7 @@ gint progress_timeout( gpointer data ) /* As this is a timeout function, return TRUE so that it * continues to get called */ - return(TRUE); + return TRUE; } /* Callback that toggles the text display within the progress @@ -97,9 +96,9 @@ int main( int argc, pdata = g_malloc( sizeof(ProgressData) ); pdata->window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_policy (GTK_WINDOW (pdata->window), FALSE, FALSE, TRUE); + gtk_window_set_resizable (GTK_WINDOW (pdata->window), TRUE); - gtk_signal_connect (GTK_OBJECT (pdata->window), "destroy", + g_signal_connect (GTK_OBJECT (pdata->window), "destroy", GTK_SIGNAL_FUNC (destroy_progress), pdata); gtk_window_set_title (GTK_WINDOW (pdata->window), "GtkProgressBar"); @@ -150,7 +149,7 @@ int main( int argc, gtk_table_attach (GTK_TABLE (table), check, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 5, 5); - gtk_signal_connect (GTK_OBJECT (check), "clicked", + g_signal_connect (GTK_OBJECT (check), "clicked", GTK_SIGNAL_FUNC (toggle_show_text), pdata); gtk_widget_show(check); @@ -160,7 +159,7 @@ int main( int argc, gtk_table_attach (GTK_TABLE (table), check, 0, 1, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 5, 5); - gtk_signal_connect (GTK_OBJECT (check), "clicked", + g_signal_connect (GTK_OBJECT (check), "clicked", GTK_SIGNAL_FUNC (toggle_activity_mode), pdata); gtk_widget_show(check); @@ -176,19 +175,19 @@ int main( int argc, gtk_table_attach (GTK_TABLE (table), button, 2, 3, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 5, 5); - gtk_signal_connect (GTK_OBJECT (button), "clicked", + g_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (set_continuous_mode), pdata); gtk_widget_show (button); /* Add a radio button to select discrete display mode */ button = gtk_radio_button_new_with_label( - gtk_radio_button_group (GTK_RADIO_BUTTON (button)), + gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)), "Discrete"); gtk_table_attach (GTK_TABLE (table), button, 2, 3, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 5, 5); - gtk_signal_connect (GTK_OBJECT (button), "clicked", + g_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (set_discrete_mode), pdata); gtk_widget_show (button); @@ -199,7 +198,7 @@ int main( int argc, /* Add a button to exit the program */ button = gtk_button_new_with_label ("close"); - gtk_signal_connect_object (GTK_OBJECT (button), "clicked", + g_signal_connect_swapped (GTK_OBJECT (button), "clicked", (GtkSignalFunc) gtk_widget_destroy, GTK_OBJECT (pdata->window)); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); @@ -216,6 +215,5 @@ int main( int argc, gtk_main (); - return(0); + return 0; } -/* example-end */ diff --git a/examples/radiobuttons/Makefile b/examples/radiobuttons/Makefile index c62cfad4cb..43efadeee7 100644 --- a/examples/radiobuttons/Makefile +++ b/examples/radiobuttons/Makefile @@ -1,8 +1,14 @@ CC = gcc +CFLAGS = -Wall \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED + radiobuttons: radiobuttons.c - $(CC) `pkg-config --cflags gtk+-2.0` radiobuttons.c -o radiobuttons `pkg-config --libs gtk+-2.0` + $(CC) radiobuttons.c -o radiobuttons $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs` clean: rm -f *.o radiobuttons diff --git a/examples/radiobuttons/radiobuttons.c b/examples/radiobuttons/radiobuttons.c index 8fc81872f6..15399ba190 100644 --- a/examples/radiobuttons/radiobuttons.c +++ b/examples/radiobuttons/radiobuttons.c @@ -1,14 +1,13 @@ -/* example-start radiobuttons radiobuttons.c */ -#include #include +#include gint close_application( GtkWidget *widget, GdkEvent *event, gpointer data ) { gtk_main_quit(); - return(FALSE); + return FALSE; } int main( int argc, @@ -25,7 +24,7 @@ int main( int argc, window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_signal_connect (GTK_OBJECT (window), "delete_event", + g_signal_connect (GTK_OBJECT (window), "delete_event", GTK_SIGNAL_FUNC(close_application), NULL); @@ -45,14 +44,14 @@ int main( int argc, gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); gtk_widget_show (button); - group = gtk_radio_button_group (GTK_RADIO_BUTTON (button)); + group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)); button = gtk_radio_button_new_with_label(group, "button2"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); gtk_widget_show (button); button = gtk_radio_button_new_with_label( - gtk_radio_button_group (GTK_RADIO_BUTTON (button)), + gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)), "button3"); gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); gtk_widget_show (button); @@ -67,7 +66,7 @@ int main( int argc, gtk_widget_show (box2); button = gtk_button_new_with_label ("close"); - gtk_signal_connect_object (GTK_OBJECT (button), "clicked", + g_signal_connect_swapped (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC(close_application), GTK_OBJECT (window)); gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); @@ -78,6 +77,5 @@ int main( int argc, gtk_main(); - return(0); + return 0; } -/* example-end */ diff --git a/examples/rangewidgets/Makefile b/examples/rangewidgets/Makefile index f0e59666ba..4ca6e0dd3d 100644 --- a/examples/rangewidgets/Makefile +++ b/examples/rangewidgets/Makefile @@ -1,8 +1,14 @@ CC = gcc +CFLAGS = -Wall \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED + rangewidgets: rangewidgets.c - $(CC) `pkg-config --cflags gtk+-2.0` rangewidgets.c -o rangewidgets `pkg-config --libs gtk+-2.0` + $(CC) rangewidgets.c -o rangewidgets $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs` clean: rm -f *.o rangewidgets diff --git a/examples/rangewidgets/rangewidgets.c b/examples/rangewidgets/rangewidgets.c index e293664f09..4c38e8c305 100644 --- a/examples/rangewidgets/rangewidgets.c +++ b/examples/rangewidgets/rangewidgets.c @@ -1,4 +1,3 @@ -/* example-start rangewidgets rangewidgets.c */ #include @@ -36,7 +35,7 @@ void cb_page_size( GtkAdjustment *get, set->page_increment = get->value; /* Now emit the "changed" signal to reconfigure all the widgets that * are attached to this adjustment */ - gtk_signal_emit_by_name (GTK_OBJECT (set), "changed"); + g_signal_emit_by_name (GTK_OBJECT (set), "changed"); } void cb_draw_value( GtkToggleButton *button ) @@ -56,11 +55,11 @@ GtkWidget *make_menu_item( gchar *name, GtkWidget *item; item = gtk_menu_item_new_with_label (name); - gtk_signal_connect (GTK_OBJECT (item), "activate", + g_signal_connect (GTK_OBJECT (item), "activate", callback, data); gtk_widget_show (item); - return(item); + return item; } void scale_set_default_values( GtkScale *scale ) @@ -88,7 +87,7 @@ void create_range_controls( void ) /* Standard window-creating stuff */ window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_signal_connect (GTK_OBJECT (window), "destroy", + g_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC(gtk_main_quit), NULL); gtk_window_set_title (GTK_WINDOW (window), "range controls"); @@ -119,7 +118,7 @@ void create_range_controls( void ) /* Reuse the same adjustment */ hscale = gtk_hscale_new (GTK_ADJUSTMENT (adj1)); - gtk_widget_set_usize (GTK_WIDGET (hscale), 200, 30); + gtk_widget_set_size_request (GTK_WIDGET (hscale), 200, 30); scale_set_default_values (GTK_SCALE (hscale)); gtk_box_pack_start (GTK_BOX (box3), hscale, TRUE, TRUE, 0); gtk_widget_show (hscale); @@ -141,7 +140,7 @@ void create_range_controls( void ) /* A checkbutton to control whether the value is displayed or not */ button = gtk_check_button_new_with_label("Display value on scale widgets"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); - gtk_signal_connect (GTK_OBJECT (button), "toggled", + g_signal_connect (GTK_OBJECT (button), "toggled", GTK_SIGNAL_FUNC(cb_draw_value), NULL); gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); gtk_widget_show (button); @@ -160,19 +159,19 @@ void create_range_controls( void ) item = make_menu_item ("Top", GTK_SIGNAL_FUNC(cb_pos_menu_select), GINT_TO_POINTER (GTK_POS_TOP)); - gtk_menu_append (GTK_MENU (menu), item); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); item = make_menu_item ("Bottom", GTK_SIGNAL_FUNC (cb_pos_menu_select), GINT_TO_POINTER (GTK_POS_BOTTOM)); - gtk_menu_append (GTK_MENU (menu), item); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); item = make_menu_item ("Left", GTK_SIGNAL_FUNC (cb_pos_menu_select), GINT_TO_POINTER (GTK_POS_LEFT)); - gtk_menu_append (GTK_MENU (menu), item); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); item = make_menu_item ("Right", GTK_SIGNAL_FUNC (cb_pos_menu_select), GINT_TO_POINTER (GTK_POS_RIGHT)); - gtk_menu_append (GTK_MENU (menu), item); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_option_menu_set_menu (GTK_OPTION_MENU (opt), menu); gtk_box_pack_start (GTK_BOX (box2), opt, TRUE, TRUE, 0); @@ -196,17 +195,17 @@ void create_range_controls( void ) item = make_menu_item ("Continuous", GTK_SIGNAL_FUNC (cb_update_menu_select), GINT_TO_POINTER (GTK_UPDATE_CONTINUOUS)); - gtk_menu_append (GTK_MENU (menu), item); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); item = make_menu_item ("Discontinuous", GTK_SIGNAL_FUNC (cb_update_menu_select), GINT_TO_POINTER (GTK_UPDATE_DISCONTINUOUS)); - gtk_menu_append (GTK_MENU (menu), item); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); item = make_menu_item ("Delayed", GTK_SIGNAL_FUNC (cb_update_menu_select), GINT_TO_POINTER (GTK_UPDATE_DELAYED)); - gtk_menu_append (GTK_MENU (menu), item); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_option_menu_set_menu (GTK_OPTION_MENU (opt), menu); gtk_box_pack_start (GTK_BOX (box2), opt, TRUE, TRUE, 0); @@ -225,7 +224,7 @@ void create_range_controls( void ) gtk_widget_show (label); adj2 = gtk_adjustment_new (1.0, 0.0, 5.0, 1.0, 1.0, 0.0); - gtk_signal_connect (GTK_OBJECT (adj2), "value_changed", + g_signal_connect (GTK_OBJECT (adj2), "value_changed", GTK_SIGNAL_FUNC (cb_digits_scale), NULL); scale = gtk_hscale_new (GTK_ADJUSTMENT (adj2)); gtk_scale_set_digits (GTK_SCALE (scale), 0); @@ -245,7 +244,7 @@ void create_range_controls( void ) gtk_widget_show (label); adj2 = gtk_adjustment_new (1.0, 1.0, 101.0, 1.0, 1.0, 0.0); - gtk_signal_connect (GTK_OBJECT (adj2), "value_changed", + g_signal_connect (GTK_OBJECT (adj2), "value_changed", GTK_SIGNAL_FUNC (cb_page_size), adj1); scale = gtk_hscale_new (GTK_ADJUSTMENT (adj2)); gtk_scale_set_digits (GTK_SCALE (scale), 0); @@ -265,7 +264,7 @@ void create_range_controls( void ) gtk_widget_show (box2); button = gtk_button_new_with_label ("Quit"); - gtk_signal_connect_object (GTK_OBJECT (button), "clicked", + g_signal_connect_swapped (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC(gtk_main_quit), NULL); gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); @@ -285,7 +284,6 @@ int main( int argc, gtk_main(); - return(0); + return 0; } -/* example-end */ diff --git a/examples/rulers/Makefile b/examples/rulers/Makefile index d4eb71b40b..336183ccfc 100644 --- a/examples/rulers/Makefile +++ b/examples/rulers/Makefile @@ -1,8 +1,14 @@ CC = gcc +CFLAGS = -Wall \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED + rulers: rulers.c - $(CC) `pkg-config --cflags gtk+-2.0` rulers.c -o rulers `pkg-config --libs gtk+-2.0` + $(CC) rulers.c -o rulers $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs` clean: rm -f *.o rulers diff --git a/examples/rulers/rulers.c b/examples/rulers/rulers.c index fa933f172d..f001e9f826 100644 --- a/examples/rulers/rulers.c +++ b/examples/rulers/rulers.c @@ -1,8 +1,7 @@ -/* example-start rulers rulers.c */ #include -#define EVENT_METHOD(i, x) GTK_WIDGET_CLASS(GTK_OBJECT(i)->klass)->x +#define EVENT_METHOD(i, x) GTK_WIDGET_GET_CLASS(i)->x #define XSIZE 600 #define YSIZE 400 @@ -13,7 +12,7 @@ gint close_application( GtkWidget *widget, gpointer data ) { gtk_main_quit(); - return(FALSE); + return FALSE; } /* The main routine */ @@ -25,7 +24,7 @@ int main( int argc, gtk_init( &argc, &argv ); window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_signal_connect (GTK_OBJECT (window), "delete_event", + g_signal_connect (GTK_OBJECT (window), "delete_event", GTK_SIGNAL_FUNC( close_application ), NULL); gtk_container_set_border_width (GTK_CONTAINER (window), 10); @@ -34,7 +33,7 @@ int main( int argc, gtk_container_add( GTK_CONTAINER(window), table ); area = gtk_drawing_area_new(); - gtk_drawing_area_size( (GtkDrawingArea *)area, XSIZE, YSIZE ); + gtk_widget_set_size_request (GTK_WIDGET (area), XSIZE, YSIZE); gtk_table_attach( GTK_TABLE(table), area, 1, 2, 1, 2, GTK_EXPAND|GTK_FILL, GTK_FILL, 0, 0 ); gtk_widget_set_events( area, GDK_POINTER_MOTION_MASK | @@ -46,11 +45,10 @@ int main( int argc, hrule = gtk_hruler_new(); gtk_ruler_set_metric( GTK_RULER(hrule), GTK_PIXELS ); gtk_ruler_set_range( GTK_RULER(hrule), 7, 13, 0, 20 ); - gtk_signal_connect_object( GTK_OBJECT(area), "motion_notify_event", + g_signal_connect_swapped( GTK_OBJECT(area), "motion_notify_event", (GtkSignalFunc)EVENT_METHOD(hrule, motion_notify_event), GTK_OBJECT(hrule) ); - /* GTK_WIDGET_CLASS(GTK_OBJECT(hrule)->klass)->motion_notify_event, */ gtk_table_attach( GTK_TABLE(table), hrule, 1, 2, 0, 1, GTK_EXPAND|GTK_SHRINK|GTK_FILL, GTK_FILL, 0, 0 ); @@ -60,10 +58,9 @@ int main( int argc, vrule = gtk_vruler_new(); gtk_ruler_set_metric( GTK_RULER(vrule), GTK_PIXELS ); gtk_ruler_set_range( GTK_RULER(vrule), 0, YSIZE, 10, YSIZE ); - gtk_signal_connect_object( GTK_OBJECT(area), "motion_notify_event", - (GtkSignalFunc) - GTK_WIDGET_CLASS(GTK_OBJECT(vrule)->klass)-> - motion_notify_event, + g_signal_connect_swapped( GTK_OBJECT(area), "motion_notify_event", + (GtkSignalFunc)EVENT_METHOD(vrule, + motion_notify_event), GTK_OBJECT(vrule) ); gtk_table_attach( GTK_TABLE(table), vrule, 0, 1, 1, 2, GTK_FILL, GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0 ); @@ -76,6 +73,5 @@ int main( int argc, gtk_widget_show( window ); gtk_main(); - return(0); + return 0; } -/* example-end */ diff --git a/examples/scribble-simple/Makefile b/examples/scribble-simple/Makefile index 4ded4c9928..53c53aa2a9 100644 --- a/examples/scribble-simple/Makefile +++ b/examples/scribble-simple/Makefile @@ -1,8 +1,14 @@ CC = gcc +CFLAGS = -Wall \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED + scribble-simple: scribble-simple.c - $(CC) `pkg-config --cflags gtk+-2.0` scribble-simple.c -o scribble-simple `pkg-config --libs gtk+-2.0` + $(CC) scribble-simple.c -o scribble-simple $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs` clean: rm -f *.o scribble-simple diff --git a/examples/scribble-simple/scribble-simple.c b/examples/scribble-simple/scribble-simple.c index 3e6bdf30f5..481c670582 100644 --- a/examples/scribble-simple/scribble-simple.c +++ b/examples/scribble-simple/scribble-simple.c @@ -1,4 +1,3 @@ -/* example-start scribble-simple scribble-simple.c */ /* GTK - The GIMP Toolkit * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald @@ -29,7 +28,7 @@ static gint configure_event( GtkWidget *widget, GdkEventConfigure *event ) { if (pixmap) - gdk_pixmap_unref(pixmap); + g_object_unref(pixmap); pixmap = gdk_pixmap_new(widget->window, widget->allocation.width, @@ -49,7 +48,7 @@ static gint configure_event( GtkWidget *widget, static gint expose_event( GtkWidget *widget, GdkEventExpose *event ) { - gdk_draw_pixmap(widget->window, + gdk_draw_drawable(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE (widget)], pixmap, event->area.x, event->area.y, @@ -75,7 +74,9 @@ static void draw_brush( GtkWidget *widget, TRUE, update_rect.x, update_rect.y, update_rect.width, update_rect.height); - gtk_widget_draw (widget, &update_rect); + gtk_widget_queue_draw_area (widget, + update_rect.x, update_rect.y, + update_rect.width, update_rect.height); } static gint button_press_event( GtkWidget *widget, @@ -110,7 +111,7 @@ static gint motion_notify_event( GtkWidget *widget, void quit () { - gtk_exit (0); + exit (0); } int main( int argc, @@ -131,29 +132,29 @@ int main( int argc, gtk_container_add (GTK_CONTAINER (window), vbox); gtk_widget_show (vbox); - gtk_signal_connect (GTK_OBJECT (window), "destroy", + g_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (quit), NULL); /* Create the drawing area */ drawing_area = gtk_drawing_area_new (); - gtk_drawing_area_size (GTK_DRAWING_AREA (drawing_area), 200, 200); + gtk_widget_set_size_request (GTK_WIDGET (drawing_area), 200, 200); gtk_box_pack_start (GTK_BOX (vbox), drawing_area, TRUE, TRUE, 0); gtk_widget_show (drawing_area); /* Signals used to handle backing pixmap */ - gtk_signal_connect (GTK_OBJECT (drawing_area), "expose_event", + g_signal_connect (GTK_OBJECT (drawing_area), "expose_event", (GtkSignalFunc) expose_event, NULL); - gtk_signal_connect (GTK_OBJECT(drawing_area),"configure_event", + g_signal_connect (GTK_OBJECT(drawing_area),"configure_event", (GtkSignalFunc) configure_event, NULL); /* Event signals */ - gtk_signal_connect (GTK_OBJECT (drawing_area), "motion_notify_event", + g_signal_connect (GTK_OBJECT (drawing_area), "motion_notify_event", (GtkSignalFunc) motion_notify_event, NULL); - gtk_signal_connect (GTK_OBJECT (drawing_area), "button_press_event", + g_signal_connect (GTK_OBJECT (drawing_area), "button_press_event", (GtkSignalFunc) button_press_event, NULL); gtk_widget_set_events (drawing_area, GDK_EXPOSURE_MASK @@ -166,7 +167,7 @@ int main( int argc, button = gtk_button_new_with_label ("Quit"); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); - gtk_signal_connect_object (GTK_OBJECT (button), "clicked", + g_signal_connect_swapped (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT (window)); gtk_widget_show (button); @@ -177,4 +178,3 @@ int main( int argc, return 0; } -/* example-end */ diff --git a/examples/scribble-xinput/Makefile b/examples/scribble-xinput/Makefile index 5d38b2a0fc..47d24b4c31 100644 --- a/examples/scribble-xinput/Makefile +++ b/examples/scribble-xinput/Makefile @@ -1,8 +1,14 @@ CC = gcc +CFLAGS = -Wall \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED + scribble-xinput: scribble-xinput.c - $(CC) `pkg-config --cflags gtk+-2.0` scribble-xinput.c -o scribble-xinput `pkg-config --libs gtk+-2.0` + $(CC) scribble-xinput.c -o scribble-xinput $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs` clean: rm -f *.o scribble-xinput diff --git a/examples/scribble-xinput/scribble-xinput.c b/examples/scribble-xinput/scribble-xinput.c index 81d4e6423b..3519b62494 100644 --- a/examples/scribble-xinput/scribble-xinput.c +++ b/examples/scribble-xinput/scribble-xinput.c @@ -1,4 +1,3 @@ -/* example-start scribble-xinput scribble-xinput.c */ /* GTK - The GIMP Toolkit * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald @@ -29,7 +28,7 @@ static gint configure_event (GtkWidget *widget, GdkEventConfigure *event) { if (pixmap) - gdk_pixmap_unref(pixmap); + g_object_unref(pixmap); pixmap = gdk_pixmap_new(widget->window, widget->allocation.width, @@ -49,7 +48,7 @@ configure_event (GtkWidget *widget, GdkEventConfigure *event) static gint expose_event (GtkWidget *widget, GdkEventExpose *event) { - gdk_draw_pixmap(widget->window, + gdk_draw_drawable(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE (widget)], pixmap, event->area.x, event->area.y, @@ -90,39 +89,27 @@ draw_brush (GtkWidget *widget, GdkInputSource source, gdk_draw_rectangle (pixmap, gc, TRUE, update_rect.x, update_rect.y, update_rect.width, update_rect.height); - gtk_widget_draw (widget, &update_rect); + gtk_widget_queue_draw_area (widget, + update_rect.x, update_rect.y, + update_rect.width, update_rect.height); } static void -print_button_press (guint32 deviceid) +print_button_press (GdkDevice *device) { - GList *tmp_list; - - /* gdk_input_list_devices returns an internal list, so we shouldn't - free it afterwards */ - tmp_list = gdk_input_list_devices(); - - while (tmp_list) - { - GdkDeviceInfo *info = (GdkDeviceInfo *)tmp_list->data; - - if (info->deviceid == deviceid) - { - g_print("Button press on device '%s'\n", info->name); - return; - } - - tmp_list = tmp_list->next; - } + g_print("Button press on device '%s'\n", device->name); } static gint button_press_event (GtkWidget *widget, GdkEventButton *event) { - print_button_press (event->deviceid); + print_button_press (event->device); - if (event->button == 1 && pixmap != NULL) - draw_brush (widget, event->source, event->x, event->y, event->pressure); + if (event->button == 1 && pixmap != NULL) { + gdouble pressure; + gdk_event_get_axis ((GdkEvent *)event, GDK_AXIS_PRESSURE, &pressure); + draw_brush (widget, event->device->source, event->x, event->y, pressure); + } return TRUE; } @@ -134,20 +121,23 @@ motion_notify_event (GtkWidget *widget, GdkEventMotion *event) gdouble pressure; GdkModifierType state; - if (event->is_hint) - gdk_input_window_get_pointer (event->window, event->deviceid, - &x, &y, &pressure, - NULL, NULL, &state); + if (event->is_hint) + { + gdk_device_get_state (event->device, event->window, NULL, &state); + gdk_event_get_axis ((GdkEvent *)event, GDK_AXIS_X, &x); + gdk_event_get_axis ((GdkEvent *)event, GDK_AXIS_Y, &y); + gdk_event_get_axis ((GdkEvent *)event, GDK_AXIS_PRESSURE, &pressure); + } else { x = event->x; y = event->y; - pressure = event->pressure; + gdk_event_get_axis ((GdkEvent *)event, GDK_AXIS_PRESSURE, &pressure); state = event->state; } if (state & GDK_BUTTON1_MASK && pixmap != NULL) - draw_brush (widget, event->source, x, y, pressure); + draw_brush (widget, event->device->source, x, y, pressure); return TRUE; } @@ -167,9 +157,9 @@ create_input_dialog () { inputd = gtk_input_dialog_new(); - gtk_signal_connect (GTK_OBJECT(inputd), "destroy", + g_signal_connect (GTK_OBJECT(inputd), "destroy", (GtkSignalFunc)input_dialog_destroy, &inputd); - gtk_signal_connect_object (GTK_OBJECT(GTK_INPUT_DIALOG(inputd)->close_button), + g_signal_connect_swapped (GTK_OBJECT(GTK_INPUT_DIALOG(inputd)->close_button), "clicked", (GtkSignalFunc)gtk_widget_hide, GTK_OBJECT(inputd)); @@ -189,7 +179,7 @@ create_input_dialog () void quit () { - gtk_exit (0); + exit (0); } int @@ -210,29 +200,29 @@ main (int argc, char *argv[]) gtk_container_add (GTK_CONTAINER (window), vbox); gtk_widget_show (vbox); - gtk_signal_connect (GTK_OBJECT (window), "destroy", + g_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (quit), NULL); /* Create the drawing area */ drawing_area = gtk_drawing_area_new (); - gtk_drawing_area_size (GTK_DRAWING_AREA (drawing_area), 200, 200); + gtk_widget_set_size_request (GTK_WIDGET (drawing_area), 200, 200); gtk_box_pack_start (GTK_BOX (vbox), drawing_area, TRUE, TRUE, 0); gtk_widget_show (drawing_area); /* Signals used to handle backing pixmap */ - gtk_signal_connect (GTK_OBJECT (drawing_area), "expose_event", + g_signal_connect (GTK_OBJECT (drawing_area), "expose_event", (GtkSignalFunc) expose_event, NULL); - gtk_signal_connect (GTK_OBJECT(drawing_area),"configure_event", + g_signal_connect (GTK_OBJECT(drawing_area),"configure_event", (GtkSignalFunc) configure_event, NULL); /* Event signals */ - gtk_signal_connect (GTK_OBJECT (drawing_area), "motion_notify_event", + g_signal_connect (GTK_OBJECT (drawing_area), "motion_notify_event", (GtkSignalFunc) motion_notify_event, NULL); - gtk_signal_connect (GTK_OBJECT (drawing_area), "button_press_event", + g_signal_connect (GTK_OBJECT (drawing_area), "button_press_event", (GtkSignalFunc) button_press_event, NULL); gtk_widget_set_events (drawing_area, GDK_EXPOSURE_MASK @@ -249,14 +239,14 @@ main (int argc, char *argv[]) button = gtk_button_new_with_label ("Input Dialog"); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); - gtk_signal_connect (GTK_OBJECT (button), "clicked", + g_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (create_input_dialog), NULL); gtk_widget_show (button); button = gtk_button_new_with_label ("Quit"); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); - gtk_signal_connect_object (GTK_OBJECT (button), "clicked", + g_signal_connect_swapped (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT (window)); gtk_widget_show (button); @@ -267,4 +257,3 @@ main (int argc, char *argv[]) return 0; } -/* example-end */ diff --git a/examples/scrolledwin/Makefile b/examples/scrolledwin/Makefile index ae74e82830..2f07fd50e8 100644 --- a/examples/scrolledwin/Makefile +++ b/examples/scrolledwin/Makefile @@ -1,8 +1,14 @@ CC = gcc +CFLAGS = -Wall \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED + scrolledwin: scrolledwin.c - $(CC) `pkg-config --cflags gtk+-2.0` scrolledwin.c -o scrolledwin `pkg-config --libs gtk+-2.0` + $(CC) scrolledwin.c -o scrolledwin $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs` clean: rm -f *.o scrolledwin diff --git a/examples/scrolledwin/scrolledwin.c b/examples/scrolledwin/scrolledwin.c index 977dcf20fd..3c9caef70f 100644 --- a/examples/scrolledwin/scrolledwin.c +++ b/examples/scrolledwin/scrolledwin.c @@ -1,5 +1,5 @@ -/* example-start scrolledwin scrolledwin.c */ +#include #include void destroy( GtkWidget *widget, @@ -23,11 +23,11 @@ int main( int argc, /* Create a new dialog window for the scrolled window to be * packed into. */ window = gtk_dialog_new (); - gtk_signal_connect (GTK_OBJECT (window), "destroy", + g_signal_connect (GTK_OBJECT (window), "destroy", (GtkSignalFunc) destroy, NULL); gtk_window_set_title (GTK_WINDOW (window), "GtkScrolledWindow example"); gtk_container_set_border_width (GTK_CONTAINER (window), 0); - gtk_widget_set_usize(window, 300, 300); + gtk_widget_set_size_request (window, 300, 300); /* create a new scrolled window. */ scrolled_window = gtk_scrolled_window_new (NULL, NULL); @@ -71,7 +71,7 @@ int main( int argc, /* Add a "close" button to the bottom of the dialog */ button = gtk_button_new_with_label ("close"); - gtk_signal_connect_object (GTK_OBJECT (button), "clicked", + g_signal_connect_swapped (GTK_OBJECT (button), "clicked", (GtkSignalFunc) gtk_widget_destroy, GTK_OBJECT (window)); @@ -89,6 +89,5 @@ int main( int argc, gtk_main(); - return(0); + return 0; } -/* example-end */ diff --git a/examples/selection/Makefile b/examples/selection/Makefile index fad63ff099..eb07c9635a 100644 --- a/examples/selection/Makefile +++ b/examples/selection/Makefile @@ -1,13 +1,19 @@ CC = gcc +CFLAGS = -Wall \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED + all: gettargets setselection gettargets: gettargets.c - $(CC) `pkg-config --cflags gtk+-2.0` gettargets.c -o gettargets `pkg-config --libs gtk+-2.0` + $(CC) gettargets.c -o gettargets $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs` setselection: setselection.c - $(CC) `pkg-config --cflags gtk+-2.0` setselection.c -o setselection `pkg-config --libs gtk+-2.0` + $(CC) setselection.c -o setselection $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs` clean: rm -f *.o gettargets setselection diff --git a/examples/selection/gettargets.c b/examples/selection/gettargets.c index 20292c700b..45d6af4ae8 100644 --- a/examples/selection/gettargets.c +++ b/examples/selection/gettargets.c @@ -1,5 +1,5 @@ -/* example-start selection gettargets.c */ +#include #include void selection_received( GtkWidget *widget, @@ -74,17 +74,17 @@ int main( int argc, gtk_window_set_title (GTK_WINDOW (window), "Event Box"); gtk_container_set_border_width (GTK_CONTAINER (window), 10); - gtk_signal_connect (GTK_OBJECT (window), "destroy", - GTK_SIGNAL_FUNC (gtk_exit), NULL); + g_signal_connect (GTK_OBJECT (window), "destroy", + GTK_SIGNAL_FUNC (exit), NULL); /* Create a button the user can click to get targets */ button = gtk_button_new_with_label ("Get Targets"); gtk_container_add (GTK_CONTAINER (window), button); - gtk_signal_connect (GTK_OBJECT(button), "clicked", + g_signal_connect (GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC (get_targets), NULL); - gtk_signal_connect (GTK_OBJECT(button), "selection_received", + g_signal_connect (GTK_OBJECT(button), "selection_received", GTK_SIGNAL_FUNC (selection_received), NULL); gtk_widget_show (button); @@ -94,4 +94,3 @@ int main( int argc, return 0; } -/* example-end */ diff --git a/examples/selection/setselection.c b/examples/selection/setselection.c index 690aa49c6c..fe93c44894 100644 --- a/examples/selection/setselection.c +++ b/examples/selection/setselection.c @@ -1,5 +1,5 @@ -/* example-start selection setselection.c */ +#include #include #include @@ -77,8 +77,8 @@ int main( int argc, gtk_window_set_title (GTK_WINDOW (window), "Event Box"); gtk_container_set_border_width (GTK_CONTAINER (window), 10); - gtk_signal_connect (GTK_OBJECT (window), "destroy", - GTK_SIGNAL_FUNC (gtk_exit), NULL); + g_signal_connect (GTK_OBJECT (window), "destroy", + GTK_SIGNAL_FUNC (exit), NULL); /* Create a toggle button to act as the selection */ @@ -86,16 +86,16 @@ int main( int argc, gtk_container_add (GTK_CONTAINER (window), selection_button); gtk_widget_show (selection_button); - gtk_signal_connect (GTK_OBJECT(selection_button), "toggled", + g_signal_connect (GTK_OBJECT(selection_button), "toggled", GTK_SIGNAL_FUNC (selection_toggled), &have_selection); - gtk_signal_connect (GTK_OBJECT(selection_button), "selection_clear_event", + g_signal_connect (GTK_OBJECT(selection_button), "selection_clear_event", GTK_SIGNAL_FUNC (selection_clear), &have_selection); gtk_selection_add_target (selection_button, GDK_SELECTION_PRIMARY, GDK_SELECTION_TYPE_STRING, 1); - gtk_signal_connect (GTK_OBJECT(selection_button), "selection_get", + g_signal_connect (GTK_OBJECT(selection_button), "selection_get", GTK_SIGNAL_FUNC (selection_handle), &have_selection); gtk_widget_show (selection_button); @@ -105,4 +105,3 @@ int main( int argc, return 0; } -/* example-end */ diff --git a/examples/spinbutton/Makefile b/examples/spinbutton/Makefile index 8963922d4a..be4bcbfbe0 100644 --- a/examples/spinbutton/Makefile +++ b/examples/spinbutton/Makefile @@ -1,8 +1,14 @@ CC = gcc +CFLAGS = -Wall \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED + spinbutton: spinbutton.c - $(CC) `pkg-config --cflags gtk+-2.0` spinbutton.c -o spinbutton `pkg-config --libs gtk+-2.0` + $(CC) spinbutton.c -o spinbutton $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs` clean: rm -f *.o spinbutton diff --git a/examples/spinbutton/spinbutton.c b/examples/spinbutton/spinbutton.c index 6b26d09a64..7bd1d91885 100644 --- a/examples/spinbutton/spinbutton.c +++ b/examples/spinbutton/spinbutton.c @@ -1,5 +1,5 @@ -/* example-start spinbutton spinbutton.c */ +#include #include static GtkWidget *spinner1; @@ -31,12 +31,12 @@ void get_value( GtkWidget *widget, GtkSpinButton *spin; spin = GTK_SPIN_BUTTON (spinner1); - label = GTK_LABEL (gtk_object_get_user_data (GTK_OBJECT (widget))); + label = GTK_LABEL (g_object_get_data (G_OBJECT (widget), "user_data")); if (GPOINTER_TO_INT (data) == 1) sprintf (buf, "%d", gtk_spin_button_get_value_as_int (spin)); else sprintf (buf, "%0.*f", spin->digits, - gtk_spin_button_get_value_as_float (spin)); + gtk_spin_button_get_value (spin)); gtk_label_set_text (label, buf); } @@ -62,7 +62,7 @@ int main( int argc, window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_signal_connect (GTK_OBJECT (window), "destroy", + g_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (gtk_main_quit), NULL); @@ -121,7 +121,7 @@ int main( int argc, 1.0, 100.0, 0.0); spinner = gtk_spin_button_new (adj, 0, 0); gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spinner), FALSE); - gtk_widget_set_usize (spinner, 55, 0); + gtk_widget_set_size_request (spinner, 55, -1); gtk_box_pack_start (GTK_BOX (vbox2), spinner, FALSE, TRUE, 0); frame = gtk_frame_new ("Accelerated"); @@ -145,7 +145,7 @@ int main( int argc, 0.5, 100.0, 0.0); spinner1 = gtk_spin_button_new (adj, 1.0, 2); gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spinner1), TRUE); - gtk_widget_set_usize (spinner1, 100, 0); + gtk_widget_set_size_request (spinner1, 100, -1); gtk_box_pack_start (GTK_BOX (vbox2), spinner1, FALSE, TRUE, 0); vbox2 = gtk_vbox_new (FALSE, 0); @@ -158,7 +158,7 @@ int main( int argc, adj = (GtkAdjustment *) gtk_adjustment_new (2, 1, 5, 1, 1, 0); spinner2 = gtk_spin_button_new (adj, 0.0, 0); gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spinner2), TRUE); - gtk_signal_connect (GTK_OBJECT (adj), "value_changed", + g_signal_connect (GTK_OBJECT (adj), "value_changed", GTK_SIGNAL_FUNC (change_digits), (gpointer) spinner2); gtk_box_pack_start (GTK_BOX (vbox2), spinner2, FALSE, TRUE, 0); @@ -167,14 +167,14 @@ int main( int argc, gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 5); button = gtk_check_button_new_with_label ("Snap to 0.5-ticks"); - gtk_signal_connect (GTK_OBJECT (button), "clicked", + g_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (toggle_snap), spinner1); gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); button = gtk_check_button_new_with_label ("Numeric only input mode"); - gtk_signal_connect (GTK_OBJECT (button), "clicked", + g_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (toggle_numeric), spinner1); gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0); @@ -185,15 +185,15 @@ int main( int argc, hbox = gtk_hbox_new (FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 5); button = gtk_button_new_with_label ("Value as Int"); - gtk_object_set_user_data (GTK_OBJECT (button), val_label); - gtk_signal_connect (GTK_OBJECT (button), "clicked", + g_object_set_data (G_OBJECT (button), "user_data", val_label); + g_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (get_value), GINT_TO_POINTER (1)); gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 5); button = gtk_button_new_with_label ("Value as Float"); - gtk_object_set_user_data (GTK_OBJECT (button), val_label); - gtk_signal_connect (GTK_OBJECT (button), "clicked", + g_object_set_data (G_OBJECT (button), "user_data", val_label); + g_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (get_value), GINT_TO_POINTER (2)); gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 5); @@ -205,7 +205,7 @@ int main( int argc, gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, TRUE, 0); button = gtk_button_new_with_label ("Close"); - gtk_signal_connect_object (GTK_OBJECT (button), "clicked", + g_signal_connect_swapped (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT (window)); gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 5); @@ -215,6 +215,5 @@ int main( int argc, /* Enter the event loop */ gtk_main (); - return(0); + return 0; } -/* example-end */ diff --git a/examples/statusbar/Makefile b/examples/statusbar/Makefile index 6ca8eaf1a3..e2bf326ba5 100644 --- a/examples/statusbar/Makefile +++ b/examples/statusbar/Makefile @@ -1,8 +1,14 @@ CC = gcc +CFLAGS = -Wall \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED + statusbar: statusbar.c - $(CC) `pkg-config --cflags gtk+-2.0` statusbar.c -o statusbar `pkg-config --libs gtk+-2.0` + $(CC) statusbar.c -o statusbar $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs` clean: rm -f *.o statusbar diff --git a/examples/statusbar/statusbar.c b/examples/statusbar/statusbar.c index c738bf02c0..55e1bda9b1 100644 --- a/examples/statusbar/statusbar.c +++ b/examples/statusbar/statusbar.c @@ -1,5 +1,5 @@ -/* example-start statusbar statusbar.c */ +#include #include #include @@ -38,10 +38,10 @@ int main( int argc, /* create a new window */ window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_widget_set_usize( GTK_WIDGET (window), 200, 100); + gtk_widget_set_size_request (GTK_WIDGET (window), 200, 100); gtk_window_set_title(GTK_WINDOW (window), "GTK Statusbar Example"); - gtk_signal_connect(GTK_OBJECT (window), "delete_event", - (GtkSignalFunc) gtk_exit, NULL); + g_signal_connect(GTK_OBJECT (window), "delete_event", + GTK_SIGNAL_FUNC (exit), NULL); vbox = gtk_vbox_new(FALSE, 1); gtk_container_add(GTK_CONTAINER(window), vbox); @@ -55,23 +55,15 @@ int main( int argc, GTK_STATUSBAR(status_bar), "Statusbar example"); button = gtk_button_new_with_label("push item"); - gtk_signal_connect(GTK_OBJECT(button), "clicked", + g_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC (push_item), GINT_TO_POINTER(context_id) ); gtk_box_pack_start(GTK_BOX(vbox), button, TRUE, TRUE, 2); gtk_widget_show(button); button = gtk_button_new_with_label("pop last item"); - gtk_signal_connect(GTK_OBJECT(button), "clicked", + g_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC (pop_item), GINT_TO_POINTER(context_id) ); gtk_box_pack_start(GTK_BOX(vbox), button, TRUE, TRUE, 2); - gtk_widget_show(button); + gtk_widget_show(button); /* always display the window as the last step so it all splashes on - * the screen at once. */ - gtk_widget_show(window); - - gtk_main (); - - return 0; -} -/* example-end */ diff --git a/examples/table/Makefile b/examples/table/Makefile index b6221ef637..98cbc50b02 100644 --- a/examples/table/Makefile +++ b/examples/table/Makefile @@ -1,8 +1,14 @@ CC = gcc +CFLAGS = -Wall \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED + table: table.c - $(CC) `pkg-config --cflags gtk+-2.0` table.c -o table `pkg-config --libs gtk+-2.0` + $(CC) table.c -o table $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs` clean: rm -f *.o table diff --git a/examples/table/table.c b/examples/table/table.c index a6b020c149..5311ff4db2 100644 --- a/examples/table/table.c +++ b/examples/table/table.c @@ -1,4 +1,3 @@ -/* example-start table table.c */ #include @@ -16,7 +15,7 @@ gint delete_event( GtkWidget *widget, gpointer data ) { gtk_main_quit (); - return(FALSE); + return FALSE; } int main( int argc, @@ -36,7 +35,7 @@ int main( int argc, /* Set a handler for delete_event that immediately * exits GTK. */ - gtk_signal_connect (GTK_OBJECT (window), "delete_event", + g_signal_connect (GTK_OBJECT (window), "delete_event", GTK_SIGNAL_FUNC (delete_event), NULL); /* Sets the border width of the window. */ @@ -53,7 +52,7 @@ int main( int argc, /* 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", + g_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (callback), (gpointer) "button 1"); @@ -68,7 +67,7 @@ int main( int argc, /* 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", + g_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (callback), (gpointer) "button 2"); /* Insert button 2 into the upper right quadrant of the table */ gtk_table_attach_defaults (GTK_TABLE(table), button, 1, 2, 0, 1); @@ -80,7 +79,7 @@ int main( int argc, /* When the button is clicked, we call the "delete_event" function * and the program exits */ - gtk_signal_connect (GTK_OBJECT (button), "clicked", + g_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (delete_event), NULL); /* Insert the quit button into the both @@ -96,4 +95,3 @@ int main( int argc, return 0; } -/* example-end */ diff --git a/examples/text/Makefile b/examples/text/Makefile index 627aab3139..59e77b6afd 100644 --- a/examples/text/Makefile +++ b/examples/text/Makefile @@ -1,8 +1,14 @@ CC = gcc +CFLAGS = -Wall \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED + text: text.c - $(CC) `pkg-config --cflags gtk+-2.0` text.c -o text `pkg-config --libs gtk+-2.0` + $(CC) text.c -o text $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs` clean: rm -f *.o text diff --git a/examples/text/text.c b/examples/text/text.c index d94e06f564..65e94a7d8d 100644 --- a/examples/text/text.c +++ b/examples/text/text.c @@ -1,7 +1,7 @@ -/* example-start text text.c */ /* text.c */ +#define GTK_ENABLE_BROKEN #include #include @@ -47,7 +47,7 @@ int main( int argc, gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_widget_set_usize (window, 600, 500); + gtk_widget_set_size_request (window, 600, 500); gtk_window_set_policy (GTK_WINDOW(window), TRUE, TRUE, FALSE); gtk_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC(close_application), @@ -181,4 +181,3 @@ int main( int argc, return(0); } -/* example-end */ diff --git a/examples/tictactoe/Makefile b/examples/tictactoe/Makefile index 5fe6eb3565..f9b2cb03e1 100644 --- a/examples/tictactoe/Makefile +++ b/examples/tictactoe/Makefile @@ -1,14 +1,20 @@ CC = gcc +CFLAGS = -Wall \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED + ttt_test: tictactoe.o ttt_test.o $(CC) ttt_test.o tictactoe.o -o ttt_test `pkg-config --libs gtk+-2.0` ttt_test.o: ttt_test.c tictactoe.h - $(CC) `pkg-config --cflags gtk+-2.0` -c ttt_test.c -o ttt_test.o + $(CC) -c ttt_test.c -o ttt_test.o $(CFLAGS) `pkg-config gtk+-2.0 --cflags` tictactoe.o: tictactoe.c tictactoe.h - $(CC) `pkg-config --cflags gtk+-2.0` -c tictactoe.c -o tictactoe.o + $(CC) -c tictactoe.c -o tictactoe.o $(CFLAGS) `pkg-config gtk+-2.0 --cflags` clean: rm -f *.o ttt_test diff --git a/examples/tictactoe/tictactoe.c b/examples/tictactoe/tictactoe.c index 040d472ea3..0625c5179d 100644 --- a/examples/tictactoe/tictactoe.c +++ b/examples/tictactoe/tictactoe.c @@ -1,4 +1,3 @@ -/* example-start tictactoe tictactoe.c */ /* GTK - The GIMP Toolkit * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald @@ -34,25 +33,27 @@ static void tictactoe_toggle (GtkWidget *widget, Tictactoe *ttt); static gint tictactoe_signals[LAST_SIGNAL] = { 0 }; -guint +GType tictactoe_get_type () { - static guint ttt_type = 0; + static GType ttt_type = 0; if (!ttt_type) { - GtkTypeInfo ttt_info = + static const GTypeInfo ttt_info = { - "Tictactoe", - sizeof (Tictactoe), sizeof (TictactoeClass), - (GtkClassInitFunc) tictactoe_class_init, - (GtkObjectInitFunc) tictactoe_init, - (GtkArgSetFunc) NULL, - (GtkArgGetFunc) NULL + NULL, + NULL, + (GClassInitFunc) tictactoe_class_init, + NULL, + NULL, + sizeof (Tictactoe), + 0, + (GInstanceInitFunc) tictactoe_init, }; - ttt_type = gtk_type_unique (gtk_vbox_get_type (), &ttt_info); + ttt_type = g_type_register_static (GTK_TYPE_VBOX, "Tictactoe", &ttt_info, 0); } return ttt_type; @@ -65,17 +66,16 @@ tictactoe_class_init (TictactoeClass *class) object_class = (GtkObjectClass*) class; - tictactoe_signals[TICTACTOE_SIGNAL] = gtk_signal_new ("tictactoe", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (TictactoeClass, - tictactoe), - gtk_signal_default_marshaller, - GTK_TYPE_NONE, 0); + tictactoe_signals[TICTACTOE_SIGNAL] = g_signal_new ("tictactoe", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_FIRST, + 0, + NULL, + NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0, NULL); - gtk_object_class_add_signals (object_class, tictactoe_signals, LAST_SIGNAL); - class->tictactoe = NULL; } @@ -95,9 +95,9 @@ tictactoe_init (Tictactoe *ttt) ttt->buttons[i][j] = gtk_toggle_button_new (); gtk_table_attach_defaults (GTK_TABLE(table), ttt->buttons[i][j], i, i+1, j, j+1); - gtk_signal_connect (GTK_OBJECT (ttt->buttons[i][j]), "toggled", + g_signal_connect (GTK_OBJECT (ttt->buttons[i][j]), "toggled", GTK_SIGNAL_FUNC (tictactoe_toggle), ttt); - gtk_widget_set_usize (ttt->buttons[i][j], 20, 20); + gtk_widget_set_size_request (ttt->buttons[i][j], 20, 20); gtk_widget_show (ttt->buttons[i][j]); } } @@ -105,7 +105,7 @@ tictactoe_init (Tictactoe *ttt) GtkWidget* tictactoe_new () { - return GTK_WIDGET ( gtk_type_new (tictactoe_get_type ())); + return GTK_WIDGET (g_object_new (tictactoe_get_type (), NULL)); } void @@ -116,10 +116,10 @@ tictactoe_clear (Tictactoe *ttt) for (i=0;i<3;i++) for (j=0;j<3;j++) { - gtk_signal_handler_block_by_data (GTK_OBJECT(ttt->buttons[i][j]), ttt); + g_signal_handlers_block_by_func (GTK_OBJECT(ttt->buttons[i][j]), NULL, ttt); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ttt->buttons[i][j]), FALSE); - gtk_signal_handler_unblock_by_data (GTK_OBJECT(ttt->buttons[i][j]), ttt); + g_signal_handlers_unblock_by_func (GTK_OBJECT(ttt->buttons[i][j]), NULL, ttt); } } @@ -152,11 +152,10 @@ tictactoe_toggle (GtkWidget *widget, Tictactoe *ttt) if (success && found) { - gtk_signal_emit (GTK_OBJECT (ttt), - tictactoe_signals[TICTACTOE_SIGNAL]); + g_signal_emit (GTK_OBJECT (ttt), + tictactoe_signals[TICTACTOE_SIGNAL], 0); break; } } } -/* example-end */ diff --git a/examples/tictactoe/tictactoe.h b/examples/tictactoe/tictactoe.h index 6dfa203ad7..f36df1913e 100644 --- a/examples/tictactoe/tictactoe.h +++ b/examples/tictactoe/tictactoe.h @@ -1,4 +1,3 @@ -/* example-start tictactoe tictactoe.h */ /* GTK - The GIMP Toolkit * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald @@ -52,7 +51,7 @@ struct _TictactoeClass void (* tictactoe) (Tictactoe *ttt); }; -guint tictactoe_get_type (void); +GtkType tictactoe_get_type (void); GtkWidget* tictactoe_new (void); void tictactoe_clear (Tictactoe *ttt); @@ -62,4 +61,3 @@ void tictactoe_clear (Tictactoe *ttt); #endif /* __TICTACTOE_H__ */ -/* example-end */ diff --git a/examples/tictactoe/ttt_test.c b/examples/tictactoe/ttt_test.c index 82941e8930..6d25f38578 100644 --- a/examples/tictactoe/ttt_test.c +++ b/examples/tictactoe/ttt_test.c @@ -1,5 +1,5 @@ -/* example-start tictactoe ttt_test.c */ +#include #include #include "tictactoe.h" @@ -22,8 +22,8 @@ int main( int argc, gtk_window_set_title (GTK_WINDOW (window), "Aspect Frame"); - gtk_signal_connect (GTK_OBJECT (window), "destroy", - GTK_SIGNAL_FUNC (gtk_exit), NULL); + g_signal_connect (GTK_OBJECT (window), "destroy", + GTK_SIGNAL_FUNC (exit), NULL); gtk_container_set_border_width (GTK_CONTAINER (window), 10); @@ -32,7 +32,7 @@ int main( int argc, gtk_container_add (GTK_CONTAINER (window), ttt); gtk_widget_show (ttt); - gtk_signal_connect (GTK_OBJECT (ttt), "tictactoe", + g_signal_connect (GTK_OBJECT (ttt), "tictactoe", GTK_SIGNAL_FUNC (win), NULL); gtk_widget_show (window); @@ -42,4 +42,3 @@ int main( int argc, return 0; } -/* example-end */ diff --git a/examples/tree/Makefile b/examples/tree/Makefile index 015f78ece4..de510b9b89 100644 --- a/examples/tree/Makefile +++ b/examples/tree/Makefile @@ -1,8 +1,14 @@ CC = gcc +CFLAGS = -Wall \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED + tree: tree.c - $(CC) `pkg-config --cflags gtk+-2.0` tree.c -o tree `pkg-config --libs gtk+-2.0` + $(CC) tree.c -o tree $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs` clean: rm -f *.o tree diff --git a/examples/tree/tree.c b/examples/tree/tree.c index 67b93fe283..acd431e13f 100644 --- a/examples/tree/tree.c +++ b/examples/tree/tree.c @@ -1,5 +1,5 @@ -/* example-start tree tree.c */ +#define GTK_ENABLE_BROKEN #include /* for all the GtkItem:: and GtkTreeItem:: signals */ @@ -44,7 +44,7 @@ static void cb_selection_changed( GtkWidget *tree ) g_print ("selection_change called for tree %p\n", tree); g_print ("selected objects are:\n"); - i = GTK_TREE_SELECTION(tree); + i = GTK_TREE_SELECTION_OLD(tree); while (i){ gchar *name; GtkLabel *label; @@ -81,7 +81,7 @@ int main( int argc, gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_widget_set_usize (scrolled_win, 150, 200); + gtk_widget_set_size_request (scrolled_win, 150, 200); gtk_container_add (GTK_CONTAINER(window), scrolled_win); gtk_widget_show (scrolled_win); @@ -179,4 +179,3 @@ int main( int argc, gtk_main(); return 0; } -/* example-end */ diff --git a/examples/wheelbarrow/Makefile b/examples/wheelbarrow/Makefile index b004ca9183..e51c26c565 100644 --- a/examples/wheelbarrow/Makefile +++ b/examples/wheelbarrow/Makefile @@ -1,8 +1,14 @@ CC = gcc +CFLAGS = -Wall \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED + wheelbarrow: wheelbarrow.c - $(CC) `pkg-config --cflags gtk+-2.0` wheelbarrow.c -o wheelbarrow `pkg-config --libs gtk+-2.0` + $(CC) wheelbarrow.c -o wheelbarrow $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs` clean: rm -f *.o wheelbarrow diff --git a/examples/wheelbarrow/wheelbarrow.c b/examples/wheelbarrow/wheelbarrow.c index 5d1df1d155..a0a7cd5412 100644 --- a/examples/wheelbarrow/wheelbarrow.c +++ b/examples/wheelbarrow/wheelbarrow.c @@ -1,4 +1,3 @@ -/* example-start wheelbarrow wheelbarrow.c */ #include @@ -143,7 +142,7 @@ int main (int argc, * since we're making it a popup. */ gtk_init (&argc, &argv); window = gtk_window_new( GTK_WINDOW_POPUP ); - gtk_signal_connect (GTK_OBJECT (window), "delete_event", + g_signal_connect (GTK_OBJECT (window), "delete_event", GTK_SIGNAL_FUNC (close_application), NULL); gtk_widget_show (window); @@ -153,12 +152,12 @@ int main (int argc, gdk_pixmap = gdk_pixmap_create_from_xpm_d( window->window, &mask, &style->bg[GTK_STATE_NORMAL], WheelbarrowFull_xpm ); - pixmap = gtk_pixmap_new( gdk_pixmap, mask ); + pixmap = gtk_image_new_from_pixmap (gdk_pixmap, mask); gtk_widget_show( pixmap ); /* To display the pixmap, we use a fixed widget to place the pixmap */ fixed = gtk_fixed_new(); - gtk_widget_set_usize( fixed, 200, 200 ); + gtk_widget_set_size_request (fixed, 200, 200); gtk_fixed_put( GTK_FIXED(fixed), pixmap, 0, 0 ); gtk_container_add( GTK_CONTAINER(window), fixed ); gtk_widget_show( fixed ); @@ -167,10 +166,9 @@ int main (int argc, gtk_widget_shape_combine_mask( window, mask, 0, 0 ); /* show the window */ - gtk_widget_set_uposition( window, 20, 400 ); + /*gtk_widget_set_uposition( window, 20, 400 );*/ gtk_widget_show( window ); gtk_main (); - return(0); + return 0; } -/* example-end */