[gedit] gedit-overlay-child: sync visible property of container and child



commit 1275e2a3929bf495ea8696e314248a7051f844fc
Author: Xan Lopez <xan gnome org>
Date:   Mon Feb 21 03:16:38 2011 +0100

    gedit-overlay-child: sync visible property of container and child
    
    That way user can hide the inner widget and the overlay child
    container will be hidden automatically.

 gedit/gedit-overlay-child.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/gedit/gedit-overlay-child.c b/gedit/gedit-overlay-child.c
index deb9425..c97162f 100644
--- a/gedit/gedit-overlay-child.c
+++ b/gedit/gedit-overlay-child.c
@@ -24,7 +24,8 @@
 
 struct _GeditOverlayChildPrivate
 {
-	GtkWidget                *widget;
+	GtkWidget		 *widget;
+	GBinding		 *binding;
 	GtkAllocation             widget_alloc;
 	GeditOverlayChildPosition position;
 	guint                     offset;
@@ -182,6 +183,10 @@ gedit_overlay_child_add (GtkContainer *container,
 
 	child->priv->widget = widget;
 
+	child->priv->binding = g_object_bind_property (G_OBJECT (widget), "visible",
+						       G_OBJECT (container), "visible",
+						       G_BINDING_BIDIRECTIONAL);
+
 	GTK_CONTAINER_CLASS (gedit_overlay_child_parent_class)->add (container, widget);
 }
 
@@ -193,6 +198,8 @@ gedit_overlay_child_remove (GtkContainer *container,
 
 	child->priv->widget = NULL;
 
+	g_object_unref (child->priv->binding);
+
 	GTK_CONTAINER_CLASS (gedit_overlay_child_parent_class)->remove (container, widget);
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]