mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 06:00:22 +00:00
demos/gtk-demo/panes.c: Use accessor functions to access GtkWidget
This commit is contained in:
parent
5bf0ed62d7
commit
3204cf726c
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user