[gtk+/refactor: 131/145] demos/gtk-demo/panes.c: Use accessor functions to access GtkWidget
- From: Javier Jardón <jjardon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/refactor: 131/145] demos/gtk-demo/panes.c: Use accessor functions to access GtkWidget
- Date: Tue, 17 Aug 2010 18:14:28 +0000 (UTC)
commit daeea05873faf9fdb83b75c3506c4baf9549b670
Author: Javier Jardón <jjardon gnome org>
Date: Mon Aug 16 00:36:48 2010 +0200
demos/gtk-demo/panes.c: Use accessor functions to access GtkWidget
demos/gtk-demo/panes.c | 24 ++++++++++++++++++------
1 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/demos/gtk-demo/panes.c b/demos/gtk-demo/panes.c
index 60ee2dd..3399653 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]