demos/gtk-demo/panes.c: Use accessor functions to access GtkWidget

This commit is contained in:
Javier Jardón 2010-08-16 00:36:48 +02:00
parent 5bf0ed62d7
commit 3204cf726c

View File

@ -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