Commit 1a30e125 authored by Johan Dahlin's avatar Johan Dahlin Committed by Johan Dahlin

Use g_object_new instead of gtk_widget_new

2008-06-19  Johan Dahlin  <jdahlin@async.com.br>

    * demos/testpixbuf.c (new_testrgb_window):
    * gtk/gtkctree.c (gtk_ctree_new_with_titles):
    * gtk/gtkitemfactory.c (gtk_item_factory_construct),
    (gtk_item_factory_create_item):
    * gtk/gtkmenu.c (gtk_menu_set_tearoff_state):
    * gtk/gtkprogressbar.c (gtk_progress_bar_new),
    (gtk_progress_bar_new_with_adjustment):
    * gtk/gtkscrolledwindow.c (gtk_scrolled_window_new):
    * gtk/gtktext.c (gtk_text_new):
    * gtk/gtkviewport.c (gtk_viewport_new):
    * tests/simple.c (main):
    * tests/testgtk.c (create_statusbar), (create_get_image),
    (create_saved_position), (create_tooltips), (create_cursors),
    (create_display_screen), (create_progress_bar), (create_idle_test):
    * tests/testmultidisplay.c (make_selection_dialog), (main):
    * tests/testmultiscreen.c (main):
    * tests/testrgb.c (new_testrgb_window):
    Use g_object_new instead of gtk_widget_new


svn path=/trunk/; revision=20462
parent a14ce91e
2008-06-19 Johan Dahlin <jdahlin@async.com.br>
* demos/testpixbuf.c (new_testrgb_window):
* gtk/gtkctree.c (gtk_ctree_new_with_titles):
* gtk/gtkitemfactory.c (gtk_item_factory_construct),
(gtk_item_factory_create_item):
* gtk/gtkmenu.c (gtk_menu_set_tearoff_state):
* gtk/gtkprogressbar.c (gtk_progress_bar_new),
(gtk_progress_bar_new_with_adjustment):
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_new):
* gtk/gtktext.c (gtk_text_new):
* gtk/gtkviewport.c (gtk_viewport_new):
* tests/simple.c (main):
* tests/testgtk.c (create_statusbar), (create_get_image),
(create_saved_position), (create_tooltips), (create_cursors),
(create_display_screen), (create_progress_bar), (create_idle_test):
* tests/testmultidisplay.c (make_selection_dialog), (main):
* tests/testmultiscreen.c (main):
* tests/testrgb.c (new_testrgb_window):
Use g_object_new instead of gtk_widget_new
2008-06-19 Johan Dahlin <jdahlin@async.com.br>
* gtk/gtkcellrendererpixbuf.c: Remove an unused prototype.
......
......@@ -383,7 +383,7 @@ new_testrgb_window (GdkPixbuf *pixbuf, gchar *title)
w = gdk_pixbuf_get_width (pixbuf);
h = gdk_pixbuf_get_height (pixbuf);
window = gtk_widget_new (gtk_window_get_type (),
window = g_object_new (gtk_window_get_type (),
"GtkObject::user_data", NULL,
"GtkWindow::type", GTK_WINDOW_TOPLEVEL,
"GtkWindow::title", title ? title : "testrgb",
......
......@@ -3572,7 +3572,7 @@ gtk_ctree_new_with_titles (gint columns,
g_return_val_if_fail (columns > 0, NULL);
g_return_val_if_fail (tree_column >= 0 && tree_column < columns, NULL);
widget = gtk_widget_new (GTK_TYPE_CTREE,
widget = g_object_new (GTK_TYPE_CTREE,
"n_columns", columns,
"tree_column", tree_column,
NULL);
......
......@@ -407,7 +407,7 @@ gtk_item_factory_construct (GtkItemFactory *ifactory,
ifactory->accel_group = gtk_accel_group_new ();
ifactory->path = g_strdup (path);
ifactory->widget = g_object_connect (gtk_widget_new (container_type, NULL),
ifactory->widget = g_object_connect (g_object_new (container_type, NULL),
"signal::destroy", gtk_widget_destroyed, &ifactory->widget,
NULL);
g_object_ref_sink (ifactory);
......@@ -1035,7 +1035,7 @@ gtk_item_factory_create_item (GtkItemFactory *ifactory,
accelerator = entry->accelerator;
widget = gtk_widget_new (type,
widget = g_object_new (type,
"visible", TRUE,
"sensitive", (type_id != quark_type_separator_item &&
type_id != quark_type_title),
......@@ -1088,7 +1088,7 @@ gtk_item_factory_create_item (GtkItemFactory *ifactory,
{
GtkWidget *label;
label = gtk_widget_new (GTK_TYPE_ACCEL_LABEL,
label = g_object_new (GTK_TYPE_ACCEL_LABEL,
"visible", TRUE,
"parent", widget,
"accel-widget", widget,
......@@ -1111,7 +1111,7 @@ gtk_item_factory_create_item (GtkItemFactory *ifactory,
gtk_menu_item_set_right_justified (GTK_MENU_ITEM (widget), TRUE);
parent = widget;
widget = gtk_widget_new (GTK_TYPE_MENU, NULL);
widget = g_object_new (GTK_TYPE_MENU, NULL);
p = g_strconcat (ifactory->path, path, NULL);
gtk_menu_set_accel_path (GTK_MENU (widget), p);
g_free (p);
......
......@@ -1814,7 +1814,7 @@ gtk_menu_set_tearoff_state (GtkMenu *menu,
{
GtkWidget *toplevel;
menu->tearoff_window = gtk_widget_new (GTK_TYPE_WINDOW,
menu->tearoff_window = g_object_new (GTK_TYPE_WINDOW,
"type", GTK_WINDOW_TOPLEVEL,
"screen", gtk_widget_get_screen (menu->toplevel),
"app-paintable", TRUE,
......
......@@ -344,7 +344,7 @@ gtk_progress_bar_new (void)
{
GtkWidget *pbar;
pbar = gtk_widget_new (GTK_TYPE_PROGRESS_BAR, NULL);
pbar = g_object_new (GTK_TYPE_PROGRESS_BAR, NULL);
return pbar;
}
......@@ -356,7 +356,7 @@ gtk_progress_bar_new_with_adjustment (GtkAdjustment *adjustment)
g_return_val_if_fail (GTK_IS_ADJUSTMENT (adjustment), NULL);
pbar = gtk_widget_new (GTK_TYPE_PROGRESS_BAR,
pbar = g_object_new (GTK_TYPE_PROGRESS_BAR,
"adjustment", adjustment,
NULL);
......
......@@ -389,7 +389,7 @@ gtk_scrolled_window_new (GtkAdjustment *hadjustment,
if (vadjustment)
g_return_val_if_fail (GTK_IS_ADJUSTMENT (vadjustment), NULL);
scrolled_window = gtk_widget_new (GTK_TYPE_SCROLLED_WINDOW,
scrolled_window = g_object_new (GTK_TYPE_SCROLLED_WINDOW,
"hadjustment", hadjustment,
"vadjustment", vadjustment,
NULL);
......
......@@ -710,7 +710,7 @@ gtk_text_new (GtkAdjustment *hadj,
if (vadj)
g_return_val_if_fail (GTK_IS_ADJUSTMENT (vadj), NULL);
text = gtk_widget_new (GTK_TYPE_TEXT,
text = g_object_new (GTK_TYPE_TEXT,
"hadjustment", hadj,
"vadjustment", vadj,
NULL);
......
......@@ -221,7 +221,7 @@ gtk_viewport_new (GtkAdjustment *hadjustment,
{
GtkWidget *viewport;
viewport = gtk_widget_new (GTK_TYPE_VIEWPORT,
viewport = g_object_new (GTK_TYPE_VIEWPORT,
"hadjustment", hadjustment,
"vadjustment", vadjustment,
NULL);
......
......@@ -37,7 +37,7 @@ main (int argc, char *argv[])
/* gdk_progclass = g_strdup ("XTerm"); */
gtk_init (&argc, &argv);
window = g_object_connect (gtk_widget_new (gtk_window_get_type (),
window = g_object_connect (g_object_new (gtk_window_get_type (),
"user_data", NULL,
"type", GTK_WINDOW_TOPLEVEL,
"title", "hello world",
......@@ -47,7 +47,7 @@ main (int argc, char *argv[])
NULL),
"signal::destroy", gtk_main_quit, NULL,
NULL);
button = g_object_connect (gtk_widget_new (gtk_button_get_type (),
button = g_object_connect (g_object_new (gtk_button_get_type (),
"GtkButton::label", "hello world",
"GtkWidget::parent", window,
"GtkWidget::visible", TRUE,
......
......@@ -1739,7 +1739,7 @@ create_statusbar (GtkWidget *widget)
G_CALLBACK (statusbar_popped),
NULL);
button = gtk_widget_new (gtk_button_get_type (),
button = g_object_new (gtk_button_get_type (),
"label", "push something",
"visible", TRUE,
"parent", box2,
......@@ -1748,7 +1748,7 @@ create_statusbar (GtkWidget *widget)
"signal::clicked", statusbar_push, statusbar,
NULL);
button = g_object_connect (gtk_widget_new (gtk_button_get_type (),
button = g_object_connect (g_object_new (gtk_button_get_type (),
"label", "pop",
"visible", TRUE,
"parent", box2,
......@@ -1756,7 +1756,7 @@ create_statusbar (GtkWidget *widget)
"signal_after::clicked", statusbar_pop, statusbar,
NULL);
button = g_object_connect (gtk_widget_new (gtk_button_get_type (),
button = g_object_connect (g_object_new (gtk_button_get_type (),
"label", "steal #4",
"visible", TRUE,
"parent", box2,
......@@ -1764,7 +1764,7 @@ create_statusbar (GtkWidget *widget)
"signal_after::clicked", statusbar_steal, statusbar,
NULL);
button = g_object_connect (gtk_widget_new (gtk_button_get_type (),
button = g_object_connect (g_object_new (gtk_button_get_type (),
"label", "test contexts",
"visible", TRUE,
"parent", box2,
......@@ -1772,7 +1772,7 @@ create_statusbar (GtkWidget *widget)
"swapped_signal_after::clicked", statusbar_contexts, statusbar,
NULL);
button = g_object_connect (gtk_widget_new (gtk_button_get_type (),
button = g_object_connect (g_object_new (gtk_button_get_type (),
"label", "push something long",
"visible", TRUE,
"parent", box2,
......@@ -2847,7 +2847,7 @@ create_get_image (GtkWidget *widget)
vbox = gtk_vbox_new (FALSE, 3);
snap = gtk_widget_new (GTK_TYPE_IMAGE, NULL);
snap = g_object_new (GTK_TYPE_IMAGE, NULL);
gid->snap = snap;
......@@ -3656,7 +3656,7 @@ create_saved_position (GtkWidget *widget)
GtkWidget *label;
GtkWidget *any;
window = g_object_connect (gtk_widget_new (GTK_TYPE_WINDOW,
window = g_object_connect (g_object_new (GTK_TYPE_WINDOW,
"type", GTK_WINDOW_TOPLEVEL,
"title", "Saved Position",
NULL),
......@@ -3678,13 +3678,13 @@ create_saved_position (GtkWidget *widget)
gtk_container_add (GTK_CONTAINER (window), main_vbox);
vbox =
gtk_widget_new (gtk_vbox_get_type (),
g_object_new (gtk_vbox_get_type (),
"GtkBox::homogeneous", FALSE,
"GtkBox::spacing", 5,
"GtkContainer::border_width", 10,
"GtkWidget::parent", main_vbox,
"GtkWidget::visible", TRUE,
"child", g_object_connect (gtk_widget_new (GTK_TYPE_TOGGLE_BUTTON,
"child", g_object_connect (g_object_new (GTK_TYPE_TOGGLE_BUTTON,
"label", "Stop Events",
"active", FALSE,
"visible", TRUE,
......@@ -3718,7 +3718,7 @@ create_saved_position (GtkWidget *widget)
g_object_set_data (G_OBJECT (window), "y", y_label);
any =
gtk_widget_new (gtk_hseparator_get_type (),
g_object_new (gtk_hseparator_get_type (),
"GtkWidget::visible", TRUE,
NULL);
gtk_box_pack_start (GTK_BOX (main_vbox), any, FALSE, TRUE, 0);
......@@ -3874,7 +3874,7 @@ create_tooltips (GtkWidget *widget)
if (!window)
{
window =
gtk_widget_new (gtk_window_get_type (),
g_object_new (gtk_window_get_type (),
"GtkWindow::type", GTK_WINDOW_TOPLEVEL,
"GtkContainer::border_width", 0,
"GtkWindow::title", "Tooltips",
......@@ -3926,7 +3926,7 @@ create_tooltips (GtkWidget *widget)
"Hi msw! ;)");
box3 =
gtk_widget_new (gtk_vbox_get_type (),
g_object_new (gtk_vbox_get_type (),
"homogeneous", FALSE,
"spacing", 5,
"border_width", 5,
......@@ -3936,7 +3936,7 @@ create_tooltips (GtkWidget *widget)
tips_query = gtk_tips_query_new ();
button =
gtk_widget_new (gtk_button_get_type (),
g_object_new (gtk_button_get_type (),
"label", "[?]",
"visible", TRUE,
"parent", box3,
......@@ -3960,7 +3960,7 @@ create_tooltips (GtkWidget *widget)
"caller", button,
NULL);
frame = gtk_widget_new (gtk_frame_get_type (),
frame = g_object_new (gtk_frame_get_type (),
"label", "ToolTips Inspector",
"label_xalign", (double) 0.5,
"border_width", 0,
......@@ -6169,7 +6169,7 @@ create_cursors (GtkWidget *widget)
gtk_container_add (GTK_CONTAINER (window), main_vbox);
vbox =
gtk_widget_new (gtk_vbox_get_type (),
g_object_new (gtk_vbox_get_type (),
"GtkBox::homogeneous", FALSE,
"GtkBox::spacing", 5,
"GtkContainer::border_width", 10,
......@@ -6216,7 +6216,7 @@ create_cursors (GtkWidget *widget)
gtk_box_pack_start (GTK_BOX (hbox), spinner, TRUE, TRUE, 0);
frame =
gtk_widget_new (gtk_frame_get_type (),
g_object_new (gtk_frame_get_type (),
"GtkFrame::shadow", GTK_SHADOW_ETCHED_IN,
"GtkFrame::label_xalign", 0.5,
"GtkFrame::label", "Cursor Area",
......@@ -6243,7 +6243,7 @@ create_cursors (GtkWidget *widget)
G_CALLBACK (set_cursor),
darea);
label = gtk_widget_new (GTK_TYPE_LABEL,
label = g_object_new (GTK_TYPE_LABEL,
"visible", TRUE,
"label", "XXX",
"parent", vbox,
......@@ -6254,7 +6254,7 @@ create_cursors (GtkWidget *widget)
g_object_set_data (G_OBJECT (spinner), "user_data", label);
any =
gtk_widget_new (gtk_hseparator_get_type (),
g_object_new (gtk_hseparator_get_type (),
"GtkWidget::visible", TRUE,
NULL);
gtk_box_pack_start (GTK_BOX (main_vbox), any, FALSE, TRUE, 0);
......@@ -8661,7 +8661,7 @@ create_display_screen (GtkWidget *widget)
GdkDisplay *display = gdk_screen_get_display (screen);
window = gtk_widget_new (gtk_window_get_type (),
window = g_object_new (gtk_window_get_type (),
"screen", screen,
"user_data", NULL,
"type", GTK_WINDOW_TOPLEVEL,
......@@ -11716,7 +11716,7 @@ create_progress_bar (GtkWidget *widget)
g_signal_connect (adj, "value_changed",
G_CALLBACK (progress_value_changed), pdata);
pdata->pbar = gtk_widget_new (GTK_TYPE_PROGRESS_BAR,
pdata->pbar = g_object_new (GTK_TYPE_PROGRESS_BAR,
"adjustment", adj,
"ellipsize", PANGO_ELLIPSIZE_MIDDLE,
NULL);
......@@ -13072,9 +13072,9 @@ create_idle_test (GtkWidget *widget)
gtk_widget_show (label);
container =
gtk_widget_new (GTK_TYPE_HBOX,
g_object_new (GTK_TYPE_HBOX,
"visible", TRUE,
/* "GtkContainer::child", gtk_widget_new (GTK_TYPE_HBOX,
/* "GtkContainer::child", g_object_new (GTK_TYPE_HBOX,
* "GtkWidget::visible", TRUE,
*/
"child", label,
......@@ -13084,19 +13084,19 @@ create_idle_test (GtkWidget *widget)
container, TRUE, TRUE, 0);
frame =
gtk_widget_new (GTK_TYPE_FRAME,
g_object_new (GTK_TYPE_FRAME,
"border_width", 5,
"label", "Label Container",
"visible", TRUE,
"parent", GTK_DIALOG (window)->vbox,
NULL);
box =
gtk_widget_new (GTK_TYPE_VBOX,
g_object_new (GTK_TYPE_VBOX,
"visible", TRUE,
"parent", frame,
NULL);
button =
g_object_connect (gtk_widget_new (GTK_TYPE_RADIO_BUTTON,
g_object_connect (g_object_new (GTK_TYPE_RADIO_BUTTON,
"label", "Resize-Parent",
"user_data", (void*)GTK_RESIZE_PARENT,
"visible", TRUE,
......@@ -13104,7 +13104,7 @@ create_idle_test (GtkWidget *widget)
NULL),
"signal::clicked", toggle_idle_container, container,
NULL);
button = gtk_widget_new (GTK_TYPE_RADIO_BUTTON,
button = g_object_new (GTK_TYPE_RADIO_BUTTON,
"label", "Resize-Queue",
"user_data", (void*)GTK_RESIZE_QUEUE,
"group", button,
......@@ -13114,7 +13114,7 @@ create_idle_test (GtkWidget *widget)
g_object_connect (button,
"signal::clicked", toggle_idle_container, container,
NULL);
button2 = gtk_widget_new (GTK_TYPE_RADIO_BUTTON,
button2 = g_object_new (GTK_TYPE_RADIO_BUTTON,
"label", "Resize-Immediate",
"user_data", (void*)GTK_RESIZE_IMMEDIATE,
NULL);
......
......@@ -65,7 +65,7 @@ make_selection_dialog (GdkScreen * screen,
if (!screen)
screen = gdk_screen_get_default ();
window = gtk_widget_new (GTK_TYPE_DIALOG,
window = g_object_new (GTK_TYPE_DIALOG,
"screen", screen,
"user_data", NULL,
"type", GTK_WINDOW_TOPLEVEL,
......@@ -75,7 +75,7 @@ make_selection_dialog (GdkScreen * screen,
G_CALLBACK (gtk_main_quit), NULL);
vbox = gtk_widget_new (GTK_TYPE_VBOX,
vbox = g_object_new (GTK_TYPE_VBOX,
"border_width", 5,
NULL);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), vbox, FALSE, FALSE, 0);
......@@ -161,11 +161,11 @@ main (int argc, char *argv[])
gtk_widget_destroy (dialog);
entry = gtk_widget_new (GTK_TYPE_ENTRY,
entry = g_object_new (GTK_TYPE_ENTRY,
"activates_default", TRUE,
"visible", TRUE,
NULL);
entry2 = gtk_widget_new (GTK_TYPE_ENTRY,
entry2 = g_object_new (GTK_TYPE_ENTRY,
"activates_default", TRUE,
"visible", TRUE,
NULL);
......
......@@ -111,7 +111,7 @@ main (int argc, char *argv[])
screen_list[i] = gdk_display_get_screen (dpy, i);
window[i] = gtk_widget_new (GTK_TYPE_WINDOW,
window[i] = g_object_new (GTK_TYPE_WINDOW,
"screen", screen_list[i],
"user_data", NULL,
"type", GTK_WINDOW_TOPLEVEL,
......@@ -126,7 +126,7 @@ main (int argc, char *argv[])
vbox[i] = gtk_vbox_new (TRUE, 0);
gtk_container_add (GTK_CONTAINER (window[i]), vbox[i]);
button = gtk_widget_new (GTK_TYPE_BUTTON,
button = g_object_new (GTK_TYPE_BUTTON,
"label", label,
"parent", vbox[i],
"visible", TRUE, NULL,
......@@ -139,7 +139,7 @@ main (int argc, char *argv[])
gtk_container_add (GTK_CONTAINER (vbox[i]), images[i]);
button = gtk_widget_new (GTK_TYPE_BUTTON,
button = g_object_new (GTK_TYPE_BUTTON,
"label", "Hide Icon",
"parent", vbox[i],
"visible", TRUE, NULL,
......@@ -155,7 +155,7 @@ main (int argc, char *argv[])
moving_vbox = gtk_vbox_new (TRUE, 0);
gtk_container_add (GTK_CONTAINER (moving_window), moving_vbox);
moving_button = gtk_widget_new (GTK_TYPE_BUTTON,
moving_button = g_object_new (GTK_TYPE_BUTTON,
"label", "Move to Next Screen",
"visible", TRUE,
NULL);
......
......@@ -280,7 +280,7 @@ new_testrgb_window (void)
GtkWidget *button;
GtkWidget *drawing_area;
window = gtk_widget_new (gtk_window_get_type (),
window = g_object_new (gtk_window_get_type (),
"GtkObject::user_data", NULL,
"GtkWindow::type", GTK_WINDOW_TOPLEVEL,
"GtkWindow::title", "testrgb",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment