summaryrefslogtreecommitdiff
path: root/demos
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@src.gnome.org>2001-10-20 23:39:32 +0000
committerOwen Taylor <otaylor@src.gnome.org>2001-10-20 23:39:32 +0000
commit58b5405bd23efa039d3f0879fa5521f3c6bd222f (patch)
treea11783a7f05ea52a93c4590aa73eb6fb789b549f /demos
parent88c9fe3815c4ea177e2aba24e4e0957b7107ff22 (diff)
downloadgtk+-58b5405bd23efa039d3f0879fa5521f3c6bd222f.tar.gz
at Oct 20 19:38:16 2001 Owen Taylor <otaylor@redhat.com>
* demos/*.c demos/gdk-pixbuf/*.c: Eliminate gtk_signal_* in favor of g_signal_*, gtk_object_* in favor of g_object_*.
Diffstat (limited to 'demos')
-rw-r--r--demos/gtk-demo/appwindow.c2
-rw-r--r--demos/gtk-demo/button_box.c6
-rw-r--r--demos/gtk-demo/colorsel.c8
-rw-r--r--demos/gtk-demo/dialog.c10
-rw-r--r--demos/gtk-demo/drawingarea.c24
-rw-r--r--demos/gtk-demo/images.c48
-rw-r--r--demos/gtk-demo/item_factory.c21
-rw-r--r--demos/gtk-demo/main.c29
-rw-r--r--demos/gtk-demo/menus.c15
-rw-r--r--demos/gtk-demo/panes.c25
-rw-r--r--demos/gtk-demo/pixbufs.c14
-rw-r--r--demos/gtk-demo/sizegroup.c12
-rw-r--r--demos/gtk-demo/stock_browser.c3
-rw-r--r--demos/gtk-demo/textview.c5
-rw-r--r--demos/pixbuf-demo.c8
-rw-r--r--demos/testanimation.c36
-rw-r--r--demos/testpixbuf-drawable.c120
-rw-r--r--demos/testpixbuf-save.c36
-rw-r--r--demos/testpixbuf-scale.c36
-rw-r--r--demos/testpixbuf.c73
20 files changed, 240 insertions, 291 deletions
diff --git a/demos/gtk-demo/appwindow.c b/demos/gtk-demo/appwindow.c
index b1befcbe69..1b5df07500 100644
--- a/demos/gtk-demo/appwindow.c
+++ b/demos/gtk-demo/appwindow.c
@@ -220,7 +220,7 @@ do_appwindow (void)
item_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<main>", accel_group);
/* Set up item factory to go away with the window */
- gtk_object_ref (GTK_OBJECT (item_factory));
+ g_object_ref (item_factory);
gtk_object_sink (GTK_OBJECT (item_factory));
g_object_set_data_full (G_OBJECT (window),
"<main>",
diff --git a/demos/gtk-demo/button_box.c b/demos/gtk-demo/button_box.c
index f4527a8331..a92bd20f97 100644
--- a/demos/gtk-demo/button_box.c
+++ b/demos/gtk-demo/button_box.c
@@ -55,9 +55,9 @@ do_button_box (void)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Button Boxes");
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(gtk_widget_destroyed),
- &window);
+ g_signal_connect (window, "destroy",
+ G_CALLBACK (gtk_widget_destroyed),
+ &window);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
diff --git a/demos/gtk-demo/colorsel.c b/demos/gtk-demo/colorsel.c
index da02ef39c4..11156cdec8 100644
--- a/demos/gtk-demo/colorsel.c
+++ b/demos/gtk-demo/colorsel.c
@@ -59,7 +59,8 @@ do_colorsel (void)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Color Selection");
- gtk_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (gtk_widget_destroyed), &window);
+ g_signal_connect (window, "destroy",
+ G_CALLBACK (gtk_widget_destroyed), &window);
gtk_container_set_border_width (GTK_CONTAINER (window), 8);
@@ -91,9 +92,8 @@ do_colorsel (void)
gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, FALSE, 0);
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (change_color_callback),
- NULL);
+ g_signal_connect (button, "clicked",
+ G_CALLBACK (change_color_callback), NULL);
}
if (!GTK_WIDGET_VISIBLE (window))
diff --git a/demos/gtk-demo/dialog.c b/demos/gtk-demo/dialog.c
index 5bca888f0b..12ff9d0114 100644
--- a/demos/gtk-demo/dialog.c
+++ b/demos/gtk-demo/dialog.c
@@ -108,7 +108,7 @@ do_dialog (void)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Dialogs");
- gtk_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (gtk_widget_destroyed), &window);
+ g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window);
gtk_container_set_border_width (GTK_CONTAINER (window), 8);
frame = gtk_frame_new ("Dialogs");
@@ -122,8 +122,8 @@ do_dialog (void)
hbox = gtk_hbox_new (FALSE, 8);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
button = gtk_button_new_with_mnemonic ("_Message Dialog");
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (message_dialog_clicked), NULL);
+ g_signal_connect (button, "clicked",
+ G_CALLBACK (message_dialog_clicked), NULL);
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), gtk_hseparator_new (), FALSE, FALSE, 0);
@@ -134,8 +134,8 @@ do_dialog (void)
vbox2 = gtk_vbox_new (FALSE, 0);
button = gtk_button_new_with_mnemonic ("_Interactive Dialog");
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (interactive_dialog_clicked), NULL);
+ g_signal_connect (button, "clicked",
+ G_CALLBACK (interactive_dialog_clicked), NULL);
gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
diff --git a/demos/gtk-demo/drawingarea.c b/demos/gtk-demo/drawingarea.c
index 007c191d2f..e4edbf8a4c 100644
--- a/demos/gtk-demo/drawingarea.c
+++ b/demos/gtk-demo/drawingarea.c
@@ -231,7 +231,7 @@ do_drawingarea (void)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Drawing Area");
- gtk_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (gtk_widget_destroyed), &window);
+ g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window);
gtk_container_set_border_width (GTK_CONTAINER (window), 8);
@@ -258,10 +258,8 @@ do_drawingarea (void)
gtk_container_add (GTK_CONTAINER (frame), da);
- gtk_signal_connect (GTK_OBJECT (da),
- "expose_event",
- GTK_SIGNAL_FUNC (checkerboard_expose),
- NULL);
+ g_signal_connect (da, "expose_event",
+ G_CALLBACK (checkerboard_expose), NULL);
/*
* Create the scribble area
@@ -284,17 +282,17 @@ do_drawingarea (void)
/* Signals used to handle backing pixmap */
- gtk_signal_connect (GTK_OBJECT (da), "expose_event",
- GTK_SIGNAL_FUNC (scribble_expose_event), NULL);
- gtk_signal_connect (GTK_OBJECT (da),"configure_event",
- GTK_SIGNAL_FUNC (scribble_configure_event), NULL);
+ g_signal_connect (da, "expose_event",
+ G_CALLBACK (scribble_expose_event), NULL);
+ g_signal_connect (da,"configure_event",
+ G_CALLBACK (scribble_configure_event), NULL);
/* Event signals */
- gtk_signal_connect (GTK_OBJECT (da), "motion_notify_event",
- GTK_SIGNAL_FUNC (scribble_motion_notify_event), NULL);
- gtk_signal_connect (GTK_OBJECT (da), "button_press_event",
- GTK_SIGNAL_FUNC (scribble_button_press_event), NULL);
+ g_signal_connect (da, "motion_notify_event",
+ G_CALLBACK (scribble_motion_notify_event), NULL);
+ g_signal_connect (da, "button_press_event",
+ G_CALLBACK (scribble_button_press_event), NULL);
/* Ask to receive events the drawing area doesn't normally
diff --git a/demos/gtk-demo/images.c b/demos/gtk-demo/images.c
index d2090428eb..154e14beda 100644
--- a/demos/gtk-demo/images.c
+++ b/demos/gtk-demo/images.c
@@ -93,10 +93,8 @@ progressive_timeout (gpointer data)
"Failure reading image file 'alphatest.png': %s",
g_strerror (errno));
- gtk_signal_connect (GTK_OBJECT (dialog),
- "response",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- NULL);
+ g_signal_connect (dialog, "response",
+ G_CALLBACK (gtk_widget_destroy), NULL);
fclose (image_stream);
image_stream = NULL;
@@ -123,10 +121,8 @@ progressive_timeout (gpointer data)
g_error_free (error);
- gtk_signal_connect (GTK_OBJECT (dialog),
- "response",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- NULL);
+ g_signal_connect (dialog, "response",
+ G_CALLBACK (gtk_widget_destroy), NULL);
fclose (image_stream);
image_stream = NULL;
@@ -162,10 +158,8 @@ progressive_timeout (gpointer data)
g_error_free (error);
- gtk_signal_connect (GTK_OBJECT (dialog),
- "response",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- NULL);
+ g_signal_connect (dialog, "response",
+ G_CALLBACK (gtk_widget_destroy), NULL);
gtk_widget_show (dialog);
@@ -203,10 +197,8 @@ progressive_timeout (gpointer data)
"Unable to open image file 'alphatest.png': %s",
g_strerror (errno));
- gtk_signal_connect (GTK_OBJECT (dialog),
- "response",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- NULL);
+ g_signal_connect (dialog, "response",
+ G_CALLBACK (gtk_widget_destroy), NULL);
gtk_widget_show (dialog);
@@ -224,15 +216,11 @@ progressive_timeout (gpointer data)
pixbuf_loader = gdk_pixbuf_loader_new ();
- g_signal_connect (G_OBJECT (pixbuf_loader),
- "area_prepared",
- G_CALLBACK (progressive_prepared_callback),
- image);
+ g_signal_connect (G_OBJECT (pixbuf_loader), "area_prepared",
+ G_CALLBACK (progressive_prepared_callback), image);
- g_signal_connect (G_OBJECT (pixbuf_loader),
- "area_updated",
- G_CALLBACK (progressive_updated_callback),
- image);
+ g_signal_connect (G_OBJECT (pixbuf_loader), "area_updated",
+ G_CALLBACK (progressive_updated_callback), image);
}
/* leave timeout installed */
@@ -290,8 +278,10 @@ do_images (void)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Images");
- gtk_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (gtk_widget_destroyed), &window);
- gtk_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (cleanup_callback), NULL);
+ g_signal_connect (window, "destroy",
+ G_CALLBACK (gtk_widget_destroyed), &window);
+ g_signal_connect (window, "destroy",
+ G_CALLBACK (cleanup_callback), NULL);
gtk_container_set_border_width (GTK_CONTAINER (window), 8);
@@ -341,10 +331,8 @@ do_images (void)
error->message);
g_error_free (error);
- gtk_signal_connect (GTK_OBJECT (dialog),
- "response",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- NULL);
+ g_signal_connect (dialog, "response",
+ G_CALLBACK (gtk_widget_destroy), NULL);
gtk_widget_show (dialog);
}
diff --git a/demos/gtk-demo/item_factory.c b/demos/gtk-demo/item_factory.c
index 5a55de4b67..34f3cb51d6 100644
--- a/demos/gtk-demo/item_factory.c
+++ b/demos/gtk-demo/item_factory.c
@@ -59,19 +59,15 @@ do_item_factory (void)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(gtk_widget_destroyed),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete-event",
- GTK_SIGNAL_FUNC (gtk_true),
- NULL);
+ g_signal_connect (window, "destroy",
+ G_CALLBACK (gtk_widget_destroyed), &window);
+ g_signal_connect (window, "delete-event",
+ G_CALLBACK (gtk_true), NULL);
accel_group = gtk_accel_group_new ();
item_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<main>", accel_group);
- gtk_object_set_data_full (GTK_OBJECT (window),
- "<main>",
- item_factory,
- (GtkDestroyNotify) gtk_object_unref);
+ g_object_set_data_full (G_OBJECT (window), "<main>",
+ item_factory, (GDestroyNotify) g_object_unref);
gtk_accel_group_attach (accel_group, G_OBJECT (window));
gtk_window_set_title (GTK_WINDOW (window), "Item Factory");
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
@@ -106,9 +102,8 @@ do_item_factory (void)
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
+ g_signal_connect_swapped (button, "clicked",
+ G_CALLBACK (gtk_widget_destroy), 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);
diff --git a/demos/gtk-demo/main.c b/demos/gtk-demo/main.c
index b40f6ec1ea..af77af1ebe 100644
--- a/demos/gtk-demo/main.c
+++ b/demos/gtk-demo/main.c
@@ -554,10 +554,8 @@ button_press_event_cb (GtkTreeView *tree_view,
cbdata->model = model;
cbdata->path = path;
- gtk_signal_connect (GTK_OBJECT (window),
- "destroy",
- GTK_SIGNAL_FUNC (window_closed_cb),
- cbdata);
+ g_signal_connect (window, "destroy",
+ G_CALLBACK (window_closed_cb), cbdata);
}
else
{
@@ -568,8 +566,7 @@ button_press_event_cb (GtkTreeView *tree_view,
gtk_tree_path_free (path);
}
- gtk_signal_emit_stop_by_name (GTK_OBJECT (tree_view),
- "button_press_event");
+ g_signal_stop_emission_by_name (tree_view, "button_press_event");
return TRUE;
}
@@ -612,10 +609,8 @@ row_activated_cb (GtkTreeView *tree_view,
cbdata->model = model;
cbdata->path = gtk_tree_path_copy (path);
- gtk_signal_connect (GTK_OBJECT (window),
- "destroy",
- GTK_SIGNAL_FUNC (window_closed_cb),
- cbdata);
+ g_signal_connect (window, "destroy",
+ G_CALLBACK (window_closed_cb), cbdata);
}
}
}
@@ -760,8 +755,8 @@ create_tree (void)
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view),
GTK_TREE_VIEW_COLUMN (column));
- g_signal_connect (G_OBJECT (selection), "changed", GTK_SIGNAL_FUNC (selection_cb), model);
- g_signal_connect (G_OBJECT (tree_view), "row_activated", GTK_SIGNAL_FUNC (row_activated_cb), model);
+ g_signal_connect (selection, "changed", G_CALLBACK (selection_cb), model);
+ g_signal_connect (tree_view, "row_activated", G_CALLBACK (row_activated_cb), model);
gtk_tree_view_expand_all (GTK_TREE_VIEW (tree_view));
@@ -801,10 +796,8 @@ setup_default_icon (void)
err->message);
g_error_free (err);
- gtk_signal_connect (GTK_OBJECT (dialog),
- "response",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- NULL);
+ g_signal_connect (dialog, "response",
+ G_CALLBACK (gtk_widget_destroy), NULL);
}
}
@@ -852,8 +845,8 @@ main (int argc, char **argv)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "GTK+ Code Demos");
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
+ g_signal_connect (window, "destroy",
+ G_CALLBACK (gtk_main_quit), NULL);
hbox = gtk_hbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), hbox);
diff --git a/demos/gtk-demo/menus.c b/demos/gtk-demo/menus.c
index 6dba405d78..99899a7d32 100644
--- a/demos/gtk-demo/menus.c
+++ b/demos/gtk-demo/menus.c
@@ -92,12 +92,10 @@ do_menus (void)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(gtk_widget_destroyed),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete-event",
- GTK_SIGNAL_FUNC (gtk_true),
- NULL);
+ g_signal_connect (window, "destroy",
+ G_CALLBACK(gtk_widget_destroyed), &window);
+ g_signal_connect (window, "delete-event",
+ G_CALLBACK (gtk_true), NULL);
accel_group = gtk_accel_group_new ();
gtk_accel_group_attach (accel_group, G_OBJECT (window));
@@ -195,9 +193,8 @@ do_menus (void)
gtk_widget_show (box2);
button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
+ g_signal_connect_swapped (button, "clicked",
+ G_CALLBACK(gtk_widget_destroy), 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);
diff --git a/demos/gtk-demo/panes.c b/demos/gtk-demo/panes.c
index 86d11c03da..686ad39250 100644
--- a/demos/gtk-demo/panes.c
+++ b/demos/gtk-demo/panes.c
@@ -77,18 +77,16 @@ create_pane_options (GtkPaned *paned,
check_button = gtk_check_button_new_with_mnemonic ("_Resize");
gtk_table_attach_defaults (GTK_TABLE (table), check_button,
0, 1, 1, 2);
- gtk_signal_connect (GTK_OBJECT (check_button), "toggled",
- GTK_SIGNAL_FUNC (toggle_resize),
- paned->child1);
+ g_signal_connect (check_button, "toggled",
+ G_CALLBACK (toggle_resize), paned->child1);
check_button = gtk_check_button_new_with_mnemonic ("_Shrink");
gtk_table_attach_defaults (GTK_TABLE (table), check_button,
0, 1, 2, 3);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button),
TRUE);
- gtk_signal_connect (GTK_OBJECT (check_button), "toggled",
- GTK_SIGNAL_FUNC (toggle_shrink),
- paned->child1);
+ g_signal_connect (check_button, "toggled",
+ G_CALLBACK (toggle_shrink), paned->child1);
label = gtk_label_new (label2);
gtk_table_attach_defaults (GTK_TABLE (table), label,
@@ -99,18 +97,16 @@ create_pane_options (GtkPaned *paned,
1, 2, 1, 2);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button),
TRUE);
- gtk_signal_connect (GTK_OBJECT (check_button), "toggled",
- GTK_SIGNAL_FUNC (toggle_resize),
- paned->child2);
+ g_signal_connect (check_button, "toggled",
+ G_CALLBACK (toggle_resize), paned->child2);
check_button = gtk_check_button_new_with_mnemonic ("_Shrink");
gtk_table_attach_defaults (GTK_TABLE (table), check_button,
1, 2, 2, 3);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button),
TRUE);
- gtk_signal_connect (GTK_OBJECT (check_button), "toggled",
- GTK_SIGNAL_FUNC (toggle_shrink),
- paned->child2);
+ g_signal_connect (check_button, "toggled",
+ G_CALLBACK (toggle_shrink), paned->child2);
return frame;
}
@@ -129,9 +125,8 @@ do_panes (void)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(gtk_widget_destroyed),
- &window);
+ g_signal_connect (window, "destroy",
+ G_CALLBACK (gtk_widget_destroyed), &window);
gtk_window_set_title (GTK_WINDOW (window), "Panes");
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
diff --git a/demos/gtk-demo/pixbufs.c b/demos/gtk-demo/pixbufs.c
index d0f2f2a4ef..cd487a999c 100644
--- a/demos/gtk-demo/pixbufs.c
+++ b/demos/gtk-demo/pixbufs.c
@@ -219,8 +219,8 @@ do_pixbufs (void)
gtk_window_set_title (GTK_WINDOW (window), "Pixbufs");
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
- gtk_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (gtk_widget_destroyed), &window);
- gtk_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (cleanup_callback), NULL);
+ g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window);
+ g_signal_connect (window, "destroy", G_CALLBACK (cleanup_callback), NULL);
error = NULL;
@@ -237,10 +237,8 @@ do_pixbufs (void)
g_error_free (error);
- gtk_signal_connect (GTK_OBJECT (dialog),
- "response",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- NULL);
+ g_signal_connect (dialog, "response",
+ G_CALLBACK (gtk_widget_destroy), NULL);
gtk_widget_show (dialog);
}
@@ -252,8 +250,8 @@ do_pixbufs (void)
da = gtk_drawing_area_new ();
- gtk_signal_connect (GTK_OBJECT (da), "expose_event",
- GTK_SIGNAL_FUNC (expose_cb), NULL);
+ g_signal_connect (da, "expose_event",
+ G_CALLBACK (expose_cb), NULL);
gtk_container_add (GTK_CONTAINER (window), da);
diff --git a/demos/gtk-demo/sizegroup.c b/demos/gtk-demo/sizegroup.c
index 536dd74532..930a0d61f8 100644
--- a/demos/gtk-demo/sizegroup.c
+++ b/demos/gtk-demo/sizegroup.c
@@ -116,10 +116,10 @@ do_sizegroup (void)
NULL);
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
- gtk_signal_connect (GTK_OBJECT (window), "response",
- GTK_SIGNAL_FUNC (gtk_widget_destroy), NULL);
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC (gtk_widget_destroyed), &window);
+ g_signal_connect (window, "response",
+ G_CALLBACK (gtk_widget_destroy), NULL);
+ g_signal_connect (window, "destroy",
+ G_CALLBACK (gtk_widget_destroyed), &window);
vbox = gtk_vbox_new (FALSE, 5);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), vbox, TRUE, TRUE, 0);
@@ -160,8 +160,8 @@ do_sizegroup (void)
gtk_box_pack_start (GTK_BOX (vbox), check_button, FALSE, FALSE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), TRUE);
- gtk_signal_connect (GTK_OBJECT (check_button), "toggled",
- GTK_SIGNAL_FUNC (toggle_grouping), size_group);
+ g_signal_connect (check_button, "toggled",
+ G_CALLBACK (toggle_grouping), size_group);
}
if (!GTK_WIDGET_VISIBLE (window))
diff --git a/demos/gtk-demo/stock_browser.c b/demos/gtk-demo/stock_browser.c
index b66edda1ae..4523d699a7 100644
--- a/demos/gtk-demo/stock_browser.c
+++ b/demos/gtk-demo/stock_browser.c
@@ -86,7 +86,6 @@ id_to_macro (const gchar *id)
{
GString *macro;
const gchar *cp;
- gchar *p;
/* gtk-foo -> GTK_STOCK_FOO */
@@ -405,7 +404,7 @@ do_stock_browser (void)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Stock Icons and Items");
- gtk_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (gtk_widget_destroyed), &window);
+ g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window);
gtk_container_set_border_width (GTK_CONTAINER (window), 8);
hbox = gtk_hbox_new (FALSE, 8);
diff --git a/demos/gtk-demo/textview.c b/demos/gtk-demo/textview.c
index 34a2bd1aa5..cf1c5d0a52 100644
--- a/demos/gtk-demo/textview.c
+++ b/demos/gtk-demo/textview.c
@@ -366,9 +366,8 @@ do_textview (void)
gtk_window_set_default_size (GTK_WINDOW (window),
450, 450);
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(gtk_widget_destroyed),
- &window);
+ g_signal_connect (window, "destroy",
+ G_CALLBACK (gtk_widget_destroyed), &window);
gtk_window_set_title (GTK_WINDOW (window), "TextView");
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
diff --git a/demos/pixbuf-demo.c b/demos/pixbuf-demo.c
index 2ecd6f1d77..c25d8e6dfe 100644
--- a/demos/pixbuf-demo.c
+++ b/demos/pixbuf-demo.c
@@ -215,13 +215,13 @@ main (int argc, char **argv)
gtk_widget_set_size_request (window, back_width, back_height);
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC (destroy_cb), NULL);
+ g_signal_connect (window, "destroy",
+ G_CALLBACK (destroy_cb), NULL);
da = gtk_drawing_area_new ();
- gtk_signal_connect (GTK_OBJECT (da), "expose_event",
- GTK_SIGNAL_FUNC (expose_cb), NULL);
+ g_signal_connect (da, "expose_event",
+ G_CALLBACK (expose_cb), NULL);
gtk_container_add (GTK_CONTAINER (window), da);
diff --git a/demos/testanimation.c b/demos/testanimation.c
index e0ce24e8f5..c9bbaba928 100644
--- a/demos/testanimation.c
+++ b/demos/testanimation.c
@@ -160,10 +160,8 @@ progressive_timeout (gpointer data)
"Failure reading image file 'alphatest.png': %s",
g_strerror (errno));
- gtk_signal_connect (GTK_OBJECT (dialog),
- "response",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- NULL);
+ g_signal_connect (dialog, "response",
+ G_CALLBACK (gtk_widget_destroy), NULL);
fclose (lc->image_stream);
lc->image_stream = NULL;
@@ -190,10 +188,8 @@ progressive_timeout (gpointer data)
g_error_free (error);
- gtk_signal_connect (GTK_OBJECT (dialog),
- "response",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- NULL);
+ g_signal_connect (dialog, "response",
+ G_CALLBACK (gtk_widget_destroy), NULL);
fclose (lc->image_stream);
lc->image_stream = NULL;
@@ -229,10 +225,8 @@ progressive_timeout (gpointer data)
g_error_free (error);
- gtk_signal_connect (GTK_OBJECT (dialog),
- "response",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- NULL);
+ g_signal_connect (dialog, "response",
+ G_CALLBACK (gtk_widget_destroy), NULL);
gtk_widget_show (dialog);
@@ -264,10 +258,8 @@ progressive_timeout (gpointer data)
lc->filename,
g_strerror (errno));
- gtk_signal_connect (GTK_OBJECT (dialog),
- "response",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- NULL);
+ g_signal_connect (dialog, "response",
+ G_CALLBACK (gtk_widget_destroy), NULL);
gtk_widget_show (dialog);
@@ -285,14 +277,10 @@ progressive_timeout (gpointer data)
lc->pixbuf_loader = gdk_pixbuf_loader_new ();
- g_signal_connect (G_OBJECT (lc->pixbuf_loader),
- "area_prepared",
- G_CALLBACK (progressive_prepared_callback),
- image);
- g_signal_connect (G_OBJECT (lc->pixbuf_loader),
- "area_updated",
- G_CALLBACK (progressive_updated_callback),
- image);
+ g_signal_connect (G_OBJECT (lc->pixbuf_loader), "area_prepared",
+ G_CALLBACK (progressive_prepared_callback), image);
+ g_signal_connect (G_OBJECT (lc->pixbuf_loader), "area_updated",
+ G_CALLBACK (progressive_updated_callback), image);
}
/* leave timeout installed */
diff --git a/demos/testpixbuf-drawable.c b/demos/testpixbuf-drawable.c
index fa98d0e037..7afb8658fb 100644
--- a/demos/testpixbuf-drawable.c
+++ b/demos/testpixbuf-drawable.c
@@ -1,73 +1,75 @@
#include <config.h>
#include <gtk/gtk.h>
-int close_app(GtkWidget *widget, gpointer data)
+int
+close_app (GtkWidget *widget, gpointer data)
{
- gtk_main_quit();
+ gtk_main_quit ();
return TRUE;
}
-int expose_cb(GtkWidget *drawing_area, GdkEventExpose *evt, gpointer data)
+int
+expose_cb (GtkWidget *drawing_area, GdkEventExpose *evt, gpointer data)
{
GdkPixbuf *pixbuf;
- pixbuf = (GdkPixbuf *) gtk_object_get_data(GTK_OBJECT(drawing_area),
- "pixbuf");
- if(gdk_pixbuf_get_has_alpha (pixbuf))
+ pixbuf = (GdkPixbuf *) g_object_get_data (G_OBJECT (drawing_area), "pixbuf");
+ if (gdk_pixbuf_get_has_alpha (pixbuf))
{
- gdk_draw_rgb_32_image(drawing_area->window,
- drawing_area->style->black_gc,
- evt->area.x, evt->area.y,
- evt->area.width,
- evt->area.height,
- GDK_RGB_DITHER_MAX,
- gdk_pixbuf_get_pixels (pixbuf) +
- (evt->area.y * gdk_pixbuf_get_rowstride (pixbuf)) +
- (evt->area.x * gdk_pixbuf_get_n_channels (pixbuf)),
- gdk_pixbuf_get_rowstride (pixbuf));
+ gdk_draw_rgb_32_image (drawing_area->window,
+ drawing_area->style->black_gc,
+ evt->area.x, evt->area.y,
+ evt->area.width,
+ evt->area.height,
+ GDK_RGB_DITHER_MAX,
+ gdk_pixbuf_get_pixels (pixbuf) +
+ (evt->area.y * gdk_pixbuf_get_rowstride (pixbuf)) +
+ (evt->area.x * gdk_pixbuf_get_n_channels (pixbuf)),
+ gdk_pixbuf_get_rowstride (pixbuf));
}
else
{
- gdk_draw_rgb_image(drawing_area->window,
- drawing_area->style->black_gc,
- evt->area.x, evt->area.y,
- evt->area.width,
- evt->area.height,
- GDK_RGB_DITHER_NORMAL,
- gdk_pixbuf_get_pixels (pixbuf) +
- (evt->area.y * gdk_pixbuf_get_rowstride (pixbuf)) +
- (evt->area.x * gdk_pixbuf_get_n_channels (pixbuf)),
- gdk_pixbuf_get_rowstride (pixbuf));
+ gdk_draw_rgb_image (drawing_area->window,
+ drawing_area->style->black_gc,
+ evt->area.x, evt->area.y,
+ evt->area.width,
+ evt->area.height,
+ GDK_RGB_DITHER_NORMAL,
+ gdk_pixbuf_get_pixels (pixbuf) +
+ (evt->area.y * gdk_pixbuf_get_rowstride (pixbuf)) +
+ (evt->area.x * gdk_pixbuf_get_n_channels (pixbuf)),
+ gdk_pixbuf_get_rowstride (pixbuf));
}
return FALSE;
}
-int configure_cb(GtkWidget *drawing_area, GdkEventConfigure *evt, gpointer data)
+int
+configure_cb (GtkWidget *drawing_area, GdkEventConfigure *evt, gpointer data)
{
GdkPixbuf *pixbuf;
- pixbuf = (GdkPixbuf *) gtk_object_get_data(GTK_OBJECT(drawing_area),
- "pixbuf");
+ pixbuf = (GdkPixbuf *) g_object_get_data (G_OBJECT (drawing_area), "pixbuf");
- g_print("X:%d Y:%d\n", evt->width, evt->height);
- if(evt->width != gdk_pixbuf_get_width (pixbuf) || evt->height != gdk_pixbuf_get_height (pixbuf))
+ g_print ("X:%d Y:%d\n", evt->width, evt->height);
+ if (evt->width != gdk_pixbuf_get_width (pixbuf) || evt->height != gdk_pixbuf_get_height (pixbuf))
{
GdkWindow *root;
GdkPixbuf *new_pixbuf;
root = gdk_get_default_root_window ();
- new_pixbuf = gdk_pixbuf_get_from_drawable(NULL, root, NULL,
- 0, 0, 0, 0, evt->width, evt->height);
- gtk_object_set_data(GTK_OBJECT(drawing_area), "pixbuf", new_pixbuf);
- gdk_pixbuf_unref(pixbuf);
+ new_pixbuf = gdk_pixbuf_get_from_drawable (NULL, root, NULL,
+ 0, 0, 0, 0, evt->width, evt->height);
+ g_object_set_data (G_OBJECT (drawing_area), "pixbuf", new_pixbuf);
+ gdk_pixbuf_unref (pixbuf);
}
return FALSE;
}
-extern void pixbuf_init();
+extern void pixbuf_init ();
-int main(int argc, char **argv)
+int
+main (int argc, char **argv)
{
GdkWindow *root;
GtkWidget *window;
@@ -77,37 +79,37 @@ int main(int argc, char **argv)
pixbuf_init ();
- gtk_init(&argc, &argv);
- gdk_rgb_set_verbose(TRUE);
+ gtk_init (&argc, &argv);
+ gdk_rgb_set_verbose (TRUE);
- gtk_widget_set_default_colormap(gdk_rgb_get_colormap());
+ gtk_widget_set_default_colormap (gdk_rgb_get_colormap ());
root = gdk_get_default_root_window ();
- pixbuf = gdk_pixbuf_get_from_drawable(NULL, root, NULL,
- 0, 0, 0, 0, 150, 160);
+ pixbuf = gdk_pixbuf_get_from_drawable (NULL, root, NULL,
+ 0, 0, 0, 0, 150, 160);
- window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- gtk_signal_connect(GTK_OBJECT(window), "delete_event",
- GTK_SIGNAL_FUNC(close_app), NULL);
- gtk_signal_connect(GTK_OBJECT(window), "destroy",
- GTK_SIGNAL_FUNC(close_app), NULL);
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ g_signal_connect (window, "delete_event",
+ G_CALLBACK (close_app), NULL);
+ g_signal_connect (window, "destroy",
+ G_CALLBACK (close_app), NULL);
- vbox = gtk_vbox_new(FALSE, 0);
- gtk_container_add(GTK_CONTAINER(window), vbox);
+ vbox = gtk_vbox_new (FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (window), vbox);
- drawing_area = gtk_drawing_area_new();
- gtk_widget_set_size_request (GTK_WIDGET(drawing_area),
+ drawing_area = gtk_drawing_area_new ();
+ gtk_widget_set_size_request (GTK_WIDGET (drawing_area),
gdk_pixbuf_get_width (pixbuf),
gdk_pixbuf_get_height (pixbuf));
- gtk_signal_connect(GTK_OBJECT(drawing_area), "expose_event",
- GTK_SIGNAL_FUNC(expose_cb), NULL);
+ g_signal_connect (drawing_area, "expose_event",
+ G_CALLBACK (expose_cb), NULL);
- gtk_signal_connect(GTK_OBJECT(drawing_area), "configure_event",
- GTK_SIGNAL_FUNC(configure_cb), NULL);
- gtk_object_set_data(GTK_OBJECT(drawing_area), "pixbuf", pixbuf);
- gtk_box_pack_start(GTK_BOX(vbox), drawing_area, TRUE, TRUE, 0);
+ g_signal_connect (drawing_area, "configure_event",
+ G_CALLBACK (configure_cb), NULL);
+ g_object_set_data (G_OBJECT (drawing_area), "pixbuf", pixbuf);
+ gtk_box_pack_start (GTK_BOX (vbox), drawing_area, TRUE, TRUE, 0);
- gtk_widget_show_all(window);
- gtk_main();
+ gtk_widget_show_all (window);
+ gtk_main ();
return 0;
}
diff --git a/demos/testpixbuf-save.c b/demos/testpixbuf-save.c
index 88cac525dd..a76ff5b87a 100644
--- a/demos/testpixbuf-save.c
+++ b/demos/testpixbuf-save.c
@@ -11,7 +11,7 @@ keypress_check (GtkWidget *widget, GdkEventKey *evt, gpointer data)
GtkDrawingArea *da = (GtkDrawingArea*)data;
GError *err = NULL;
- pixbuf = (GdkPixbuf *) gtk_object_get_data (GTK_OBJECT (da), "pixbuf");
+ pixbuf = (GdkPixbuf *) g_object_get_data (G_OBJECT (da), "pixbuf");
if (evt->keyval == 'q')
gtk_main_quit ();
@@ -58,8 +58,8 @@ expose_cb (GtkWidget *drawing_area, GdkEventExpose *evt, gpointer data)
{
GdkPixbuf *pixbuf;
- pixbuf = (GdkPixbuf *) gtk_object_get_data (GTK_OBJECT (drawing_area),
- "pixbuf");
+ pixbuf = (GdkPixbuf *) g_object_get_data (G_OBJECT (drawing_area),
+ "pixbuf");
if (gdk_pixbuf_get_has_alpha (pixbuf)) {
gdk_draw_rgb_32_image (drawing_area->window,
drawing_area->style->black_gc,
@@ -91,8 +91,8 @@ configure_cb (GtkWidget *drawing_area, GdkEventConfigure *evt, gpointer data)
{
GdkPixbuf *pixbuf;
- pixbuf = (GdkPixbuf *) gtk_object_get_data (GTK_OBJECT (drawing_area),
- "pixbuf");
+ pixbuf = (GdkPixbuf *) g_object_get_data (G_OBJECT (drawing_area),
+ "pixbuf");
g_print ("X:%d Y:%d\n", evt->width, evt->height);
if (evt->width != gdk_pixbuf_get_width (pixbuf) || evt->height != gdk_pixbuf_get_height (pixbuf)) {
@@ -102,7 +102,7 @@ configure_cb (GtkWidget *drawing_area, GdkEventConfigure *evt, gpointer data)
root = gdk_get_default_root_window ();
new_pixbuf = gdk_pixbuf_get_from_drawable (NULL, root, NULL,
0, 0, 0, 0, evt->width, evt->height);
- gtk_object_set_data (GTK_OBJECT (drawing_area), "pixbuf", new_pixbuf);
+ g_object_set_data (G_OBJECT (drawing_area), "pixbuf", new_pixbuf);
gdk_pixbuf_unref (pixbuf);
}
@@ -127,10 +127,10 @@ main (int argc, char **argv)
0, 0, 0, 0, 150, 160);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC (close_app), NULL);
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC (close_app), NULL);
+ g_signal_connect (window, "delete_event",
+ G_CALLBACK (close_app), NULL);
+ g_signal_connect (window, "destroy",
+ G_CALLBACK (close_app), NULL);
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
@@ -139,14 +139,14 @@ main (int argc, char **argv)
gtk_widget_set_size_request (GTK_WIDGET (drawing_area),
gdk_pixbuf_get_width (pixbuf),
gdk_pixbuf_get_height (pixbuf));
- gtk_signal_connect (GTK_OBJECT (drawing_area), "expose_event",
- GTK_SIGNAL_FUNC (expose_cb), NULL);
-
- gtk_signal_connect (GTK_OBJECT (drawing_area), "configure_event",
- GTK_SIGNAL_FUNC (configure_cb), NULL);
- gtk_signal_connect (GTK_OBJECT (window), "key_press_event",
- GTK_SIGNAL_FUNC (keypress_check), drawing_area);
- gtk_object_set_data (GTK_OBJECT (drawing_area), "pixbuf", pixbuf);
+ g_signal_connect (drawing_area, "expose_event",
+ G_CALLBACK (expose_cb), NULL);
+
+ g_signal_connect (drawing_area, "configure_event",
+ G_CALLBACK (configure_cb), NULL);
+ g_signal_connect (window, "key_press_event",
+ G_CALLBACK (keypress_check), drawing_area);
+ g_object_set_data (G_OBJECT (drawing_area), "pixbuf", pixbuf);
gtk_box_pack_start (GTK_BOX (vbox), drawing_area, TRUE, TRUE, 0);
gtk_widget_show_all (window);
diff --git a/demos/testpixbuf-scale.c b/demos/testpixbuf-scale.c
index 959fa115c9..0f25487c44 100644
--- a/demos/testpixbuf-scale.c
+++ b/demos/testpixbuf-scale.c
@@ -89,8 +89,8 @@ main(int argc, char **argv)
g_print ("%s was created by '%s'\n", argv[1], creator);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
+ g_signal_connect (window, "destroy",
+ G_CALLBACK (gtk_main_quit), NULL);
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
@@ -98,29 +98,29 @@ main(int argc, char **argv)
menu = gtk_menu_new ();
menuitem = gtk_menu_item_new_with_label ("NEAREST");
- gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
- GTK_SIGNAL_FUNC (set_interp_type),
- GUINT_TO_POINTER (GDK_INTERP_NEAREST));
+ g_signal_connect (menuitem, "activate",
+ G_CALLBACK (set_interp_type),
+ GUINT_TO_POINTER (GDK_INTERP_NEAREST));
gtk_widget_show (menuitem);
gtk_container_add (GTK_CONTAINER (menu), menuitem);
menuitem = gtk_menu_item_new_with_label ("BILINEAR");
- gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
- GTK_SIGNAL_FUNC (set_interp_type),
- GUINT_TO_POINTER (GDK_INTERP_BILINEAR));
+ g_signal_connect (menuitem, "activate",
+ G_CALLBACK (set_interp_type),
+ GUINT_TO_POINTER (GDK_INTERP_BILINEAR));
gtk_widget_show (menuitem);
gtk_container_add (GTK_CONTAINER (menu), menuitem);
menuitem = gtk_menu_item_new_with_label ("TILES");
- gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
- GTK_SIGNAL_FUNC (set_interp_type),
- GUINT_TO_POINTER (GDK_INTERP_TILES));
+ g_signal_connect (menuitem, "activate",
+ G_CALLBACK (set_interp_type),
+ GUINT_TO_POINTER (GDK_INTERP_TILES));
gtk_container_add (GTK_CONTAINER (menu), menuitem);
menuitem = gtk_menu_item_new_with_label ("HYPER");
- gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
- GTK_SIGNAL_FUNC (set_interp_type),
- GUINT_TO_POINTER (GDK_INTERP_HYPER));
+ g_signal_connect (menuitem, "activate",
+ G_CALLBACK (set_interp_type),
+ GUINT_TO_POINTER (GDK_INTERP_HYPER));
gtk_container_add (GTK_CONTAINER (menu), menuitem);
optionmenu = gtk_option_menu_new ();
@@ -137,8 +137,8 @@ main(int argc, char **argv)
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (overall_alpha, 0, 255, 1, 10, 0));
- gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
- GTK_SIGNAL_FUNC (overall_changed_cb), NULL);
+ g_signal_connect (adjustment, "value_changed",
+ G_CALLBACK (overall_changed_cb), NULL);
hscale = gtk_hscale_new (adjustment);
gtk_scale_set_digits (GTK_SCALE (hscale), 0);
@@ -153,8 +153,8 @@ main(int argc, char **argv)
darea = gtk_drawing_area_new ();
gtk_box_pack_start (GTK_BOX (vbox), darea, TRUE, TRUE, 0);
- gtk_signal_connect (GTK_OBJECT (darea), "expose_event",
- GTK_SIGNAL_FUNC (expose_cb), NULL);
+ g_signal_connect (darea, "expose_event",
+ G_CALLBACK (expose_cb), NULL);
gtk_window_set_default_size (GTK_WINDOW (window),
gdk_pixbuf_get_width (pixbuf),
diff --git a/demos/testpixbuf.c b/demos/testpixbuf.c
index 8f8da3765b..f79f6c66db 100644
--- a/demos/testpixbuf.c
+++ b/demos/testpixbuf.c
@@ -318,7 +318,7 @@ expose_func (GtkWidget *drawing_area, GdkEventExpose *event, gpointer data)
{
GdkPixbuf *pixbuf;
- pixbuf = (GdkPixbuf *)gtk_object_get_data(GTK_OBJECT(drawing_area), "pixbuf");
+ pixbuf = (GdkPixbuf *)g_object_get_data (G_OBJECT (drawing_area), "pixbuf");
if (gdk_pixbuf_get_has_alpha (pixbuf)) {
gdk_draw_rgb_32_image (drawing_area->window,
@@ -350,14 +350,14 @@ config_func (GtkWidget *drawing_area, GdkEventConfigure *event, gpointer data)
{
GdkPixbuf *pixbuf;
- pixbuf = (GdkPixbuf *)gtk_object_get_data(GTK_OBJECT(drawing_area), "pixbuf");
+ pixbuf = (GdkPixbuf *)g_object_get_data (G_OBJECT (drawing_area), "pixbuf");
- g_print("X:%d Y:%d\n", event->width, event->height);
+ g_print ("X:%d Y:%d\n", event->width, event->height);
#if 0
if (((event->width) != gdk_pixbuf_get_width (pixbuf)) ||
((event->height) != gdk_pixbuf_get_height (pixbuf)))
- gdk_pixbuf_scale(pixbuf, event->width, event->height);
+ gdk_pixbuf_scale (pixbuf, event->width, event->height);
#endif
}
@@ -381,8 +381,8 @@ new_testrgb_window (GdkPixbuf *pixbuf, gchar *title)
"GtkWindow::title", title ? title : "testrgb",
"GtkWindow::allow_shrink", TRUE,
NULL);
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- (GtkSignalFunc) quit_func, NULL);
+ g_signal_connect (window, "destroy",
+ G_CALLBACK (quit_func), NULL);
vbox = gtk_vbox_new (FALSE, 0);
@@ -393,25 +393,24 @@ new_testrgb_window (GdkPixbuf *pixbuf, gchar *title)
drawing_area = gtk_drawing_area_new ();
temp_box = gtk_hbox_new (FALSE, 0);
- gtk_widget_set_size_request (GTK_WIDGET(drawing_area), w, h);
+ gtk_widget_set_size_request (GTK_WIDGET (drawing_area), w, h);
gtk_box_pack_start (GTK_BOX (temp_box), drawing_area, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), temp_box, FALSE, FALSE, 0);
- gtk_signal_connect (GTK_OBJECT(drawing_area), "expose_event",
- GTK_SIGNAL_FUNC(expose_func), NULL);
- gtk_signal_connect (GTK_OBJECT(drawing_area), "configure_event",
- GTK_SIGNAL_FUNC (config_func), NULL);
+ g_signal_connect (drawing_area, "expose_event",
+ G_CALLBACK (expose_func), NULL);
+ g_signal_connect (drawing_area, "configure_event",
+ G_CALLBACK (config_func), NULL);
- gtk_object_set_data (GTK_OBJECT(drawing_area), "pixbuf", pixbuf);
+ g_object_set_data (G_OBJECT (drawing_area), "pixbuf", pixbuf);
gtk_widget_show (drawing_area);
button = gtk_button_new_with_label ("Quit");
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- (GtkSignalFunc) gtk_widget_destroy,
- GTK_OBJECT (window));
+ g_signal_connect_swapped (button, "clicked",
+ G_CALLBACK (gtk_widget_destroy), window);
gtk_widget_show (button);
@@ -425,7 +424,7 @@ new_testrgb_window (GdkPixbuf *pixbuf, gchar *title)
static gint
-update_timeout(gpointer data)
+update_timeout (gpointer data)
{
ProgressFileStatus *status = data;
gboolean done;
@@ -433,10 +432,10 @@ update_timeout(gpointer data)
done = FALSE;
error = FALSE;
- if (!feof(status->imagefile)) {
+ if (!feof (status->imagefile)) {
gint nbytes;
- nbytes = fread(status->buf, 1, status->readlen,
+ nbytes = fread (status->buf, 1, status->readlen,
status->imagefile);
@@ -467,31 +466,31 @@ update_timeout(gpointer data)
static void
-progressive_prepared_callback(GdkPixbufLoader* loader, gpointer data)
+progressive_prepared_callback (GdkPixbufLoader* loader, gpointer data)
{
GtkWidget** retloc = data;
GdkPixbuf* pixbuf;
- pixbuf = gdk_pixbuf_loader_get_pixbuf(loader);
- g_assert(pixbuf != NULL);
+ pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
+ g_assert (pixbuf != NULL);
- gdk_pixbuf_ref(pixbuf); /* for the RGB window */
+ gdk_pixbuf_ref (pixbuf); /* for the RGB window */
- *retloc = new_testrgb_window(pixbuf, "Progressive");
+ *retloc = new_testrgb_window (pixbuf, "Progressive");
return;
}
static void
-progressive_updated_callback(GdkPixbufLoader* loader, guint x, guint y, guint width, guint height, gpointer data)
+progressive_updated_callback (GdkPixbufLoader* loader, guint x, guint y, guint width, guint height, gpointer data)
{
GtkWidget** window_loc = data;
/* g_print ("progressive_updated_callback:\n\t%d\t%d\t%d\t%d\n", x, y, width, height); */
if (*window_loc != NULL)
- gtk_widget_queue_draw_area(*window_loc,
+ gtk_widget_queue_draw_area (*window_loc,
x, y, width, height);
return;
@@ -499,7 +498,7 @@ progressive_updated_callback(GdkPixbufLoader* loader, guint x, guint y, guint wi
static int readlen = 4096;
-extern void pixbuf_init();
+extern void pixbuf_init ();
int
main (int argc, char **argv)
@@ -519,16 +518,16 @@ main (int argc, char **argv)
gtk_widget_set_default_colormap (gdk_rgb_get_colormap ());
{
- char *tbf_readlen = getenv("TBF_READLEN");
- if(tbf_readlen) readlen = atoi(tbf_readlen);
+ char *tbf_readlen = getenv ("TBF_READLEN");
+ if (tbf_readlen) readlen = atoi (tbf_readlen);
}
{
- char *tbf_bps = getenv("TBF_KBPS");
+ char *tbf_bps = getenv ("TBF_KBPS");
guint bps;
if (tbf_bps) {
- bps = atoi(tbf_bps);
+ bps = atoi (tbf_bps);
g_print ("Simulating %d kBytes/sec\n", bps);
readlen = (bps*1024)/10;
}
@@ -580,7 +579,7 @@ main (int argc, char **argv)
}
#if 0
- pixbuf = gdk_pixbuf_rotate(pixbuf, 10.0);
+ pixbuf = gdk_pixbuf_rotate (pixbuf, 10.0);
#endif
if (pixbuf) {
@@ -599,13 +598,11 @@ main (int argc, char **argv)
status.rgbwin = &rgb_window;
status.buf = g_malloc (readlen);
- g_signal_connect (G_OBJECT(pixbuf_loader),
- "area_prepared",
- GTK_SIGNAL_FUNC(progressive_prepared_callback),
+ g_signal_connect (pixbuf_loader, "area_prepared",
+ G_CALLBACK (progressive_prepared_callback),
&rgb_window);
- g_signal_connect (G_OBJECT(pixbuf_loader),
- "area_updated",
- GTK_SIGNAL_FUNC(progressive_updated_callback),
+ g_signal_connect (pixbuf_loader, "area_updated",
+ G_CALLBACK (progressive_updated_callback),
&rgb_window);
status.imagefile = fopen (argv[1], "r");
@@ -613,7 +610,7 @@ main (int argc, char **argv)
status.readlen = readlen;
- status.timeout = gtk_timeout_add(100, update_timeout, &status);
+ status.timeout = gtk_timeout_add (100, update_timeout, &status);
}
#endif
}