diff --git a/docs/tutorial/gtk-tut.sgml b/docs/tutorial/gtk-tut.sgml
index 8353c31877..d140cd0d92 100755
--- a/docs/tutorial/gtk-tut.sgml
+++ b/docs/tutorial/gtk-tut.sgml
@@ -352,15 +352,15 @@ 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. */
- g_signal_connect (G_OBJECT (button), "clicked",
+ g_signal_connect (button, "clicked",
G_CALLBACK (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. */
- g_signal_connect_swapped (G_OBJECT (button), "clicked",
+ g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_widget_destroy),
- G_OBJECT (window));
+ window);
/* This packs the button into the window (a gtk container). */
gtk_container_add (GTK_CONTAINER (window), button);
@@ -672,7 +672,7 @@ event. Possible values for the type are:
something like:
-g_signal_connect (G_OBJECT (button), "button_press_event",
+g_signal_connect (button, "button_press_event",
G_CALLBACK (button_press_callback), NULL);
@@ -867,7 +867,7 @@ NULL to the hello() callback function. Obviously, the "clicked" signal
is emitted when we click the button with our mouse pointer.
- g_signal_connect (G_OBJECT (button), "clicked",
+ g_signal_connect (button, "clicked",
G_CALLBACK (hello), NULL);
@@ -882,9 +882,9 @@ GtkWidget *widget as an argument, we use the g_signal_connect_swapped()
function here instead of straight g_signal_connect().
- g_signal_connect_swapped (G_OBJECT (button), "clicked",
+ g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_widget_destroy),
- G_OBJECT (window));
+ window);
This is a packing call, which will be explained in depth later on in
@@ -1103,7 +1103,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 */
- g_signal_connect (G_OBJECT (button), "clicked",
+ g_signal_connect (button, "clicked",
G_CALLBACK (callback), (gpointer) "button 1");
/* Instead of gtk_container_add, we pack this button into the invisible
@@ -1119,7 +1119,7 @@ int main( int argc,
/* Call the same callback function with a different argument,
* passing a pointer to "button 2" instead. */
- g_signal_connect (G_OBJECT (button), "clicked",
+ g_signal_connect (button, "clicked",
G_CALLBACK (callback), (gpointer) "button 2");
gtk_box_pack_start(GTK_BOX (box1), button, TRUE, TRUE, 0);
@@ -1545,9 +1545,9 @@ int main( int argc,
button = gtk_button_new_with_label ("Quit");
/* Setup the signal to terminate the program when the button is clicked */
- g_signal_connect_swapped (G_OBJECT (button), "clicked",
+ g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_main_quit),
- G_OBJECT (window));
+ window);
/* Pack the button into the quitbox.
* The last 3 arguments to gtk_box_pack_start are:
* expand, fill, padding. */
@@ -1815,7 +1815,7 @@ int main( int argc,
/* When the button is clicked, we call the "callback" function
* with a pointer to "button 1" as its argument */
- g_signal_connect (G_OBJECT (button), "clicked",
+ g_signal_connect (button, "clicked",
G_CALLBACK (callback), (gpointer) "button 1");
@@ -1830,7 +1830,7 @@ int main( int argc,
/* When the button is clicked, we call the "callback" function
* with a pointer to "button 2" as its argument */
- g_signal_connect (G_OBJECT (button), "clicked",
+ g_signal_connect (button, "clicked",
G_CALLBACK (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);
@@ -1842,7 +1842,7 @@ int main( int argc,
/* When the button is clicked, we call the "delete-event" function
* and the program exits */
- g_signal_connect (G_OBJECT (button), "clicked",
+ g_signal_connect (button, "clicked",
G_CALLBACK (delete_event), NULL);
/* Insert the quit button into the both
@@ -1922,13 +1922,13 @@ function's declaration.
As you can see below in the class hierarchy, all GtkWidgets are
derived from the GObject base class. This means you can use a widget
-in any place the function asks for an object - simply use the
-G_OBJECT() macro.
+in any place the function asks for an object. Note that many functions
+accept a gpointer so there is no need to cast the type.
For example:
-g_signal_connect( G_OBJECT (button), "clicked",
+g_signal_connect( button, "clicked",
G_CALLBACK (callback_function), callback_data);
@@ -2200,7 +2200,7 @@ int main( int argc,
button = gtk_button_new ();
/* Connect the "clicked" signal of the button to our callback */
- g_signal_connect (G_OBJECT (button), "clicked",
+ g_signal_connect (button, "clicked",
G_CALLBACK (callback), (gpointer) "cool button");
/* This calls our box creating function */
@@ -2516,9 +2516,9 @@ int main( int argc,
gtk_widget_show (box2);
button = gtk_button_new_with_label ("close");
- g_signal_connect_swapped (G_OBJECT (button), "clicked",
+ g_signal_connect_swapped (button, "clicked",
G_CALLBACK (close_application),
- G_OBJECT (window));
+ window);
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
gtk_widget_set_can_default (button, TRUE);
gtk_widget_grab_default (button);
@@ -2723,8 +2723,8 @@ void cb_rotate_picture (GtkAdjustment *adj, GtkWidget *picture)
and connect it to the scale widget's adjustment like this:
-g_signal_connect (G_OBJECT (adj), "value_changed",
- G_CALLBACK (cb_rotate_picture), (gpointer) picture);
+g_signal_connect (adj, "value_changed",
+ G_CALLBACK (cb_rotate_picture), picture);
What about when a widget reconfigures the upper or lower
@@ -2749,7 +2749,7 @@ this signal on it to reconfigure whatever widgets are using it, like
this:
-g_signal_emit_by_name (G_OBJECT (adjustment), "changed");
+g_signal_emit_by_name (adjustment, "changed");
Now go forth and adjust!
@@ -3007,7 +3007,7 @@ when you modify its values directly, you should emit the "changed"
signal on it, like this:
-g_signal_emit_by_name (G_OBJECT (adjustment), "changed");
+g_signal_emit_by_name (adjustment, "changed");
@@ -3105,7 +3105,7 @@ static void cb_page_size( GtkAdjustment *get,
gtk_adjustment_set_value (set, CLAMP (set->value,
set->lower,
(set->upper - set->page_size)));
- g_signal_emit_by_name(G_OBJECT(set), "changed");
+ g_signal_emit_by_name(set, "changed");
}
static void cb_draw_value( GtkToggleButton *button )
@@ -3125,7 +3125,7 @@ static GtkWidget *make_menu_item ( gchar *name,
GtkWidget *item;
item = gtk_menu_item_new_with_label (name);
- g_signal_connect (G_OBJECT (item), "activate",
+ g_signal_connect (item, "activate",
callback, (gpointer) data);
gtk_widget_show (item);
@@ -3210,7 +3210,7 @@ static 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);
- g_signal_connect (G_OBJECT (button), "toggled",
+ g_signal_connect (button, "toggled",
G_CALLBACK (cb_draw_value), NULL);
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
gtk_widget_show (button);
@@ -3294,7 +3294,7 @@ static 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);
- g_signal_connect (G_OBJECT (adj2), "value_changed",
+ g_signal_connect (adj2, "value_changed",
G_CALLBACK (cb_digits_scale), NULL);
scale = gtk_hscale_new (GTK_ADJUSTMENT (adj2));
gtk_scale_set_digits (GTK_SCALE (scale), 0);
@@ -3314,7 +3314,7 @@ static 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);
- g_signal_connect (G_OBJECT (adj2), "value_changed",
+ g_signal_connect (adj2, "value_changed",
G_CALLBACK (cb_page_size), (gpointer) adj1);
scale = gtk_hscale_new (GTK_ADJUSTMENT (adj2));
gtk_scale_set_digits (GTK_SCALE (scale), 0);
@@ -3334,7 +3334,7 @@ static void create_range_controls( void )
gtk_widget_show (box2);
button = gtk_button_new_with_label ("Quit");
- g_signal_connect_swapped (G_OBJECT (button), "clicked",
+ g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_main_quit),
NULL);
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
@@ -4045,9 +4045,9 @@ 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);
- g_signal_connect (G_OBJECT (check), "clicked",
+ g_signal_connect (check, "clicked",
G_CALLBACK (toggle_show_text),
- (gpointer) pdata);
+ pdata);
gtk_widget_show (check);
/* Add a check button to toggle activity mode */
@@ -4055,9 +4055,9 @@ 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);
- g_signal_connect (G_OBJECT (check), "clicked",
+ g_signal_connect (check, "clicked",
G_CALLBACK (toggle_activity_mode),
- (gpointer) pdata);
+ pdata);
gtk_widget_show (check);
/* Add a check button to toggle orientation */
@@ -4065,16 +4065,16 @@ int main( int argc,
gtk_table_attach (GTK_TABLE (table), check, 0, 1, 2, 3,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
5, 5);
- g_signal_connect (G_OBJECT (check), "clicked",
+ g_signal_connect (check, "clicked",
G_CALLBACK (toggle_orientation),
- (gpointer) pdata);
+ pdata);
gtk_widget_show (check);
/* Add a button to exit the program */
button = gtk_button_new_with_label ("close");
- g_signal_connect_swapped (G_OBJECT (button), "clicked",
+ g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_widget_destroy),
- G_OBJECT (pdata->window));
+ pdata->window);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
/* This makes it so the button is the default. */
@@ -4258,9 +4258,9 @@ To follow all mouse movements within a window area, we would use
#define EVENT_METHOD(i, x) GTK_WIDGET_GET_CLASS(i)->x
- g_signal_connect_swapped (G_OBJECT (area), "motion_notify_event",
+ g_signal_connect_swapped (area, "motion_notify_event",
G_CALLBACK (EVENT_METHOD (ruler, motion_notify_event)),
- G_OBJECT (ruler));
+ ruler);
The following example creates a drawing area with a horizontal ruler
@@ -4327,9 +4327,9 @@ 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);
- g_signal_connect_swapped (G_OBJECT (area), "motion_notify_event",
+ g_signal_connect_swapped (area, "motion_notify_event",
G_CALLBACK (EVENT_METHOD (hrule, motion_notify_event)),
- G_OBJECT (hrule));
+ hrule);
gtk_table_attach (GTK_TABLE (table), hrule, 1, 2, 0, 1,
GTK_EXPAND|GTK_SHRINK|GTK_FILL, GTK_FILL, 0, 0);
@@ -4339,9 +4339,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 );
- g_signal_connect_swapped (G_OBJECT (area), "motion_notify_event",
+ g_signal_connect_swapped (area, "motion_notify_event",
G_CALLBACK (EVENT_METHOD (vrule, motion_notify_event)),
- G_OBJECT (vrule));
+ vrule);
gtk_table_attach (GTK_TABLE (table), vrule, 0, 1, 1, 2,
GTK_FILL, GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0);
@@ -4493,13 +4493,13 @@ int main( int argc,
GTK_STATUSBAR (status_bar), "Statusbar example");
button = gtk_button_new_with_label ("push item");
- g_signal_connect (G_OBJECT (button), "clicked",
+ g_signal_connect (button, "clicked",
G_CALLBACK (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");
- g_signal_connect (G_OBJECT (button), "clicked",
+ g_signal_connect (button, "clicked",
G_CALLBACK (pop_item), GINT_TO_POINTER (context_id));
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 2);
gtk_widget_show (button);
@@ -4652,7 +4652,7 @@ int main( int argc,
G_CALLBACK (gtk_main_quit), NULL);
g_signal_connect_swapped (window, "delete-event",
G_CALLBACK (gtk_widget_destroy),
- G_OBJECT (window));
+ window);
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
@@ -4660,9 +4660,9 @@ int main( int argc,
entry = gtk_entry_new ();
gtk_entry_set_max_length (GTK_ENTRY (entry), 50);
- g_signal_connect (G_OBJECT (entry), "activate",
+ g_signal_connect (entry, "activate",
G_CALLBACK (enter_callback),
- (gpointer) entry);
+ entry);
gtk_entry_set_text (GTK_ENTRY (entry), "hello");
tmp_pos = GTK_ENTRY (entry)->text_length;
gtk_editable_insert_text (GTK_EDITABLE (entry), " world", -1, &tmp_pos);
@@ -4677,22 +4677,22 @@ int main( int argc,
check = gtk_check_button_new_with_label ("Editable");
gtk_box_pack_start (GTK_BOX (hbox), check, TRUE, TRUE, 0);
- g_signal_connect (G_OBJECT (check), "toggled",
- G_CALLBACK (entry_toggle_editable), (gpointer) entry);
+ g_signal_connect (check, "toggled",
+ G_CALLBACK (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);
- g_signal_connect (G_OBJECT (check), "toggled",
- G_CALLBACK (entry_toggle_visibility), (gpointer) entry);
+ g_signal_connect (check, "toggled",
+ G_CALLBACK (entry_toggle_visibility), entry);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), TRUE);
gtk_widget_show (check);
button = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
- g_signal_connect_swapped (G_OBJECT (button), "clicked",
+ g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_widget_destroy),
- G_OBJECT (window));
+ window);
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
gtk_widget_set_can_default (button, TRUE);
gtk_widget_grab_default (button);
@@ -5100,25 +5100,25 @@ 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);
- g_signal_connect (G_OBJECT (adj), "value_changed",
+ g_signal_connect (adj, "value_changed",
G_CALLBACK (change_digits),
- (gpointer) spinner2);
+ spinner2);
gtk_box_pack_start (GTK_BOX (vbox2), spinner2, FALSE, TRUE, 0);
hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 5);
button = gtk_check_button_new_with_label ("Snap to 0.5-ticks");
- g_signal_connect (G_OBJECT (button), "clicked",
+ g_signal_connect (button, "clicked",
G_CALLBACK (toggle_snap),
- (gpointer) spinner1);
+ 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");
- g_signal_connect (G_OBJECT (button), "clicked",
+ g_signal_connect (button, "clicked",
G_CALLBACK (toggle_numeric),
- (gpointer) spinner1);
+ spinner1);
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
@@ -5128,14 +5128,14 @@ int main( int argc,
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 5);
button = gtk_button_new_with_label ("Value as Int");
g_object_set_data (G_OBJECT (button), "user_data", val_label);
- g_signal_connect (G_OBJECT (button), "clicked",
+ g_signal_connect (button, "clicked",
G_CALLBACK (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");
g_object_set_data (G_OBJECT (button), "user_data", val_label);
- g_signal_connect (G_OBJECT (button), "clicked",
+ g_signal_connect (button, "clicked",
G_CALLBACK (get_value),
GINT_TO_POINTER (2));
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 5);
@@ -5147,9 +5147,9 @@ int main( int argc,
gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, TRUE, 0);
button = gtk_button_new_with_label ("Close");
- g_signal_connect_swapped (G_OBJECT (button), "clicked",
+ g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_widget_destroy),
- G_OBJECT (window));
+ window);
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 5);
gtk_widget_show_all (window);
@@ -5302,8 +5302,8 @@ pressed the Return or Enter key, and read the text. The first is
accomplished using something like:
- g_signal_connect (G_OBJECT (GTK_COMBO (combo)->entry), "activate",
- G_CALLBACK (my_callback_function), (gpointer) my_data);
+ g_signal_connect (GTK_COMBO (combo)->entry, "activate",
+ G_CALLBACK (my_callback_function), my_data);
Getting the text at any arbitrary time is accomplished by simply using
@@ -6092,7 +6092,7 @@ static gboolean area_event( GtkWidget *widget,
/* Connect to the "color_changed" signal, set the client-data
* to the colorsel widget */
- g_signal_connect (G_OBJECT (colorsel), "color_changed",
+ g_signal_connect (colorsel, "color_changed",
G_CALLBACK (color_changed_cb), (gpointer) colorsel);
/* Show the dialog */
@@ -6258,16 +6258,16 @@ int main( int argc,
/* Create a new file selection widget */
filew = gtk_file_selection_new ("File selection");
- g_signal_connect (G_OBJECT (filew), "destroy",
+ g_signal_connect (filew, "destroy",
G_CALLBACK (gtk_main_quit), NULL);
/* Connect the ok_button to file_ok_sel function */
- g_signal_connect (G_OBJECT (GTK_FILE_SELECTION (filew)->ok_button),
+ g_signal_connect (GTK_FILE_SELECTION (filew)->ok_button,
"clicked", G_CALLBACK (file_ok_sel), (gpointer) filew);
/* Connect the cancel_button to destroy the widget */
- g_signal_connect_swapped (G_OBJECT (GTK_FILE_SELECTION (filew)->cancel_button),
+ g_signal_connect_swapped (GTK_FILE_SELECTION (filew)->cancel_button,
"clicked", G_CALLBACK (gtk_widget_destroy),
- G_OBJECT (filew));
+ filew);
/* Lets set the filename, as if this were a save dialog, and we are giving
a default filename */
@@ -6353,7 +6353,7 @@ int main( int argc,
gtk_window_set_title (GTK_WINDOW (window), "Event Box");
- g_signal_connect (G_OBJECT (window), "destroy",
+ g_signal_connect (window, "destroy",
G_CALLBACK (exit), NULL);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
@@ -6375,7 +6375,7 @@ int main( int argc,
/* And bind an action to it */
gtk_widget_set_events (event_box, GDK_BUTTON_PRESS_MASK);
- g_signal_connect (G_OBJECT (event_box), "button_press_event",
+ g_signal_connect (event_box, "button_press_event",
G_CALLBACK (exit), NULL);
/* Yet one more thing you need an X window for ... */
@@ -6533,7 +6533,7 @@ int main( int argc,
gtk_window_set_title (GTK_WINDOW (window), "Fixed Container");
/* Here we connect the "destroy" event to a signal handler */
- g_signal_connect (G_OBJECT (window), "destroy",
+ g_signal_connect (window, "destroy",
G_CALLBACK (gtk_main_quit), NULL);
/* Sets the border width of the window. */
@@ -6551,7 +6551,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. */
- g_signal_connect (G_OBJECT (button), "clicked",
+ g_signal_connect (button, "clicked",
G_CALLBACK (move_button), (gpointer) fixed);
/* This packs the button into the fixed containers window. */
@@ -6720,7 +6720,7 @@ int main( int argc,
gtk_window_set_title (GTK_WINDOW (window), "Frame Example");
/* Here we connect the "destroy" event to a signal handler */
- g_signal_connect (G_OBJECT (window), "destroy",
+ g_signal_connect (window, "destroy",
G_CALLBACK (gtk_main_quit), NULL);
gtk_widget_set_size_request (window, 300, 300);
@@ -6818,7 +6818,7 @@ int main( int argc,
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Aspect Frame");
- g_signal_connect (G_OBJECT (window), "destroy",
+ g_signal_connect (window, "destroy",
G_CALLBACK (gtk_main_quit), NULL);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
@@ -7017,7 +7017,7 @@ int main( int argc,
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Paned Windows");
- g_signal_connect (G_OBJECT (window), "destroy",
+ g_signal_connect (window, "destroy",
G_CALLBACK (gtk_main_quit), NULL);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
gtk_widget_set_size_request (GTK_WIDGET (window), 450, 400);
@@ -7189,7 +7189,7 @@ int main( int argc,
/* Create a new dialog window for the scrolled window to be
* packed into. */
window = gtk_dialog_new ();
- g_signal_connect (G_OBJECT (window), "destroy",
+ g_signal_connect (window, "destroy",
G_CALLBACK (destroy), NULL);
gtk_window_set_title (GTK_WINDOW (window), "GtkScrolledWindow example");
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
@@ -7237,9 +7237,9 @@ int main( int argc,
/* Add a "close" button to the bottom of the dialog */
button = gtk_button_new_with_label ("close");
- g_signal_connect_swapped (G_OBJECT (button), "clicked",
+ g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_widget_destroy),
- G_OBJECT (window));
+ window);
/* this makes it so the button is the default. */
@@ -7358,7 +7358,7 @@ int main( int argc,
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Button Boxes");
- g_signal_connect (G_OBJECT (window), "destroy",
+ g_signal_connect (window, "destroy",
G_CALLBACK (gtk_main_quit),
NULL);
@@ -8119,43 +8119,43 @@ int main( int argc,
/* Create a bunch of buttons */
button = gtk_button_new_with_label ("close");
- g_signal_connect_swapped (G_OBJECT (button), "clicked",
+ g_signal_connect_swapped (button, "clicked",
G_CALLBACK (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");
- g_signal_connect_swapped (G_OBJECT (button), "clicked",
+ g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_notebook_next_page),
- G_OBJECT (notebook));
+ 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");
- g_signal_connect_swapped (G_OBJECT (button), "clicked",
+ g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_notebook_prev_page),
- G_OBJECT (notebook));
+ 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");
- g_signal_connect (G_OBJECT (button), "clicked",
+ g_signal_connect (button, "clicked",
G_CALLBACK (rotate_book),
- (gpointer) notebook);
+ 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");
- g_signal_connect (G_OBJECT (button), "clicked",
+ g_signal_connect (button, "clicked",
G_CALLBACK (tabsborder_book),
- (gpointer) notebook);
+ 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");
- g_signal_connect (G_OBJECT (button), "clicked",
+ g_signal_connect (button, "clicked",
G_CALLBACK (remove_book),
- (gpointer) notebook);
+ notebook);
gtk_table_attach_defaults (GTK_TABLE (table), button, 5, 6, 1, 2);
gtk_widget_show (button);
@@ -8280,15 +8280,15 @@ standard File menu, with the options Open,
gtk_menu_shell_append (GTK_MENU_SHELL (file_menu), quit_item);
/* Attach the callback functions to the activate signal */
- g_signal_connect_swapped (G_OBJECT (open_item), "activate",
+ g_signal_connect_swapped (open_item, "activate",
G_CALLBACK (menuitem_response),
(gpointer) "file.open");
- g_signal_connect_swapped (G_OBJECT (save_item), "activate",
+ g_signal_connect_swapped (save_item, "activate",
G_CALLBACK (menuitem_response),
(gpointer) "file.save");
/* We can attach the Quit menu item to our exit function */
- g_signal_connect_swapped (G_OBJECT (quit_item), "activate",
+ g_signal_connect_swapped (quit_item, "activate",
G_CALLBACK (destroy),
(gpointer) "file.quit");
@@ -8399,9 +8399,9 @@ shown in the sample code to pass information to gtk_menu_popup().
Bind that event handler to a widget with
- g_signal_connect_swapped (G_OBJECT (widget), "event",
+ g_signal_connect_swapped (widget, "event",
G_CALLBACK (handler),
- G_OBJECT (menu));
+ menu);
where widget is the widget you are binding to,
handler is the handling function, and menu is a menu
@@ -8482,7 +8482,7 @@ int main( int argc,
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items);
/* Do something interesting when the menuitem is selected */
- g_signal_connect_swapped (G_OBJECT (menu_items), "activate",
+ g_signal_connect_swapped (menu_items, "activate",
G_CALLBACK (menuitem_response),
(gpointer) g_strdup (buf));
@@ -8513,9 +8513,9 @@ int main( int argc,
/* Create a button to which to attach menu as a popup */
button = gtk_button_new_with_label ("press me");
- g_signal_connect_swapped (G_OBJECT (button), "event",
+ g_signal_connect_swapped (button, "event",
G_CALLBACK (button_press),
- G_OBJECT (menu));
+ menu);
gtk_box_pack_end (GTK_BOX (vbox), button, TRUE, TRUE, 2);
gtk_widget_show (button);
@@ -9019,7 +9019,7 @@ GtkWidget *get_popup_menu( void )
/* Make a button to activate the popup menu */
button = gtk_button_new_with_label ("Popup");
/* Make the menu popup when clicked */
- g_signal_connect (G_OBJECT(button),
+ g_signal_connect (button,
"event",
G_CALLBACK(popup_cb),
(gpointer) menu);
@@ -9055,7 +9055,7 @@ int main( int argc,
/* Make a window */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- g_signal_connect (G_OBJECT (window), "destroy",
+ g_signal_connect (window, "destroy",
G_CALLBACK (gtk_main_quit),
NULL);
gtk_window_set_title (GTK_WINDOW(window), "Item Factory");
@@ -9718,7 +9718,7 @@ int main( int argc,
gtk_window_set_title (GTK_WINDOW (window), "Event Box");
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
- g_signal_connect (G_OBJECT (window), "destroy",
+ g_signal_connect (window, "destroy",
G_CALLBACK (exit), NULL);
/* Create a button the user can click to get targets */
@@ -9726,9 +9726,9 @@ int main( int argc,
button = gtk_button_new_with_label ("Get Targets");
gtk_container_add (GTK_CONTAINER (window), button);
- g_signal_connect (G_OBJECT (button), "clicked",
+ g_signal_connect (button, "clicked",
G_CALLBACK (get_targets), (gpointer) window);
- g_signal_connect (G_OBJECT (window), "selection_received",
+ g_signal_connect (window, "selection_received",
G_CALLBACK (selection_received), NULL);
gtk_widget_show (button);
@@ -9894,7 +9894,7 @@ int main( int argc,
gtk_window_set_title (GTK_WINDOW (window), "Event Box");
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
- g_signal_connect (G_OBJECT (window), "destroy",
+ g_signal_connect (window, "destroy",
G_CALLBACK (exit), NULL);
/* Create a toggle button to act as the selection */
@@ -9904,16 +9904,16 @@ int main( int argc,
gtk_container_add (GTK_CONTAINER (window), selection_button);
gtk_widget_show (selection_button);
- g_signal_connect (G_OBJECT (selection_button), "toggled",
+ g_signal_connect (selection_button, "toggled",
G_CALLBACK (selection_toggled), (gpointer) &have_selection);
- g_signal_connect (G_OBJECT (selection_widget), "selection_clear_event",
+ g_signal_connect (selection_widget, "selection_clear_event",
G_CALLBACK (selection_clear), (gpointer) &have_selection);
gtk_selection_add_target (selection_widget,
GDK_SELECTION_PRIMARY,
GDK_SELECTION_TYPE_STRING,
1);
- g_signal_connect (G_OBJECT (selection_widget), "selection_get",
+ g_signal_connect (selection_widget, "selection_get",
G_CALLBACK (selection_handle), (gpointer) &have_selection);
gtk_widget_show (selection_button);
@@ -11367,7 +11367,7 @@ tictactoe_init (Tictactoe *ttt)
ttt->buttons[i][j] = gtk_toggle_button_new ();
gtk_table_attach_defaults (GTK_TABLE (ttt), ttt->buttons[i][j],
i, i+1, j, j+1);
- g_signal_connect (G_OBJECT (ttt->buttons[i][j]), "toggled",
+ g_signal_connect (ttt->buttons[i][j], "toggled",
G_CALLBACK (tictactoe_toggle), ttt);
gtk_widget_set_size_request (ttt->buttons[i][j], 20, 20);
gtk_widget_show (ttt->buttons[i][j]);
@@ -11454,7 +11454,7 @@ tictactoe_toggle (GtkWidget *widget, Tictactoe *ttt)
if (success && found)
{
- g_signal_emit (G_OBJECT (ttt),
+ g_signal_emit (ttt,
tictactoe_signals[TICTACTOE_SIGNAL], 0);
break;
}
@@ -11488,7 +11488,7 @@ main (int argc, char *argv[])
gtk_window_set_title (GTK_WINDOW (window), "Aspect Frame");
- g_signal_connect (G_OBJECT (window), "destroy",
+ g_signal_connect (window, "destroy",
G_CALLBACK (exit), NULL);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
@@ -11499,7 +11499,7 @@ main (int argc, char *argv[])
gtk_widget_show (ttt);
/* And attach to its "tictactoe" signal */
- g_signal_connect (G_OBJECT (ttt), "tictactoe",
+ g_signal_connect (ttt, "tictactoe",
G_CALLBACK (win), NULL);
gtk_widget_show (window);
@@ -14654,7 +14654,7 @@ tictactoe_init (Tictactoe *ttt)
ttt->buttons[i][j] = gtk_toggle_button_new ();
gtk_table_attach_defaults (GTK_TABLE (ttt), ttt->buttons[i][j],
i, i+1, j, j+1);
- g_signal_connect (G_OBJECT (ttt->buttons[i][j]), "toggled",
+ g_signal_connect (ttt->buttons[i][j], "toggled",
G_CALLBACK (tictactoe_toggle), (gpointer) ttt);
gtk_widget_set_size_request (ttt->buttons[i][j], 20, 20);
gtk_widget_show (ttt->buttons[i][j]);
@@ -14715,7 +14715,7 @@ tictactoe_toggle (GtkWidget *widget, Tictactoe *ttt)
if (success && found)
{
- g_signal_emit (G_OBJECT (ttt),
+ g_signal_emit (ttt,
tictactoe_signals[TICTACTOE_SIGNAL], 0);
break;
}
@@ -14757,7 +14757,7 @@ int main( int argc,
gtk_window_set_title (GTK_WINDOW (window), "Aspect Frame");
- g_signal_connect (G_OBJECT (window), "destroy",
+ g_signal_connect (window, "destroy",
G_CALLBACK (exit), NULL);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
@@ -14768,7 +14768,7 @@ int main( int argc,
gtk_widget_show (ttt);
/* And attach to its "tictactoe" signal */
- g_signal_connect (G_OBJECT (ttt), "tictactoe",
+ g_signal_connect (ttt, "tictactoe",
G_CALLBACK (win), NULL);
gtk_widget_show (window);
@@ -15602,7 +15602,7 @@ int main( int argc,
gtk_window_set_title (GTK_WINDOW (window), "Dial");
- g_signal_connect (G_OBJECT (window), "destroy",
+ g_signal_connect (window, "destroy",
G_CALLBACK (exit), NULL);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
@@ -15629,7 +15629,7 @@ int main( int argc,
gtk_box_pack_end (GTK_BOX (vbox), label, 0, 0, 0);
gtk_widget_show (label);
- g_signal_connect (G_OBJECT (adjustment), "value_changed",
+ g_signal_connect (adjustment, "value_changed",
G_CALLBACK (value_changed), (gpointer) label);
gtk_widget_show (window);
@@ -15789,7 +15789,7 @@ int main( int argc,
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_widget_show (vbox);
- g_signal_connect (G_OBJECT (window), "destroy",
+ g_signal_connect (window, "destroy",
G_CALLBACK (quit), NULL);
/* Create the drawing area */
@@ -15802,16 +15802,16 @@ int main( int argc,
/* Signals used to handle backing pixmap */
- g_signal_connect (G_OBJECT (drawing_area), "expose_event",
+ g_signal_connect (drawing_area, "expose_event",
G_CALLBACK (expose_event), NULL);
- g_signal_connect (G_OBJECT (drawing_area),"configure_event",
+ g_signal_connect (drawing_area, "configure_event",
G_CALLBACK (configure_event), NULL);
/* Event signals */
- g_signal_connect (G_OBJECT (drawing_area), "motion_notify_event",
+ g_signal_connect (drawing_area, "motion_notify_event",
G_CALLBACK (motion_notify_event), NULL);
- g_signal_connect (G_OBJECT (drawing_area), "button_press_event",
+ g_signal_connect (drawing_area, "button_press_event",
G_CALLBACK (button_press_event), NULL);
gtk_widget_set_events (drawing_area, GDK_EXPOSURE_MASK
@@ -15824,9 +15824,9 @@ int main( int argc,
button = gtk_button_new_with_label ("Quit");
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
- g_signal_connect_swapped (G_OBJECT (button), "clicked",
+ g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_widget_destroy),
- G_OBJECT (window));
+ window);
gtk_widget_show (button);
gtk_widget_show (window);
@@ -16005,12 +16005,12 @@ create_input_dialog ()
{
inputd = gtk_input_dialog_new();
- g_signal_connect (G_OBJECT (inputd), "destroy",
+ g_signal_connect (inputd, "destroy",
G_CALLBACK (input_dialog_destroy), (gpointer) &inputd);
- g_signal_connect_swapped (G_OBJECT (GTK_INPUT_DIALOG (inputd)->close_button),
+ g_signal_connect_swapped (GTK_INPUT_DIALOG (inputd)->close_button,
"clicked",
G_CALLBACK (gtk_widget_hide),
- G_OBJECT (inputd));
+ inputd);
gtk_widget_hide (GTK_INPUT_DIALOG (inputd)->save_button);
gtk_widget_show (inputd);
@@ -16043,7 +16043,7 @@ main (int argc, char *argv[])
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_widget_show (vbox);
- g_signal_connect (G_OBJECT (window), "destroy",
+ g_signal_connect (window, "destroy",
G_CALLBACK (gtk_main_quit), NULL);
/* Create the drawing area */
@@ -16056,16 +16056,16 @@ main (int argc, char *argv[])
/* Signals used to handle backing pixmap */
- g_signal_connect (G_OBJECT (drawing_area), "expose_event",
+ g_signal_connect (drawing_area, "expose_event",
G_CALLBACK (expose_event), NULL);
- g_signal_connect (G_OBJECT(drawing_area),"configure_event",
+ g_signal_connect (drawing_area, "configure_event",
G_CALLBACK (configure_event), NULL);
/* Event signals */
- g_signal_connect (G_OBJECT (drawing_area), "motion_notify_event",
+ g_signal_connect (drawing_area, "motion_notify_event",
G_CALLBACK (motion_notify_event), NULL);
- g_signal_connect (G_OBJECT (drawing_area), "button_press_event",
+ g_signal_connect (drawing_area, "button_press_event",
G_CALLBACK (button_press_event), NULL);
gtk_widget_set_events (drawing_area, GDK_EXPOSURE_MASK
@@ -16082,16 +16082,16 @@ main (int argc, char *argv[])
button = gtk_button_new_with_label ("Input Dialog");
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
- g_signal_connect (G_OBJECT (button), "clicked",
+ g_signal_connect (button, "clicked",
G_CALLBACK (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);
- g_signal_connect_swapped (G_OBJECT (button), "clicked",
+ g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_widget_destroy),
- G_OBJECT (window));
+ window);
gtk_widget_show (button);
gtk_widget_show (window);