summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-04-05 04:02:06 +0000
committerMatthias Clasen <mclasen@redhat.com>2019-04-05 12:01:43 +0000
commit0a4a7b310d6def5337391c019c007b5234b6d807 (patch)
treef04a00d2184e375f3ccbcc750e7748ef9208da29 /tests
parenta26f4005766a29c4c4893e0dc75d97c6d502b0f7 (diff)
downloadgtk+-0a4a7b310d6def5337391c019c007b5234b6d807.tar.gz
testgtk: Stop using child properties
Diffstat (limited to 'tests')
-rw-r--r--tests/testgtk.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 309a260aa6..e7719e39a5 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -4025,17 +4025,15 @@ page_switch (GtkWidget *widget, gpointer *page, gint page_num)
static void
tab_fill (GtkToggleButton *button, GtkWidget *child)
{
- gtk_container_child_set (GTK_CONTAINER (sample_notebook), child,
- "tab-fill", gtk_toggle_button_get_active (button),
- NULL);
+ GtkNotebookPage *page = gtk_notebook_get_page (GTK_NOTEBOOK (sample_notebook), child);
+ g_object_set (page, "tab-fill", gtk_toggle_button_get_active (button), NULL);
}
static void
tab_expand (GtkToggleButton *button, GtkWidget *child)
{
- gtk_container_child_set (GTK_CONTAINER (sample_notebook), child,
- "tab-expand", gtk_toggle_button_get_active (button),
- NULL);
+ GtkNotebookPage *page = gtk_notebook_get_page (GTK_NOTEBOOK (sample_notebook), child);
+ g_object_set (page, "tab-expand", gtk_toggle_button_get_active (button), NULL);
}
static void
@@ -4322,23 +4320,29 @@ create_notebook (GtkWidget *widget)
void
toggle_resize (GtkWidget *widget, GtkWidget *child)
{
- GtkContainer *container = GTK_CONTAINER (gtk_widget_get_parent (child));
- GValue value = G_VALUE_INIT;
- g_value_init (&value, G_TYPE_BOOLEAN);
- gtk_container_child_get_property (container, child, "resize", &value);
- g_value_set_boolean (&value, !g_value_get_boolean (&value));
- gtk_container_child_set_property (container, child, "resize", &value);
+ GtkPaned *paned = GTK_PANED (gtk_widget_get_parent (child));
+ gboolean is_child1;
+ gboolean resize;
+ const char *prop;
+
+ is_child1 = (child == gtk_paned_get_child1 (paned));
+ prop = is_child1 ? "resize-child1" : "resize-child2";
+ g_object_get (paned, prop, &resize, NULL);
+ g_object_set (paned, prop, !resize, NULL);
}
void
toggle_shrink (GtkWidget *widget, GtkWidget *child)
{
- GtkContainer *container = GTK_CONTAINER (gtk_widget_get_parent (child));
- GValue value = G_VALUE_INIT;
- g_value_init (&value, G_TYPE_BOOLEAN);
- gtk_container_child_get_property (container, child, "shrink", &value);
- g_value_set_boolean (&value, !g_value_get_boolean (&value));
- gtk_container_child_set_property (container, child, "shrink", &value);
+ GtkPaned *paned = GTK_PANED (gtk_widget_get_parent (child));
+ gboolean is_child1;
+ gboolean resize;
+ const char *prop;
+
+ is_child1 = (child == gtk_paned_get_child1 (paned));
+ prop = is_child1 ? "shrink-child1" : "shrink-child2";
+ g_object_get (paned, prop, &resize, NULL);
+ g_object_set (paned, prop, !resize, NULL);
}
GtkWidget *