diff options
author | Matthias Clasen <matthiasc@src.gnome.org> | 2002-02-16 23:52:30 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2002-02-16 23:52:30 +0000 |
commit | b3d5f148e6c0e2cb688403655c7800b762e33602 (patch) | |
tree | 1056439dd24e464adbabc5c374182a886c669345 /examples/buttons | |
parent | 554838e4f602d59f5be241d1da188934d51d49c3 (diff) | |
download | gtk+-b3d5f148e6c0e2cb688403655c7800b762e33602.tar.gz |
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.
Diffstat (limited to 'examples/buttons')
-rw-r--r-- | examples/buttons/Makefile | 8 | ||||
-rw-r--r-- | examples/buttons/buttons.c | 20 |
2 files changed, 17 insertions, 11 deletions
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 <stdlib.h> #include <gtk/gtk.h> /* 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 */ |