summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorSven Neumann <sven@gimp.org>2008-08-11 18:36:07 +0000
committerSven Neumann <neo@src.gnome.org>2008-08-11 18:36:07 +0000
commit82f6ccd79cc9c6c1d032a620649c1a0b500943eb (patch)
treea7fe470d84196b53139ee2d9d8f4bef6c352edcc /examples
parente3e126ae9eb9f860f2b99157d18cb3d6428add78 (diff)
downloadgtk+-82f6ccd79cc9c6c1d032a620649c1a0b500943eb.tar.gz
updated the (quite outdated) examples to use canonical signal names as
2008-08-11 Sven Neumann <sven@gimp.org> * examples/*: updated the (quite outdated) examples to use canonical signal names as well. Removed some unneeded casts and trailing whitespace while I was on it... svn path=/trunk/; revision=21071
Diffstat (limited to 'examples')
-rw-r--r--examples/buttons/buttons.c2
-rw-r--r--examples/calendar/calendar.c50
-rw-r--r--examples/colorsel/colorsel.c7
-rw-r--r--examples/entry/entry.c26
-rw-r--r--examples/eventbox/eventbox.c36
-rw-r--r--examples/gtkdial/dial_test.c29
-rw-r--r--examples/helloworld/helloworld.c40
-rw-r--r--examples/helloworld2/helloworld2.c30
-rw-r--r--examples/list/list.c72
-rw-r--r--examples/menu/menu.c16
-rw-r--r--examples/notebook/notebook.c80
-rw-r--r--examples/packbox/packbox.c118
-rw-r--r--examples/pixmap/pixmap.c8
-rw-r--r--examples/radiobuttons/radiobuttons.c16
-rw-r--r--examples/rangewidgets/rangewidgets.c54
-rw-r--r--examples/rulers/rulers.c18
-rw-r--r--examples/scribble-simple/scribble-simple.c14
-rw-r--r--examples/scribble-xinput/scribble-xinput.c24
-rw-r--r--examples/selection/gettargets.c22
-rw-r--r--examples/selection/setselection.c24
-rw-r--r--examples/spinbutton/spinbutton.c86
-rw-r--r--examples/statusbar/statusbar.c14
-rw-r--r--examples/table/table.c10
23 files changed, 400 insertions, 396 deletions
diff --git a/examples/buttons/buttons.c b/examples/buttons/buttons.c
index 7935202b85..d78ce834cd 100644
--- a/examples/buttons/buttons.c
+++ b/examples/buttons/buttons.c
@@ -58,7 +58,7 @@ int main( int argc,
g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (gtk_main_quit), NULL);
- g_signal_connect (G_OBJECT (window), "delete_event",
+ g_signal_connect (G_OBJECT (window), "delete-event",
G_CALLBACK (gtk_main_quit), NULL);
/* Sets the border width of the window. */
diff --git a/examples/calendar/calendar.c b/examples/calendar/calendar.c
index 63e11881a7..c0d85b00f5 100644
--- a/examples/calendar/calendar.c
+++ b/examples/calendar/calendar.c
@@ -40,7 +40,7 @@ typedef struct _CalendarData {
enum {
calendar_show_header,
calendar_show_days,
- calendar_month_change,
+ calendar_month_change,
calendar_show_week,
calendar_monday_first
};
@@ -108,7 +108,7 @@ static void calendar_day_selected_double_click ( GtkWidget *widget,
if (GTK_CALENDAR (data->window)->marked_date[day-1] == 0) {
gtk_calendar_mark_day (GTK_CALENDAR (data->window), day);
- } else {
+ } else {
gtk_calendar_unmark_day (GTK_CALENDAR (data->window), day);
}
}
@@ -154,7 +154,7 @@ static void calendar_set_flags( CalendarData *calendar )
{
gint i;
gint options = 0;
- for (i = 0;i < 5; i++)
+ for (i = 0;i < 5; i++)
if (calendar->settings[i])
{
options = options + (1 << i);
@@ -175,7 +175,7 @@ static void calendar_toggle_flag( GtkWidget *toggle,
calendar->settings[j] = !calendar->settings[j];
calendar_set_flags (calendar);
-
+
}
static void calendar_font_selection_ok( GtkWidget *button,
@@ -187,7 +187,7 @@ static void calendar_font_selection_ok( GtkWidget *button,
if (calendar->window)
{
font_name = gtk_font_selection_dialog_get_font_name (GTK_FONT_SELECTION_DIALOG (calendar->font_dialog));
- if (font_name)
+ if (font_name)
{
style = gtk_rc_style_new ();
pango_font_description_free (style->font_desc);
@@ -209,18 +209,18 @@ static void calendar_select_font( GtkWidget *button,
window = gtk_font_selection_dialog_new ("Font Selection Dialog");
g_return_if_fail (GTK_IS_FONT_SELECTION_DIALOG (window));
calendar->font_dialog = window;
-
+
gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_MOUSE);
-
+
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed),
&calendar->font_dialog);
-
+
g_signal_connect (GTK_FONT_SELECTION_DIALOG (window)->ok_button,
"clicked", G_CALLBACK (calendar_font_selection_ok),
calendar);
g_signal_connect_swapped (GTK_FONT_SELECTION_DIALOG (window)->cancel_button,
- "clicked", G_CALLBACK (gtk_widget_destroy),
+ "clicked", G_CALLBACK (gtk_widget_destroy),
calendar->font_dialog);
}
window = calendar->font_dialog;
@@ -246,7 +246,7 @@ static void create_calendar( void )
GtkWidget *bbox;
static CalendarData calendar_data;
gint i;
-
+
struct {
char *label;
} flags[] =
@@ -258,7 +258,7 @@ static void create_calendar( void )
{ "Week Start Monday" }
};
-
+
calendar_data.window = NULL;
calendar_data.font_dialog = NULL;
@@ -297,27 +297,27 @@ static void create_calendar( void )
calendar=gtk_calendar_new ();
calendar_data.window = calendar;
calendar_set_flags (&calendar_data);
- gtk_calendar_mark_day (GTK_CALENDAR (calendar), 19);
+ gtk_calendar_mark_day (GTK_CALENDAR (calendar), 19);
gtk_container_add (GTK_CONTAINER (frame), calendar);
- g_signal_connect (calendar, "month_changed",
+ g_signal_connect (calendar, "month-changed",
G_CALLBACK (calendar_month_changed),
&calendar_data);
- g_signal_connect (calendar, "day_selected",
+ g_signal_connect (calendar, "day-selected",
G_CALLBACK (calendar_day_selected),
&calendar_data);
- g_signal_connect (calendar, "day_selected_double_click",
+ g_signal_connect (calendar, "day-selected-double-click",
G_CALLBACK (calendar_day_selected_double_click),
&calendar_data);
- g_signal_connect (calendar, "prev_month",
+ g_signal_connect (calendar, "prev-month",
G_CALLBACK (calendar_prev_month),
&calendar_data);
- g_signal_connect (calendar, "next_month",
+ g_signal_connect (calendar, "next-month",
G_CALLBACK (calendar_next_month),
&calendar_data);
- g_signal_connect (calendar, "prev_year",
+ g_signal_connect (calendar, "prev-year",
G_CALLBACK (calendar_prev_year),
&calendar_data);
- g_signal_connect (calendar, "next_year",
+ g_signal_connect (calendar, "next-year",
G_CALLBACK (calendar_next_year),
&calendar_data);
@@ -327,8 +327,8 @@ static void create_calendar( void )
vbox2 = gtk_vbox_new (FALSE, DEF_PAD);
gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, FALSE, DEF_PAD);
-
- /* Build the Right frame with the flags in */
+
+ /* Build the Right frame with the flags in */
frame = gtk_frame_new ("Flags");
gtk_box_pack_start (GTK_BOX (vbox2), frame, TRUE, TRUE, DEF_PAD);
@@ -345,7 +345,7 @@ static void create_calendar( void )
gtk_box_pack_start (GTK_BOX (vbox3), toggle, TRUE, TRUE, 0);
calendar_data.flag_checkboxes[i] = toggle;
}
- /* Build the right font-button */
+ /* Build the right font-button */
button = gtk_button_new_with_label ("Font...");
g_signal_connect (button,
"clicked",
@@ -362,7 +362,7 @@ static void create_calendar( void )
vbox2 = gtk_vbox_new (TRUE, DEF_PAD_SMALL);
gtk_container_add (GTK_CONTAINER (frame), vbox2);
-
+
hbox = gtk_hbox_new (FALSE, 3);
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, TRUE, 0);
label = gtk_label_new ("Signal:");
@@ -389,8 +389,8 @@ static void create_calendar( void )
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_END);
button = gtk_button_new_with_label ("Close");
- g_signal_connect (button, "clicked",
- G_CALLBACK (gtk_main_quit),
+ g_signal_connect (button, "clicked",
+ G_CALLBACK (gtk_main_quit),
NULL);
gtk_container_add (GTK_CONTAINER (bbox), button);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
diff --git a/examples/colorsel/colorsel.c b/examples/colorsel/colorsel.c
index 75656cd36a..cd2801c875 100644
--- a/examples/colorsel/colorsel.c
+++ b/examples/colorsel/colorsel.c
@@ -45,10 +45,11 @@ static gboolean area_event( GtkWidget *widget,
gtk_color_selection_set_current_color (colorsel, &color);
gtk_color_selection_set_has_palette (colorsel, TRUE);
- /* Connect to the "color_changed" signal, set the client-data
+ /* Connect to the "color-changed" signal, set the client-data
* to the colorsel widget */
- g_signal_connect (G_OBJECT (colorsel), "color_changed",
- G_CALLBACK (color_changed_cb), (gpointer) colorsel);
+ g_signal_connect (colorsel, "color-changed",
+ G_CALLBACK (color_changed_cb),
+ colorsel);
/* Show the dialog */
response = gtk_dialog_run (GTK_DIALOG (colorseldlg));
diff --git a/examples/entry/entry.c b/examples/entry/entry.c
index 77b98e2021..ab06ec5214 100644
--- a/examples/entry/entry.c
+++ b/examples/entry/entry.c
@@ -42,11 +42,11 @@ int main( int argc,
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_size_request (GTK_WIDGET (window), 200, 100);
gtk_window_set_title (GTK_WINDOW (window), "GTK Entry");
- g_signal_connect (G_OBJECT (window), "destroy",
+ g_signal_connect (window, "destroy",
G_CALLBACK (gtk_main_quit), NULL);
- g_signal_connect_swapped (G_OBJECT (window), "delete_event",
- G_CALLBACK (gtk_widget_destroy),
- G_OBJECT (window));
+ g_signal_connect_swapped (window, "delete-event",
+ G_CALLBACK (gtk_widget_destroy),
+ window);
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
@@ -54,7 +54,7 @@ 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);
gtk_entry_set_text (GTK_ENTRY (entry), "hello");
@@ -68,30 +68,30 @@ int main( int argc,
hbox = gtk_hbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (vbox), hbox);
gtk_widget_show (hbox);
-
+
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_signal_connect (check, "toggled",
G_CALLBACK (entry_toggle_editable), (gpointer) 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_signal_connect (check, "toggled",
G_CALLBACK (entry_toggle_visibility), (gpointer) 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_FLAGS (button, GTK_CAN_DEFAULT);
gtk_widget_grab_default (button);
gtk_widget_show (button);
-
+
gtk_widget_show (window);
gtk_main();
diff --git a/examples/eventbox/eventbox.c b/examples/eventbox/eventbox.c
index ef56da93ea..f24d81306a 100644
--- a/examples/eventbox/eventbox.c
+++ b/examples/eventbox/eventbox.c
@@ -8,46 +8,46 @@ int main( int argc,
GtkWidget *window;
GtkWidget *event_box;
GtkWidget *label;
-
+
gtk_init (&argc, &argv);
-
+
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
+
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);
-
+
/* Create an EventBox and add it to our toplevel window */
-
+
event_box = gtk_event_box_new ();
gtk_container_add (GTK_CONTAINER (window), event_box);
gtk_widget_show (event_box);
-
+
/* Create a long label */
-
+
label = gtk_label_new ("Click here to quit, quit, quit, quit, quit");
gtk_container_add (GTK_CONTAINER (event_box), label);
gtk_widget_show (label);
-
+
/* Clip it short. */
gtk_widget_set_size_request (label, 110, 20);
-
+
/* 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 ... */
-
+
gtk_widget_realize (event_box);
gdk_window_set_cursor (event_box->window, gdk_cursor_new (GDK_HAND1));
-
+
gtk_widget_show (window);
-
+
gtk_main ();
-
+
return 0;
}
diff --git a/examples/gtkdial/dial_test.c b/examples/gtkdial/dial_test.c
index 3944c8b397..ccadb3d077 100644
--- a/examples/gtkdial/dial_test.c
+++ b/examples/gtkdial/dial_test.c
@@ -22,16 +22,16 @@ int main( int argc,
GtkWidget *frame;
GtkWidget *vbox;
GtkWidget *label;
-
+
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
+
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);
vbox = gtk_vbox_new (FALSE, 5);
@@ -41,14 +41,14 @@ int main( int argc,
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_container_add (GTK_CONTAINER (vbox), frame);
- gtk_widget_show (frame);
-
+ gtk_widget_show (frame);
+
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_size_request (dial, 100, 100); */
-
+
gtk_container_add (GTK_CONTAINER (frame), dial);
gtk_widget_show (dial);
@@ -56,12 +56,13 @@ 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_CALLBACK (value_changed), (gpointer) label);
-
+ g_signal_connect (adjustment, "value-changed",
+ G_CALLBACK (value_changed),
+ label);
+
gtk_widget_show (window);
-
+
gtk_main ();
-
+
return 0;
}
diff --git a/examples/helloworld/helloworld.c b/examples/helloworld/helloworld.c
index ffc19cb31b..8a9b0cb3b2 100644
--- a/examples/helloworld/helloworld.c
+++ b/examples/helloworld/helloworld.c
@@ -40,60 +40,60 @@ int main( int argc,
/* GtkWidget is the storage type for widgets */
GtkWidget *window;
GtkWidget *button;
-
+
/* This is called in all GTK applications. Arguments are parsed
* from the command line and are returned to the application. */
gtk_init (&argc, &argv);
-
+
/* create a new window */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- /* When the window is given the "delete_event" signal (this is given
+
+ /* When the window is given the "delete-event" signal (this is given
* by the window manager, usually by the "close" option, or on the
* 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. */
- g_signal_connect (G_OBJECT (window), "delete_event",
+ g_signal_connect (window, "delete-event",
G_CALLBACK (delete_event), NULL);
-
- /* Here we connect the "destroy" event to a signal handler.
+
+ /* 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. */
- g_signal_connect (G_OBJECT (window), "destroy",
+ g_signal_connect (window, "destroy",
G_CALLBACK (destroy), NULL);
-
+
/* Sets the border width of the window. */
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");
-
+
/* 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);
-
+
/* The final step is to display this newly created widget. */
gtk_widget_show (button);
-
+
/* and the window */
gtk_widget_show (window);
-
+
/* All GTK applications must have a gtk_main(). Control ends here
* and waits for an event to occur (like a key press or
* mouse event). */
gtk_main ();
-
+
return 0;
}
diff --git a/examples/helloworld2/helloworld2.c b/examples/helloworld2/helloworld2.c
index a62c88210f..d661d164a2 100644
--- a/examples/helloworld2/helloworld2.c
+++ b/examples/helloworld2/helloworld2.c
@@ -3,23 +3,23 @@
/* Our new improved callback. The data passed to this function
* is printed to stdout. */
-static void callback( GtkWidget *widget,
- gpointer data )
+static void callback (GtkWidget *widget,
+ gpointer data)
{
g_print ("Hello again - %s was pressed\n", (gchar *) data);
}
/* another callback */
-static gboolean delete_event( GtkWidget *widget,
+static gboolean delete_event (GtkWidget *widget,
GdkEvent *event,
- gpointer data )
+ gpointer data)
{
gtk_main_quit ();
return FALSE;
}
-int main( int argc,
- char *argv[] )
+int main (int argc,
+ char *argv[])
{
/* GtkWidget is the storage type for widgets */
GtkWidget *window;
@@ -39,7 +39,7 @@ int main( int argc,
/* Here we just set a handler for delete_event that immediately
* exits GTK. */
- g_signal_connect (G_OBJECT (window), "delete_event",
+ g_signal_connect (window, "delete-event",
G_CALLBACK (delete_event), NULL);
/* Sets the border width of the window. */
@@ -55,15 +55,15 @@ 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 */
- g_signal_connect (G_OBJECT (button), "clicked",
- G_CALLBACK (callback), (gpointer) "button 1");
+ g_signal_connect (button, "clicked",
+ G_CALLBACK (callback), "button 1");
/* Instead of gtk_container_add, we pack this button into the invisible
* box, which has been packed into the window. */
- gtk_box_pack_start (GTK_BOX(box1), button, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (box1), button, TRUE, TRUE, 0);
/* Always remember this step, this tells GTK that our preparation for
* this button is complete, and it can now be displayed. */
@@ -74,10 +74,10 @@ 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_CALLBACK (callback), (gpointer) "button 2");
+ g_signal_connect (button, "clicked",
+ G_CALLBACK (callback), "button 2");
- gtk_box_pack_start(GTK_BOX (box1), button, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (box1), button, TRUE, TRUE, 0);
/* The order in which we show the buttons is not really important, but I
* recommend showing the window last, so it all pops up at once. */
@@ -86,7 +86,7 @@ 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 ();
diff --git a/examples/list/list.c b/examples/list/list.c
index d0d436a386..966e31e76e 100644
--- a/examples/list/list.c
+++ b/examples/list/list.c
@@ -24,7 +24,7 @@ static void sigh_button_event( GtkWidget *gtklist,
gint main( int argc,
gchar *argv[] )
-{
+{
GtkWidget *separator;
GtkWidget *window;
GtkWidget *vbox;
@@ -36,37 +36,37 @@ gint main( int argc,
GList *dlist;
guint i;
gchar buffer[64];
-
-
+
+
/* Initialize GTK (and subsequently GDK) */
gtk_init (&argc, &argv);
-
-
+
+
/* Create a window to put all the widgets in
* connect gtk_main_quit() to the "destroy" event of
* the window to handle window manager close-window-events
*/
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "GtkList Example");
- g_signal_connect (G_OBJECT (window), "destroy",
+ g_signal_connect (window, "destroy",
G_CALLBACK (gtk_main_quit),
NULL);
-
-
+
+
/* 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_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_size_request (scrolled_window, 250, 150);
gtk_container_add (GTK_CONTAINER (vbox), scrolled_window);
gtk_widget_show (scrolled_window);
-
+
/* Create thekList widget.
* Connect the sigh_print_selection() signal handler
* function to the "selection_changed" signal of the List
@@ -76,10 +76,10 @@ gint main( int argc,
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window),
gtklist);
gtk_widget_show (gtklist);
- g_signal_connect (G_OBJECT (gtklist), "selection_changed",
+ g_signal_connect (gtklist, "selection-changed",
G_CALLBACK (sigh_print_selection),
NULL);
-
+
/* We create a "Prison" to put a list item in ;) */
frame=gtk_frame_new ("Prison");
gtk_widget_set_size_request (frame, 200, 50);
@@ -87,29 +87,29 @@ gint main( int argc,
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
gtk_container_add (GTK_CONTAINER (vbox), frame);
gtk_widget_show (frame);
-
+
/* Connect the sigh_button_event() signal handler to the List
* which will handle the "arresting" of list items
*/
- g_signal_connect (G_OBJECT (gtklist), "button_release_event",
+ g_signal_connect (gtklist, "button-release-event",
G_CALLBACK (sigh_button_event),
frame);
-
+
/* Create a separator */
separator=gtk_hseparator_new ();
gtk_container_add (GTK_CONTAINER (vbox), separator);
gtk_widget_show (separator);
-
+
/* Finally create a button and connect its "clicked" signal
* to the destruction of the window */
button=gtk_button_new_with_label ("Close");
gtk_container_add (GTK_CONTAINER (vbox), button);
gtk_widget_show (button);
- g_signal_connect_swapped (G_OBJECT (button), "clicked",
+ g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_widget_destroy),
window);
-
-
+
+
/* Now we create 5 list items, each having its own
* label and add them to the List using gtk_container_add()
* Also we query the text string from the label and
@@ -118,7 +118,7 @@ gint main( int argc,
for (i = 0; i < 5; i++) {
GtkWidget *label;
gchar *string;
-
+
sprintf(buffer, "ListItemContainer with Label #%d", i);
label=gtk_label_new (buffer);
list_item=gtk_list_item_new ();
@@ -153,13 +153,13 @@ gint main( int argc,
"ListItem with integrated Label");
}
gtk_list_append_items (GTK_LIST (gtklist), dlist);
-
+
/* Finally we want to see the window, don't we? ;) */
gtk_widget_show (window);
-
+
/* Fire up the main event loop of gtk */
gtk_main ();
-
+
/* We get here after gtk_main_quit() has been called which
* happens if the main window gets destroyed
*/
@@ -180,7 +180,7 @@ void sigh_button_event( GtkWidget *gtklist,
event->button == 3) {
GList *dlist, *free_list;
GtkWidget *new_prisoner;
-
+
/* Fetch the currently selected list item which
* will be our next prisoner ;)
*/
@@ -189,7 +189,7 @@ void sigh_button_event( GtkWidget *gtklist,
new_prisoner = GTK_WIDGET (dlist->data);
else
new_prisoner = NULL;
-
+
/* Look for already imprisoned list items, we
* will put them back into the list.
* Remember to free the doubly linked list that
@@ -199,26 +199,26 @@ void sigh_button_event( GtkWidget *gtklist,
free_list = dlist;
while (dlist) {
GtkWidget *list_item;
-
+
list_item = dlist->data;
-
+
gtk_widget_reparent (list_item, gtklist);
-
+
dlist = dlist->next;
}
g_list_free (free_list);
-
+
/* If we have a new prisoner, remove him from the
* List and put him into the frame "Prison".
* We need to unselect the item first.
*/
if (new_prisoner) {
GList static_dlist;
-
+
static_dlist.data = new_prisoner;
static_dlist.next = NULL;
static_dlist.prev = NULL;
-
+
gtk_list_unselect_child (GTK_LIST (gtklist),
new_prisoner);
gtk_widget_reparent (new_prisoner, frame);
@@ -233,12 +233,12 @@ void sigh_print_selection( GtkWidget *gtklist,
gpointer func_data )
{
GList *dlist;
-
+
/* Fetch the doubly linked list of selected items
* of the List, remember to treat this as read-only!
*/
dlist = GTK_LIST (gtklist)->selection;
-
+
/* If there are no selected items there is nothing more
* to do than just telling the user so
*/
@@ -249,17 +249,17 @@ void sigh_print_selection( GtkWidget *gtklist,
/* Ok, we got a selection and so we print it
*/
g_print ("The selection is a ");
-
+
/* Get the list item from the doubly linked list
* and then query the data associated with list_item_data_key.
* We then just print it */
while (dlist) {
const gchar *item_data_string;
-
+
item_data_string = g_object_get_data (G_OBJECT (dlist->data),
list_item_data_key);
g_print("%s ", item_data_string);
-
+
dlist = dlist->next;
}
g_print ("\n");
diff --git a/examples/menu/menu.c b/examples/menu/menu.c
index 6cf1dce09d..a52ce69399 100644
--- a/examples/menu/menu.c
+++ b/examples/menu/menu.c
@@ -25,11 +25,11 @@ int main( int argc,
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_size_request (GTK_WIDGET (window), 200, 100);
gtk_window_set_title (GTK_WINDOW (window), "GTK Menu Test");
- g_signal_connect (G_OBJECT (window), "delete_event",
+ g_signal_connect (window, "delete-event",
G_CALLBACK (gtk_main_quit), NULL);
/* Init the menu-widget, and remember -- never
- * gtk_show_widget() the menu widget!!
+ * gtk_show_widget() the menu widget!!
* This is the menu that holds the menu items, the one that
* will pop up when you click on the "Root Menu" in the app */
menu = gtk_menu_new ();
@@ -52,8 +52,8 @@ 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_CALLBACK (menuitem_response),
+ g_signal_connect_swapped (menu_items, "activate",
+ G_CALLBACK (menuitem_response),
(gpointer) g_strdup (buf));
/* Show the widget */
@@ -83,9 +83,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_CALLBACK (button_press),
- G_OBJECT (menu));
+ g_signal_connect_swapped (button, "event",
+ G_CALLBACK (button_press),
+ menu);
gtk_box_pack_end (GTK_BOX (vbox), button, TRUE, TRUE, 2);
gtk_widget_show (button);
@@ -113,7 +113,7 @@ static gboolean button_press( GtkWidget *widget,
{
if (event->type == GDK_BUTTON_PRESS) {
- GdkEventButton *bevent = (GdkEventButton *) event;
+ GdkEventButton *bevent = (GdkEventButton *) event;
gtk_menu_popup (GTK_MENU (widget), NULL, NULL, NULL, NULL,
bevent->button, bevent->time);
/* Tell calling code that we have handled this event; the buck
diff --git a/examples/notebook/notebook.c b/examples/notebook/notebook.c
index 76249bb058..17a22c7943 100644
--- a/examples/notebook/notebook.c
+++ b/examples/notebook/notebook.c
@@ -16,10 +16,10 @@ static void tabsborder_book( GtkButton *button,
gint tval = FALSE;
gint bval = FALSE;
if (notebook->show_tabs == 0)
- tval = TRUE;
+ tval = TRUE;
if (notebook->show_border == 0)
bval = TRUE;
-
+
gtk_notebook_set_show_tabs (notebook, tval);
gtk_notebook_set_show_border (notebook, bval);
}
@@ -29,10 +29,10 @@ static void remove_book( GtkButton *button,
GtkNotebook *notebook )
{
gint page;
-
+
page = gtk_notebook_get_current_page (notebook);
gtk_notebook_remove_page (notebook, page);
- /* Need to refresh the widget --
+ /* Need to refresh the widget --
This forces the widget to redraw itself. */
gtk_widget_queue_draw (GTK_WIDGET (notebook));
}
@@ -58,118 +58,118 @@ int main( int argc,
int i;
char bufferf[32];
char bufferl[32];
-
+
gtk_init (&argc, &argv);
-
+
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- g_signal_connect (G_OBJECT (window), "delete_event",
+
+ g_signal_connect (window, "delete-event",
G_CALLBACK (delete), NULL);
-
+
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
table = gtk_table_new (3, 6, FALSE);
gtk_container_add (GTK_CONTAINER (window), table);
-
+
/* Create a new notebook, place the position of the tabs */
notebook = gtk_notebook_new ();
gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_TOP);
gtk_table_attach_defaults (GTK_TABLE (table), notebook, 0, 6, 0, 1);
gtk_widget_show (notebook);
-
+
/* Let's append a bunch of pages to the notebook */
for (i = 0; i < 5; i++) {
sprintf(bufferf, "Append Frame %d", i + 1);
sprintf(bufferl, "Page %d", i + 1);
-
+
frame = gtk_frame_new (bufferf);
gtk_container_set_border_width (GTK_CONTAINER (frame), 10);
gtk_widget_set_size_request (frame, 100, 75);
gtk_widget_show (frame);
-
+
label = gtk_label_new (bufferf);
gtk_container_add (GTK_CONTAINER (frame), label);
gtk_widget_show (label);
-
+
label = gtk_label_new (bufferl);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), frame, label);
}
-
+
/* Now let's add a page to a specific spot */
checkbutton = gtk_check_button_new_with_label ("Check me please!");
gtk_widget_set_size_request (checkbutton, 100, 75);
gtk_widget_show (checkbutton);
-
+
label = gtk_label_new ("Add page");
gtk_notebook_insert_page (GTK_NOTEBOOK (notebook), checkbutton, label, 2);
-
+
/* Now finally let's prepend pages to the notebook */
for (i = 0; i < 5; i++) {
sprintf (bufferf, "Prepend Frame %d", i + 1);
sprintf (bufferl, "PPage %d", i + 1);
-
+
frame = gtk_frame_new (bufferf);
gtk_container_set_border_width (GTK_CONTAINER (frame), 10);
gtk_widget_set_size_request (frame, 100, 75);
gtk_widget_show (frame);
-
+
label = gtk_label_new (bufferf);
gtk_container_add (GTK_CONTAINER (frame), label);
gtk_widget_show (label);
-
+
label = gtk_label_new (bufferl);
gtk_notebook_prepend_page (GTK_NOTEBOOK (notebook), frame, label);
}
-
+
/* Set what page to start at (page 4) */
gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), 3);
/* 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);
-
+
gtk_widget_show (table);
gtk_widget_show (window);
-
+
gtk_main ();
-
+
return 0;
}
diff --git a/examples/packbox/packbox.c b/examples/packbox/packbox.c
index 2961102a64..9189825626 100644
--- a/examples/packbox/packbox.c
+++ b/examples/packbox/packbox.c
@@ -11,63 +11,63 @@ static gboolean delete_event( GtkWidget *widget,
return FALSE;
}
-/* Make a new hbox filled with button-labels. Arguments for the
- * variables we're interested are passed in to this function.
+/* Make a new hbox filled with button-labels. Arguments for the
+ * variables we're interested are passed in to this function.
* We do not show the box, but do show everything inside. */
static GtkWidget *make_box( gboolean homogeneous,
gint spacing,
gboolean expand,
gboolean fill,
- guint padding )
+ guint padding )
{
GtkWidget *box;
GtkWidget *button;
char padstr[80];
-
+
/* Create a new hbox with the appropriate homogeneous
* and spacing settings */
box = gtk_hbox_new (homogeneous, spacing);
-
+
/* Create a series of buttons with the appropriate settings */
button = gtk_button_new_with_label ("gtk_box_pack");
gtk_box_pack_start (GTK_BOX (box), button, expand, fill, padding);
gtk_widget_show (button);
-
+
button = gtk_button_new_with_label ("(box,");
gtk_box_pack_start (GTK_BOX (box), button, expand, fill, padding);
gtk_widget_show (button);
-
+
button = gtk_button_new_with_label ("button,");
gtk_box_pack_start (GTK_BOX (box), button, expand, fill, padding);
gtk_widget_show (button);
-
+
/* Create a button with the label depending on the value of
* expand. */
if (expand == TRUE)
button = gtk_button_new_with_label ("TRUE,");
else
button = gtk_button_new_with_label ("FALSE,");
-
+
gtk_box_pack_start (GTK_BOX (box), button, expand, fill, padding);
gtk_widget_show (button);
-
+
/* This is the same as the button creation for "expand"
* above, but uses the shorthand form. */
button = gtk_button_new_with_label (fill ? "TRUE," : "FALSE,");
gtk_box_pack_start (GTK_BOX (box), button, expand, fill, padding);
gtk_widget_show (button);
-
+
sprintf (padstr, "%d);", padding);
-
+
button = gtk_button_new_with_label (padstr);
gtk_box_pack_start (GTK_BOX (box), button, expand, fill, padding);
gtk_widget_show (button);
-
+
return box;
}
int main( int argc,
- char *argv[])
+ char *argv[])
{
GtkWidget *window;
GtkWidget *button;
@@ -77,51 +77,51 @@ int main( int argc,
GtkWidget *label;
GtkWidget *quitbox;
int which;
-
+
/* Our init, don't forget this! :) */
gtk_init (&argc, &argv);
-
+
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. */
exit (1);
}
-
+
which = atoi (argv[1]);
/* Create our window */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- /* You should always remember to connect the delete_event signal
+ /* You should always remember to connect the "delete-event" signal
* to the main window. This is very important for proper intuitive
* behavior */
- g_signal_connect (G_OBJECT (window), "delete_event",
+ g_signal_connect (window, "delete-event",
G_CALLBACK (delete_event), NULL);
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
* on top of the other in this vbox. */
box1 = gtk_vbox_new (FALSE, 0);
-
+
/* which example to show. These correspond to the pictures above. */
switch (which) {
case 1:
/* create a new label. */
label = gtk_label_new ("gtk_hbox_new (FALSE, 0);");
-
- /* Align the label to the left side. We'll discuss this function and
+
+ /* Align the label to the left side. We'll discuss this function and
* others in the section on Widget Attributes. */
gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
- /* Pack the label into the vertical box (vbox box1). Remember that
+ /* Pack the label into the vertical box (vbox box1). Remember that
* widgets added to a vbox will be packed one on top of the other in
* order. */
gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 0);
-
+
/* Show the label */
gtk_widget_show (label);
-
+
/* Call our make box function - homogeneous = FALSE, spacing = 0,
* expand = FALSE, fill = FALSE, padding = 0 */
box2 = make_box (FALSE, 0, FALSE, FALSE, 0);
@@ -133,93 +133,93 @@ int main( int argc,
box2 = make_box (FALSE, 0, TRUE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
gtk_widget_show (box2);
-
+
/* Args are: homogeneous, spacing, expand, fill, padding */
box2 = make_box (FALSE, 0, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
gtk_widget_show (box2);
-
- /* Creates a separator, we'll learn more about these later,
+
+ /* Creates a separator, we'll learn more about these later,
* but they are quite simple. */
separator = gtk_hseparator_new ();
-
+
/* Pack the separator into the vbox. Remember each of these
* widgets is being packed into a vbox, so they'll be stacked
* vertically. */
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 5);
gtk_widget_show (separator);
-
+
/* Create another new label, and show it. */
label = gtk_label_new ("gtk_hbox_new (TRUE, 0);");
gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 0);
gtk_widget_show (label);
-
+
/* Args are: homogeneous, spacing, expand, fill, padding */
box2 = make_box (TRUE, 0, TRUE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
gtk_widget_show (box2);
-
+
/* Args are: homogeneous, spacing, expand, fill, padding */
box2 = make_box (TRUE, 0, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
gtk_widget_show (box2);
-
+
/* Another new separator. */
separator = gtk_hseparator_new ();
/* The last 3 arguments to gtk_box_pack_start are:
* expand, fill, padding. */
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 5);
gtk_widget_show (separator);
-
+
break;
case 2:
- /* Create a new label, remember box1 is a vbox as created
+ /* Create a new label, remember box1 is a vbox as created
* near the beginning of main() */
label = gtk_label_new ("gtk_hbox_new (FALSE, 10);");
gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 0);
gtk_widget_show (label);
-
+
/* Args are: homogeneous, spacing, expand, fill, padding */
box2 = make_box (FALSE, 10, TRUE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
gtk_widget_show (box2);
-
+
/* Args are: homogeneous, spacing, expand, fill, padding */
box2 = make_box (FALSE, 10, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
gtk_widget_show (box2);
-
+
separator = gtk_hseparator_new ();
/* The last 3 arguments to gtk_box_pack_start are:
* expand, fill, padding. */
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 5);
gtk_widget_show (separator);
-
+
label = gtk_label_new ("gtk_hbox_new (FALSE, 0);");
gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 0);
gtk_widget_show (label);
-
+
/* Args are: homogeneous, spacing, expand, fill, padding */
box2 = make_box (FALSE, 0, TRUE, FALSE, 10);
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
gtk_widget_show (box2);
-
+
/* Args are: homogeneous, spacing, expand, fill, padding */
box2 = make_box (FALSE, 0, TRUE, TRUE, 10);
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
gtk_widget_show (box2);
-
+
separator = gtk_hseparator_new ();
/* The last 3 arguments to gtk_box_pack_start are: expand, fill, padding. */
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 5);
gtk_widget_show (separator);
break;
-
+
case 3:
/* This demonstrates the ability to use gtk_box_pack_end() to
@@ -233,11 +233,11 @@ int main( int argc,
gtk_box_pack_end (GTK_BOX (box2), label, FALSE, FALSE, 0);
/* Show the label. */
gtk_widget_show (label);
-
+
/* Pack box2 into box1 (the vbox remember ? :) */
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
gtk_widget_show (box2);
-
+
/* A separator for the bottom. */
separator = gtk_hseparator_new ();
/* This explicitly sets the separator to 400 pixels wide by 5 pixels
@@ -246,46 +246,46 @@ int main( int argc,
* hbox. Otherwise, all the widgets in the hbox would be packed as
* close together as possible. */
gtk_widget_set_size_request (separator, 400, 5);
- /* pack the separator into the vbox (box1) created near the start
+ /* pack the separator into the vbox (box1) created near the start
* of main() */
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 5);
- gtk_widget_show (separator);
+ gtk_widget_show (separator);
}
-
+
/* Create another new hbox.. remember we can use as many as we need! */
quitbox = gtk_hbox_new (FALSE, 0);
-
+
/* Our quit button. */
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. */
gtk_box_pack_start (GTK_BOX (quitbox), button, TRUE, FALSE, 0);
/* pack the quitbox into the vbox (box1) */
gtk_box_pack_start (GTK_BOX (box1), quitbox, FALSE, FALSE, 0);
-
+
/* Pack the vbox (box1) which now contains all our widgets, into the
* main window. */
gtk_container_add (GTK_CONTAINER (window), box1);
-
+
/* And show everything left */
gtk_widget_show (button);
gtk_widget_show (quitbox);
-
+
gtk_widget_show (box1);
/* Showing the window last so everything pops up at once. */
gtk_widget_show (window);
-
+
/* And of course, our main function. */
gtk_main ();
- /* Control returns here when gtk_main_quit() is called, but not when
+ /* Control returns here when gtk_main_quit() is called, but not when
* exit() is used. */
-
+
return 0;
}
diff --git a/examples/pixmap/pixmap.c b/examples/pixmap/pixmap.c
index 6c3e95934a..7bb3850219 100644
--- a/examples/pixmap/pixmap.c
+++ b/examples/pixmap/pixmap.c
@@ -53,12 +53,12 @@ int main( int argc,
GdkPixmap *pixmap;
GdkBitmap *mask;
GtkStyle *style;
-
+
/* create the main window, and attach delete_event signal to terminating
the application */
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- g_signal_connect (G_OBJECT (window), "delete_event",
+ g_signal_connect (window, "delete-event",
G_CALLBACK (close_application), NULL);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
gtk_widget_show (window);
@@ -79,11 +79,11 @@ int main( int argc,
gtk_container_add (GTK_CONTAINER (window), button);
gtk_widget_show (button);
- g_signal_connect (G_OBJECT (button), "clicked",
+ g_signal_connect (button, "clicked",
G_CALLBACK (button_clicked), NULL);
/* show the window */
gtk_main ();
-
+
return 0;
}
diff --git a/examples/radiobuttons/radiobuttons.c b/examples/radiobuttons/radiobuttons.c
index 77aff9a020..05fd1e38a2 100644
--- a/examples/radiobuttons/radiobuttons.c
+++ b/examples/radiobuttons/radiobuttons.c
@@ -19,12 +19,12 @@ int main( int argc,
GtkWidget *button;
GtkWidget *separator;
GSList *group;
-
- gtk_init (&argc, &argv);
-
+
+ gtk_init (&argc, &argv);
+
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- g_signal_connect (G_OBJECT (window), "delete_event",
+
+ g_signal_connect (window, "delete-event",
G_CALLBACK (close_application),
NULL);
@@ -65,15 +65,15 @@ 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_FLAGS (button, GTK_CAN_DEFAULT);
gtk_widget_grab_default (button);
gtk_widget_show (button);
gtk_widget_show (window);
-
+
gtk_main ();
return 0;
diff --git a/examples/rangewidgets/rangewidgets.c b/examples/rangewidgets/rangewidgets.c
index f898600fff..17bfcceb94 100644
--- a/examples/rangewidgets/rangewidgets.c
+++ b/examples/rangewidgets/rangewidgets.c
@@ -34,7 +34,7 @@ static void cb_page_size( GtkAdjustment *get,
set->page_size = get->value;
set->page_increment = get->value;
- /* This sets the adjustment and makes it emit the "changed" signal to
+ /* This sets the adjustment and makes it emit the "changed" signal to
reconfigure all the widgets that are attached to this signal. */
gtk_adjustment_set_value (set, CLAMP (set->value,
set->lower,
@@ -47,7 +47,7 @@ static void cb_draw_value( GtkToggleButton *button )
/* Turn the value display on the scale widgets off or on depending
* on the state of the checkbutton */
gtk_scale_set_draw_value (GTK_SCALE (hscale), button->active);
- gtk_scale_set_draw_value (GTK_SCALE (vscale), button->active);
+ gtk_scale_set_draw_value (GTK_SCALE (vscale), button->active);
}
/* Convenience functions */
@@ -57,9 +57,9 @@ static GtkWidget *make_menu_item ( gchar *name,
gpointer data )
{
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);
@@ -91,7 +91,7 @@ static void create_range_controls( void )
/* Standard window-creating stuff */
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), "range controls");
@@ -110,7 +110,7 @@ static void create_range_controls( void )
* scrollbar widgets, and the highest value you'll get is actually
* (upper - page_size). */
adj1 = gtk_adjustment_new (0.0, 0.0, 101.0, 0.1, 1.0, 1.0);
-
+
vscale = gtk_vscale_new (GTK_ADJUSTMENT (adj1));
scale_set_default_values (GTK_SCALE (vscale));
gtk_box_pack_start (GTK_BOX (box2), vscale, TRUE, TRUE, 0);
@@ -131,7 +131,7 @@ static void create_range_controls( void )
scrollbar = gtk_hscrollbar_new (GTK_ADJUSTMENT (adj1));
/* Notice how this causes the scales to always be updated
* continuously when the scrollbar is moved */
- gtk_range_set_update_policy (GTK_RANGE (scrollbar),
+ gtk_range_set_update_policy (GTK_RANGE (scrollbar),
GTK_UPDATE_CONTINUOUS);
gtk_box_pack_start (GTK_BOX (box3), scrollbar, TRUE, TRUE, 0);
gtk_widget_show (scrollbar);
@@ -144,11 +144,11 @@ 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);
-
+
box2 = gtk_hbox_new (FALSE, 10);
gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
@@ -156,7 +156,7 @@ static void create_range_controls( void )
label = gtk_label_new ("Scale Value Position:");
gtk_box_pack_start (GTK_BOX (box2), label, FALSE, FALSE, 0);
gtk_widget_show (label);
-
+
opt = gtk_option_menu_new ();
menu = gtk_menu_new ();
@@ -164,19 +164,19 @@ static void create_range_controls( void )
G_CALLBACK (cb_pos_menu_select),
GINT_TO_POINTER (GTK_POS_TOP));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-
- item = make_menu_item ("Bottom", G_CALLBACK (cb_pos_menu_select),
+
+ item = make_menu_item ("Bottom", G_CALLBACK (cb_pos_menu_select),
GINT_TO_POINTER (GTK_POS_BOTTOM));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-
+
item = make_menu_item ("Left", G_CALLBACK (cb_pos_menu_select),
GINT_TO_POINTER (GTK_POS_LEFT));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-
+
item = make_menu_item ("Right", G_CALLBACK (cb_pos_menu_select),
GINT_TO_POINTER (GTK_POS_RIGHT));
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);
gtk_widget_show (opt);
@@ -192,35 +192,35 @@ static void create_range_controls( void )
label = gtk_label_new ("Scale Update Policy:");
gtk_box_pack_start (GTK_BOX (box2), label, FALSE, FALSE, 0);
gtk_widget_show (label);
-
+
opt = gtk_option_menu_new ();
menu = gtk_menu_new ();
-
+
item = make_menu_item ("Continuous",
G_CALLBACK (cb_update_menu_select),
GINT_TO_POINTER (GTK_UPDATE_CONTINUOUS));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-
+
item = make_menu_item ("Discontinuous",
G_CALLBACK (cb_update_menu_select),
GINT_TO_POINTER (GTK_UPDATE_DISCONTINUOUS));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-
+
item = make_menu_item ("Delayed",
G_CALLBACK (cb_update_menu_select),
GINT_TO_POINTER (GTK_UPDATE_DELAYED));
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);
gtk_widget_show (opt);
-
+
gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
gtk_widget_show (box2);
box2 = gtk_hbox_new (FALSE, 10);
gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
-
+
/* An HScale widget for adjusting the number of digits on the
* sample scales. */
label = gtk_label_new ("Scale Digits:");
@@ -228,7 +228,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);
@@ -237,10 +237,10 @@ static void create_range_controls( void )
gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
gtk_widget_show (box2);
-
+
box2 = gtk_hbox_new (FALSE, 10);
gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
-
+
/* And, one last HScale widget for adjusting the page size of the
* scrollbar. */
label = gtk_label_new ("Scrollbar Page Size:");
@@ -248,7 +248,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);
@@ -268,7 +268,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);
diff --git a/examples/rulers/rulers.c b/examples/rulers/rulers.c
index ac5435c438..0f48e8bbcc 100644
--- a/examples/rulers/rulers.c
+++ b/examples/rulers/rulers.c
@@ -24,7 +24,7 @@ int main( int argc,
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- g_signal_connect (G_OBJECT (window), "delete_event",
+ g_signal_connect (window, "delete-event",
G_CALLBACK (close_application), NULL);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
@@ -45,21 +45,23 @@ 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_CALLBACK (EVENT_METHOD (hrule, motion_notify_event)),
- G_OBJECT (hrule));
+ g_signal_connect_swapped (area, "motion-notify-event",
+ G_CALLBACK (EVENT_METHOD (hrule,
+ motion_notify_event)),
+ hrule);
gtk_table_attach (GTK_TABLE (table), hrule, 1, 2, 0, 1,
GTK_EXPAND|GTK_SHRINK|GTK_FILL, GTK_FILL, 0, 0);
-
+
/* The vertical ruler goes on the left. As the mouse moves across
* the drawing area, a motion_notify_event is passed to the
* appropriate event handler for the ruler. */
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_CALLBACK (EVENT_METHOD (vrule, motion_notify_event)),
- G_OBJECT (vrule));
+ g_signal_connect_swapped (area, "motion-notify-event",
+ G_CALLBACK (EVENT_METHOD (vrule,
+ motion_notify_event)),
+ vrule);
gtk_table_attach (GTK_TABLE (table), vrule, 0, 1, 1, 2,
GTK_FILL, GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0);
diff --git a/examples/scribble-simple/scribble-simple.c b/examples/scribble-simple/scribble-simple.c
index 92e54da91e..069eea1b8d 100644
--- a/examples/scribble-simple/scribble-simple.c
+++ b/examples/scribble-simple/scribble-simple.c
@@ -133,7 +133,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 */
@@ -146,16 +146,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
@@ -168,9 +168,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);
diff --git a/examples/scribble-xinput/scribble-xinput.c b/examples/scribble-xinput/scribble-xinput.c
index 657266f675..900a3ecd5e 100644
--- a/examples/scribble-xinput/scribble-xinput.c
+++ b/examples/scribble-xinput/scribble-xinput.c
@@ -157,12 +157,12 @@ create_input_dialog ()
{
inputd = gtk_input_dialog_new();
- g_signal_connect (G_OBJECT (inputd), "destroy",
- G_CALLBACK (input_dialog_destroy), (gpointer) &inputd);
- g_signal_connect_swapped (G_OBJECT (GTK_INPUT_DIALOG (inputd)->close_button),
+ g_signal_connect (inputd, "destroy",
+ G_CALLBACK (input_dialog_destroy), &inputd);
+ 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);
@@ -194,7 +194,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 */
@@ -207,16 +207,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
@@ -233,16 +233,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);
diff --git a/examples/selection/gettargets.c b/examples/selection/gettargets.c
index 388664553b..9b4aca4d7f 100644
--- a/examples/selection/gettargets.c
+++ b/examples/selection/gettargets.c
@@ -2,8 +2,8 @@
#include <stdlib.h>
#include <gtk/gtk.h>
-static void selection_received( GtkWidget *widget,
- GtkSelectionData *selection_data,
+static void selection_received( GtkWidget *widget,
+ GtkSelectionData *selection_data,
gpointer data );
/* Signal handler invoked when user clicks on the "Get Targets" button */
@@ -11,7 +11,7 @@ static void get_targets( GtkWidget *widget,
gpointer data )
{
static GdkAtom targets_atom = GDK_NONE;
- GtkWidget *window = (GtkWidget *)data;
+ GtkWidget *window = (GtkWidget *)data;
/* Get the atom corresponding to the string "TARGETS" */
if (targets_atom == GDK_NONE)
@@ -24,7 +24,7 @@ static void get_targets( GtkWidget *widget,
/* Signal handler called when the selections owner returns the data */
static void selection_received( GtkWidget *widget,
- GtkSelectionData *selection_data,
+ GtkSelectionData *selection_data,
gpointer data )
{
GdkAtom *atoms;
@@ -43,7 +43,7 @@ static void selection_received( GtkWidget *widget,
g_print ("Selection \"TARGETS\" was not returned as atoms!\n");
return;
}
-
+
/* Print out the atoms we received */
atoms = (GdkAtom *)selection_data->data;
@@ -66,7 +66,7 @@ int main( int argc,
{
GtkWidget *window;
GtkWidget *button;
-
+
gtk_init (&argc, &argv);
/* Create the toplevel window */
@@ -75,7 +75,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 */
@@ -83,15 +83,15 @@ 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);
gtk_widget_show (window);
-
+
gtk_main ();
-
+
return 0;
}
diff --git a/examples/selection/setselection.c b/examples/selection/setselection.c
index 8ecf96c42a..1e22c4eea1 100644
--- a/examples/selection/setselection.c
+++ b/examples/selection/setselection.c
@@ -47,7 +47,7 @@ static gboolean selection_clear( GtkWidget *widget,
}
/* Supplies the current time as the selection. */
-static void selection_handle( GtkWidget *widget,
+static void selection_handle( GtkWidget *widget,
GtkSelectionData *selection_data,
guint info,
guint time_stamp,
@@ -57,7 +57,7 @@ static void selection_handle( GtkWidget *widget,
time_t current_time;
current_time = time (NULL);
- timestr = asctime (localtime (&current_time));
+ timestr = asctime (localtime (&current_time));
/* When we return a single string, it should not be null terminated.
That will be done for us */
@@ -71,7 +71,7 @@ int main( int argc,
GtkWidget *window;
static int have_selection = FALSE;
-
+
gtk_init (&argc, &argv);
/* Create the toplevel window */
@@ -80,7 +80,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 */
@@ -90,22 +90,22 @@ 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_CALLBACK (selection_toggled), (gpointer) &have_selection);
- g_signal_connect (G_OBJECT (selection_widget), "selection_clear_event",
- G_CALLBACK (selection_clear), (gpointer) &have_selection);
+ g_signal_connect (selection_button, "toggled",
+ G_CALLBACK (selection_toggled), &have_selection);
+ g_signal_connect (selection_widget, "selection-clear-event",
+ G_CALLBACK (selection_clear), &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_CALLBACK (selection_handle), (gpointer) &have_selection);
+ g_signal_connect (selection_widget, "selection-get",
+ G_CALLBACK (selection_handle), &have_selection);
gtk_widget_show (selection_button);
gtk_widget_show (window);
-
+
gtk_main ();
-
+
return 0;
}
diff --git a/examples/spinbutton/spinbutton.c b/examples/spinbutton/spinbutton.c
index 7c69d9028e..eff67ff823 100644
--- a/examples/spinbutton/spinbutton.c
+++ b/examples/spinbutton/spinbutton.c
@@ -63,7 +63,7 @@ int main( int argc,
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);
@@ -72,150 +72,150 @@ int main( int argc,
main_vbox = gtk_vbox_new (FALSE, 5);
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 10);
gtk_container_add (GTK_CONTAINER (window), main_vbox);
-
+
frame = gtk_frame_new ("Not accelerated");
gtk_box_pack_start (GTK_BOX (main_vbox), frame, TRUE, TRUE, 0);
-
+
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
gtk_container_add (GTK_CONTAINER (frame), vbox);
-
+
/* Day, month, year spinners */
-
+
hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 5);
-
+
vbox2 = gtk_vbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 5);
-
+
label = gtk_label_new ("Day :");
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, TRUE, 0);
-
+
adj = (GtkAdjustment *) gtk_adjustment_new (1.0, 1.0, 31.0, 1.0,
5.0, 0.0);
spinner = gtk_spin_button_new (adj, 0, 0);
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spinner), TRUE);
gtk_box_pack_start (GTK_BOX (vbox2), spinner, FALSE, TRUE, 0);
-
+
vbox2 = gtk_vbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 5);
-
+
label = gtk_label_new ("Month :");
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, TRUE, 0);
-
+
adj = (GtkAdjustment *) gtk_adjustment_new (1.0, 1.0, 12.0, 1.0,
5.0, 0.0);
spinner = gtk_spin_button_new (adj, 0, 0);
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spinner), TRUE);
gtk_box_pack_start (GTK_BOX (vbox2), spinner, FALSE, TRUE, 0);
-
+
vbox2 = gtk_vbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 5);
-
+
label = gtk_label_new ("Year :");
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, TRUE, 0);
-
+
adj = (GtkAdjustment *) gtk_adjustment_new (1998.0, 0.0, 2100.0,
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_size_request (spinner, 55, -1);
gtk_box_pack_start (GTK_BOX (vbox2), spinner, FALSE, TRUE, 0);
-
+
frame = gtk_frame_new ("Accelerated");
gtk_box_pack_start (GTK_BOX (main_vbox), frame, TRUE, TRUE, 0);
-
+
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
gtk_container_add (GTK_CONTAINER (frame), vbox);
-
+
hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 5);
-
+
vbox2 = gtk_vbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 5);
-
+
label = gtk_label_new ("Value :");
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, TRUE, 0);
-
+
adj = (GtkAdjustment *) gtk_adjustment_new (0.0, -10000.0, 10000.0,
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_size_request (spinner1, 100, -1);
gtk_box_pack_start (GTK_BOX (vbox2), spinner1, FALSE, TRUE, 0);
-
+
vbox2 = gtk_vbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 5);
-
+
label = gtk_label_new ("Digits :");
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, TRUE, 0);
-
+
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);
-
+
val_label = gtk_label_new ("");
-
+
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");
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);
-
+
gtk_box_pack_start (GTK_BOX (vbox), val_label, TRUE, TRUE, 0);
gtk_label_set_text (GTK_LABEL (val_label), "0");
-
+
hbox = gtk_hbox_new (FALSE, 0);
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);
/* Enter the event loop */
gtk_main ();
-
+
return 0;
}
diff --git a/examples/statusbar/statusbar.c b/examples/statusbar/statusbar.c
index eab9a2a4a1..6e06abb08d 100644
--- a/examples/statusbar/statusbar.c
+++ b/examples/statusbar/statusbar.c
@@ -38,14 +38,14 @@ int main( int argc,
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_size_request (GTK_WIDGET (window), 200, 100);
gtk_window_set_title (GTK_WINDOW (window), "GTK Statusbar Example");
- g_signal_connect (G_OBJECT (window), "delete_event",
+ g_signal_connect (window, "delete-event",
G_CALLBACK (exit), NULL);
-
+
vbox = gtk_vbox_new (FALSE, 1);
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_widget_show (vbox);
-
- status_bar = gtk_statusbar_new ();
+
+ status_bar = gtk_statusbar_new ();
gtk_box_pack_start (GTK_BOX (vbox), status_bar, TRUE, TRUE, 0);
gtk_widget_show (status_bar);
@@ -53,13 +53,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);
+ 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);
diff --git a/examples/table/table.c b/examples/table/table.c
index f616602957..df3a50009e 100644
--- a/examples/table/table.c
+++ b/examples/table/table.c
@@ -35,7 +35,7 @@ int main( int argc,
/* Set a handler for delete_event that immediately
* exits GTK. */
- g_signal_connect (G_OBJECT (window), "delete_event",
+ g_signal_connect (window, "delete-event",
G_CALLBACK (delete_event), NULL);
/* Sets the border width of the window. */
@@ -52,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 */
- g_signal_connect (G_OBJECT (button), "clicked",
+ g_signal_connect (button, "clicked",
G_CALLBACK (callback), (gpointer) "button 1");
@@ -67,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 */
- 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);
@@ -79,10 +79,10 @@ 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
+ /* Insert the quit button into the both
* lower quadrants of the table */
gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 2, 1, 2);