testgtk: Stop using child properties

This commit is contained in:
Matthias Clasen 2019-04-05 04:02:06 +00:00
parent a26f400576
commit 0a4a7b310d

View File

@ -4025,17 +4025,15 @@ page_switch (GtkWidget *widget, gpointer *page, gint page_num)
static void static void
tab_fill (GtkToggleButton *button, GtkWidget *child) tab_fill (GtkToggleButton *button, GtkWidget *child)
{ {
gtk_container_child_set (GTK_CONTAINER (sample_notebook), child, GtkNotebookPage *page = gtk_notebook_get_page (GTK_NOTEBOOK (sample_notebook), child);
"tab-fill", gtk_toggle_button_get_active (button), g_object_set (page, "tab-fill", gtk_toggle_button_get_active (button), NULL);
NULL);
} }
static void static void
tab_expand (GtkToggleButton *button, GtkWidget *child) tab_expand (GtkToggleButton *button, GtkWidget *child)
{ {
gtk_container_child_set (GTK_CONTAINER (sample_notebook), child, GtkNotebookPage *page = gtk_notebook_get_page (GTK_NOTEBOOK (sample_notebook), child);
"tab-expand", gtk_toggle_button_get_active (button), g_object_set (page, "tab-expand", gtk_toggle_button_get_active (button), NULL);
NULL);
} }
static void static void
@ -4322,23 +4320,29 @@ create_notebook (GtkWidget *widget)
void void
toggle_resize (GtkWidget *widget, GtkWidget *child) toggle_resize (GtkWidget *widget, GtkWidget *child)
{ {
GtkContainer *container = GTK_CONTAINER (gtk_widget_get_parent (child)); GtkPaned *paned = GTK_PANED (gtk_widget_get_parent (child));
GValue value = G_VALUE_INIT; gboolean is_child1;
g_value_init (&value, G_TYPE_BOOLEAN); gboolean resize;
gtk_container_child_get_property (container, child, "resize", &value); const char *prop;
g_value_set_boolean (&value, !g_value_get_boolean (&value));
gtk_container_child_set_property (container, child, "resize", &value); 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 void
toggle_shrink (GtkWidget *widget, GtkWidget *child) toggle_shrink (GtkWidget *widget, GtkWidget *child)
{ {
GtkContainer *container = GTK_CONTAINER (gtk_widget_get_parent (child)); GtkPaned *paned = GTK_PANED (gtk_widget_get_parent (child));
GValue value = G_VALUE_INIT; gboolean is_child1;
g_value_init (&value, G_TYPE_BOOLEAN); gboolean resize;
gtk_container_child_get_property (container, child, "shrink", &value); const char *prop;
g_value_set_boolean (&value, !g_value_get_boolean (&value));
gtk_container_child_set_property (container, child, "shrink", &value); 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 * GtkWidget *