Commit a2dafdfc authored by GMT 1999 Tony Gale's avatar GMT 1999 Tony Gale Committed by Tony Gale

- Replace all uses of deprecated functions. - Replace menufactory example

Thu Jan 28 10:16:28 GMT 1999 Tony Gale  <gale@gtk.org>

        * docs/gtk_tut.sgml:
          - Replace all uses of deprecated functions.
          - Replace menufactory example with itemfactory example
            from Nick Scott <mendigo@geocities.com>
          - Minor bug fixes in the examples.
parent a7000587
Thu Jan 28 10:16:28 GMT 1999 Tony Gale <gale@gtk.org>
* docs/gtk_tut.sgml:
- Replace all uses of deprecated functions.
- Replace menufactory example with itemfactory example
from Nick Scott <mendigo@geocities.com>
- Minor bug fixes in the examples.
1999-01-28 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gdk/gdkim.c:
......
Thu Jan 28 10:16:28 GMT 1999 Tony Gale <gale@gtk.org>
* docs/gtk_tut.sgml:
- Replace all uses of deprecated functions.
- Replace menufactory example with itemfactory example
from Nick Scott <mendigo@geocities.com>
- Minor bug fixes in the examples.
1999-01-28 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gdk/gdkim.c:
......
Thu Jan 28 10:16:28 GMT 1999 Tony Gale <gale@gtk.org>
* docs/gtk_tut.sgml:
- Replace all uses of deprecated functions.
- Replace menufactory example with itemfactory example
from Nick Scott <mendigo@geocities.com>
- Minor bug fixes in the examples.
1999-01-28 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gdk/gdkim.c:
......
Thu Jan 28 10:16:28 GMT 1999 Tony Gale <gale@gtk.org>
* docs/gtk_tut.sgml:
- Replace all uses of deprecated functions.
- Replace menufactory example with itemfactory example
from Nick Scott <mendigo@geocities.com>
- Minor bug fixes in the examples.
1999-01-28 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gdk/gdkim.c:
......
Thu Jan 28 10:16:28 GMT 1999 Tony Gale <gale@gtk.org>
* docs/gtk_tut.sgml:
- Replace all uses of deprecated functions.
- Replace menufactory example with itemfactory example
from Nick Scott <mendigo@geocities.com>
- Minor bug fixes in the examples.
1999-01-28 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gdk/gdkim.c:
......
Thu Jan 28 10:16:28 GMT 1999 Tony Gale <gale@gtk.org>
* docs/gtk_tut.sgml:
- Replace all uses of deprecated functions.
- Replace menufactory example with itemfactory example
from Nick Scott <mendigo@geocities.com>
- Minor bug fixes in the examples.
1999-01-28 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gdk/gdkim.c:
......
Thu Jan 28 10:16:28 GMT 1999 Tony Gale <gale@gtk.org>
* docs/gtk_tut.sgml:
- Replace all uses of deprecated functions.
- Replace menufactory example with itemfactory example
from Nick Scott <mendigo@geocities.com>
- Minor bug fixes in the examples.
1999-01-28 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gdk/gdkim.c:
......
This diff is collapsed.
This diff is collapsed.
......@@ -14,7 +14,7 @@ main (int argc, char *argv[])
gtk_window_set_title (GTK_WINDOW (window), "Aspect Frame");
gtk_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
gtk_container_border_width (GTK_CONTAINER (window), 10);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
/* Create an aspect_frame and add it to our toplevel window */
......
......@@ -18,7 +18,7 @@ GtkWidget *xpm_label_box( GtkWidget *parent,
/* Create box for xpm and label */
box1 = gtk_hbox_new (FALSE, 0);
gtk_container_border_width (GTK_CONTAINER (box1), 2);
gtk_container_set_border_width (GTK_CONTAINER (box1), 2);
/* Get the style of the button to get the
* background color. */
......@@ -77,7 +77,7 @@ int main( int argc,
/* Sets the border width of the window. */
gtk_container_border_width (GTK_CONTAINER (window), 10);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
gtk_widget_realize(window);
/* Create a new button */
......
......@@ -31,7 +31,7 @@ gint main (int argc, gchar *argv[])
NULL);
vbox=gtk_vbox_new(FALSE, 5);
gtk_container_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);
......
......@@ -64,14 +64,14 @@ int main (int argc, char *argv[])
gtk_box_pack_start (GTK_BOX (hbox), check, TRUE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT(check), "toggled",
GTK_SIGNAL_FUNC(entry_toggle_editable), entry);
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(check), TRUE);
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",
GTK_SIGNAL_FUNC(entry_toggle_visibility), entry);
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(check), TRUE);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), TRUE);
gtk_widget_show (check);
button = gtk_button_new_with_label ("Close");
......
......@@ -18,7 +18,7 @@ main (int argc, char *argv[])
gtk_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC (gtk_exit), NULL);
gtk_container_border_width (GTK_CONTAINER (window), 10);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
/* Create an EventBox and add it to our toplevel window */
......@@ -49,6 +49,6 @@ main (int argc, char *argv[])
gtk_main ();
return 0;
return(0);
}
/* example-end */
......@@ -64,7 +64,7 @@ int main( int argc,
GTK_SIGNAL_FUNC (destroy), NULL);
/* Sets the border width of the window. */
gtk_container_border_width (GTK_CONTAINER (window), 10);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
/* Creates a new button with the label "Hello World". */
button = gtk_button_new_with_label ("Hello World");
......
......@@ -43,7 +43,7 @@ int main( int argc,
GTK_SIGNAL_FUNC (delete_event), NULL);
/* Sets the border width of the window. */
gtk_container_border_width (GTK_CONTAINER (window), 10);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
/* We create a box to pack widgets into. This is described in detail
* in the "packing" section. The box is not really visible, it
......
......@@ -61,7 +61,7 @@ gint main (int argc,
/* Inside the window we need a box to arrange the widgets
* vertically */
vbox=gtk_vbox_new(FALSE, 5);
gtk_container_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);
......@@ -88,7 +88,7 @@ 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_border_width(GTK_CONTAINER(frame), 5);
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);
......
CC = gcc
all: menu menufactory
all: menu itemfactory
menu: menu.c
$(CC) `gtk-config --cflags` menu.c -o menu `gtk-config --libs`
menufactory: menufactory.o mfmain.o
$(CC) `gtk-config --libs` menufactory.o mfmain.o -o menufactory
menufactory.o: menufactory.c mfmain.h
$(CC) `gtk-config --cflags` -c menufactory.c -o menufactory.o
mfmain.o: mfmain.c mfmain.h menufactory.h
$(CC) `gtk-config --cflags` -c mfmain.c -o mfmain.o
itemfactory: itemfactory.c
$(CC) `gtk-config --cflags` itemfactory.c -o itemfactory `gtk-config --libs`
clean:
rm -f *.o menu menufactory
rm -f *.o menu itemfactory
/* example-start menu menufactory.c */
#include <gtk/gtk.h>
#include <strings.h>
#include "mfmain.h"
static void print_hello(GtkWidget *widget, gpointer data);
/* this is the GtkMenuEntry structure used to create new menus. The
* first member is the menu definition string. The second, the
* default accelerator key used to access this menu function with
* the keyboard. The third is the callback function to call when
* this menu item is selected (by the accelerator key, or with the
* mouse.) The last member is the data to pass to your callback function.
*/
static GtkMenuEntry menu_items[] =
{
{"<Main>/File/New", "<control>N", print_hello, NULL},
{"<Main>/File/Open", "<control>O", print_hello, NULL},
{"<Main>/File/Save", "<control>S", print_hello, NULL},
{"<Main>/File/Save as", NULL, NULL, NULL},
{"<Main>/File/<separator>", NULL, NULL, NULL},
{"<Main>/File/Quit", "<control>Q", file_quit_cmd_callback, "OK, I'll quit"},
{"<Main>/Options/Test", NULL, NULL, NULL}
};
static void
print_hello(GtkWidget *widget, gpointer data)
{
printf("hello!\n");
}
void get_main_menu(GtkWidget *window, GtkWidget ** menubar)
{
int nmenu_items = sizeof(menu_items) / sizeof(menu_items[0]);
GtkMenuFactory *factory;
GtkMenuFactory *subfactory;
factory = gtk_menu_factory_new(GTK_MENU_FACTORY_MENU_BAR);
subfactory = gtk_menu_factory_new(GTK_MENU_FACTORY_MENU_BAR);
gtk_menu_factory_add_subfactory(factory, subfactory, "<Main>");
gtk_menu_factory_add_entries(factory, menu_items, nmenu_items);
gtk_window_add_accelerator_table(GTK_WINDOW(window), subfactory->table);
if (menubar)
*menubar = subfactory->widget;
}
/* example-end */
/* example-start menu menufactory.h */
#ifndef __MENUFACTORY_H__
#define __MENUFACTORY_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
void get_main_menu (GtkWidget *, GtkWidget **menubar);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __MENUFACTORY_H__ */
/* example-end */
/* example-start menu mfmain.c */
#include <gtk/gtk.h>
#include "mfmain.h"
#include "menufactory.h"
int main(int argc, char *argv[])
{
GtkWidget *window;
GtkWidget *main_vbox;
GtkWidget *menubar;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_signal_connect(GTK_OBJECT(window), "destroy",
GTK_SIGNAL_FUNC(file_quit_cmd_callback),
"WM destroy");
gtk_window_set_title(GTK_WINDOW(window), "Menu Factory");
gtk_widget_set_usize(GTK_WIDGET(window), 300, 200);
main_vbox = gtk_vbox_new(FALSE, 1);
gtk_container_border_width(GTK_CONTAINER(main_vbox), 1);
gtk_container_add(GTK_CONTAINER(window), main_vbox);
gtk_widget_show(main_vbox);
get_main_menu(window, &menubar);
gtk_box_pack_start(GTK_BOX(main_vbox), menubar, FALSE, TRUE, 0);
gtk_widget_show(menubar);
gtk_widget_show(window);
gtk_main();
return(0);
}
/* This is just to demonstrate how callbacks work when using the
* menufactory. Often, people put all the callbacks from the menus
* in a separate file, and then have them call the appropriate functions
* from there. Keeps it more organized. */
void file_quit_cmd_callback (GtkWidget *widget, gpointer data)
{
g_print ("%s\n", (char *) data);
gtk_exit(0);
}
/* example-end */
/* example-start menu mfmain.h */
#ifndef __MFMAIN_H__
#define __MFMAIN_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
void file_quit_cmd_callback(GtkWidget *widget, gpointer data);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __MFMAIN_H__ */
/* example-end */
......@@ -59,7 +59,7 @@ int main (int argc, char *argv[])
gtk_signal_connect (GTK_OBJECT (window), "delete_event",
GTK_SIGNAL_FUNC (delete), NULL);
gtk_container_border_width (GTK_CONTAINER (window), 10);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
table = gtk_table_new(3,6,FALSE);
gtk_container_add (GTK_CONTAINER (window), table);
......@@ -76,7 +76,7 @@ int main (int argc, char *argv[])
sprintf(bufferl, "Page %d", i+1);
frame = gtk_frame_new (bufferf);
gtk_container_border_width (GTK_CONTAINER (frame), 10);
gtk_container_set_border_width (GTK_CONTAINER (frame), 10);
gtk_widget_set_usize (frame, 100, 75);
gtk_widget_show (frame);
......@@ -102,7 +102,7 @@ int main (int argc, char *argv[])
sprintf(bufferl, "PPage %d", i+1);
frame = gtk_frame_new (bufferf);
gtk_container_border_width (GTK_CONTAINER (frame), 10);
gtk_container_set_border_width (GTK_CONTAINER (frame), 10);
gtk_widget_set_usize (frame, 100, 75);
gtk_widget_show (frame);
......@@ -139,22 +139,22 @@ int main (int argc, char *argv[])
gtk_widget_show(button);
button = gtk_button_new_with_label ("tab position");
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) rotate_book, GTK_OBJECT(notebook));
gtk_signal_connect (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) 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_object (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) tabsborder_book,
GTK_OBJECT (notebook));
gtk_signal_connect (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) 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_object (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) remove_book,
GTK_OBJECT(notebook));
gtk_signal_connect (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) remove_book,
GTK_OBJECT(notebook));
gtk_table_attach_defaults(GTK_TABLE(table), button, 5,6,1,2);
gtk_widget_show(button);
......
......@@ -96,7 +96,7 @@ int main( int argc,
* behavior */
gtk_signal_connect (GTK_OBJECT (window), "delete_event",
GTK_SIGNAL_FUNC (delete_event), NULL);
gtk_container_border_width (GTK_CONTAINER (window), 10);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
/* We create a vertical box (vbox) to pack the horizontal boxes into.
* This allows us to stack the horizontal boxes filled with buttons one
......
......@@ -114,7 +114,7 @@ main (int argc, char *argv[])
gtk_window_set_title (GTK_WINDOW (window), "Paned Windows");
gtk_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
gtk_container_border_width (GTK_CONTAINER (window), 10);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
gtk_widget_set_usize (GTK_WIDGET(window), 450, 400);
/* create a vpaned widget and add it to our toplevel window */
......
......@@ -54,7 +54,7 @@ int main( int argc, char *argv[] )
window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
gtk_signal_connect( GTK_OBJECT (window), "delete_event",
GTK_SIGNAL_FUNC (close_application), NULL );
gtk_container_border_width( GTK_CONTAINER (window), 10 );
gtk_container_set_border_width( GTK_CONTAINER (window), 10 );
gtk_widget_show( window );
/* now for the pixmap from gdk */
......
......@@ -29,14 +29,14 @@ int main( int argc,
NULL);
gtk_window_set_title (GTK_WINDOW (window), "radio buttons");
gtk_container_border_width (GTK_CONTAINER (window), 0);
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
box1 = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), box1);
gtk_widget_show (box1);
box2 = gtk_vbox_new (FALSE, 10);
gtk_container_border_width (GTK_CONTAINER (box2), 10);
gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
gtk_widget_show (box2);
......@@ -46,7 +46,7 @@ int main( int argc,
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
button = gtk_radio_button_new_with_label(group, "button2");
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button), TRUE);
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);
......@@ -61,7 +61,7 @@ int main( int argc,
gtk_widget_show (separator);
box2 = gtk_vbox_new (FALSE, 10);
gtk_container_border_width (GTK_CONTAINER (box2), 10);
gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
gtk_widget_show (box2);
......
......@@ -98,7 +98,7 @@ void create_range_controls( void )
gtk_widget_show (box1);
box2 = gtk_hbox_new (FALSE, 10);
gtk_container_border_width (GTK_CONTAINER (box2), 10);
gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
gtk_widget_show (box2);
......@@ -134,20 +134,20 @@ void create_range_controls( void )
gtk_widget_show (scrollbar);
box2 = gtk_hbox_new (FALSE, 10);
gtk_container_border_width (GTK_CONTAINER (box2), 10);
gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
gtk_widget_show (box2);
/* 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_state (GTK_TOGGLE_BUTTON (button), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
gtk_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);
box2 = gtk_hbox_new (FALSE, 10);
gtk_container_border_width (GTK_CONTAINER (box2), 10);
gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
/* An option menu to change the position of the value */
label = gtk_label_new ("Scale Value Position:");
......@@ -182,7 +182,7 @@ void create_range_controls( void )
gtk_widget_show (box2);
box2 = gtk_hbox_new (FALSE, 10);
gtk_container_border_width (GTK_CONTAINER (box2), 10);
gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
/* Yet another option menu, this time for the update policy of the
* scale widgets */
......@@ -216,7 +216,7 @@ void create_range_controls( void )
gtk_widget_show (box2);
box2 = gtk_hbox_new (FALSE, 10);
gtk_container_border_width (GTK_CONTAINER (box2), 10);
gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
/* A GtkHScale widget for adjusting the number of digits on the
* sample scales. */
......@@ -236,7 +236,7 @@ void create_range_controls( void )
gtk_widget_show (box2);
box2 = gtk_hbox_new (FALSE, 10);
gtk_container_border_width (GTK_CONTAINER (box2), 10);
gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
/* And, one last GtkHScale widget for adjusting the page size of the
* scrollbar. */
......@@ -260,7 +260,7 @@ void create_range_controls( void )
gtk_widget_show (separator);
box2 = gtk_vbox_new (FALSE, 10);
gtk_container_border_width (GTK_CONTAINER (box2), 10);
gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
gtk_widget_show (box2);
......
......@@ -22,7 +22,7 @@ int main( int argc, char *argv[] ) {
window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
gtk_signal_connect (GTK_OBJECT (window), "delete_event",
GTK_SIGNAL_FUNC( close_application ), NULL);
gtk_container_border_width (GTK_CONTAINER (window), 10);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
/* Create a table for placing the ruler and the drawing area */
table = gtk_table_new( 3, 2, FALSE );
......
......@@ -26,13 +26,13 @@ int main (int argc, char *argv[])
gtk_signal_connect (GTK_OBJECT (window), "destroy",
(GtkSignalFunc) destroy, NULL);
gtk_window_set_title (GTK_WINDOW (window), "GtkScrolledWindow example");
gtk_container_border_width (GTK_CONTAINER (window), 0);
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
gtk_widget_set_usize(window, 300, 300);
/* create a new scrolled window. */
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_container_border_width (GTK_CONTAINER (scrolled_window), 10);
gtk_container_set_border_width (GTK_CONTAINER (scrolled_window), 10);
/* the policy is one of GTK_POLICY AUTOMATIC, or GTK_POLICY_ALWAYS.
* GTK_POLICY_AUTOMATIC will automatically decide whether you need
......
......@@ -72,7 +72,7 @@ main (int argc, char *argv[])
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Event Box");
gtk_container_border_width (GTK_CONTAINER (window), 10);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
gtk_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC (gtk_exit), NULL);
......
......@@ -15,7 +15,7 @@ selection_toggled (GtkWidget *widget, gint *have_selection)
/* if claiming the selection failed, we return the button to
the out state */
if (!*have_selection)
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(widget), FALSE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(widget), FALSE);
}
else
{
......@@ -37,7 +37,7 @@ selection_clear (GtkWidget *widget, GdkEventSelection *event,
gint *have_selection)
{
*have_selection = FALSE;
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(widget), FALSE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(widget), FALSE);
return TRUE;
}
......@@ -75,7 +75,7 @@ main (int argc, char *argv[])
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Event Box");
gtk_container_border_width (GTK_CONTAINER (window), 10);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
gtk_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC (gtk_exit), NULL);
......
......@@ -11,14 +11,14 @@ void push_item (GtkWidget *widget, gpointer data)
char buff[20];
g_snprintf(buff, 20, "Item %d", count++);
gtk_statusbar_push( GTK_STATUSBAR(status_bar), (guint) &data, buff);
gtk_statusbar_push( GTK_STATUSBAR(status_bar), GPOINTER_TO_INT(data), buff);
return;
}
void pop_item (GtkWidget *widget, gpointer data)
{
gtk_statusbar_pop( GTK_STATUSBAR(status_bar), (guint) &data );
gtk_statusbar_pop( GTK_STATUSBAR(status_bar), GPOINTER_TO_INT(data) );
return;
}
......@@ -29,7 +29,7 @@ int main (int argc, char *argv[])
GtkWidget *vbox;
GtkWidget *button;
int context_id;
gint context_id;
gtk_init (&argc, &argv);
......@@ -52,13 +52,13 @@ int main (int argc, char *argv[])
button = gtk_button_new_with_label("push item");
gtk_signal_connect(GTK_OBJECT(button), "clicked",
GTK_SIGNAL_FUNC (push_item), &context_id);
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",
GTK_SIGNAL_FUNC (pop_item), &context_id);
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);
......
......@@ -39,7 +39,7 @@ int main( int argc,
GTK_SIGNAL_FUNC (delete_event), NULL);
/* Sets the border width of the window. */
gtk_container_border_width (GTK_CONTAINER (window), 20);
gtk_container_set_border_width (GTK_CONTAINER (window), 20);
/* Create a 2x2 table */
table = gtk_table_new (2, 2, TRUE);
......
......@@ -51,7 +51,7 @@ int main (int argc, char *argv[])
GTK_SIGNAL_FUNC(close_application),
NULL);
gtk_window_set_title (GTK_WINDOW (window), "Text Widget Example");
gtk_container_border_width (GTK_CONTAINER (window), 0);
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
box1 = gtk_vbox_new (FALSE, 0);
......@@ -60,7 +60,7 @@ int main (int argc, char *argv[])
box2 = gtk_vbox_new (FALSE, 10);
gtk_container_border_width (GTK_CONTAINER (box2), 10);
gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
gtk_widget_show (box2);
......@@ -145,13 +145,13 @@ int main (int argc, char *argv[])
gtk_box_pack_start (GTK_BOX (hbox), check, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT(check), "toggled",
GTK_SIGNAL_FUNC(text_toggle_editable), text);
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(check), TRUE);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), TRUE);
gtk_widget_show (check);
check = gtk_check_button_new_with_label("Wrap Words");
gtk_box_pack_start (GTK_BOX (hbox), check, FALSE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT(check), "toggled",
GTK_SIGNAL_FUNC(text_toggle_word_wrap), text);
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(check), FALSE);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), FALSE);
gtk_widget_show (check);
separator = gtk_hseparator_new ();
......@@ -159,7 +159,7 @@ int main (int argc, char *argv[])
gtk_widget_show (separator);
box2 = gtk_vbox_new (FALSE, 10);
gtk_container_border_width (GTK_CONTAINER (box2), 10);
gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
gtk_widget_show (box2);
......@@ -176,6 +176,6 @@ int main (int argc, char *argv[])
gtk_main ();
return 0;
return(0);
}
/* example-end */
......@@ -115,7 +115,7 @@ tictactoe_clear (Tictactoe *ttt)
for (j=0;j<3;j++)
{
gtk_signal_handler_block_by_data (GTK_OBJECT(ttt->buttons[i][j]), ttt);
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (ttt->buttons[i][j]),
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);