diff --git a/demos/gtk-demo/panes.c b/demos/gtk-demo/panes.c index 60ee2dd635..3399653d10 100644 --- a/demos/gtk-demo/panes.c +++ b/demos/gtk-demo/panes.c @@ -17,17 +17,23 @@ void toggle_resize (GtkWidget *widget, GtkWidget *child) { - GtkPaned *paned = GTK_PANED (child->parent); - gboolean is_child1 = (child == gtk_paned_get_child1 (paned)); + GtkWidget *parent; + GtkPaned *paned; + gboolean is_child1; gboolean resize, shrink; + parent = gtk_widget_get_parent (child); + paned = GTK_PANED (parent); + + is_child1 = (child == gtk_paned_get_child1 (paned)); + gtk_container_child_get (GTK_CONTAINER (paned), child, "resize", &resize, "shrink", &shrink, NULL); g_object_ref (child); - gtk_container_remove (GTK_CONTAINER (child->parent), child); + gtk_container_remove (GTK_CONTAINER (parent), child); if (is_child1) gtk_paned_pack1 (paned, child, !resize, shrink); else @@ -39,17 +45,23 @@ void toggle_shrink (GtkWidget *widget, GtkWidget *child) { - GtkPaned *paned = GTK_PANED (child->parent); - gboolean is_child1 = (child == gtk_paned_get_child1 (paned)); + GtkWidget *parent; + GtkPaned *paned; + gboolean is_child1; gboolean resize, shrink; + parent = gtk_widget_get_parent (child); + paned = GTK_PANED (parent); + + is_child1 = (child == gtk_paned_get_child1 (paned)); + gtk_container_child_get (GTK_CONTAINER (paned), child, "resize", &resize, "shrink", &shrink, NULL); g_object_ref (child); - gtk_container_remove (GTK_CONTAINER (child->parent), child); + gtk_container_remove (GTK_CONTAINER (parent), child); if (is_child1) gtk_paned_pack1 (paned, child, resize, !shrink); else