summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/dialog.ui9
-rw-r--r--tests/gdkgears.c20
-rw-r--r--tests/meson.build1
-rw-r--r--tests/mydialog2.ui2
-rw-r--r--tests/overlayscroll.c1
-rw-r--r--tests/selectionmode.ui3
-rw-r--r--tests/simple.c4
-rw-r--r--tests/syncscroll.c3
-rw-r--r--tests/testaccel.c119
-rw-r--r--tests/testadjustsize.c5
-rw-r--r--tests/testappchooser.c2
-rw-r--r--tests/testappchooserbutton.c11
-rw-r--r--tests/testassistant.c27
-rw-r--r--tests/testbox.c1
-rw-r--r--tests/testcalendar.c1
-rw-r--r--tests/testcellarea.c14
-rw-r--r--tests/testcombo.c24
-rw-r--r--tests/testcombochange.c62
-rw-r--r--tests/testdialog.c28
-rw-r--r--tests/testdnd.c2
-rw-r--r--tests/testentrycompletion.c4
-rw-r--r--tests/testfilechooser.c2
-rw-r--r--tests/testfilechooserbutton.c5
-rw-r--r--tests/testflowbox.c28
-rw-r--r--tests/testfontchooser.c5
-rw-r--r--tests/testgiconpixbuf.c2
-rw-r--r--tests/testglarea.c12
-rw-r--r--tests/testgmenu.c2
-rw-r--r--tests/testgrid.c2
-rw-r--r--tests/testgtk.c246
-rw-r--r--tests/testgtk.css4
-rw-r--r--tests/testheaderbar.c1
-rw-r--r--tests/testheightforwidth.c171
-rw-r--r--tests/testiconview.c2
-rw-r--r--tests/testlist.c3
-rw-r--r--tests/testlist2.c1
-rw-r--r--tests/testlogout.c10
-rw-r--r--tests/testmenubutton.c10
-rw-r--r--tests/testmodelbutton.c98
-rw-r--r--tests/testorientable.c20
-rw-r--r--tests/testoverlay.c29
-rw-r--r--tests/testscrolledwindow.c14
-rw-r--r--tests/testselectionmode.c7
-rw-r--r--tests/teststack.c2
-rw-r--r--tests/teststackedheaders.c9
-rw-r--r--tests/teststackedheaders.ui6
-rw-r--r--tests/testtreelistmodel.c4
-rw-r--r--tests/testtreeview.c4
-rw-r--r--tests/testverticalcells.c2
-rw-r--r--tests/testvolumebutton.c35
-rw-r--r--tests/testwindowsize.c2
51 files changed, 316 insertions, 765 deletions
diff --git a/tests/dialog.ui b/tests/dialog.ui
index d2dab24f8c..67f2ef9d24 100644
--- a/tests/dialog.ui
+++ b/tests/dialog.ui
@@ -13,7 +13,6 @@
<object class="GtkDialog" id="dialog">
<property name="modal">1</property>
<property name="destroy_with_parent">1</property>
- <property name="type_hint">dialog</property>
<property name="default_width">500</property>
<property name="use_header_bar">1</property>
<property name="title" translatable="yes">Join Chat Room</property>
@@ -44,14 +43,13 @@
<object class="GtkButton" id="confirm_button">
<property name="label" translatable="yes">_Join</property>
<property name="can_focus">1</property>
- <property name="has_default">1</property>
<property name="receives_default">1</property>
<property name="use_underline">1</property>
</object>
</child>
</object>
</child>
- <child internal-child="vbox">
+ <child internal-child="content_area">
<object class="GtkBox" id="dialog-vbox1">
<property name="orientation">vertical</property>
<property name="spacing">2</property>
@@ -61,11 +59,10 @@
<child>
<object class="GtkStackPage">
<property name="name">main</property>
- <property name="position">0</property>
<property name="child">
<object class="GtkGrid" id="grid1">
- <property name="margin_left">24</property>
- <property name="margin_right">24</property>
+ <property name="margin_start">24</property>
+ <property name="margin_end">24</property>
<property name="margin_top">24</property>
<property name="margin_bottom">24</property>
<property name="row_spacing">12</property>
diff --git a/tests/gdkgears.c b/tests/gdkgears.c
index 5c98eed4db..e40460c495 100644
--- a/tests/gdkgears.c
+++ b/tests/gdkgears.c
@@ -66,7 +66,6 @@ create_axis_slider (GtkGears *gears,
label = gtk_label_new (text);
gtk_container_add (GTK_CONTAINER (box), label);
- gtk_widget_show (label);
adj = gtk_adjustment_new (gtk_gears_get_axis (gears, axis), 0.0, 360.0, 1.0, 12.0, 0.0);
g_object_set_data (G_OBJECT (adj), "axis", GINT_TO_POINTER (axis));
@@ -77,9 +76,6 @@ create_axis_slider (GtkGears *gears,
gtk_scale_set_draw_value (GTK_SCALE (slider), FALSE);
gtk_container_add (GTK_CONTAINER (box), slider);
gtk_widget_set_vexpand (slider, TRUE);
- gtk_widget_show (slider);
-
- gtk_widget_show (box);
return box;
}
@@ -93,7 +89,6 @@ moar_gears (GtkButton *button, gpointer data)
gears = gtk_gears_new ();
gtk_widget_set_size_request (gears, 100, 100);
gtk_container_add (container, gears);
- gtk_widget_show (gears);
}
static void
@@ -142,43 +137,35 @@ main (int argc, char *argv[])
gtk_widget_set_margin_bottom (overlay, 12);
gtk_window_set_child (GTK_WINDOW (window), overlay);
- gtk_widget_show (overlay);
revealer = gtk_revealer_new ();
gtk_widget_set_halign (revealer, GTK_ALIGN_END);
gtk_widget_set_valign (revealer, GTK_ALIGN_START);
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), revealer);
- gtk_widget_show (revealer);
frame = gtk_frame_new (NULL);
gtk_widget_add_css_class (frame, "app-notification");
gtk_revealer_set_child (GTK_REVEALER (revealer), frame);
- gtk_widget_show (frame);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE);
gtk_box_set_spacing (GTK_BOX (hbox), 6);
gtk_frame_set_child (GTK_FRAME (frame), hbox);
- gtk_widget_show (hbox);
label = gtk_label_new ("This is a transparent overlay widget!!!!\nAmazing, eh?");
gtk_container_add (GTK_CONTAINER (hbox), label);
- gtk_widget_show (label);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, FALSE);
gtk_box_set_spacing (GTK_BOX (box), 6);
gtk_overlay_set_child (GTK_OVERLAY (overlay), box);
- gtk_widget_show (box);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE);
gtk_box_set_spacing (GTK_BOX (box), 6);
gtk_container_add (GTK_CONTAINER (box), hbox);
- gtk_widget_show (hbox);
gears = gtk_gears_new ();
gtk_widget_set_hexpand (gears, TRUE);
gtk_widget_set_vexpand (gears, TRUE);
gtk_container_add (GTK_CONTAINER (hbox), gears);
- gtk_widget_show (gears);
for (i = 0; i < GTK_GEARS_N_AXIS; i++)
gtk_container_add (GTK_CONTAINER (hbox), create_axis_slider (GTK_GEARS (gears), i));
@@ -186,7 +173,6 @@ main (int argc, char *argv[])
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE);
gtk_box_set_spacing (GTK_BOX (hbox), 6);
gtk_container_add (GTK_CONTAINER (box), hbox);
- gtk_widget_show (hbox);
fps_label = gtk_label_new ("");
gtk_widget_set_hexpand (fps_label, TRUE);
@@ -229,33 +215,27 @@ main (int argc, char *argv[])
GTK_POLICY_AUTOMATIC,
GTK_POLICY_NEVER);
gtk_container_add (GTK_CONTAINER (box), scrolled);
- gtk_widget_show (scrolled);
extra_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE);
gtk_box_set_spacing (GTK_BOX (extra_hbox), 6);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), extra_hbox);
- gtk_widget_show (extra_hbox);
bbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_set_spacing (GTK_BOX (bbox), 6);
gtk_container_add (GTK_CONTAINER (box), bbox);
- gtk_widget_show (bbox);
button = gtk_button_new_with_label ("Moar gears!");
gtk_container_add (GTK_CONTAINER (bbox), button);
g_signal_connect (button, "clicked", G_CALLBACK (moar_gears), extra_hbox);
- gtk_widget_show (button);
button = gtk_button_new_with_label ("Less gears!");
gtk_container_add (GTK_CONTAINER (bbox), button);
g_signal_connect (button, "clicked", G_CALLBACK (less_gears), extra_hbox);
- gtk_widget_show (button);
button = gtk_button_new_with_label ("Quit");
gtk_widget_set_hexpand (button, TRUE);
gtk_container_add (GTK_CONTAINER (bbox), button);
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_widget_destroy), window);
- gtk_widget_show (button);
gtk_widget_show (window);
diff --git a/tests/meson.build b/tests/meson.build
index a6a386ef4b..03bb928fd4 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -63,7 +63,6 @@ gtk_tests = [
['testlevelbar'],
['testlockbutton'],
['testmenubutton'],
- ['testmodelbutton'],
['testmountoperation'],
['testnotebookdnd'],
['testnouiprint'],
diff --git a/tests/mydialog2.ui b/tests/mydialog2.ui
index aa1f990358..d9bd63ae40 100644
--- a/tests/mydialog2.ui
+++ b/tests/mydialog2.ui
@@ -1,6 +1,6 @@
<interface>
<template class="MyDialog2" parent="GtkDialog">
- <child internal-child="vbox">
+ <child internal-child="content_area">
<object class="GtkBox">
<child>
<object class="GtkLabel" id="content">
diff --git a/tests/overlayscroll.c b/tests/overlayscroll.c
index 2aaabb3710..2daee85411 100644
--- a/tests/overlayscroll.c
+++ b/tests/overlayscroll.c
@@ -77,6 +77,7 @@ main (int argc, char *argv[])
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
+ gtk_widget_set_hexpand (sw, TRUE);
gtk_container_add (GTK_CONTAINER (box), sw);
content = get_content ();
diff --git a/tests/selectionmode.ui b/tests/selectionmode.ui
index e9b40674ec..a728bd02f8 100644
--- a/tests/selectionmode.ui
+++ b/tests/selectionmode.ui
@@ -27,7 +27,6 @@
</object>
</child>
</object>
- <packing/>
</child>
<child type="title">
<object class="GtkStack" id="titlestack">
@@ -80,14 +79,12 @@
</object>
</child>
</object>
- <packing/>
</child>
<child type="end">
<object class="GtkButton" id="cancel-button">
<property name="visible">0</property>
<property name="label">Cancel</property>
</object>
- <packing/>
</child>
</object>
</child>
diff --git a/tests/simple.c b/tests/simple.c
index 2bf39223bc..062afdc9fa 100644
--- a/tests/simple.c
+++ b/tests/simple.c
@@ -51,6 +51,10 @@ main (int argc, char *argv[])
button = gtk_button_new ();
gtk_button_set_label (GTK_BUTTON (button), "hello world");
+ gtk_widget_set_margin_top (button, 10);
+ gtk_widget_set_margin_bottom (button, 10);
+ gtk_widget_set_margin_start (button, 10);
+ gtk_widget_set_margin_end (button, 10);
g_signal_connect (button, "clicked", G_CALLBACK (hello), NULL);
gtk_window_set_child (GTK_WINDOW (window), button);
diff --git a/tests/syncscroll.c b/tests/syncscroll.c
index 4a0a8c6103..7ad7662133 100644
--- a/tests/syncscroll.c
+++ b/tests/syncscroll.c
@@ -32,6 +32,7 @@ main (int argc, char *argv[])
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_NEVER,
GTK_POLICY_EXTERNAL);
+ gtk_widget_set_hexpand (sw, TRUE);
gtk_container_add (GTK_CONTAINER (box), sw);
tv = gtk_text_view_new ();
fill_text_view (tv, "Left");
@@ -43,6 +44,7 @@ main (int argc, char *argv[])
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_NEVER,
GTK_POLICY_EXTERNAL);
+ gtk_widget_set_hexpand (sw, TRUE);
gtk_container_add (GTK_CONTAINER (box), sw);
tv = gtk_text_view_new ();
fill_text_view (tv, "Middle");
@@ -52,6 +54,7 @@ main (int argc, char *argv[])
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_NEVER,
GTK_POLICY_EXTERNAL);
+ gtk_widget_set_hexpand (sw, TRUE);
gtk_container_add (GTK_CONTAINER (box), sw);
tv = gtk_text_view_new ();
fill_text_view (tv, "Right");
diff --git a/tests/testaccel.c b/tests/testaccel.c
index 5a7ddd140c..270d8a1b16 100644
--- a/tests/testaccel.c
+++ b/tests/testaccel.c
@@ -35,10 +35,10 @@ accel_edited_callback (GtkCellRendererText *cell,
g_print ("%u %d %u\n", keyval, mask, hardware_keycode);
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
- 0, (gint)mask,
- 1, keyval,
- 2, hardware_keycode,
- -1);
+ 0, (gint)mask,
+ 1, keyval,
+ 2, hardware_keycode,
+ -1);
gtk_tree_path_free (path);
}
@@ -59,62 +59,61 @@ accel_cleared_callback (GtkCellRendererText *cell,
static GtkWidget *
key_test (void)
{
- GtkWidget *window, *sw, *tv;
- GtkListStore *store;
- GtkTreeViewColumn *column;
- GtkCellRenderer *rend;
- gint i;
- GtkWidget *box, *entry;
-
- /* create window */
- window = gtk_window_new ();
- gtk_window_set_default_size (GTK_WINDOW (window), 400, 400);
-
- sw = gtk_scrolled_window_new (NULL, NULL);
- gtk_widget_set_hexpand (sw, TRUE);
- box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
- gtk_widget_show (box);
- gtk_window_set_child (GTK_WINDOW (window), box);
- gtk_container_add (GTK_CONTAINER (box), sw);
-
- store = gtk_list_store_new (3, G_TYPE_INT, G_TYPE_UINT, G_TYPE_UINT);
- tv = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
- gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), tv);
- column = gtk_tree_view_column_new ();
- rend = gtk_cell_renderer_accel_new ();
- g_object_set (G_OBJECT (rend),
- "accel-mode", GTK_CELL_RENDERER_ACCEL_MODE_GTK,
- "editable", TRUE,
- NULL);
- g_signal_connect (G_OBJECT (rend),
- "accel-edited",
- G_CALLBACK (accel_edited_callback),
- store);
- g_signal_connect (G_OBJECT (rend),
- "accel-cleared",
- G_CALLBACK (accel_cleared_callback),
- store);
-
- gtk_tree_view_column_pack_start (column, rend,
- TRUE);
- gtk_tree_view_column_set_attributes (column, rend,
- "accel-mods", 0,
- "accel-key", 1,
- "keycode", 2,
- NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (tv), column);
-
- for (i = 0; i < 10; i++) {
- GtkTreeIter iter;
-
- gtk_list_store_append (store, &iter);
- }
-
- entry = gtk_entry_new ();
- gtk_widget_show (entry);
- gtk_container_add (GTK_CONTAINER (box), entry);
-
- return window;
+ GtkWidget *window, *sw, *tv;
+ GtkListStore *store;
+ GtkTreeViewColumn *column;
+ GtkCellRenderer *rend;
+ gint i;
+ GtkWidget *box, *entry;
+
+ /* create window */
+ window = gtk_window_new ();
+ gtk_window_set_default_size (GTK_WINDOW (window), 400, 400);
+
+ sw = gtk_scrolled_window_new (NULL, NULL);
+ gtk_widget_set_vexpand (sw, TRUE);
+ box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
+ gtk_window_set_child (GTK_WINDOW (window), box);
+ gtk_container_add (GTK_CONTAINER (box), sw);
+
+ store = gtk_list_store_new (3, G_TYPE_INT, G_TYPE_UINT, G_TYPE_UINT);
+ tv = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
+ gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), tv);
+ column = gtk_tree_view_column_new ();
+ rend = gtk_cell_renderer_accel_new ();
+ g_object_set (G_OBJECT (rend),
+ "accel-mode", GTK_CELL_RENDERER_ACCEL_MODE_GTK,
+ "editable", TRUE,
+ NULL);
+ g_signal_connect (G_OBJECT (rend),
+ "accel-edited",
+ G_CALLBACK (accel_edited_callback),
+ store);
+ g_signal_connect (G_OBJECT (rend),
+ "accel-cleared",
+ G_CALLBACK (accel_cleared_callback),
+ store);
+
+ gtk_tree_view_column_pack_start (column, rend,
+ TRUE);
+ gtk_tree_view_column_set_attributes (column, rend,
+ "accel-mods", 0,
+ "accel-key", 1,
+ "keycode", 2,
+ NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (tv), column);
+
+ for (i = 0; i < 10; i++)
+ {
+ GtkTreeIter iter;
+
+ gtk_list_store_append (store, &iter);
+ }
+
+ entry = gtk_entry_new ();
+ gtk_container_add (GTK_CONTAINER (box), entry);
+
+ return window;
}
gint
diff --git a/tests/testadjustsize.c b/tests/testadjustsize.c
index 2e3c251f16..d9a122042a 100644
--- a/tests/testadjustsize.c
+++ b/tests/testadjustsize.c
@@ -331,11 +331,9 @@ open_valigned_label_window (void)
g_signal_connect (test_window, "destroy", G_CALLBACK (quit_cb), &done);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_widget_show (box);
gtk_window_set_child (GTK_WINDOW (window), box);
label = gtk_label_new ("Both labels expand");
- gtk_widget_show (label);
gtk_container_add (GTK_CONTAINER (box), label);
label = gtk_label_new ("Some wrapping text with width-chars = 15 and max-width-chars = 35");
@@ -343,10 +341,7 @@ open_valigned_label_window (void)
gtk_label_set_width_chars (GTK_LABEL (label), 15);
gtk_label_set_max_width_chars (GTK_LABEL (label), 35);
- gtk_widget_show (label);
-
frame = gtk_frame_new (NULL);
- gtk_widget_show (frame);
gtk_frame_set_child (GTK_FRAME (frame), label);
gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
diff --git a/tests/testappchooser.c b/tests/testappchooser.c
index 82eda9d4ca..7735cdec80 100644
--- a/tests/testappchooser.c
+++ b/tests/testappchooser.c
@@ -230,7 +230,7 @@ main (int argc, char **argv)
g_signal_connect (open, "clicked",
G_CALLBACK (display_dialog), NULL);
- gtk_container_add (GTK_CONTAINER (toplevel), grid);
+ gtk_window_set_child (GTK_WINDOW (toplevel), grid);
gtk_widget_show (toplevel);
g_signal_connect (toplevel, "destroy", G_CALLBACK (quit_cb), &done);
diff --git a/tests/testappchooserbutton.c b/tests/testappchooserbutton.c
index 9d69ce0189..288949db76 100644
--- a/tests/testappchooserbutton.c
+++ b/tests/testappchooserbutton.c
@@ -83,9 +83,14 @@ main (int argc,
toplevel = gtk_window_new ();
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
- gtk_container_add (GTK_CONTAINER (toplevel), box);
+ gtk_widget_set_margin_top (box, 12);
+ gtk_widget_set_margin_bottom (box, 12);
+ gtk_widget_set_margin_start (box, 12);
+ gtk_widget_set_margin_end (box, 12);
+ gtk_window_set_child (GTK_WINDOW (toplevel), box);
button = gtk_app_chooser_button_new ("image/jpeg");
+ gtk_widget_set_vexpand (button, TRUE);
gtk_container_add (GTK_CONTAINER (box), button);
g_signal_connect (button, "changed",
@@ -93,14 +98,18 @@ main (int argc,
w = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (w), "<b>Selected app info</b>");
+ gtk_widget_set_vexpand (w, TRUE);
gtk_container_add (GTK_CONTAINER (box), w);
w = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+ gtk_widget_set_vexpand (w, TRUE);
gtk_container_add (GTK_CONTAINER (box), w);
sel_image = gtk_image_new ();
+ gtk_widget_set_hexpand (sel_image, TRUE);
gtk_container_add (GTK_CONTAINER (w), sel_image);
sel_name = gtk_label_new (NULL);
+ gtk_widget_set_hexpand (sel_name, TRUE);
gtk_container_add (GTK_CONTAINER (w), sel_name);
gtk_app_chooser_button_set_heading (GTK_APP_CHOOSER_BUTTON (button), "Choose one, <i>not</i> two");
diff --git a/tests/testassistant.c b/tests/testassistant.c
index 2d010753d3..83cc9d5c44 100644
--- a/tests/testassistant.c
+++ b/tests/testassistant.c
@@ -164,13 +164,11 @@ create_simple_assistant (GtkWidget *widget)
G_CALLBACK (prepare_callback), NULL);
page = get_test_page ("Page 1");
- gtk_widget_show (page);
gtk_assistant_append_page (GTK_ASSISTANT (assistant), page);
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), page, "Page 1");
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), page, TRUE);
page = get_test_page ("Page 2");
- gtk_widget_show (page);
gtk_assistant_append_page (GTK_ASSISTANT (assistant), page);
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), page, "Page 2");
gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), page, GTK_ASSISTANT_PAGE_CONFIRM);
@@ -208,12 +206,10 @@ create_anonymous_assistant (GtkWidget *widget)
G_CALLBACK (prepare_callback), NULL);
page = get_test_page ("Page 1");
- gtk_widget_show (page);
gtk_assistant_append_page (GTK_ASSISTANT (assistant), page);
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), page, TRUE);
page = get_test_page ("Page 2");
- gtk_widget_show (page);
gtk_assistant_append_page (GTK_ASSISTANT (assistant), page);
gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), page, GTK_ASSISTANT_PAGE_CONFIRM);
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), page, TRUE);
@@ -263,7 +259,6 @@ create_generous_assistant (GtkWidget *widget)
G_CALLBACK (prepare_callback), NULL);
page = get_test_page ("Introduction");
- gtk_widget_show (page);
gtk_assistant_append_page (GTK_ASSISTANT (assistant), page);
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), page, "Introduction");
gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), page, GTK_ASSISTANT_PAGE_INTRO);
@@ -275,14 +270,12 @@ create_generous_assistant (GtkWidget *widget)
check = gtk_check_button_new_with_label ("Next page visible");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), TRUE);
g_signal_connect (G_OBJECT (check), "toggled",
- G_CALLBACK (visible_cb), next);
- gtk_widget_show (check);
+ G_CALLBACK (visible_cb), next);
gtk_container_add (GTK_CONTAINER (page), check);
add_completion_test_page (assistant, "Even More Content", TRUE, TRUE);
page = get_test_page ("Confirmation");
- gtk_widget_show (page);
gtk_assistant_append_page (GTK_ASSISTANT (assistant), page);
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), page, "Confirmation");
gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), page, GTK_ASSISTANT_PAGE_CONFIRM);
@@ -298,7 +291,6 @@ create_generous_assistant (GtkWidget *widget)
gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), page, GTK_ASSISTANT_PAGE_PROGRESS);
page = gtk_check_button_new_with_label ("Summary complete");
- gtk_widget_show (page);
gtk_assistant_append_page (GTK_ASSISTANT (assistant), page);
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), page, "Summary");
gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), page, GTK_ASSISTANT_PAGE_SUMMARY);
@@ -391,19 +383,16 @@ create_nonlinear_assistant (GtkWidget *widget)
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), page, TRUE);
page = get_test_page ("Page 2A");
- gtk_widget_show (page);
gtk_assistant_append_page (GTK_ASSISTANT (assistant), page);
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), page, "Page 2");
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), page, TRUE);
page = get_test_page ("Page 2B");
- gtk_widget_show (page);
gtk_assistant_append_page (GTK_ASSISTANT (assistant), page);
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), page, "Page 2");
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), page, TRUE);
page = get_test_page ("Confirmation");
- gtk_widget_show (page);
gtk_assistant_append_page (GTK_ASSISTANT (assistant), page);
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), page, "Confirmation");
gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), page, GTK_ASSISTANT_PAGE_CONFIRM);
@@ -475,32 +464,27 @@ create_looping_assistant (GtkWidget *widget)
assistant, NULL);
page = get_test_page ("Introduction");
- gtk_widget_show (page);
gtk_assistant_append_page (GTK_ASSISTANT (assistant), page);
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), page, "Introduction");
gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), page, GTK_ASSISTANT_PAGE_INTRO);
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), page, TRUE);
page = get_test_page ("Content");
- gtk_widget_show (page);
gtk_assistant_append_page (GTK_ASSISTANT (assistant), page);
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), page, "Content");
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), page, TRUE);
page = get_test_page ("More content");
- gtk_widget_show (page);
gtk_assistant_append_page (GTK_ASSISTANT (assistant), page);
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), page, "More content");
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), page, TRUE);
page = gtk_check_button_new_with_label ("Loop?");
- gtk_widget_show (page);
gtk_assistant_append_page (GTK_ASSISTANT (assistant), page);
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), page, "Loop?");
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), page, TRUE);
page = get_test_page ("Confirmation");
- gtk_widget_show (page);
gtk_assistant_append_page (GTK_ASSISTANT (assistant), page);
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), page, "Confirmation");
gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), page, GTK_ASSISTANT_PAGE_CONFIRM);
@@ -540,7 +524,6 @@ create_full_featured_assistant (GtkWidget *widget)
button = gtk_button_new_with_label ("_Stop");
gtk_button_set_use_underline (GTK_BUTTON (button), TRUE);
- gtk_widget_show (button);
gtk_assistant_add_action_widget (GTK_ASSISTANT (assistant), button);
g_signal_connect (button, "clicked",
G_CALLBACK (toggle_invisible), assistant);
@@ -555,7 +538,6 @@ create_full_featured_assistant (GtkWidget *widget)
G_CALLBACK (prepare_callback), NULL);
page = get_test_page ("Page 1");
- gtk_widget_show (page);
gtk_assistant_append_page (GTK_ASSISTANT (assistant), page);
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), page, "Page 1");
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), page, TRUE);
@@ -566,13 +548,11 @@ create_full_featured_assistant (GtkWidget *widget)
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), page, TRUE);
page = gtk_file_chooser_widget_new (GTK_FILE_CHOOSER_ACTION_OPEN);
- gtk_widget_show (page);
gtk_assistant_append_page (GTK_ASSISTANT (assistant), page);
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), page, "Filechooser");
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), page, TRUE);
page = get_test_page ("Page 3");
- gtk_widget_show (page);
gtk_assistant_append_page (GTK_ASSISTANT (assistant), page);
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), page, "Page 3");
gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), page, GTK_ASSISTANT_PAGE_CONFIRM);
@@ -603,7 +583,6 @@ flip_pages (GtkButton *button, GtkAssistant *assistant)
gtk_assistant_remove_page (assistant, 1);
gtk_assistant_insert_page (assistant, page, 2);
- gtk_widget_show (page);
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), page, title);
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), page, TRUE);
@@ -626,7 +605,6 @@ create_page_flipping_assistant (GtkWidget *widget)
button = gtk_button_new_with_label ("_Flip");
gtk_button_set_use_underline (GTK_BUTTON (button), TRUE);
- gtk_widget_show (button);
gtk_assistant_add_action_widget (GTK_ASSISTANT (assistant), button);
g_signal_connect (button, "clicked",
G_CALLBACK (flip_pages), assistant);
@@ -641,7 +619,6 @@ create_page_flipping_assistant (GtkWidget *widget)
G_CALLBACK (prepare_callback), NULL);
page = get_test_page ("Page 1");
- gtk_widget_show (page);
gtk_assistant_append_page (GTK_ASSISTANT (assistant), page);
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), page, "Page 1");
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), page, TRUE);
@@ -654,13 +631,11 @@ create_page_flipping_assistant (GtkWidget *widget)
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), page, TRUE);
page = get_test_page ("Page 3");
- gtk_widget_show (page);
gtk_assistant_append_page (GTK_ASSISTANT (assistant), page);
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), page, "Page 3");
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), page, TRUE);
page = get_test_page ("Summary");
- gtk_widget_show (page);
gtk_assistant_append_page (GTK_ASSISTANT (assistant), page);
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), page, "Summary");
gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), page, GTK_ASSISTANT_PAGE_SUMMARY);
diff --git a/tests/testbox.c b/tests/testbox.c
index 1d91d6714d..62e62f3d47 100644
--- a/tests/testbox.c
+++ b/tests/testbox.c
@@ -110,7 +110,6 @@ main (int argc, char *argv[])
gtk_widget_set_margin_top (check, 10);
gtk_widget_set_margin_bottom (check, 10);
gtk_widget_set_halign (check, GTK_ALIGN_CENTER);
- gtk_widget_show (check);
gtk_container_add (GTK_CONTAINER (vbox), check);
b = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
diff --git a/tests/testcalendar.c b/tests/testcalendar.c
index 978316d88d..a697fa5937 100644
--- a/tests/testcalendar.c
+++ b/tests/testcalendar.c
@@ -200,6 +200,7 @@ create_calendar(void)
g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
+ gtk_widget_set_vexpand (hpaned, TRUE);
/* Calendar widget */
diff --git a/tests/testcellarea.c b/tests/testcellarea.c
index 1726b15807..78c3e817ce 100644
--- a/tests/testcellarea.c
+++ b/tests/testcellarea.c
@@ -86,7 +86,6 @@ simple_iconview (void)
GtkCellRenderer *renderer;
iconview = gtk_icon_view_new ();
- gtk_widget_show (iconview);
model = simple_list_model ();
@@ -205,7 +204,6 @@ simple_cell_area (void)
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Horizontal");
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Vertical");
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
- gtk_widget_show (widget);
gtk_container_add (GTK_CONTAINER (vbox), widget);
g_signal_connect (G_OBJECT (widget), "changed",
@@ -213,7 +211,6 @@ simple_cell_area (void)
widget = gtk_check_button_new_with_label ("Align 2nd Cell");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
- gtk_widget_show (widget);
gtk_container_add (GTK_CONTAINER (vbox), widget);
g_signal_connect (G_OBJECT (widget), "toggled",
@@ -221,7 +218,6 @@ simple_cell_area (void)
widget = gtk_check_button_new_with_label ("Align 3rd Cell");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
- gtk_widget_show (widget);
gtk_container_add (GTK_CONTAINER (vbox), widget);
g_signal_connect (G_OBJECT (widget), "toggled",
@@ -230,7 +226,6 @@ simple_cell_area (void)
widget = gtk_check_button_new_with_label ("Expand 1st Cell");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
- gtk_widget_show (widget);
gtk_container_add (GTK_CONTAINER (vbox), widget);
g_signal_connect (G_OBJECT (widget), "toggled",
@@ -238,7 +233,6 @@ simple_cell_area (void)
widget = gtk_check_button_new_with_label ("Expand 2nd Cell");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
- gtk_widget_show (widget);
gtk_container_add (GTK_CONTAINER (vbox), widget);
g_signal_connect (G_OBJECT (widget), "toggled",
@@ -246,7 +240,6 @@ simple_cell_area (void)
widget = gtk_check_button_new_with_label ("Expand 3rd Cell");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
- gtk_widget_show (widget);
gtk_container_add (GTK_CONTAINER (vbox), widget);
g_signal_connect (G_OBJECT (widget), "toggled",
@@ -347,7 +340,6 @@ focus_iconview (gboolean color_bg, GtkCellRenderer **focus, GtkCellRenderer **si
GtkCellRenderer *renderer, *toggle;
iconview = gtk_icon_view_new ();
- gtk_widget_show (iconview);
model = focus_list_model ();
@@ -425,7 +417,6 @@ focus_cell_area (void)
window = gtk_window_new ();
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
- gtk_widget_show (hbox);
gtk_window_set_title (GTK_WINDOW (window), "Focus and editable cells");
@@ -448,7 +439,6 @@ focus_cell_area (void)
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Horizontal");
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Vertical");
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
- gtk_widget_show (widget);
gtk_container_add (GTK_CONTAINER (vbox), widget);
g_signal_connect (G_OBJECT (widget), "changed",
@@ -456,7 +446,6 @@ focus_cell_area (void)
widget = gtk_check_button_new_with_label ("Focus Sibling");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
- gtk_widget_show (widget);
gtk_container_add (GTK_CONTAINER (vbox), widget);
g_signal_connect (G_OBJECT (widget), "toggled",
@@ -515,8 +504,6 @@ background_area (void)
window = gtk_window_new ();
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
- gtk_widget_show (hbox);
- gtk_widget_show (main_vbox);
gtk_window_set_child (GTK_WINDOW (window), main_vbox);
gtk_window_set_title (GTK_WINDOW (window), "Background Area");
@@ -549,7 +536,6 @@ background_area (void)
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Horizontal");
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Vertical");
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
- gtk_widget_show (widget);
gtk_container_add (GTK_CONTAINER (vbox), widget);
g_signal_connect (G_OBJECT (widget), "changed",
diff --git a/tests/testcombo.c b/tests/testcombo.c
index 139f6df5b6..2fb35f8186 100644
--- a/tests/testcombo.c
+++ b/tests/testcombo.c
@@ -961,7 +961,7 @@ main (int argc, char **argv)
gtk_container_add (GTK_CONTAINER (mainbox), tmp);
boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_container_add (GTK_CONTAINER (tmp), boom);
+ gtk_frame_set_child (GTK_FRAME (tmp), boom);
cellview = gtk_cell_view_new ();
renderer = gtk_cell_renderer_pixbuf_new ();
@@ -982,7 +982,7 @@ main (int argc, char **argv)
gtk_container_add (GTK_CONTAINER (mainbox), tmp);
boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_container_add (GTK_CONTAINER (tmp), boom);
+ gtk_frame_set_child (GTK_FRAME (tmp), boom);
model = create_list_blaat ();
combobox = gtk_combo_box_new_with_model (model);
@@ -1022,7 +1022,7 @@ main (int argc, char **argv)
gtk_container_add (GTK_CONTAINER (mainbox), tmp);
boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_container_add (GTK_CONTAINER (tmp), boom);
+ gtk_frame_set_child (GTK_FRAME (tmp), boom);
model = create_empty_list_blaat ();
combobox = gtk_combo_box_new_with_model (model);
@@ -1065,7 +1065,7 @@ main (int argc, char **argv)
gtk_container_add (GTK_CONTAINER (mainbox), tmp);
boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_container_add (GTK_CONTAINER (tmp), boom);
+ gtk_frame_set_child (GTK_FRAME (tmp), boom);
model = create_list_blaat ();
combobox = gtk_combo_box_new_with_model (model);
@@ -1119,7 +1119,7 @@ main (int argc, char **argv)
gtk_container_add (GTK_CONTAINER (mainbox), tmp);
boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_container_add (GTK_CONTAINER (tmp), boom);
+ gtk_frame_set_child (GTK_FRAME (tmp), boom);
model = create_tree_blaat ();
combobox = gtk_combo_box_new_with_model (model);
@@ -1162,7 +1162,7 @@ main (int argc, char **argv)
gtk_container_add (GTK_CONTAINER (mainbox), tmp);
boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_container_add (GTK_CONTAINER (tmp), boom);
+ gtk_frame_set_child (GTK_FRAME (tmp), boom);
/* GtkComboBoxEntry */
@@ -1170,7 +1170,7 @@ main (int argc, char **argv)
gtk_container_add (GTK_CONTAINER (mainbox), tmp);
boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_container_add (GTK_CONTAINER (tmp), boom);
+ gtk_frame_set_child (GTK_FRAME (tmp), boom);
comboboxtext = gtk_combo_box_text_new_with_entry ();
setup_combo_entry (GTK_COMBO_BOX_TEXT (comboboxtext));
@@ -1182,7 +1182,7 @@ main (int argc, char **argv)
gtk_container_add (GTK_CONTAINER (mainbox), tmp);
boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_container_add (GTK_CONTAINER (tmp), boom);
+ gtk_frame_set_child (GTK_FRAME (tmp), boom);
model = create_phylogenetic_tree ();
combobox = gtk_combo_box_new_with_model (model);
@@ -1204,7 +1204,7 @@ main (int argc, char **argv)
gtk_container_add (GTK_CONTAINER (mainbox), tmp);
boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_container_add (GTK_CONTAINER (tmp), boom);
+ gtk_frame_set_child (GTK_FRAME (tmp), boom);
model = create_capital_tree ();
combobox = gtk_combo_box_new_with_model (model);
@@ -1235,7 +1235,7 @@ main (int argc, char **argv)
gtk_container_add (GTK_CONTAINER (mainbox), tmp);
boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_container_add (GTK_CONTAINER (tmp), boom);
+ gtk_frame_set_child (GTK_FRAME (tmp), boom);
model = create_food_list ();
combobox = gtk_combo_box_new_with_model (model);
@@ -1269,7 +1269,7 @@ main (int argc, char **argv)
gtk_container_add (GTK_CONTAINER (mainbox), tmp);
boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_container_add (GTK_CONTAINER (tmp), boom);
+ gtk_frame_set_child (GTK_FRAME (tmp), boom);
model = create_list_long ();
combobox = gtk_combo_box_new_with_model (model);
@@ -1294,7 +1294,7 @@ main (int argc, char **argv)
g_free (text);
}
gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), 53);
- gtk_container_add (GTK_CONTAINER (tmp), combobox);
+ gtk_frame_set_child (GTK_FRAME (tmp), combobox);
gtk_widget_show (window);
diff --git a/tests/testcombochange.c b/tests/testcombochange.c
index 57f2c5bdd9..96e9c27393 100644
--- a/tests/testcombochange.c
+++ b/tests/testcombochange.c
@@ -70,39 +70,6 @@ combochange_log (const char *fmt,
g_free (msg);
}
-static GtkWidget *
-create_combo (const char *name,
- gboolean is_list)
-{
- GtkCellRenderer *cell_renderer;
- GtkWidget *combo;
- GtkCssProvider *provider;
- GtkStyleContext *context;
- gchar *css_data;
-
- combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (model));
- cell_renderer = gtk_cell_renderer_text_new ();
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell_renderer, TRUE);
- gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), cell_renderer,
- "text", 0, NULL);
-
- gtk_widget_set_name (combo, name);
-
- context = gtk_widget_get_style_context (combo);
-
- provider = gtk_css_provider_new ();
- css_data = g_strdup_printf ("#%s { -GtkComboBox-appears-as-list: %s }",
- name, is_list ? "true" : "false");
- gtk_css_provider_load_from_data (provider, css_data, -1);
- g_free (css_data);
-
- gtk_style_context_add_provider (context,
- GTK_STYLE_PROVIDER (provider),
- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
-
- return combo;
-}
-
static void
on_insert (void)
{
@@ -230,10 +197,9 @@ main (int argc, char **argv)
GtkWidget *button_vbox;
GtkWidget *combo_vbox;
GtkWidget *button;
- GtkWidget *menu_combo;
- GtkWidget *label;
- GtkWidget *list_combo;
-
+ GtkWidget *combo;
+ GtkCellRenderer *cell_renderer;
+
test_init ();
gtk_init ();
@@ -254,21 +220,13 @@ main (int argc, char **argv)
combo_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
gtk_container_add (GTK_CONTAINER (hbox), combo_vbox);
- label = gtk_label_new (NULL);
- gtk_label_set_markup (GTK_LABEL (label), "<b>Menu mode</b>");
- gtk_container_add (GTK_CONTAINER (combo_vbox), label);
-
- menu_combo = create_combo ("menu-combo", FALSE);
- gtk_widget_set_margin_start (menu_combo, 12);
- gtk_container_add (GTK_CONTAINER (combo_vbox), menu_combo);
-
- label = gtk_label_new (NULL);
- gtk_label_set_markup (GTK_LABEL (label), "<b>List mode</b>");
- gtk_container_add (GTK_CONTAINER (combo_vbox), label);
-
- list_combo = create_combo ("list-combo", TRUE);
- gtk_widget_set_margin_start (list_combo, 12);
- gtk_container_add (GTK_CONTAINER (combo_vbox), list_combo);
+ combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (model));
+ cell_renderer = gtk_cell_renderer_text_new ();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell_renderer, TRUE);
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), cell_renderer,
+ "text", 0, NULL);
+ gtk_widget_set_margin_start (combo, 12);
+ gtk_container_add (GTK_CONTAINER (combo_vbox), combo);
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_set_hexpand (scrolled_window, TRUE);
diff --git a/tests/testdialog.c b/tests/testdialog.c
index 57b99a8690..14d35a261f 100644
--- a/tests/testdialog.c
+++ b/tests/testdialog.c
@@ -24,7 +24,6 @@ static void
show_message_dialog1a (GtkWindow *parent)
{
GtkWidget *dialog;
- GtkWidget *image;
dialog = GTK_WIDGET (gtk_message_dialog_new (parent,
GTK_DIALOG_MODAL|
@@ -34,9 +33,6 @@ show_message_dialog1a (GtkWindow *parent)
GTK_BUTTONS_OK,
"The system network services are not compatible with this version."));
- image = gtk_image_new_from_icon_name ("computer-fail");
- gtk_widget_show (image);
-
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
}
@@ -99,7 +95,8 @@ add_content (GtkWidget *dialog)
gtk_widget_set_margin_end (label, 50);
gtk_widget_set_margin_top (label, 50);
gtk_widget_set_margin_bottom (label, 50);
- gtk_widget_show (label);
+ gtk_widget_set_hexpand (label, TRUE);
+ gtk_widget_set_vexpand (label, TRUE);
gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), label);
}
@@ -183,8 +180,7 @@ show_dialog_with_header_buttons2 (GtkWindow *parent)
GtkBuilder *builder;
GtkWidget *dialog;
- builder = gtk_builder_new ();
- gtk_builder_add_from_file (builder, "dialog.ui", NULL);
+ builder = gtk_builder_new_from_file ("dialog.ui");
dialog = (GtkWidget *)gtk_builder_get_object (builder, "dialog");
g_object_unref (builder);
@@ -334,97 +330,79 @@ main (int argc, char *argv[])
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
gtk_widget_set_halign (vbox, GTK_ALIGN_FILL);
gtk_widget_set_valign (vbox, GTK_ALIGN_CENTER);
- gtk_widget_show (vbox);
gtk_window_set_child (GTK_WINDOW (window), vbox);
box = gtk_flow_box_new ();
gtk_flow_box_set_selection_mode (GTK_FLOW_BOX (box), GTK_SELECTION_NONE);
gtk_widget_set_hexpand (box, TRUE);
- gtk_widget_show (box);
gtk_container_add (GTK_CONTAINER (vbox), box);
button = gtk_button_new_with_label ("Message dialog");
g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_message_dialog1), window);
- gtk_widget_show (button);
gtk_container_add (GTK_CONTAINER (box), button);
button = gtk_button_new_with_label ("Message with icon");
g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_message_dialog1a), window);
- gtk_widget_show (button);
gtk_container_add (GTK_CONTAINER (box), button);
button = gtk_button_new_with_label ("Confirmation dialog");
g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_message_dialog2), window);
- gtk_widget_show (button);
gtk_container_add (GTK_CONTAINER (box), button);
button = gtk_button_new_with_label ("Builtin");
button = gtk_button_new_with_label ("Builtin");
g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_color_chooser), window);
- gtk_widget_show (button);
gtk_container_add (GTK_CONTAINER (box), button);
button = gtk_button_new_with_label ("Generic Builtin");
g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_color_chooser_generic), window);
- gtk_widget_show (button);
gtk_container_add (GTK_CONTAINER (box), button);
button = gtk_button_new_with_label ("Simple");
g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_dialog), window);
- gtk_widget_show (button);
gtk_container_add (GTK_CONTAINER (box), button);
button = gtk_button_new_with_label ("With Header");
g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_dialog_with_header), window);
- gtk_widget_show (button);
gtk_container_add (GTK_CONTAINER (box), button);
button = gtk_button_new_with_label ("With Buttons");
g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_dialog_with_buttons), window);
- gtk_widget_show (button);
gtk_container_add (GTK_CONTAINER (box), button);
button = gtk_button_new_with_label ("Header & Buttons");
g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_dialog_with_header_buttons), window);
- gtk_widget_show (button);
gtk_container_add (GTK_CONTAINER (box), button);
button = gtk_button_new_with_label ("Header & Buttons & Builder");
g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_dialog_with_header_buttons2), window);
- gtk_widget_show (button);
gtk_container_add (GTK_CONTAINER (box), button);
button = gtk_button_new_with_label ("Template");
button = gtk_button_new_with_label ("Template");
g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_dialog_from_template), window);
- gtk_widget_show (button);
gtk_container_add (GTK_CONTAINER (box), button);
button = gtk_button_new_with_label ("Template With Header");
g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_dialog_from_template_with_header), window);
- gtk_widget_show (button);
gtk_container_add (GTK_CONTAINER (box), button);
button = gtk_button_new_with_label ("Flexible Template");
g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_dialog_flex_template), window);
- gtk_widget_show (button);
gtk_container_add (GTK_CONTAINER (box), button);
button = gtk_check_button_new_with_label ("Dialogs have headers");
g_object_bind_property (gtk_settings_get_default (), "gtk-dialogs-use-header",
button, "active",
G_BINDING_BIDIRECTIONAL|G_BINDING_SYNC_CREATE);
- gtk_widget_show (button);
gtk_widget_set_halign (button, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (vbox), button);
button = gtk_spinner_new ();
gtk_spinner_start (GTK_SPINNER (button));
- gtk_widget_show (button);
gtk_widget_set_halign (button, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (vbox), button);
- gtk_widget_show (window);
while (TRUE)
g_main_context_iteration (NULL, TRUE);
diff --git a/tests/testdnd.c b/tests/testdnd.c
index f6659a54c4..b81f938dca 100644
--- a/tests/testdnd.c
+++ b/tests/testdnd.c
@@ -463,7 +463,7 @@ popup_cb (gpointer data)
g_signal_connect (dest, "drop", G_CALLBACK (popup_drop), NULL);
gtk_widget_add_controller (button, GTK_EVENT_CONTROLLER (dest));
}
- gtk_container_add (GTK_CONTAINER (popup_window), grid);
+ gtk_window_set_child (GTK_WINDOW (popup_window), grid);
}
gtk_widget_show (popup_window);
popped_up = TRUE;
diff --git a/tests/testentrycompletion.c b/tests/testentrycompletion.c
index 2f726b53ef..e06dc3f5ec 100644
--- a/tests/testentrycompletion.c
+++ b/tests/testentrycompletion.c
@@ -314,6 +314,10 @@ main (int argc, char *argv[])
g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
+ gtk_widget_set_margin_start (vbox, 5);
+ gtk_widget_set_margin_end (vbox, 5);
+ gtk_widget_set_margin_top (vbox, 5);
+ gtk_widget_set_margin_bottom (vbox, 5);
gtk_window_set_child (GTK_WINDOW (window), vbox);
label = gtk_label_new (NULL);
diff --git a/tests/testfilechooser.c b/tests/testfilechooser.c
index 0a9e19e2bf..0558dab5b0 100644
--- a/tests/testfilechooser.c
+++ b/tests/testfilechooser.c
@@ -452,7 +452,7 @@ main (int argc, char **argv)
control_window = gtk_window_new ();
vbbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_container_add (GTK_CONTAINER (control_window), vbbox);
+ gtk_window_set_child (GTK_WINDOW (control_window), vbbox);
button = gtk_button_new_with_mnemonic ("_Select all");
gtk_widget_set_sensitive (button, multiple);
diff --git a/tests/testfilechooserbutton.c b/tests/testfilechooserbutton.c
index 196cebf764..8015a3e6e6 100644
--- a/tests/testfilechooserbutton.c
+++ b/tests/testfilechooserbutton.c
@@ -132,31 +132,26 @@ tests_button_clicked_cb (GtkButton *real_button,
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (tests), box);
- gtk_widget_show (box);
button = gtk_button_new_with_label ("Print Selected Path");
g_signal_connect (button, "clicked",
G_CALLBACK (print_selected_path_clicked_cb), user_data);
gtk_container_add (GTK_CONTAINER (box), button);
- gtk_widget_show (button);
button = gtk_button_new_with_label ("Add $PWD's Parent as Shortcut");
g_signal_connect (button, "clicked",
G_CALLBACK (add_pwds_parent_as_shortcut_clicked_cb), user_data);
gtk_container_add (GTK_CONTAINER (box), button);
- gtk_widget_show (button);
button = gtk_button_new_with_label ("Remove $PWD's Parent as Shortcut");
g_signal_connect (button, "clicked",
G_CALLBACK (del_pwds_parent_as_shortcut_clicked_cb), user_data);
gtk_container_add (GTK_CONTAINER (box), button);
- gtk_widget_show (button);
button = gtk_button_new_with_label ("Unselect all");
g_signal_connect (button, "clicked",
G_CALLBACK (unselect_all_clicked_cb), user_data);
gtk_container_add (GTK_CONTAINER (box), button);
- gtk_widget_show (button);
g_object_set_data (user_data, "tests-dialog", tests);
}
diff --git a/tests/testflowbox.c b/tests/testflowbox.c
index f44cbed2d9..e8b499bf6e 100644
--- a/tests/testflowbox.c
+++ b/tests/testflowbox.c
@@ -48,8 +48,6 @@ populate_flowbox_simple (GtkFlowBox *flowbox)
widget = gtk_label_new (text);
frame = gtk_frame_new (NULL);
- gtk_widget_show (widget);
- gtk_widget_show (frame);
gtk_frame_set_child (GTK_FRAME (frame), widget);
@@ -117,7 +115,6 @@ populate_flowbox_buttons (GtkFlowBox *flowbox)
for (i = 0; i < 50; i++)
{
widget = gtk_button_new_with_label ("Button");
- gtk_widget_show (widget);
gtk_container_add (GTK_CONTAINER (flowbox), widget);
widget = gtk_widget_get_parent (widget);
gtk_widget_set_can_focus (widget, FALSE);
@@ -143,8 +140,6 @@ populate_flowbox_wrappy (GtkFlowBox *flowbox)
{
widget = gtk_label_new (strings[i]);
frame = gtk_frame_new (NULL);
- gtk_widget_show (widget);
- gtk_widget_show (frame);
gtk_frame_set_child (GTK_FRAME (frame), widget);
@@ -384,8 +379,6 @@ create_window (void)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
- gtk_widget_show (vbox);
- gtk_widget_show (hbox);
gtk_window_set_child (GTK_WINDOW (window), hbox);
gtk_container_add (GTK_CONTAINER (hbox), vbox);
@@ -394,7 +387,6 @@ create_window (void)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_widget_show (swindow);
gtk_container_add (GTK_CONTAINER (hbox), swindow);
flowbox = gtk_flow_box_new ();
@@ -406,7 +398,6 @@ create_window (void)
gtk_flow_box_set_row_spacing (GTK_FLOW_BOX (flowbox), INITIAL_RSPACING);
gtk_flow_box_set_min_children_per_line (GTK_FLOW_BOX (flowbox), INITIAL_MINIMUM_LENGTH);
gtk_flow_box_set_max_children_per_line (GTK_FLOW_BOX (flowbox), INITIAL_MAXIMUM_LENGTH);
- gtk_widget_show (flowbox);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (swindow), flowbox);
gtk_flow_box_set_hadjustment (GTK_FLOW_BOX (flowbox),
@@ -421,14 +412,11 @@ create_window (void)
expander = gtk_expander_new ("Flow Box controls");
gtk_expander_set_expanded (GTK_EXPANDER (expander), TRUE);
flowbox_cntl = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
- gtk_widget_show (flowbox_cntl);
- gtk_widget_show (expander);
gtk_container_add (GTK_CONTAINER (expander), flowbox_cntl);
gtk_container_add (GTK_CONTAINER (vbox), expander);
widget = gtk_check_button_new_with_label ("Homogeneous");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
- gtk_widget_show (widget);
gtk_widget_set_tooltip_text (widget, "Set whether the items should be displayed at the same size");
gtk_container_add (GTK_CONTAINER (flowbox_cntl), widget);
@@ -441,7 +429,6 @@ create_window (void)
g_object_bind_property (widget, "active",
flowbox, "activate-on-single-click",
G_BINDING_SYNC_CREATE);
- gtk_widget_show (widget);
gtk_container_add (GTK_CONTAINER (flowbox_cntl), widget);
/* Add alignment controls */
@@ -451,7 +438,6 @@ create_window (void)
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "End");
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Center");
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), INITIAL_HALIGN);
- gtk_widget_show (widget);
gtk_widget_set_tooltip_text (widget, "Set the horizontal alignment policy");
gtk_container_add (GTK_CONTAINER (flowbox_cntl), widget);
@@ -465,7 +451,6 @@ create_window (void)
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "End");
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Center");
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), INITIAL_VALIGN);
- gtk_widget_show (widget);
gtk_widget_set_tooltip_text (widget, "Set the vertical alignment policy");
gtk_container_add (GTK_CONTAINER (flowbox_cntl), widget);
@@ -478,7 +463,6 @@ create_window (void)
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Horizontal");
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Vertical");
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
- gtk_widget_show (widget);
gtk_widget_set_tooltip_text (widget, "Set the flowbox orientation");
gtk_container_add (GTK_CONTAINER (flowbox_cntl), widget);
@@ -493,7 +477,6 @@ create_window (void)
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Browse");
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Multiple");
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 1);
- gtk_widget_show (widget);
gtk_widget_set_tooltip_text (widget, "Set the selection mode");
gtk_container_add (GTK_CONTAINER (flowbox_cntl), widget);
@@ -504,7 +487,6 @@ create_window (void)
/* Add minimum line length in items control */
widget = gtk_spin_button_new_with_range (1, 10, 1);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), INITIAL_MINIMUM_LENGTH);
- gtk_widget_show (widget);
gtk_widget_set_tooltip_text (widget, "Set the minimum amount of items per line before wrapping");
gtk_container_add (GTK_CONTAINER (flowbox_cntl), widget);
@@ -517,7 +499,6 @@ create_window (void)
/* Add natural line length in items control */
widget = gtk_spin_button_new_with_range (1, 10, 1);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), INITIAL_MAXIMUM_LENGTH);
- gtk_widget_show (widget);
gtk_widget_set_tooltip_text (widget, "Set the natural amount of items per line ");
gtk_container_add (GTK_CONTAINER (flowbox_cntl), widget);
@@ -529,14 +510,12 @@ create_window (void)
/* Add horizontal/vertical spacing controls */
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
- gtk_widget_show (hbox);
widget = gtk_label_new ("H Spacing");
gtk_container_add (GTK_CONTAINER (hbox), widget);
widget = gtk_spin_button_new_with_range (0, 30, 1);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), INITIAL_CSPACING);
- gtk_widget_show (widget);
gtk_widget_set_tooltip_text (widget, "Set the horizontal spacing between children");
gtk_container_add (GTK_CONTAINER (hbox), widget);
@@ -549,14 +528,12 @@ create_window (void)
gtk_container_add (GTK_CONTAINER (flowbox_cntl), hbox);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
- gtk_widget_show (hbox);
widget = gtk_label_new ("V Spacing");
gtk_container_add (GTK_CONTAINER (hbox), widget);
widget = gtk_spin_button_new_with_range (0, 30, 1);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), INITIAL_RSPACING);
- gtk_widget_show (widget);
gtk_widget_set_tooltip_text (widget, "Set the vertical spacing between children");
gtk_container_add (GTK_CONTAINER (hbox), widget);
@@ -572,7 +549,6 @@ create_window (void)
widget = gtk_check_button_new_with_label ("Filter");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
- gtk_widget_show (widget);
gtk_widget_set_tooltip_text (widget, "Set whether some items should be filtered out");
gtk_container_add (GTK_CONTAINER (flowbox_cntl), widget);
@@ -582,7 +558,6 @@ create_window (void)
widget = gtk_check_button_new_with_label ("Sort");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
- gtk_widget_show (widget);
gtk_widget_set_tooltip_text (widget, "Set whether items should be sorted");
gtk_container_add (GTK_CONTAINER (flowbox_cntl), widget);
@@ -595,8 +570,6 @@ create_window (void)
expander = gtk_expander_new ("Test item controls");
gtk_expander_set_expanded (GTK_EXPANDER (expander), TRUE);
items_cntl = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
- gtk_widget_show (items_cntl);
- gtk_widget_show (expander);
gtk_container_add (GTK_CONTAINER (expander), items_cntl);
gtk_container_add (GTK_CONTAINER (vbox), expander);
@@ -608,7 +581,6 @@ create_window (void)
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Images");
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Buttons");
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
- gtk_widget_show (widget);
gtk_widget_set_tooltip_text (widget, "Set the item set to use");
gtk_container_add (GTK_CONTAINER (items_cntl), widget);
diff --git a/tests/testfontchooser.c b/tests/testfontchooser.c
index dedb011f9b..b13acbc21a 100644
--- a/tests/testfontchooser.c
+++ b/tests/testfontchooser.c
@@ -69,7 +69,6 @@ int
main (int argc, char *argv[])
{
GtkWidget *window;
- GtkWidget *box;
GtkWidget *fontchooser;
gboolean done = FALSE;
@@ -79,9 +78,7 @@ main (int argc, char *argv[])
window = gtk_window_new ();
gtk_widget_set_size_request (window, 600, 600);
- box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
- gtk_window_set_child (GTK_WINDOW (window), box);
- gtk_container_add (GTK_CONTAINER (box), fontchooser);
+ gtk_window_set_child (GTK_WINDOW (window), fontchooser);
gtk_widget_show (window);
diff --git a/tests/testgiconpixbuf.c b/tests/testgiconpixbuf.c
index 0a52da4b4d..3f698098e2 100644
--- a/tests/testgiconpixbuf.c
+++ b/tests/testgiconpixbuf.c
@@ -50,7 +50,7 @@ main (int argc,
pixbuf = gdk_pixbuf_new_from_file ("apple-red.png", NULL);
toplevel = gtk_window_new ();
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
- gtk_container_add (GTK_CONTAINER (toplevel), hbox);
+ gtk_window_set_child (GTK_WINDOW (toplevel), hbox);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_container_add (GTK_CONTAINER (hbox), vbox);
diff --git a/tests/testglarea.c b/tests/testglarea.c
index b32aa2cab0..3fa0bcbf37 100644
--- a/tests/testglarea.c
+++ b/tests/testglarea.c
@@ -375,7 +375,6 @@ create_axis_slider (int axis)
label = gtk_label_new (text);
gtk_container_add (GTK_CONTAINER (box), label);
- gtk_widget_show (label);
adj = gtk_adjustment_new (0.0, 0.0, 360.0, 1.0, 12.0, 0.0);
g_signal_connect (adj, "value-changed",
@@ -384,9 +383,6 @@ create_axis_slider (int axis)
slider = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, adj);
gtk_container_add (GTK_CONTAINER (box), slider);
gtk_widget_set_hexpand (slider, TRUE);
- gtk_widget_show (slider);
-
- gtk_widget_show (box);
return box;
}
@@ -421,9 +417,12 @@ main (int argc, char *argv[])
g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, FALSE);
+ gtk_widget_set_margin_start (box, 12);
+ gtk_widget_set_margin_end (box, 12);
+ gtk_widget_set_margin_top (box, 12);
+ gtk_widget_set_margin_bottom (box, 12);
gtk_box_set_spacing (GTK_BOX (box), 6);
gtk_window_set_child (GTK_WINDOW (window), box);
- gtk_widget_show (box);
gl_area = gtk_gl_area_new ();
gtk_widget_set_hexpand (gl_area, TRUE);
@@ -432,12 +431,10 @@ main (int argc, char *argv[])
g_signal_connect (gl_area, "realize", G_CALLBACK (realize), NULL);
g_signal_connect (gl_area, "unrealize", G_CALLBACK (unrealize), NULL);
g_signal_connect (gl_area, "render", G_CALLBACK (render), NULL);
- gtk_widget_show (gl_area);
controls = gtk_box_new (GTK_ORIENTATION_VERTICAL, FALSE);
gtk_container_add (GTK_CONTAINER (box), controls);
gtk_widget_set_hexpand (controls, TRUE);
- gtk_widget_show (controls);
for (i = 0; i < N_AXIS; i++)
gtk_container_add (GTK_CONTAINER (controls), create_axis_slider (i));
@@ -446,7 +443,6 @@ main (int argc, char *argv[])
gtk_widget_set_hexpand (button, TRUE);
gtk_container_add (GTK_CONTAINER (box), button);
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_widget_destroy), window);
- gtk_widget_show (button);
gtk_widget_show (window);
diff --git a/tests/testgmenu.c b/tests/testgmenu.c
index f435560967..d4a342c3d1 100644
--- a/tests/testgmenu.c
+++ b/tests/testgmenu.c
@@ -685,7 +685,7 @@ main (int argc, char *argv[])
else
{
button = gtk_menu_button_new ();
- gtk_button_set_label (GTK_BUTTON (button), "Click here");
+ gtk_menu_button_set_label (GTK_MENU_BUTTON (button), "Click here");
gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (button), model);
gtk_widget_insert_action_group (button, "actions", group);
gtk_container_add (GTK_CONTAINER (box), button);
diff --git a/tests/testgrid.c b/tests/testgrid.c
index ba007a89b8..36f73650b4 100644
--- a/tests/testgrid.c
+++ b/tests/testgrid.c
@@ -335,8 +335,6 @@ insert_cb (GtkButton *button, GtkWidget *window)
gtk_grid_insert_next_to (g4, child, GTK_POS_RIGHT);
gtk_grid_attach (g4, test_widget ("(1, 0)", "red"), 1, 0, 1, 1);
gtk_grid_attach (g4, test_widget ("(1, 2)", "red"), 1, 2, 1, 1);
-
- gtk_widget_show (GTK_WIDGET (g));
}
gtk_button_set_label (button, inserted ? "Insert" : "Remove");
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 8f0cfe22ec..0d2b9b3a91 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -126,6 +126,7 @@ build_alpha_widgets (void)
GtkWidget *entry;
grid = gtk_grid_new ();
+ gtk_widget_set_vexpand (grid, TRUE);
radio_button = gtk_radio_button_new_with_label (NULL, "Red");
gtk_widget_set_hexpand (radio_button, TRUE);
@@ -211,12 +212,15 @@ create_alpha_window (GtkWidget *widget)
content_area = gtk_dialog_get_content_area (GTK_DIALOG (window));
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
+ gtk_widget_set_margin_top (vbox, 12);
+ gtk_widget_set_margin_bottom (vbox, 12);
+ gtk_widget_set_margin_start (vbox, 12);
+ gtk_widget_set_margin_end (vbox, 12);
+ gtk_widget_set_vexpand (vbox, TRUE);
gtk_container_add (GTK_CONTAINER (content_area), vbox);
label = gtk_label_new (NULL);
- gtk_container_add (GTK_CONTAINER (vbox), label);
-
- label = gtk_label_new (NULL);
+ gtk_widget_set_vexpand (label, TRUE);
gtk_container_add (GTK_CONTAINER (vbox), label);
display = gtk_widget_get_display (window);
on_composited_changed (display, NULL, GTK_LABEL (label));
@@ -284,6 +288,10 @@ create_buttons (GtkWidget *widget)
grid = gtk_grid_new ();
gtk_grid_set_row_spacing (GTK_GRID (grid), 5);
gtk_grid_set_column_spacing (GTK_GRID (grid), 5);
+ gtk_widget_set_margin_top (grid, 10);
+ gtk_widget_set_margin_bottom (grid, 10);
+ gtk_widget_set_margin_start (grid, 10);
+ gtk_widget_set_margin_end (grid, 10);
gtk_container_add (GTK_CONTAINER (box1), grid);
button[0] = gtk_button_new_with_label ("button1");
@@ -315,6 +323,10 @@ create_buttons (GtkWidget *widget)
gtk_container_add (GTK_CONTAINER (box1), box2);
button[9] = gtk_button_new_with_label ("close");
+ gtk_widget_set_margin_top (button[9], 10);
+ gtk_widget_set_margin_bottom (button[9], 10);
+ gtk_widget_set_margin_start (button[9], 10);
+ gtk_widget_set_margin_end (button[9], 10);
g_signal_connect_swapped (button[9], "clicked",
G_CALLBACK (gtk_widget_destroy),
window);
@@ -476,6 +488,11 @@ create_check_buttons (GtkWidget *widget)
box1 = gtk_dialog_get_content_area (GTK_DIALOG (window));
box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
+ gtk_widget_set_hexpand (box2, TRUE);
+ gtk_widget_set_margin_start (box2, 10);
+ gtk_widget_set_margin_end (box2, 10);
+ gtk_widget_set_margin_top (box2, 10);
+ gtk_widget_set_margin_bottom (box2, 10);
gtk_container_add (GTK_CONTAINER (box1), box2);
button = gtk_check_button_new_with_mnemonic ("_button1");
@@ -492,10 +509,11 @@ create_check_buttons (GtkWidget *widget)
gtk_container_add (GTK_CONTAINER (box2), button);
separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
- gtk_container_add (GTK_CONTAINER (box1), separator);
+ gtk_container_add (GTK_CONTAINER (box2), separator);
table = create_widget_grid (GTK_TYPE_CHECK_BUTTON);
- gtk_container_add (GTK_CONTAINER (box1), table);
+ gtk_widget_set_vexpand (table, TRUE);
+ gtk_container_add (GTK_CONTAINER (box2), table);
}
if (!gtk_widget_get_visible (window))
@@ -818,8 +836,6 @@ create_sensitivity_control (GtkWidget *widget)
"toggled",
G_CALLBACK (sensitivity_toggled),
widget);
-
- gtk_widget_show (button);
return button;
}
@@ -871,8 +887,6 @@ create_selectable_control (GtkWidget *widget)
"toggled",
G_CALLBACK (selectable_toggled),
widget);
-
- gtk_widget_show (button);
return button;
}
@@ -1179,6 +1193,8 @@ create_rotated_text (GtkWidget *widget)
content_area = gtk_dialog_get_content_area (GTK_DIALOG (window));
drawing_area = gtk_drawing_area_new ();
+ gtk_widget_set_hexpand (drawing_area, TRUE);
+ gtk_widget_set_vexpand (drawing_area, TRUE);
gtk_container_add (GTK_CONTAINER (content_area), drawing_area);
tile_pixbuf = gdk_pixbuf_new_from_file ("marble.xpm", NULL);
@@ -1190,8 +1206,6 @@ create_rotated_text (GtkWidget *widget)
g_signal_connect (drawing_area, "unrealize",
G_CALLBACK (on_rotated_text_unrealize), NULL);
- gtk_widget_show (gtk_button_get_child (GTK_BUTTON (window)));
-
gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (drawing_area), DEFAULT_TEXT_RADIUS * 2);
gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (drawing_area), DEFAULT_TEXT_RADIUS * 2);
}
@@ -1507,7 +1521,6 @@ add_placeholder_clicked_cb (GtkButton *button,
GtkWidget *label;
label = gtk_label_new ("You filtered everything!!!");
- gtk_widget_show (label);
gtk_list_box_set_placeholder (GTK_LIST_BOX (list), label);
}
@@ -1561,7 +1574,6 @@ create_listbox (GtkWidget *widget)
{
gint value = g_random_int_range (0, 10000);
label = gtk_label_new (g_strdup_printf ("Value %u", value));
- gtk_widget_show (label);
gtk_container_add (GTK_CONTAINER (list), label);
g_object_set_data (G_OBJECT (gtk_widget_get_parent (label)), "value", GINT_TO_POINTER (value));
}
@@ -1603,7 +1615,7 @@ create_listbox (GtkWidget *widget)
static GtkWidget *
accel_button_new (const gchar *text,
- const gchar *accel)
+ const gchar *accel)
{
guint keyval;
GdkModifierType modifiers;
@@ -1624,7 +1636,6 @@ accel_button_new (const gchar *text,
shortcut = gtk_shortcut_new (gtk_keyval_trigger_new (keyval, modifiers),
g_object_ref (gtk_activate_action_get ()));
gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (controller), shortcut);
- g_object_unref (shortcut);
gtk_widget_add_controller (button, controller);
label = gtk_accel_label_new (text);
@@ -1642,6 +1653,7 @@ create_key_lookup (GtkWidget *widget)
if (!window)
{
+ GtkWidget *box;
GtkWidget *button;
GtkWidget *content_area;
@@ -1658,34 +1670,37 @@ create_key_lookup (GtkWidget *widget)
content_area = gtk_dialog_get_content_area (GTK_DIALOG (window));
+ box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+ gtk_widget_set_hexpand (box, TRUE);
+ gtk_widget_set_vexpand (box, TRUE);
+ gtk_container_add (GTK_CONTAINER (content_area), box);
+
button = gtk_button_new_with_mnemonic ("Button 1 (_a)");
- gtk_container_add (GTK_CONTAINER (content_area), button);
+ gtk_container_add (GTK_CONTAINER (box), button);
button = gtk_button_new_with_mnemonic ("Button 2 (_A)");
- gtk_container_add (GTK_CONTAINER (content_area), button);
+ gtk_container_add (GTK_CONTAINER (box), button);
button = gtk_button_new_with_mnemonic ("Button 3 (_\321\204)");
- gtk_container_add (GTK_CONTAINER (content_area), button);
+ gtk_container_add (GTK_CONTAINER (box), button);
button = gtk_button_new_with_mnemonic ("Button 4 (_\320\244)");
- gtk_container_add (GTK_CONTAINER (content_area), button);
+ gtk_container_add (GTK_CONTAINER (box), button);
button = gtk_button_new_with_mnemonic ("Button 6 (_b)");
- gtk_container_add (GTK_CONTAINER (content_area), button);
+ gtk_container_add (GTK_CONTAINER (box), button);
button = accel_button_new ("Button 7", "<Alt><Shift>b");
- gtk_container_add (GTK_CONTAINER (content_area), button);
+ gtk_container_add (GTK_CONTAINER (box), button);
button = accel_button_new ("Button 8", "<Alt>d");
- gtk_container_add (GTK_CONTAINER (content_area), button);
+ gtk_container_add (GTK_CONTAINER (box), button);
button = accel_button_new ("Button 9", "<Alt>Cyrillic_ve");
- gtk_container_add (GTK_CONTAINER (content_area), button);
+ gtk_container_add (GTK_CONTAINER (box), button);
button = gtk_button_new_with_mnemonic ("Button 10 (_1)");
- gtk_container_add (GTK_CONTAINER (content_area), button);
+ gtk_container_add (GTK_CONTAINER (box), button);
button = gtk_button_new_with_mnemonic ("Button 11 (_!)");
- gtk_container_add (GTK_CONTAINER (content_area), button);
+ gtk_container_add (GTK_CONTAINER (box), button);
button = accel_button_new ("Button 12", "<Super>a");
- gtk_container_add (GTK_CONTAINER (content_area), button);
+ gtk_container_add (GTK_CONTAINER (box), button);
button = accel_button_new ("Button 13", "<Hyper>a");
- gtk_container_add (GTK_CONTAINER (content_area), button);
+ gtk_container_add (GTK_CONTAINER (box), button);
button = accel_button_new ("Button 14", "<Meta>a");
- gtk_container_add (GTK_CONTAINER (content_area), button);
- button = accel_button_new ("Button 15", "<Shift><Mod4>b");
- gtk_container_add (GTK_CONTAINER (content_area), button);
+ gtk_container_add (GTK_CONTAINER (box), button);
window_ptr = &window;
g_object_add_weak_pointer (G_OBJECT (window), window_ptr);
@@ -1914,8 +1929,8 @@ scrolled_windows_remove (GtkWidget *dialog, gint response, GtkWidget *scrollwin)
if (sw_parent)
{
g_object_ref (scrollwin);
- gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (scrollwin)), scrollwin);
- gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw_parent), scrollwin);
+ gtk_window_set_child (GTK_WINDOW (gtk_widget_get_parent (scrollwin)), NULL);
+ gtk_container_add (GTK_CONTAINER (sw_parent), scrollwin);
g_object_unref (scrollwin);
@@ -1937,7 +1952,7 @@ scrolled_windows_remove (GtkWidget *dialog, gint response, GtkWidget *scrollwin)
g_object_ref (scrollwin);
gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (scrollwin)), scrollwin);
- gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw_float_parent), scrollwin);
+ gtk_window_set_child (GTK_WINDOW (sw_float_parent), scrollwin);
g_object_unref (scrollwin);
@@ -1984,14 +1999,12 @@ create_scrolled_windows (GtkWidget *widget)
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (content_area), scrolled_window);
- gtk_widget_show (scrolled_window);
grid = gtk_grid_new ();
gtk_grid_set_row_spacing (GTK_GRID (grid), 10);
gtk_grid_set_column_spacing (GTK_GRID (grid), 10);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled_window), grid);
gtk_viewport_set_scroll_to_focus (GTK_VIEWPORT (gtk_widget_get_parent (grid)), TRUE);
- gtk_widget_show (grid);
for (i = 0; i < 20; i++)
for (j = 0; j < 20; j++)
@@ -1999,7 +2012,6 @@ create_scrolled_windows (GtkWidget *widget)
sprintf (buffer, "button (%d,%d)\n", i, j);
button = gtk_toggle_button_new_with_label (buffer);
gtk_grid_attach (GTK_GRID (grid), button, i, j, 1, 1);
- gtk_widget_show (button);
}
gtk_dialog_add_button (GTK_DIALOG (window),
@@ -2134,6 +2146,10 @@ create_entry (GtkWidget *widget)
box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
+ gtk_widget_set_margin_top (box2, 10);
+ gtk_widget_set_margin_bottom (box2, 10);
+ gtk_widget_set_margin_start (box2, 10);
+ gtk_widget_set_margin_end (box2, 10);
gtk_container_add (GTK_CONTAINER (box1), box2);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
@@ -2142,6 +2158,7 @@ create_entry (GtkWidget *widget)
entry = gtk_entry_new ();
gtk_editable_set_text (GTK_EDITABLE (entry), "hello world \330\247\331\204\330\263\331\204\330\247\331\205 \330\271\331\204\331\212\331\203\331\205");
gtk_editable_select_region (GTK_EDITABLE (entry), 0, 5);
+ gtk_widget_set_hexpand (entry, TRUE);
gtk_container_add (GTK_CONTAINER (hbox), entry);
cb = GTK_COMBO_BOX_TEXT (gtk_combo_box_text_new_with_entry ());
@@ -2158,12 +2175,12 @@ create_entry (GtkWidget *widget)
gtk_combo_box_text_append_text (cb, "item8 item8 item8");
gtk_combo_box_text_append_text (cb, "item9 item9");
- cb_entry = gtk_button_get_child (GTK_BUTTON (cb));
+ cb_entry = gtk_combo_box_get_child (GTK_COMBO_BOX (cb));
gtk_editable_set_text (GTK_EDITABLE (cb_entry), "hello world \n\n\n foo");
gtk_editable_select_region (GTK_EDITABLE (cb_entry), 0, -1);
gtk_container_add (GTK_CONTAINER (box2), GTK_WIDGET (cb));
- sensitive_check = gtk_check_button_new_with_label("Sensitive");
+ sensitive_check = gtk_check_button_new_with_label ("Sensitive");
gtk_container_add (GTK_CONTAINER (box2), sensitive_check);
g_signal_connect (sensitive_check, "toggled",
G_CALLBACK (entry_toggle_sensitive), entry);
@@ -2189,6 +2206,10 @@ create_entry (GtkWidget *widget)
gtk_container_add (GTK_CONTAINER (box1), separator);
box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
+ gtk_widget_set_margin_top (box2, 10);
+ gtk_widget_set_margin_bottom (box2, 10);
+ gtk_widget_set_margin_start (box2, 10);
+ gtk_widget_set_margin_end (box2, 10);
gtk_container_add (GTK_CONTAINER (box1), box2);
button = gtk_button_new_with_label ("close");
@@ -2274,6 +2295,7 @@ create_size_group_window (GdkDisplay *display,
{
GtkWidget *content_area;
GtkWidget *window;
+ GtkWidget *vbox;
GtkWidget *grid;
GtkWidget *main_button;
GtkWidget *button;
@@ -2300,8 +2322,11 @@ create_size_group_window (GdkDisplay *display,
content_area = gtk_dialog_get_content_area (GTK_DIALOG (window));
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+ gtk_container_add (GTK_CONTAINER (content_area), vbox);
+
grid = gtk_grid_new ();
- gtk_container_add (GTK_CONTAINER (content_area), grid);
+ gtk_container_add (GTK_CONTAINER (vbox), grid);
gtk_grid_set_row_spacing (GTK_GRID (grid), 5);
gtk_grid_set_column_spacing (GTK_GRID (grid), 5);
@@ -2362,16 +2387,18 @@ create_size_group_window (GdkDisplay *display,
g_object_unref (vgroup2);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
- gtk_container_add (GTK_CONTAINER (content_area), hbox);
+ gtk_container_add (GTK_CONTAINER (vbox), hbox);
spin_button = gtk_spin_button_new_with_range (1, 100, 1);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin_button), SIZE_GROUP_INITIAL_SIZE);
+ gtk_widget_set_hexpand (spin_button, TRUE);
gtk_container_add (GTK_CONTAINER (hbox), spin_button);
g_signal_connect (spin_button, "value_changed",
G_CALLBACK (size_group_hsize_changed), main_button);
spin_button = gtk_spin_button_new_with_range (1, 100, 1);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin_button), SIZE_GROUP_INITIAL_SIZE);
+ gtk_widget_set_hexpand (spin_button, TRUE);
gtk_container_add (GTK_CONTAINER (hbox), spin_button);
g_signal_connect (spin_button, "value_changed",
G_CALLBACK (size_group_vsize_changed), main_button);
@@ -2635,6 +2662,7 @@ create_spins (GtkWidget *widget)
gtk_container_add (GTK_CONTAINER (vbox), hbox);
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+ gtk_widget_set_hexpand (vbox2, TRUE);
gtk_container_add (GTK_CONTAINER (hbox), vbox2);
label = gtk_label_new ("Time :");
@@ -2654,6 +2682,7 @@ create_spins (GtkWidget *widget)
gtk_container_add (GTK_CONTAINER (vbox2), spinner);
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+ gtk_widget_set_hexpand (vbox2, TRUE);
gtk_container_add (GTK_CONTAINER (hbox), vbox2);
label = gtk_label_new ("Month :");
@@ -2679,6 +2708,7 @@ create_spins (GtkWidget *widget)
gtk_container_add (GTK_CONTAINER (vbox2), spinner);
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+ gtk_widget_set_hexpand (vbox2, TRUE);
gtk_container_add (GTK_CONTAINER (hbox), vbox2);
label = gtk_label_new ("Hex :");
@@ -2762,6 +2792,7 @@ create_spins (GtkWidget *widget)
gtk_container_add (GTK_CONTAINER (vbox), hbox);
button = gtk_button_new_with_label ("Value as Int");
+ gtk_widget_set_hexpand (button, TRUE);
g_object_set_data (G_OBJECT (button), "user_data", val_label);
g_signal_connect (button, "clicked",
G_CALLBACK (get_value),
@@ -2769,6 +2800,7 @@ create_spins (GtkWidget *widget)
gtk_container_add (GTK_CONTAINER (hbox), button);
button = gtk_button_new_with_label ("Value as Float");
+ gtk_widget_set_hexpand (button, TRUE);
g_object_set_data (G_OBJECT (button), "user_data", val_label);
g_signal_connect (button, "clicked",
G_CALLBACK (get_value),
@@ -2782,11 +2814,13 @@ create_spins (GtkWidget *widget)
gtk_container_add (GTK_CONTAINER (main_vbox), frame);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_frame_set_child (GTK_FRAME (frame), vbox);
+ gtk_frame_set_child (GTK_FRAME (frame), hbox);
val_label = gtk_label_new ("0.0");
+ gtk_widget_set_hexpand (val_label, TRUE);
spinner = gtk_spin_button_new_with_range (0.0, 10.0, 0.009);
+ gtk_widget_set_hexpand (spinner, TRUE);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (spinner), 0.0);
g_signal_connect (spinner, "value_changed",
G_CALLBACK (get_spin_value), val_label);
@@ -2797,6 +2831,7 @@ create_spins (GtkWidget *widget)
gtk_container_add (GTK_CONTAINER (main_vbox), hbox);
button = gtk_button_new_with_label ("Close");
+ gtk_widget_set_hexpand (button, TRUE);
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_widget_destroy),
window);
@@ -3084,6 +3119,10 @@ create_cursors (GtkWidget *widget)
if (cursor_demo)
{
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+ gtk_widget_set_margin_top (hbox, 5);
+ gtk_widget_set_margin_bottom (hbox, 5);
+ gtk_widget_set_margin_start (hbox, 5);
+ gtk_widget_set_margin_end (hbox, 5);
gtk_container_add (GTK_CONTAINER (vbox), hbox);
label = gtk_label_new ("Cursor Theme:");
@@ -3097,6 +3136,7 @@ create_cursors (GtkWidget *widget)
size = gtk_spin_button_new_with_range (1.0, 128.0, 1.0);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (size), 24.0);
+ gtk_widget_set_hexpand (size, TRUE);
gtk_container_add (GTK_CONTAINER (hbox), size);
g_signal_connect (entry, "changed",
@@ -3106,6 +3146,10 @@ create_cursors (GtkWidget *widget)
}
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+ gtk_widget_set_margin_top (hbox, 5);
+ gtk_widget_set_margin_bottom (hbox, 5);
+ gtk_widget_set_margin_start (hbox, 5);
+ gtk_widget_set_margin_end (hbox, 5);
gtk_container_add (GTK_CONTAINER (vbox), hbox);
label = gtk_label_new ("Cursor Name:");
@@ -3120,6 +3164,7 @@ create_cursors (GtkWidget *widget)
gtk_entry_completion_set_text_column (completion, 0);
gtk_entry_set_completion (GTK_ENTRY (entry), completion);
g_object_unref (model);
+ gtk_widget_set_hexpand (entry, TRUE);
gtk_container_add (GTK_CONTAINER (hbox), entry);
frame =
@@ -3138,7 +3183,6 @@ create_cursors (GtkWidget *widget)
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), 0);
g_signal_connect (gesture, "pressed", G_CALLBACK (cursor_pressed_cb), entry);
gtk_widget_add_controller (darea, GTK_EVENT_CONTROLLER (gesture));
- gtk_widget_show (darea);
g_signal_connect (entry, "changed",
G_CALLBACK (set_cursor_from_name), darea);
@@ -3148,9 +3192,14 @@ create_cursors (GtkWidget *widget)
gtk_container_add (GTK_CONTAINER (main_vbox), any);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+ gtk_widget_set_margin_top (hbox, 10);
+ gtk_widget_set_margin_bottom (hbox, 10);
+ gtk_widget_set_margin_start (hbox, 10);
+ gtk_widget_set_margin_end (hbox, 10);
gtk_container_add (GTK_CONTAINER (main_vbox), hbox);
button = gtk_button_new_with_label ("Close");
+ gtk_widget_set_hexpand (button, TRUE);
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_widget_destroy),
window);
@@ -3190,6 +3239,10 @@ create_color_selection (GtkWidget *widget)
gtk_window_set_title (GTK_WINDOW (window), "GtkColorButton");
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
+ gtk_widget_set_margin_top (hbox, 5);
+ gtk_widget_set_margin_bottom (hbox, 5);
+ gtk_widget_set_margin_start (hbox, 5);
+ gtk_widget_set_margin_end (hbox, 5);
gtk_window_set_child (GTK_WINDOW (window), hbox);
label = gtk_label_new ("Pick a color");
@@ -3367,6 +3420,10 @@ create_font_selection (GtkWidget *widget)
gtk_window_set_title (GTK_WINDOW (window), "GtkFontButton");
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
+ gtk_widget_set_margin_top (hbox, 8);
+ gtk_widget_set_margin_bottom (hbox, 8);
+ gtk_widget_set_margin_start (hbox, 8);
+ gtk_widget_set_margin_end (hbox, 8);
gtk_window_set_child (GTK_WINDOW (window), hbox);
label = gtk_label_new ("Pick a font");
@@ -3421,7 +3478,6 @@ dialog_response_cb (GtkWidget *widget, gint response, gpointer unused)
gtk_widget_set_margin_bottom (label, 10);
gtk_container_add (GTK_CONTAINER (content_area),
label);
- gtk_widget_show (label);
}
g_list_free (children);
@@ -3568,7 +3624,7 @@ create_display_screen (GtkWidget *widget)
combo_dpy = gtk_combo_box_text_new_with_entry ();
gtk_widget_set_hexpand (combo_dpy, TRUE);
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_dpy), "diabolo:0.0");
- gtk_editable_set_text (GTK_EDITABLE (gtk_button_get_child (GTK_BUTTON (combo_dpy))),
+ gtk_editable_set_text (GTK_EDITABLE (gtk_combo_box_get_child (GTK_COMBO_BOX (combo_dpy))),
"<hostname>:<X Server Num>.<Screen Num>");
gtk_grid_attach (GTK_GRID (grid), label_dpy, 0, 0, 1, 1);
@@ -3576,9 +3632,9 @@ create_display_screen (GtkWidget *widget)
bbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_set_halign (bbox, GTK_ALIGN_END);
- applyb = gtk_button_new_with_label ("_Apply");
- cancelb = gtk_button_new_with_label ("_Cancel");
-
+ applyb = gtk_button_new_with_mnemonic ("_Apply");
+ cancelb = gtk_button_new_with_mnemonic ("_Cancel");
+
gtk_container_add (GTK_CONTAINER (vbox), bbox);
gtk_container_add (GTK_CONTAINER (bbox), applyb);
@@ -3586,7 +3642,7 @@ create_display_screen (GtkWidget *widget)
scr_dpy_data = g_new0 (ScreenDisplaySelection, 1);
- scr_dpy_data->entry = gtk_button_get_child (GTK_BUTTON (combo_dpy));
+ scr_dpy_data->entry = gtk_combo_box_get_child (GTK_COMBO_BOX (combo_dpy));
scr_dpy_data->toplevel = GTK_WIDGET (gtk_widget_get_root (widget));
scr_dpy_data->dialog_window = window;
@@ -3638,12 +3694,10 @@ create_range_controls (GtkWidget *widget)
box1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_window_set_child (GTK_WINDOW (window), box1);
- gtk_widget_show (box1);
box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
gtk_container_add (GTK_CONTAINER (box1), box2);
- gtk_widget_show (box2);
adjustment = gtk_adjustment_new (0.0, 0.0, 101.0, 0.1, 1.0, 1.0);
@@ -3653,20 +3707,16 @@ create_range_controls (GtkWidget *widget)
gtk_scale_set_digits (GTK_SCALE (scale), 1);
gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE);
gtk_container_add (GTK_CONTAINER (box2), scale);
- gtk_widget_show (scale);
scrollbar = gtk_scrollbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_ADJUSTMENT (adjustment));
gtk_container_add (GTK_CONTAINER (box2), scrollbar);
- gtk_widget_show (scrollbar);
scale = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, GTK_ADJUSTMENT (adjustment));
gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE);
- g_signal_connect (scale,
- "format_value",
- G_CALLBACK (reformat_value),
- NULL);
+ gtk_scale_set_format_value_func (GTK_SCALE (scale),
+ (GtkScaleFormatValueFunc) reformat_value,
+ NULL, NULL);
gtk_container_add (GTK_CONTAINER (box2), scale);
- gtk_widget_show (scale);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
@@ -3675,7 +3725,6 @@ create_range_controls (GtkWidget *widget)
gtk_scale_set_digits (GTK_SCALE (scale), 2);
gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE);
gtk_container_add (GTK_CONTAINER (hbox), scale);
- gtk_widget_show (scale);
scale = gtk_scale_new (GTK_ORIENTATION_VERTICAL, GTK_ADJUSTMENT (adjustment));
gtk_widget_set_size_request (scale, -1, 200);
@@ -3683,29 +3732,23 @@ create_range_controls (GtkWidget *widget)
gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE);
gtk_range_set_inverted (GTK_RANGE (scale), TRUE);
gtk_container_add (GTK_CONTAINER (hbox), scale);
- gtk_widget_show (scale);
scale = gtk_scale_new (GTK_ORIENTATION_VERTICAL, GTK_ADJUSTMENT (adjustment));
gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE);
- g_signal_connect (scale,
- "format_value",
- G_CALLBACK (reformat_value),
- NULL);
+ gtk_scale_set_format_value_func (GTK_SCALE (scale),
+ (GtkScaleFormatValueFunc) reformat_value,
+ NULL, NULL);
gtk_container_add (GTK_CONTAINER (hbox), scale);
- gtk_widget_show (scale);
gtk_container_add (GTK_CONTAINER (box2), hbox);
- gtk_widget_show (hbox);
separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
gtk_container_add (GTK_CONTAINER (box1), separator);
- gtk_widget_show (separator);
box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
gtk_container_add (GTK_CONTAINER (box1), box2);
- gtk_widget_show (box2);
button = gtk_button_new_with_label ("close");
@@ -3714,7 +3757,6 @@ create_range_controls (GtkWidget *widget)
window);
gtk_container_add (GTK_CONTAINER (box2), button);
gtk_window_set_default_widget (GTK_WINDOW (window), button);
- gtk_widget_show (button);
}
if (!gtk_widget_get_visible (window))
@@ -3847,7 +3889,7 @@ create_pages (GtkNotebook *notebook, gint start, gint end)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_box_set_homogeneous (GTK_BOX (vbox), TRUE);
- gtk_container_add (GTK_CONTAINER (child), vbox);
+ gtk_frame_set_child (GTK_FRAME (child), vbox);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
@@ -3869,8 +3911,6 @@ create_pages (GtkNotebook *notebook, gint start, gint end)
G_CALLBACK (gtk_widget_hide),
child);
- gtk_widget_show (child);
-
label_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
pixwid = gtk_image_new_from_pixbuf (book_closed);
g_object_set_data (G_OBJECT (child), "tab_pixmap", pixwid);
@@ -3882,7 +3922,6 @@ create_pages (GtkNotebook *notebook, gint start, gint end)
gtk_widget_set_margin_top (pixwid, 1);
label = gtk_label_new_with_mnemonic (accel_buffer);
gtk_container_add (GTK_CONTAINER (label_box), label);
- gtk_widget_show (label_box);
menu_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
@@ -3896,7 +3935,6 @@ create_pages (GtkNotebook *notebook, gint start, gint end)
gtk_widget_set_margin_top (pixwid, 1);
label = gtk_label_new (buffer);
gtk_container_add (GTK_CONTAINER (menu_box), label);
- gtk_widget_show (menu_box);
gtk_notebook_append_page_menu (notebook, child, label_box, menu_box);
}
@@ -4021,8 +4059,9 @@ create_notebook (GtkWidget *widget)
sample_notebook = gtk_notebook_new ();
g_signal_connect (sample_notebook, "switch_page",
- G_CALLBACK (page_switch), NULL);
+ G_CALLBACK (page_switch), NULL);
gtk_notebook_set_tab_pos (GTK_NOTEBOOK (sample_notebook), GTK_POS_TOP);
+ gtk_widget_set_vexpand (sample_notebook, TRUE);
gtk_container_add (GTK_CONTAINER (box1), sample_notebook);
gtk_widget_realize (sample_notebook);
@@ -4252,8 +4291,6 @@ create_panes (GtkWidget *widget)
"Vertical",
"Top",
"Bottom"));
-
- gtk_widget_show (vbox);
}
if (!gtk_widget_get_visible (window))
@@ -4670,22 +4707,18 @@ create_wmhints (GtkWidget *widget)
box1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_window_set_child (GTK_WINDOW (window), box1);
- gtk_widget_show (box1);
label = gtk_label_new ("Try iconizing me!");
gtk_widget_set_size_request (label, 150, 50);
gtk_container_add (GTK_CONTAINER (box1), label);
- gtk_widget_show (label);
separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
gtk_container_add (GTK_CONTAINER (box1), separator);
- gtk_widget_show (separator);
box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
gtk_container_add (GTK_CONTAINER (box1), box2);
- gtk_widget_show (box2);
button = gtk_button_new_with_label ("close");
@@ -4696,7 +4729,6 @@ create_wmhints (GtkWidget *widget)
gtk_container_add (GTK_CONTAINER (box2), button);
gtk_window_set_default_widget (GTK_WINDOW (window), button);
- gtk_widget_show (button);
}
if (!gtk_widget_get_visible (window))
@@ -4760,9 +4792,10 @@ tracking_label (GtkWidget *window)
gtk_container_add (GTK_CONTAINER (hbox), label);
g_object_set_data (G_OBJECT (label), "title", (gpointer)gtk_window_get_title (GTK_WINDOW (window)));
- g_signal_connect (gtk_native_get_surface (GTK_NATIVE (window)), "notify::state",
- G_CALLBACK (surface_state_callback),
- label);
+ g_signal_connect_object (gtk_native_get_surface (GTK_NATIVE (window)), "notify::state",
+ G_CALLBACK (surface_state_callback),
+ label,
+ 0);
button = gtk_button_new_with_label ("Unminimize");
g_signal_connect_object (button,
@@ -4812,8 +4845,6 @@ tracking_label (GtkWidget *window)
G_CONNECT_SWAPPED);
gtk_container_add (GTK_CONTAINER (hbox), button);
- gtk_widget_show (hbox);
-
return hbox;
}
@@ -4873,8 +4904,6 @@ get_state_controls (GtkWidget *window)
G_CONNECT_SWAPPED);
gtk_container_add (GTK_CONTAINER (vbox), button);
- gtk_widget_show (vbox);
-
return vbox;
}
@@ -4898,7 +4927,7 @@ create_surface_states (GtkWidget *widget)
G_CALLBACK (gtk_widget_destroyed),
&window);
- gtk_window_set_title (GTK_WINDOW (window), "Window states");
+ gtk_window_set_title (GTK_WINDOW (window), "Surface states");
box1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_window_set_child (GTK_WINDOW (window), box1);
@@ -4915,7 +4944,7 @@ create_surface_states (GtkWidget *widget)
gtk_window_minimize (GTK_WINDOW (iconified));
gtk_window_set_title (GTK_WINDOW (iconified), "Minimized initially");
controls = get_state_controls (iconified);
- gtk_container_add (GTK_CONTAINER (iconified), controls);
+ gtk_window_set_child (GTK_WINDOW (iconified), controls);
normal = gtk_window_new ();
@@ -4929,7 +4958,7 @@ create_surface_states (GtkWidget *widget)
gtk_window_set_title (GTK_WINDOW (normal), "Unminimized initially");
controls = get_state_controls (normal);
- gtk_container_add (GTK_CONTAINER (normal), controls);
+ gtk_window_set_child (GTK_WINDOW (normal), controls);
gtk_widget_realize (iconified);
gtk_widget_realize (normal);
@@ -4942,7 +4971,6 @@ create_surface_states (GtkWidget *widget)
gtk_widget_show (iconified);
gtk_widget_show (normal);
- gtk_widget_show (box1);
}
if (!gtk_widget_get_visible (window))
@@ -5059,7 +5087,7 @@ window_controls (GtkWidget *window)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
- gtk_container_add (GTK_CONTAINER (control_window), vbox);
+ gtk_window_set_child (GTK_WINDOW (control_window), vbox);
label = gtk_label_new ("<no size>");
gtk_container_add (GTK_CONTAINER (vbox), label);
@@ -5145,8 +5173,6 @@ window_controls (GtkWidget *window)
G_CONNECT_SWAPPED);
gtk_container_add (GTK_CONTAINER (vbox), button);
- gtk_widget_show (vbox);
-
return control_window;
}
@@ -5165,8 +5191,8 @@ create_window_sizing (GtkWidget *widget)
gtk_widget_get_display (widget));
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label), "<span foreground=\"purple\"><big>Window being resized</big></span>\nBlah blah blah blah\nblah blah blah\nblah blah blah blah blah");
- gtk_container_add (GTK_CONTAINER (target_window), label);
- gtk_widget_show (label);
+ gtk_window_set_child (GTK_WINDOW (target_window), label);
+ gtk_widget_show (target_window);
g_signal_connect (target_window, "destroy",
G_CALLBACK (gtk_widget_destroyed),
@@ -5560,7 +5586,6 @@ create_timeout_test (GtkWidget *widget)
gtk_widget_set_margin_top (label, 10);
gtk_widget_set_margin_bottom (label, 10);
gtk_container_add (GTK_CONTAINER (content_area), label);
- gtk_widget_show (label);
button = gtk_button_new_with_label ("close");
g_signal_connect_swapped (button, "clicked",
@@ -5568,21 +5593,18 @@ create_timeout_test (GtkWidget *widget)
window);
gtk_container_add (GTK_CONTAINER (action_area), button);
gtk_window_set_default_widget (GTK_WINDOW (window), button);
- gtk_widget_show (button);
button = gtk_button_new_with_label ("start");
g_signal_connect (button, "clicked",
G_CALLBACK(start_timeout_test),
label);
gtk_container_add (GTK_CONTAINER (action_area), button);
- gtk_widget_show (button);
button = gtk_button_new_with_label ("stop");
g_signal_connect (button, "clicked",
G_CALLBACK (stop_timeout_test),
NULL);
gtk_container_add (GTK_CONTAINER (action_area), button);
- gtk_widget_show (button);
}
if (!gtk_widget_get_visible (window))
@@ -5984,12 +6006,12 @@ struct {
{ "size groups", create_size_groups },
{ "spinbutton", create_spins },
{ "statusbar", create_statusbar },
+ { "surface states", create_surface_states },
{ "test timeout", create_timeout_test },
{ "toggle buttons", create_toggle_buttons },
{ "tooltips", create_tooltips },
{ "WM hints", create_wmhints },
- { "window sizing", create_window_sizing },
- { "window states", create_surface_states }
+ { "window sizing", create_window_sizing }
};
int nbuttons = sizeof (buttons) / sizeof (buttons[0]);
@@ -6043,6 +6065,10 @@ create_main_window (void)
gtk_widget_set_name (label, "testgtk-version-label");
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
+ gtk_widget_set_margin_top (scrolled_window, 10);
+ gtk_widget_set_margin_bottom (scrolled_window, 10);
+ gtk_widget_set_margin_start (scrolled_window, 10);
+ gtk_widget_set_margin_end (scrolled_window, 10);
gtk_widget_set_vexpand (scrolled_window, TRUE);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_NEVER,
@@ -6050,9 +6076,12 @@ create_main_window (void)
gtk_container_add (GTK_CONTAINER (box1), scrolled_window);
box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+ gtk_widget_set_margin_top (box2, 10);
+ gtk_widget_set_margin_bottom (box2, 10);
+ gtk_widget_set_margin_start (box2, 10);
+ gtk_widget_set_margin_end (box2, 10);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled_window), box2);
gtk_viewport_set_scroll_to_focus (GTK_VIEWPORT (gtk_widget_get_parent (box2)), TRUE);
- gtk_widget_show (box2);
for (i = 0; i < nbuttons; i++)
{
@@ -6070,14 +6099,15 @@ create_main_window (void)
separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
gtk_container_add (GTK_CONTAINER (box1), separator);
- box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
- gtk_container_add (GTK_CONTAINER (box1), box2);
-
button = gtk_button_new_with_mnemonic ("_Close");
+ gtk_widget_set_margin_top (button, 10);
+ gtk_widget_set_margin_bottom (button, 10);
+ gtk_widget_set_margin_start (button, 10);
+ gtk_widget_set_margin_end (button, 10);
g_signal_connect (button, "clicked",
G_CALLBACK (do_exit),
window);
- gtk_container_add (GTK_CONTAINER (box2), button);
+ gtk_container_add (GTK_CONTAINER (box1), button);
gtk_window_set_default_widget (GTK_WINDOW (window), button);
gtk_widget_show (window);
diff --git a/tests/testgtk.css b/tests/testgtk.css
index 4bd3f366b9..fc892f98b9 100644
--- a/tests/testgtk.css
+++ b/tests/testgtk.css
@@ -11,11 +11,11 @@ label:selected {
}
label:hover {
- background-color: mix (#a0a0a0, rgb (75%, 200, 0%), 0.9);
+ background-color: mix(#a0a0a0, rgb(75%, 78%, 0%), 0.9);
}
/* override testgtk2, introduce the green color in the button list */
#main_window scrolledwindow button:hover {
- background-color: rgb (0%, 75%, 0);
+ background-color: rgb(0%, 75%, 0%);
}
diff --git a/tests/testheaderbar.c b/tests/testheaderbar.c
index 539ed3bbae..9d3bcd2ba1 100644
--- a/tests/testheaderbar.c
+++ b/tests/testheaderbar.c
@@ -143,6 +143,7 @@ main (int argc, char *argv[])
content = gtk_image_new_from_icon_name ("start-here-symbolic");
gtk_image_set_pixel_size (GTK_IMAGE (content), 512);
+ gtk_widget_set_vexpand (content, TRUE);
gtk_container_add (GTK_CONTAINER (box), content);
diff --git a/tests/testheightforwidth.c b/tests/testheightforwidth.c
index 41c62f24b6..f5d4afff0e 100644
--- a/tests/testheightforwidth.c
+++ b/tests/testheightforwidth.c
@@ -45,10 +45,8 @@ static TestInterface interfaces[] = {
" <child>"
" <object class=\"GtkBox\" id=\"hbox5\">"
" <property name=\"orientation\">horizontal</property>"
- " <property name=\"visible\">True</property>"
" <child>"
" <object class=\"GtkLabel\" id=\"label9\">"
- " <property name=\"visible\">True</property>"
" <property name=\"label\" translatable=\"yes\">Some labels do ellipsize</property>"
" <property name=\"ellipsize\">end</property>"
" <attributes>"
@@ -56,13 +54,9 @@ static TestInterface interfaces[] = {
" <attribute name=\"foreground\" value=\"#09610feefe03\"/>"
" </attributes>"
" </object>"
- " <packing>"
- " <property name=\"position\">0</property>"
- " </packing>"
" </child>"
" <child>"
" <object class=\"GtkLabel\" id=\"label10\">"
- " <property name=\"visible\">True</property>"
" <property name=\"label\" translatable=\"yes\">but some</property>"
" <property name=\"ellipsize\">end</property>"
" <attributes>"
@@ -70,13 +64,9 @@ static TestInterface interfaces[] = {
" <attribute name=\"foreground\" value=\"#0000af6b0993\"/>"
" </attributes>"
" </object>"
- " <packing>"
- " <property name=\"position\">1</property>"
- " </packing>"
" </child>"
" <child>"
" <object class=\"GtkLabel\" id=\"label11\">"
- " <property name=\"visible\">True</property>"
" <property name=\"label\" translatable=\"yes\">do not at all</property>"
" <attributes>"
" <attribute name=\"style\" value=\"normal\"/>"
@@ -84,9 +74,6 @@ static TestInterface interfaces[] = {
" <attribute name=\"foreground\" value=\"#ffff00000000\"/>"
" </attributes>"
" </object>"
- " <packing>"
- " <property name=\"position\">2</property>"
- " </packing>"
" </child>"
" </object>"
" </child>"
@@ -106,31 +93,25 @@ static TestInterface interfaces[] = {
" <child>"
" <object class=\"GtkPaned\" id=\"hpaned1\">"
" <property name=\"orientation\">horizontal</property>"
- " <property name=\"visible\">True</property>"
" <property name=\"can_focus\">True</property>"
+ " <property name=\"resize-child1\">False</property>"
+ " <property name=\"shrink-child1\">False</property>"
" <child>"
" <object class=\"GtkBox\" id=\"vbox2\">"
" <property name=\"orientation\">vertical</property>"
- " <property name=\"visible\">True</property>"
" <child>"
" <object class=\"GtkLabel\" id=\"label3\">"
- " <property name=\"visible\">True</property>"
" <property name=\"label\" translatable=\"yes\">A short static label.</property>"
" <attributes>"
" <attribute name=\"weight\" value=\"bold\"/>"
" </attributes>"
" </object>"
- " <packing>"
- " <property name=\"position\">0</property>"
- " </packing>"
" </child>"
" <child>"
" <object class=\"GtkFrame\" id=\"frame1\">"
" <property name=\"label\">Long label</property>"
- " <property name=\"visible\">True</property>"
" <child>"
" <object class=\"GtkLabel\" id=\"label1\">"
- " <property name=\"visible\">True</property>"
" <property name=\"label\" translatable=\"yes\">This is a really long label for the purpose of testing line wrapping is working correctly in conjunction with height-for-width support in GTK+</property>"
" <property name=\"wrap\">True</property>"
" <property name=\"max_width_chars\">30</property>"
@@ -140,18 +121,13 @@ static TestInterface interfaces[] = {
" </object>"
" </child>"
" </object>"
- " <packing>"
- " <property name=\"position\">1</property>"
- " </packing>"
" </child>"
" <child>"
" <object class=\"GtkButton\" id=\"button2\">"
- " <property name=\"visible\">True</property>"
" <property name=\"can_focus\">True</property>"
" <property name=\"receives_default\">True</property>"
" <child>"
" <object class=\"GtkLabel\" id=\"label2\">"
- " <property name=\"visible\">True</property>"
" <property name=\"label\" translatable=\"yes\">A really really long label inside a button to demonstrate height for width working inside buttons</property>"
" <property name=\"wrap\">True</property>"
" <property name=\"max_width_chars\">25</property>"
@@ -161,19 +137,11 @@ static TestInterface interfaces[] = {
" </object>"
" </child>"
" </object>"
- " <packing>"
- " <property name=\"position\">2</property>"
- " </packing>"
" </child>"
" </object>"
- " <packing>"
- " <property name=\"resize\">False</property>"
- " <property name=\"shrink\">False</property>"
- " </packing>"
" </child>"
" <child>"
" <object class=\"GtkLabel\" id=\"label4\">"
- " <property name=\"visible\">True</property>"
" <property name=\"label\" translatable=\"yes\">This static label\n"
"can shrink.</property>"
" <property name=\"justify\">center</property>"
@@ -182,10 +150,6 @@ static TestInterface interfaces[] = {
" <attribute name=\"foreground\" value=\"#ffff00000000\"/>"
" </attributes>"
" </object>"
- " <packing>"
- " <property name=\"resize\">True</property>"
- " <property name=\"shrink\">True</property>"
- " </packing>"
" </child>"
" </object>"
" </child>"
@@ -206,24 +170,21 @@ static TestInterface interfaces[] = {
" <child>"
" <object class=\"GtkPaned\" id=\"hpaned1\">"
" <property name=\"orientation\">horizontal</property>"
- " <property name=\"visible\">True</property>"
" <property name=\"can_focus\">True</property>"
+ " <property name=\"resize-child1\">False</property>"
+ " <property name=\"shrink-child1\">False</property>"
" <child>"
" <object class=\"GtkBox\" id=\"vbox1\">"
" <property name=\"orientation\">vertical</property>"
- " <property name=\"visible\">True</property>"
" <child>"
" <object class=\"GtkBox\" id=\"hbox1\">"
" <property name=\"orientation\">horizontal</property>"
- " <property name=\"visible\">True</property>"
" <child>"
" <object class=\"GtkButton\" id=\"button1\">"
- " <property name=\"visible\">True</property>"
" <property name=\"can_focus\">True</property>"
" <property name=\"receives_default\">True</property>"
" <child>"
" <object class=\"GtkLabel\" id=\"label2\">"
- " <property name=\"visible\">True</property>"
" <property name=\"label\" translatable=\"yes\">A button that wraps.</property>"
" <property name=\"wrap\">True</property>"
" <property name=\"width_chars\">10</property>"
@@ -233,13 +194,9 @@ static TestInterface interfaces[] = {
" </object>"
" </child>"
" </object>"
- " <packing>"
- " <property name=\"position\">0</property>"
- " </packing>"
" </child>"
" <child>"
" <object class=\"GtkLabel\" id=\"label1\">"
- " <property name=\"visible\">True</property>"
" <property name=\"label\" translatable=\"yes\">Lets try setting up some long text to wrap up in this hbox and see if the height-for-width is gonna work !</property>"
" <property name=\"wrap\">True</property>"
" <property name=\"width_chars\">30</property>"
@@ -247,35 +204,20 @@ static TestInterface interfaces[] = {
" <attribute name=\"foreground\" value=\"#07d0a9b20972\"/>"
" </attributes>"
" </object>"
- " <packing>"
- " <property name=\"position\">1</property>"
- " </packing>"
" </child>"
" </object>"
- " <packing>"
- " <property name=\"position\">0</property>"
- " </packing>"
" </child>"
" <child>"
" <object class=\"GtkButton\" id=\"button2\">"
" <property name=\"label\" translatable=\"yes\">A button that expands in the vbox</property>"
- " <property name=\"visible\">True</property>"
" <property name=\"can_focus\">True</property>"
" <property name=\"receives_default\">True</property>"
" </object>"
- " <packing>"
- " <property name=\"position\">1</property>"
- " </packing>"
" </child>"
" </object>"
- " <packing>"
- " <property name=\"resize\">False</property>"
- " <property name=\"shrink\">False</property>"
- " </packing>"
" </child>"
" <child>"
" <object class=\"GtkLabel\" id=\"label4\">"
- " <property name=\"visible\">True</property>"
" <property name=\"label\" translatable=\"yes\">This label is\n"
"set to shrink inside\n"
"the paned window.</property>"
@@ -285,10 +227,6 @@ static TestInterface interfaces[] = {
" <attribute name=\"foreground\" value=\"#ffff00000000\"/>"
" </attributes>"
" </object>"
- " <packing>"
- " <property name=\"resize\">True</property>"
- " <property name=\"shrink\">True</property>"
- " </packing>"
" </child>"
" </object>"
" </child>"
@@ -309,20 +247,18 @@ static TestInterface interfaces[] = {
" <child>"
" <object class=\"GtkPaned\" id=\"hpaned1\">"
" <property name=\"orientation\">horizontal</property>"
- " <property name=\"visible\">True</property>"
" <property name=\"can_focus\">True</property>"
+ " <property name=\"resize-child1\">False</property>"
+ " <property name=\"shrink-child1\">False</property>"
" <child>"
" <object class=\"GtkBox\" id=\"vbox1\">"
" <property name=\"orientation\">vertical</property>"
- " <property name=\"visible\">True</property>"
" <child>"
" <object class=\"GtkBox\" id=\"hbox1\">"
" <property name=\"orientation\">horizontal</property>"
- " <property name=\"visible\">True</property>"
" <property name=\"spacing\">6</property>"
" <child>"
" <object class=\"GtkLabel\" id=\"label1\">"
- " <property name=\"visible\">True</property>"
" <property name=\"label\" translatable=\"yes\">The first 2 labels require 10 characters.</property>"
" <property name=\"wrap\">True</property>"
" <property name=\"width_chars\">10</property>"
@@ -331,13 +267,9 @@ static TestInterface interfaces[] = {
" <attribute name=\"foreground\" value=\"#ffff00000000\"/>"
" </attributes>"
" </object>"
- " <packing>"
- " <property name=\"position\">0</property>"
- " </packing>"
" </child>"
" <child>"
" <object class=\"GtkLabel\" id=\"label2\">"
- " <property name=\"visible\">True</property>"
" <property name=\"label\" translatable=\"yes\">This label has a maximum natural width of 20 characters. The second two labels expand.</property>"
" <property name=\"wrap\">True</property>"
" <property name=\"width_chars\">10</property>"
@@ -347,13 +279,9 @@ static TestInterface interfaces[] = {
" <attribute name=\"foreground\" value=\"#05c2a161134b\"/>"
" </attributes>"
" </object>"
- " <packing>"
- " <property name=\"position\">1</property>"
- " </packing>"
" </child>"
" <child>"
" <object class=\"GtkLabel\" id=\"label3\">"
- " <property name=\"visible\">True</property>"
" <property name=\"label\" translatable=\"yes\">This label requires a default minimum size.</property>"
" <property name=\"wrap\">True</property>"
" <attributes>"
@@ -361,18 +289,11 @@ static TestInterface interfaces[] = {
" <attribute name=\"foreground\" value=\"#03e30758fb5f\"/>"
" </attributes>"
" </object>"
- " <packing>"
- " <property name=\"position\">2</property>"
- " </packing>"
" </child>"
" </object>"
- " <packing>"
- " <property name=\"position\">0</property>"
- " </packing>"
" </child>"
" <child>"
" <object class=\"GtkLabel\" id=\"label4\">"
- " <property name=\"visible\">True</property>"
" <property name=\"label\" translatable=\"yes\">This test demonstrates how the \"width-chars\" and \"max-width-chars\"\n"
"properties can be used to specify the minimum requested wrap width\n"
"and the maximum natural wrap width respectively.</property>"
@@ -383,19 +304,11 @@ static TestInterface interfaces[] = {
" <attribute name=\"foreground\" value=\"#05470000abaf\"/>"
" </attributes>"
" </object>"
- " <packing>"
- " <property name=\"position\">1</property>"
- " </packing>"
" </child>"
" </object>"
- " <packing>"
- " <property name=\"resize\">False</property>"
- " <property name=\"shrink\">False</property>"
- " </packing>"
" </child>"
" <child>"
" <object class=\"GtkLabel\" id=\"label5\">"
- " <property name=\"visible\">True</property>"
" <property name=\"label\" translatable=\"yes\">Some static\n"
"text that shrinks.\n"
"\n"
@@ -407,10 +320,6 @@ static TestInterface interfaces[] = {
" <attribute name=\"foreground\" value=\"#ffff00000000\"/>"
" </attributes>"
" </object>"
- " <packing>"
- " <property name=\"resize\">True</property>"
- " <property name=\"shrink\">True</property>"
- " </packing>"
" </child>"
" </object>"
" </child>"
@@ -432,15 +341,14 @@ static TestInterface interfaces[] = {
" <child>"
" <object class=\"GtkPaned\" id=\"hpaned1\">"
" <property name=\"orientation\">horizontal</property>"
- " <property name=\"visible\">True</property>"
" <property name=\"can_focus\">True</property>"
+ " <property name=\"resize-child1\">False</property>"
+ " <property name=\"shrink-child1\">False</property>"
" <child>"
" <object class=\"GtkExpander\" id=\"expander1\">"
- " <property name=\"visible\">True</property>"
" <property name=\"can_focus\">True</property>"
" <child>"
" <object class=\"GtkLabel\" id=\"label2\">"
- " <property name=\"visible\">True</property>"
" <property name=\"label\" translatable=\"yes\">More wrapping text to fill the largish content area in the expander </property>"
" <property name=\"wrap\">True</property>"
" <property name=\"width_chars\">10</property>"
@@ -452,7 +360,6 @@ static TestInterface interfaces[] = {
" </child>"
" <child type=\"label\">"
" <object class=\"GtkLabel\" id=\"label1\">"
- " <property name=\"visible\">True</property>"
" <property name=\"label\" translatable=\"yes\">Here is some expander text that wraps</property>"
" <property name=\"wrap\">True</property>"
" <property name=\"width_chars\">10</property>"
@@ -463,14 +370,9 @@ static TestInterface interfaces[] = {
" </object>"
" </child>"
" </object>"
- " <packing>"
- " <property name=\"resize\">False</property>"
- " <property name=\"shrink\">False</property>"
- " </packing>"
" </child>"
" <child>"
" <object class=\"GtkLabel\" id=\"label3\">"
- " <property name=\"visible\">True</property>"
" <property name=\"label\" translatable=\"yes\">static\n"
"text\n"
"here</property>"
@@ -478,10 +380,6 @@ static TestInterface interfaces[] = {
" <attribute name=\"foreground\" value=\"red\"/>"
" </attributes>"
" </object>"
- " <packing>"
- " <property name=\"resize\">True</property>"
- " <property name=\"shrink\">True</property>"
- " </packing>"
" </child>"
" </object>"
" </child>"
@@ -503,18 +401,15 @@ static TestInterface interfaces[] = {
" <property name=\"default_height\">150</property>"
" <child>"
" <object class=\"GtkFrame\" id=\"frame1\">"
- " <property name=\"visible\">True</property>"
" <property name=\"label_xalign\">0</property>"
" <child>"
" <object class=\"GtkLabel\" id=\"label2\">"
- " <property name=\"visible\">True</property>"
" <property name=\"margin_start\">12</property>"
" <property name=\"label\" translatable=\"yes\">some content</property>"
" </object>"
" </child>"
" <child type=\"label\">"
" <object class=\"GtkLabel\" id=\"label1\">"
- " <property name=\"visible\">True</property>"
" <property name=\"label\" translatable=\"yes\">A frame label that's a little long and wraps</property>"
" <property name=\"use_markup\">True</property>"
" <property name=\"wrap\">True</property>"
@@ -539,34 +434,28 @@ static TestInterface interfaces[] = {
" <child>"
" <object class=\"GtkPaned\" id=\"hpaned1\">"
" <property name=\"orientation\">horizontal</property>"
- " <property name=\"visible\">True</property>"
" <property name=\"can_focus\">True</property>"
+ " <property name=\"shrink-child1\">False</property>"
+ " <property name=\"resize-child2\">False</property>"
" <child>"
" <object class=\"GtkBox\" id=\"vbox1\">"
" <property name=\"orientation\">vertical</property>"
- " <property name=\"visible\">True</property>"
" <property name=\"spacing\">5</property>"
" <child>"
" <object class=\"GtkBox\" id=\"hbox1\">"
" <property name=\"orientation\">horizontal</property>"
- " <property name=\"visible\">True</property>"
" <property name=\"spacing\">5</property>"
" <child>"
" <object class=\"GtkLabel\" id=\"label1\">"
- " <property name=\"visible\">True</property>"
" <property name=\"label\" translatable=\"yes\">this combo box</property>"
" <attributes>"
" <attribute name=\"weight\" value=\"bold\"/>"
" <attribute name=\"foreground\" value=\"#b3460000eb1c\"/>"
" </attributes>"
" </object>"
- " <packing>"
- " <property name=\"position\">0</property>"
- " </packing>"
" </child>"
" <child>"
" <object class=\"GtkLabel\" id=\"label2\">"
- " <property name=\"visible\">True</property>"
" <property name=\"label\" translatable=\"yes\">contains some wrapping locations</property>"
" <property name=\"ellipsize\">end</property>"
" <property name=\"width_chars\">10</property>"
@@ -575,13 +464,9 @@ static TestInterface interfaces[] = {
" <attribute name=\"foreground\" value=\"#b3460000eb1c\"/>"
" </attributes>"
" </object>"
- " <packing>"
- " <property name=\"position\">1</property>"
- " </packing>"
" </child>"
" <child>"
" <object class=\"GtkComboBox\" id=\"combobox1\">"
- " <property name=\"visible\">True</property>"
" <property name=\"model\">liststore1</property>"
" <property name=\"active\">0</property>"
" <child>"
@@ -602,22 +487,14 @@ static TestInterface interfaces[] = {
" </attributes>"
" </child>"
" </object>"
- " <packing>"
- " <property name=\"position\">2</property>"
- " </packing>"
" </child>"
" </object>"
- " <packing>"
- " <property name=\"position\">0</property>"
- " </packing>"
" </child>"
" <child>"
" <object class=\"GtkFrame\" id=\"frame1\">"
- " <property name=\"visible\">True</property>"
" <property name=\"label_xalign\">0</property>"
" <child>"
" <object class=\"GtkLabel\" id=\"label3\">"
- " <property name=\"visible\">True</property>"
" <property name=\"label\" translatable=\"yes\">This test shows combo boxes\n"
"requesting and allocating space\n"
"for its backing content using\n"
@@ -634,31 +511,22 @@ static TestInterface interfaces[] = {
" </object>"
" </child>"
" </object>"
- " <packing>"
- " <property name=\"position\">1</property>"
- " </packing>"
" </child>"
" <child>"
" <object class=\"GtkBox\" id=\"hbox2\">"
" <property name=\"orientation\">horizontal</property>"
- " <property name=\"visible\">True</property>"
" <property name=\"spacing\">5</property>"
" <child>"
" <object class=\"GtkLabel\" id=\"label4\">"
- " <property name=\"visible\">True</property>"
" <property name=\"label\" translatable=\"yes\">this combo box</property>"
" <attributes>"
" <attribute name=\"weight\" value=\"bold\"/>"
" <attribute name=\"foreground\" value=\"#ffffa5a50000\"/>"
" </attributes>"
" </object>"
- " <packing>"
- " <property name=\"position\">0</property>"
- " </packing>"
" </child>"
" <child>"
" <object class=\"GtkLabel\" id=\"label5\">"
- " <property name=\"visible\">True</property>"
" <property name=\"label\" translatable=\"yes\">contains some ellipsizing locations</property>"
" <property name=\"ellipsize\">end</property>"
" <property name=\"width_chars\">10</property>"
@@ -667,13 +535,9 @@ static TestInterface interfaces[] = {
" <attribute name=\"foreground\" value=\"#ffffa5a50000\"/>"
" </attributes>"
" </object>"
- " <packing>"
- " <property name=\"position\">1</property>"
- " </packing>"
" </child>"
" <child>"
" <object class=\"GtkComboBox\" id=\"combobox2\">"
- " <property name=\"visible\">True</property>"
" <property name=\"model\">liststore1</property>"
" <property name=\"active\">0</property>"
" <child>"
@@ -694,24 +558,13 @@ static TestInterface interfaces[] = {
" </attributes>"
" </child>"
" </object>"
- " <packing>"
- " <property name=\"position\">2</property>"
- " </packing>"
" </child>"
" </object>"
- " <packing>"
- " <property name=\"position\">2</property>"
- " </packing>"
" </child>"
" </object>"
- " <packing>"
- " <property name=\"resize\">True</property>"
- " <property name=\"shrink\">False</property>"
- " </packing>"
" </child>"
" <child>"
" <object class=\"GtkLabel\" id=\"label6\">"
- " <property name=\"visible\">True</property>"
" <property name=\"label\" translatable=\"yes\">Some static\n"
"text here\n"
"that shrinks.</property>"
@@ -720,10 +573,6 @@ static TestInterface interfaces[] = {
" <attribute name=\"foreground\" value=\"#ffff00000000\"/>"
" </attributes>"
" </object>"
- " <packing>"
- " <property name=\"resize\">False</property>"
- " <property name=\"shrink\">True</property>"
- " </packing>"
" </child>"
" </object>"
" </child>"
diff --git a/tests/testiconview.c b/tests/testiconview.c
index 102eed4d33..1b9c4d942f 100644
--- a/tests/testiconview.c
+++ b/tests/testiconview.c
@@ -349,7 +349,7 @@ do_popup_menu (GtkWidget *icon_list,
g_object_set_data_full (G_OBJECT (menu), "item-path", data, (GDestroyNotify)free_item_data);
item = gtk_button_new_with_label ("Activate");
- gtk_container_add (GTK_CONTAINER (menu), item);
+ gtk_popover_set_child (GTK_POPOVER (menu), item);
g_signal_connect (item, "clicked", G_CALLBACK (item_cb), data);
gtk_popover_popup (GTK_POPOVER (menu));
diff --git a/tests/testlist.c b/tests/testlist.c
index c382097a11..497122844f 100644
--- a/tests/testlist.c
+++ b/tests/testlist.c
@@ -52,7 +52,6 @@ row_new (const gchar* text, gint sort_id) {
{
row->label = gtk_label_new (text);
gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), row->label);
- gtk_widget_show (row->label);
}
row->sort_id = sort_id;
@@ -78,8 +77,6 @@ update_header_cb (Row *row, Row *before, gpointer data)
gtk_container_add (GTK_CONTAINER (hbox), l);
b = gtk_button_new_with_label ("button");
gtk_container_add (GTK_CONTAINER (hbox), b);
- gtk_widget_show (l);
- gtk_widget_show (b);
gtk_list_box_row_set_header (GTK_LIST_BOX_ROW (row), hbox);
}
diff --git a/tests/testlist2.c b/tests/testlist2.c
index 6b176a0fea..9c284417be 100644
--- a/tests/testlist2.c
+++ b/tests/testlist2.c
@@ -19,7 +19,6 @@ remove_this_row (GtkButton *button, GtkWidget *child)
row = gtk_widget_get_parent (child);
revealer = gtk_revealer_new ();
gtk_revealer_set_reveal_child (GTK_REVEALER (revealer), TRUE);
- gtk_widget_show (revealer);
g_object_ref (child);
gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (child)), child);
gtk_revealer_set_child (GTK_REVEALER (revealer), child);
diff --git a/tests/testlogout.c b/tests/testlogout.c
index 2d9cd215bd..1ea27335be 100644
--- a/tests/testlogout.c
+++ b/tests/testlogout.c
@@ -132,14 +132,6 @@ activate (GtkApplication *app,
gtk_application_add_window (app, GTK_WINDOW (win));
}
-static void
-quit (GtkApplication *app,
- gpointer data)
-{
- g_print ("Received quit\n");
- gtk_widget_destroy (win);
-}
-
int
main (int argc, char *argv[])
{
@@ -150,8 +142,6 @@ main (int argc, char *argv[])
g_signal_connect (app, "activate",
G_CALLBACK (activate), NULL);
- g_signal_connect (app, "quit",
- G_CALLBACK (quit), NULL);
g_application_run (G_APPLICATION (app), argc, argv);
diff --git a/tests/testmenubutton.c b/tests/testmenubutton.c
index 7ef5eaa4b0..a1f1c78a9d 100644
--- a/tests/testmenubutton.c
+++ b/tests/testmenubutton.c
@@ -38,7 +38,6 @@ int main (int argc, char **argv)
GtkWidget *grid;
GtkWidget *entry;
GtkWidget *label;
- GtkWidget *check;
GtkWidget *combo;
guint i;
guint row = 0;
@@ -56,7 +55,6 @@ int main (int argc, char **argv)
/* horizontal alignment */
label = gtk_label_new ("Horizontal Alignment:");
- gtk_widget_show (label);
gtk_grid_attach (GTK_GRID (grid), label, 0, row++, 1, 1);
combo = gtk_combo_box_text_new ();
@@ -66,14 +64,12 @@ int main (int argc, char **argv)
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "Center");
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "Baseline");
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), INITIAL_HALIGN);
- gtk_widget_show (combo);
gtk_grid_attach_next_to (GTK_GRID (grid), combo, label, GTK_POS_RIGHT, 1, 1);
g_signal_connect (G_OBJECT (combo), "changed",
G_CALLBACK (horizontal_alignment_changed), menubuttons);
/* vertical alignment */
label = gtk_label_new ("Vertical Alignment:");
- gtk_widget_show (label);
gtk_grid_attach (GTK_GRID (grid), label, 0, row++, 1, 1);
combo = gtk_combo_box_text_new ();
@@ -83,7 +79,6 @@ int main (int argc, char **argv)
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "Center");
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "Baseline");
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), INITIAL_HALIGN);
- gtk_widget_show (combo);
gtk_grid_attach_next_to (GTK_GRID (grid), combo, label, GTK_POS_RIGHT, 1, 1);
g_signal_connect (G_OBJECT (combo), "changed",
G_CALLBACK (vertical_alignment_changed), menubuttons);
@@ -97,10 +92,6 @@ int main (int argc, char **argv)
gtk_grid_attach_next_to (GTK_GRID (grid), button, entry, GTK_POS_RIGHT, 1, 1);
menubuttons = g_list_prepend (menubuttons, button);
- check = gtk_check_button_new_with_label ("Popover");
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), TRUE);
- gtk_grid_attach (GTK_GRID (grid), check, 0, row, 1, 1);
-
/* Button with GMenuModel */
menu = g_menu_new ();
for (i = 5; i > 0; i--) {
@@ -116,7 +107,6 @@ int main (int argc, char **argv)
}
button = gtk_menu_button_new ();
- g_object_bind_property (check, "active", button, "use-popover", G_BINDING_SYNC_CREATE);
gtk_widget_set_halign (button, GTK_ALIGN_START);
menubuttons = g_list_prepend (menubuttons, button);
diff --git a/tests/testmodelbutton.c b/tests/testmodelbutton.c
deleted file mode 100644
index 523de0db26..0000000000
--- a/tests/testmodelbutton.c
+++ /dev/null
@@ -1,98 +0,0 @@
-#include <gtk/gtk.h>
-#include "gtk/gtkmodelbuttonprivate.h"
-
-static void
-on_action_beep (GSimpleAction *action,
- GVariant *parameter,
- void *user_data)
-{
- GdkDisplay *display = gdk_display_get_default ();
- gdk_display_beep (display);
-}
-
-static void
-on_application_activate (GApplication *gapplication,
- void *user_data)
-{
- GtkApplication *application = GTK_APPLICATION (gapplication);
- GtkCssProvider *css_provider = gtk_css_provider_new ();
- GdkDisplay *display = gdk_display_get_default ();
-
- GSimpleAction *action;
- GtkWidget *box;
- GIcon *gicon;
- GtkWidget *model_button;
- GtkWidget *widget;
-
- gtk_css_provider_load_from_data (css_provider,
- "window > box { padding: 0.5em; }"
- "window > box > * { margin: 0.5em; }"
- /* :iconic == FALSE */
- "modelbutton > check { background: red; }"
- "modelbutton > radio { background: green; }"
- "modelbutton > arrow { background: blue; }"
- /* :iconic == TRUE */
- "button.model { background: yellow; }"
- , -1);
- g_assert (GDK_IS_DISPLAY (display));
- gtk_style_context_add_provider_for_display (display,
- GTK_STYLE_PROVIDER (css_provider),
- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
-
- action = g_simple_action_new ("beep", NULL);
- g_signal_connect (action, "activate", G_CALLBACK (on_action_beep), NULL);
- g_action_map_add_action (G_ACTION_MAP (application), G_ACTION (action));
-
- box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-
- gicon = g_themed_icon_new ("face-smile");
-
- model_button = g_object_new (g_type_from_name ("GtkModelButton"),
- "action-name", "app.beep",
- "text", "It’s-a-me! ModelButton",
- "icon", gicon,
- NULL);
- gtk_container_add (GTK_CONTAINER (box), model_button);
-
- g_object_unref (gicon);
-
- widget = gtk_combo_box_text_new ();
- gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (widget),
- NULL, "GTK_BUTTON_ROLE_NORMAL");
- gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (widget),
- NULL, "GTK_BUTTON_ROLE_CHECK");
- gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (widget),
- NULL, "GTK_BUTTON_ROLE_RADIO");
- gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
- g_object_bind_property (widget, "active",
- model_button, "role",
- G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
- gtk_container_add (GTK_CONTAINER (box), widget);
-
- widget = gtk_toggle_button_new_with_label (":iconic");
- g_object_bind_property (widget, "active",
- model_button, "iconic",
- G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
- gtk_container_add (GTK_CONTAINER (box), widget);
-
- widget = gtk_window_new ();
- gtk_container_add (GTK_CONTAINER (widget), box);
- gtk_widget_show (widget);
- gtk_application_add_window (GTK_APPLICATION (application), GTK_WINDOW (widget));
-}
-
-int
-main (int argc,
- char *argv[])
-{
- GtkApplication *application = gtk_application_new ("org.gtk.test.modelbutton",
- G_APPLICATION_FLAGS_NONE);
- int result;
-
- g_signal_connect (application, "activate",
- G_CALLBACK (on_application_activate), NULL);
-
- result = g_application_run (G_APPLICATION (application), argc, argv);
- g_object_unref (application);
- return result;
-}
diff --git a/tests/testorientable.c b/tests/testorientable.c
index 0ffa5b184c..2413be638f 100644
--- a/tests/testorientable.c
+++ b/tests/testorientable.c
@@ -58,7 +58,7 @@ int
main (int argc, char **argv)
{
GtkWidget *window;
- GtkWidget *grid;
+ GtkWidget *vbox;
GtkWidget *box, *button;
GList *orientables = NULL;
gboolean done = FALSE;
@@ -66,14 +66,15 @@ main (int argc, char **argv)
gtk_init ();
window = gtk_window_new ();
- grid= gtk_grid_new ();
- gtk_grid_set_row_spacing (GTK_GRID (grid), 12);
- gtk_grid_set_column_spacing (GTK_GRID (grid), 12);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+
+ button = gtk_toggle_button_new_with_label ("Horizontal");
+ gtk_container_add (GTK_CONTAINER (vbox), button);
/* GtkBox */
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
orientables = g_list_prepend (orientables, box);
- gtk_grid_attach (GTK_GRID (grid), box, 0, 1, 1, 1);
+ gtk_container_add (GTK_CONTAINER (vbox), box);
gtk_container_add (GTK_CONTAINER (box),
gtk_button_new_with_label ("GtkBox 1"));
gtk_container_add (GTK_CONTAINER (box),
@@ -81,17 +82,10 @@ main (int argc, char **argv)
gtk_container_add (GTK_CONTAINER (box),
gtk_button_new_with_label ("GtkBox 3"));
- /* GtkSeparator */
- box = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
- orientables = g_list_prepend (orientables, box);
- gtk_grid_attach (GTK_GRID (grid), box, 2, 1, 1, 1);
-
- button = gtk_toggle_button_new_with_label ("Horizontal");
- gtk_grid_attach (GTK_GRID (grid), button, 0, 0, 1, 1);
g_signal_connect (button, "toggled",
G_CALLBACK (orient_toggled), orientables);
- gtk_window_set_child (GTK_WINDOW (window), grid);
+ gtk_window_set_child (GTK_WINDOW (window), vbox);
gtk_widget_show (window);
g_signal_connect (window, "destroy",
diff --git a/tests/testoverlay.c b/tests/testoverlay.c
index 565adf549c..d7187be70a 100644
--- a/tests/testoverlay.c
+++ b/tests/testoverlay.c
@@ -272,7 +272,10 @@ static const gchar *buffer =
" <property name='label'>Witty remark goes here</property>"
" <property name='halign'>end</property>"
" <property name='valign'>end</property>"
-" <property name='margin'>4</property>"
+" <property name='margin-top'>4</property>"
+" <property name='margin-bottom'>4</property>"
+" <property name='margin-start'>4</property>"
+" <property name='margin-end'>4</property>"
" </object>"
" </child>"
" <child>"
@@ -280,20 +283,20 @@ static const gchar *buffer =
" <child>"
" <object class='GtkLabel' id='left'>"
" <property name='label'>Left</property>"
+" <layout>"
+" <property name='left-attach'>0</property>"
+" <property name='top-attach'>0</property>"
+" </layout>"
" </object>"
-" <packing>"
-" <property name='left_attach'>0</property>"
-" <property name='top_attach'>0</property>"
-" </packing>"
" </child>"
" <child>"
" <object class='GtkLabel' id='right'>"
" <property name='label'>Right</property>"
+" <layout>"
+" <property name='left-attach'>2</property>"
+" <property name='top-attach'>0</property>"
+" </layout>"
" </object>"
-" <packing>"
-" <property name='left_attach'>2</property>"
-" <property name='top_attach'>0</property>"
-" </packing>"
" </child>"
" <child>"
" <object class='GtkTextView' id='text'>"
@@ -301,11 +304,11 @@ static const gchar *buffer =
" <property name='height-request'>200</property>"
" <property name='hexpand'>True</property>"
" <property name='vexpand'>True</property>"
+" <layout>"
+" <property name='left-attach'>1</property>"
+" <property name='top-attach'>0</property>"
+" </layout>"
" </object>"
-" <packing>"
-" <property name='left_attach'>1</property>"
-" <property name='top_attach'>0</property>"
-" </packing>"
" </child>"
" </object>"
" </child>"
diff --git a/tests/testscrolledwindow.c b/tests/testscrolledwindow.c
index 6ea0fa354e..31674219e6 100644
--- a/tests/testscrolledwindow.c
+++ b/tests/testscrolledwindow.c
@@ -87,8 +87,6 @@ scrollable_policy (void)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
- gtk_widget_show (vbox);
- gtk_widget_show (hbox);
gtk_window_set_child (GTK_WINDOW (window), hbox);
gtk_container_add (GTK_CONTAINER (hbox), vbox);
@@ -100,7 +98,6 @@ scrollable_policy (void)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_widget_show (swindow);
gtk_frame_set_child (GTK_FRAME (frame), swindow);
viewport = gtk_viewport_new (NULL, NULL);
@@ -116,8 +113,6 @@ scrollable_policy (void)
gtk_label_set_width_chars (GTK_LABEL (label), 40);
gtk_label_set_max_width_chars (GTK_LABEL (label), 100);
- gtk_widget_show (label);
- gtk_widget_show (viewport);
gtk_viewport_set_child (GTK_VIEWPORT (viewport), label);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (swindow), viewport);
@@ -125,14 +120,11 @@ scrollable_policy (void)
expander = gtk_expander_new ("Controls");
gtk_expander_set_expanded (GTK_EXPANDER (expander), TRUE);
cntl = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
- gtk_widget_show (cntl);
- gtk_widget_show (expander);
gtk_container_add (GTK_CONTAINER (expander), cntl);
gtk_container_add (GTK_CONTAINER (vbox), expander);
/* Add Horizontal policy control here */
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
- gtk_widget_show (hbox);
widget = gtk_label_new ("hscroll-policy");
gtk_widget_set_hexpand (widget, TRUE);
@@ -152,7 +144,6 @@ scrollable_policy (void)
/* Add Vertical policy control here */
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
- gtk_widget_show (hbox);
widget = gtk_label_new ("vscroll-policy");
gtk_widget_set_hexpand (widget, TRUE);
@@ -181,8 +172,6 @@ scrollable_policy (void)
gtk_widget_set_hexpand (widget, TRUE);
gtk_container_add (GTK_CONTAINER (hbox), widget);
gtk_container_add (GTK_CONTAINER (cntl), hbox);
- gtk_widget_show (widget);
- gtk_widget_show (hbox);
g_signal_connect (G_OBJECT (widget), "value-changed",
G_CALLBACK (content_width_changed), swindow);
@@ -197,8 +186,6 @@ scrollable_policy (void)
gtk_widget_set_hexpand (widget, TRUE);
gtk_container_add (GTK_CONTAINER (hbox), widget);
gtk_container_add (GTK_CONTAINER (cntl), hbox);
- gtk_widget_show (widget);
- gtk_widget_show (hbox);
g_signal_connect (G_OBJECT (widget), "value-changed",
G_CALLBACK (content_height_changed), swindow);
@@ -233,7 +220,6 @@ scrollable_policy (void)
/* Listbox */
listbox = gtk_list_box_new ();
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (swindow), listbox);
- gtk_widget_show (listbox);
/* Min content */
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
diff --git a/tests/testselectionmode.c b/tests/testselectionmode.c
index 1d400e76f9..7e912c9ae3 100644
--- a/tests/testselectionmode.c
+++ b/tests/testselectionmode.c
@@ -27,12 +27,9 @@ selectable_row_init (SelectableRow *row)
gtk_widget_set_margin_top (row->check, 10);
gtk_widget_set_margin_bottom (row->check, 10);
- gtk_widget_show (row->box);
- gtk_widget_show (row->check);
-
- gtk_container_add (GTK_CONTAINER (row), row->box);
+ gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), row->box);
gtk_container_add (GTK_CONTAINER (row->box), row->revealer);
- gtk_container_add (GTK_CONTAINER (row->revealer), row->check);
+ gtk_revealer_set_child (GTK_REVEALER (row->revealer), row->check);
}
static void
diff --git a/tests/teststack.c b/tests/teststack.c
index 00b21226a4..dbbb219467 100644
--- a/tests/teststack.c
+++ b/tests/teststack.c
@@ -37,7 +37,7 @@ toggle_icon_name (GtkWidget *button, gpointer data)
gboolean active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
GtkStackPage *page;
- page = gtk_stack_get_page (GTK_STACK (gtk_widget_get_parent (button)), button);
+ page = gtk_stack_get_page (GTK_STACK (stack), w1);
g_object_set (page, "icon-name", active ? "edit-find-symbolic" : NULL, NULL);
}
diff --git a/tests/teststackedheaders.c b/tests/teststackedheaders.c
index 2f19db1b97..3435418238 100644
--- a/tests/teststackedheaders.c
+++ b/tests/teststackedheaders.c
@@ -4,7 +4,6 @@
static GtkWidget *header_stack;
static GtkWidget *page_stack;
-#if 0
static void
back_to_main (GtkButton *button)
{
@@ -18,13 +17,14 @@ go_to_secondary (GtkButton *button)
gtk_stack_set_visible_child_name (GTK_STACK (header_stack), "secondary");
gtk_stack_set_visible_child_name (GTK_STACK (page_stack), "secondary");
}
-#endif
int
main (int argc, char *argv[])
{
GtkBuilder *builder;
GtkWidget *win;
+ GtkWidget *new_btn;
+ GtkWidget *back_btn;
#ifdef GTK_SRCDIR
g_chdir (GTK_SRCDIR);
@@ -38,6 +38,11 @@ main (int argc, char *argv[])
win = (GtkWidget *)gtk_builder_get_object (builder, "window");
header_stack = (GtkWidget *)gtk_builder_get_object (builder, "header_stack");
page_stack = (GtkWidget *)gtk_builder_get_object (builder, "page_stack");
+ new_btn = (GtkWidget *)gtk_builder_get_object (builder, "new_btn");
+ back_btn = (GtkWidget *)gtk_builder_get_object (builder, "back_btn");
+
+ g_signal_connect (new_btn, "clicked", G_CALLBACK (go_to_secondary), NULL);
+ g_signal_connect (back_btn, "clicked", G_CALLBACK (back_to_main), NULL);
g_assert (header_stack);
diff --git a/tests/teststackedheaders.ui b/tests/teststackedheaders.ui
index 96a6012b1a..6112f77de9 100644
--- a/tests/teststackedheaders.ui
+++ b/tests/teststackedheaders.ui
@@ -11,10 +11,9 @@
<property name="child">
<object class="GtkHeaderBar">
<child type="start">
- <object class="GtkButton">
+ <object class="GtkButton" id="new_btn">
<property name="label">New</property>
<property name="valign">center</property>
- <signal name="clicked" handler="go_to_secondary"/>
</object>
</child>
<child type="title">
@@ -32,10 +31,9 @@
<property name="child">
<object class="GtkHeaderBar">
<child type="start">
- <object class="GtkButton">
+ <object class="GtkButton" id="back_btn">
<property name="label">&lt;</property>
<property name="valign">center</property>
- <signal name="clicked" handler="back_to_main"/>
</object>
</child>
</object>
diff --git a/tests/testtreelistmodel.c b/tests/testtreelistmodel.c
index b267fded4c..303951d077 100644
--- a/tests/testtreelistmodel.c
+++ b/tests/testtreelistmodel.c
@@ -175,7 +175,7 @@ create_widget_for_model (gpointer item,
gtk_widget_set_vexpand (row, TRUE);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
- gtk_container_add (GTK_CONTAINER (row), box);
+ gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), box);
depth = gtk_tree_list_row_get_depth (item);
if (depth > 0)
@@ -198,7 +198,7 @@ create_widget_for_model (gpointer item,
gtk_container_add (GTK_CONTAINER (child), title);
arrow = g_object_new (GTK_TYPE_SPINNER, "css-name", "arrow", NULL);
- gtk_container_add (GTK_CONTAINER (title), arrow);
+ gtk_button_set_child (GTK_BUTTON (title), arrow);
}
else
{
diff --git a/tests/testtreeview.c b/tests/testtreeview.c
index 0715c449f4..a14c45040c 100644
--- a/tests/testtreeview.c
+++ b/tests/testtreeview.c
@@ -362,9 +362,7 @@ set_columns_type (GtkTreeView *tree_view, ColumnsType type)
image = gtk_image_new_from_pixbuf (pixbuf);
g_object_unref (pixbuf);
-
- gtk_widget_show (image);
-
+
gtk_tree_view_column_set_widget (col, image);
rend = gtk_cell_renderer_toggle_new ();
diff --git a/tests/testverticalcells.c b/tests/testverticalcells.c
index b3aaed3924..e1a4ffe5cf 100644
--- a/tests/testverticalcells.c
+++ b/tests/testverticalcells.c
@@ -334,7 +334,7 @@ main (gint argc, gchar **argv)
column = gtk_tree_view_column_new ();
renderer = gtk_cell_renderer_pixbuf_new ();
- g_object_set (renderer, "stock-size", GTK_ICON_SIZE_LARGE, NULL);
+ g_object_set (renderer, "icon-size", GTK_ICON_SIZE_LARGE, NULL);
gtk_tree_view_column_pack_start (column, renderer, TRUE);
gtk_tree_view_column_set_attributes (column, renderer,
"icon-name", ICON_COLUMN, NULL);
diff --git a/tests/testvolumebutton.c b/tests/testvolumebutton.c
index 5a3b31f049..22997d6d93 100644
--- a/tests/testvolumebutton.c
+++ b/tests/testvolumebutton.c
@@ -26,23 +26,6 @@ value_changed (GtkWidget *button,
}
static void
-toggle_orientation (GtkWidget *button,
- GtkWidget *scalebutton)
-{
- if (gtk_orientable_get_orientation (GTK_ORIENTABLE (scalebutton)) ==
- GTK_ORIENTATION_HORIZONTAL)
- {
- gtk_orientable_set_orientation (GTK_ORIENTABLE (scalebutton),
- GTK_ORIENTATION_VERTICAL);
- }
- else
- {
- gtk_orientable_set_orientation (GTK_ORIENTABLE (scalebutton),
- GTK_ORIENTATION_HORIZONTAL);
- }
-}
-
-static void
response_cb (GtkDialog *dialog,
gint arg1,
gpointer user_data)
@@ -63,9 +46,9 @@ show_error (gpointer data)
GTK_MESSAGE_INFO,
GTK_BUTTONS_CLOSE,
"This should have unbroken the grab");
- g_signal_connect (G_OBJECT (dialog),
- "response",
- G_CALLBACK (response_cb), NULL);
+ g_signal_connect_object (G_OBJECT (dialog),
+ "response",
+ G_CALLBACK (response_cb), NULL, 0);
gtk_widget_show (dialog);
return G_SOURCE_REMOVE;
@@ -78,7 +61,6 @@ main (int argc,
GtkWidget *window;
GtkWidget *button;
GtkWidget *button2;
- GtkWidget *button3;
GtkWidget *box;
GtkWidget *vbox;
@@ -100,18 +82,7 @@ main (int argc,
gtk_container_add (GTK_CONTAINER (box), button);
gtk_container_add (GTK_CONTAINER (box), button2);
- button3 = gtk_button_new_with_label ("Toggle orientation");
- gtk_container_add (GTK_CONTAINER (box), button3);
-
- g_signal_connect (G_OBJECT (button3), "clicked",
- G_CALLBACK (toggle_orientation),
- button);
- g_signal_connect (G_OBJECT (button3), "clicked",
- G_CALLBACK (toggle_orientation),
- button2);
-
gtk_widget_show (window);
- g_signal_emit_by_name (button, "clicked");
g_timeout_add (4000, (GSourceFunc) show_error, window);
while (TRUE)
diff --git a/tests/testwindowsize.c b/tests/testwindowsize.c
index 99148869bf..0d3fc8ccbb 100644
--- a/tests/testwindowsize.c
+++ b/tests/testwindowsize.c
@@ -58,10 +58,8 @@ show_dialog (void)
gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
label);
- gtk_widget_show (label);
label = gtk_label_new ("? x ?");
- //gtk_widget_show (label);
gtk_dialog_add_action_widget (GTK_DIALOG (dialog), label, GTK_RESPONSE_HELP);
gtk_widget_realize (dialog);