[gdl] Fix more GSeal issues. See bug 612497.



commit aee676e13dc344cc80800d2682737c43a459e11b
Author: Andre Klapper <a9016009 gmx de>
Date:   Sun Jun 6 15:30:38 2010 +0200

    Fix more GSeal issues. See bug 612497.

 gdl/gdl-dock-bar.c         |   90 ++++++++++++++++++++++++-------------------
 gdl/gdl-dock-placeholder.c |   17 ++++++--
 gdl/gdl-dock-tablabel.c    |   79 ++++++++++++++++++++++----------------
 gdl/gdl-switcher.c         |    2 +-
 4 files changed, 109 insertions(+), 79 deletions(-)
---
diff --git a/gdl/gdl-dock-bar.c b/gdl/gdl-dock-bar.c
index 6fee679..2827bc4 100644
--- a/gdl/gdl-dock-bar.c
+++ b/gdl/gdl-dock-bar.c
@@ -465,13 +465,14 @@ static void gdl_dock_bar_size_vrequest (GtkWidget *widget,
   GList *children;
   gint nvis_children;
   gint height;
+  guint border_width;
 
   box = GTK_BOX (widget);
   requisition->width = 0;
   requisition->height = 0;
   nvis_children = 0;
 
-  children = box->children;
+  children = gtk_container_get_children (GTK_CONTAINER (box));
   while (children)
     {
       child = children->data;
@@ -481,7 +482,7 @@ static void gdl_dock_bar_size_vrequest (GtkWidget *widget,
 	{
 	  gtk_widget_size_request (child->widget, &child_requisition);
 
-	  if (box->homogeneous)
+	  if (gtk_box_get_homogeneous (box))
 	    {
 	      height = child_requisition.height + child->padding * 2;
 	      requisition->height = MAX (requisition->height, height);
@@ -499,13 +500,14 @@ static void gdl_dock_bar_size_vrequest (GtkWidget *widget,
 
   if (nvis_children > 0)
     {
-      if (box->homogeneous)
+      if (gtk_box_get_homogeneous (box))
 	requisition->height *= nvis_children;
-      requisition->height += (nvis_children - 1) * box->spacing;
+      requisition->height += (nvis_children - 1) * gtk_box_get_spacing (box);
     }
 
-  requisition->width += GTK_CONTAINER (box)->border_width * 2;
-  requisition->height += GTK_CONTAINER (box)->border_width * 2;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (box));
+  requisition->width += border_width * 2;
+  requisition->height += border_width * 2;
 
 }
 
@@ -522,13 +524,14 @@ static void gdl_dock_bar_size_vallocate (GtkWidget     *widget,
   gint height;
   gint extra;
   gint y;
+  guint border_width;
 
   box = GTK_BOX (widget);
   widget->allocation = *allocation;
 
   nvis_children = 0;
   nexpand_children = 0;
-  children = box->children;
+  children = gtk_container_get_children (GTK_CONTAINER (box));
 
   while (children)
     {
@@ -543,13 +546,15 @@ static void gdl_dock_bar_size_vallocate (GtkWidget     *widget,
 	}
     }
 
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (box));
+
   if (nvis_children > 0)
     {
-      if (box->homogeneous)
+      if (gtk_box_get_homogeneous (box))
 	{
 	  height = (allocation->height -
-		   GTK_CONTAINER (box)->border_width * 2 -
-		   (nvis_children - 1) * box->spacing);
+		   border_width * 2 -
+		   (nvis_children - 1) * gtk_box_get_spacing (box));
 	  extra = height / nvis_children;
 	}
       else if (nexpand_children > 0)
@@ -563,11 +568,11 @@ static void gdl_dock_bar_size_vallocate (GtkWidget     *widget,
 	  extra = 0;
 	}
 
-      y = allocation->y + GTK_CONTAINER (box)->border_width;
-      child_allocation.x = allocation->x + GTK_CONTAINER (box)->border_width;
-      child_allocation.width = MAX (1, (gint) allocation->width - (gint) GTK_CONTAINER (box)->border_width * 2);
+      y = allocation->y + border_width;
+      child_allocation.x = allocation->x + border_width;
+      child_allocation.width = MAX (1, (gint) allocation->width - (gint) border_width * 2);
 
-      children = box->children;
+      children = gtk_container_get_children (GTK_CONTAINER (box));
       while (children)
 	{
 	  child = children->data;
@@ -575,7 +580,7 @@ static void gdl_dock_bar_size_vallocate (GtkWidget     *widget,
 
 	  if ((child->pack == GTK_PACK_START) && gtk_widget_get_visible (child->widget))
 	    {
-	      if (box->homogeneous)
+	      if (gtk_box_get_homogeneous (box))
 		{
 		  if (nvis_children == 1)
 		    child_height = height;
@@ -620,13 +625,13 @@ static void gdl_dock_bar_size_vallocate (GtkWidget     *widget,
 
 	      gtk_widget_size_allocate (child->widget, &child_allocation);
 
-	      y += child_height + box->spacing;
+	      y += child_height + gtk_box_get_spacing (box);
 	    }
 	}
 
-      y = allocation->y + allocation->height - GTK_CONTAINER (box)->border_width;
+      y = allocation->y + allocation->height - border_width;
 
-      children = box->children;
+      children = gtk_container_get_children (GTK_CONTAINER (box));
       while (children)
 	{
 	  child = children->data;
@@ -637,7 +642,7 @@ static void gdl_dock_bar_size_vallocate (GtkWidget     *widget,
 	      GtkRequisition child_requisition;
 	      gtk_widget_get_child_requisition (child->widget, &child_requisition);
 
-              if (box->homogeneous)
+              if (gtk_box_get_homogeneous (box))
                 {
                   if (nvis_children == 1)
                     child_height = height;
@@ -676,7 +681,7 @@ static void gdl_dock_bar_size_vallocate (GtkWidget     *widget,
 
               gtk_widget_size_allocate (child->widget, &child_allocation);
 
-              y -= (child_height + box->spacing);
+              y -= (child_height + gtk_box_get_spacing (box));
 	    }
 	}
     }
@@ -690,13 +695,14 @@ static void gdl_dock_bar_size_hrequest (GtkWidget *widget,
   GList *children;
   gint nvis_children;
   gint width;
+  guint border_width;
 
   box = GTK_BOX (widget);
   requisition->width = 0;
   requisition->height = 0;
   nvis_children = 0;
 
-  children = box->children;
+  children = gtk_container_get_children (GTK_CONTAINER (box));
   while (children)
     {
       child = children->data;
@@ -708,7 +714,7 @@ static void gdl_dock_bar_size_hrequest (GtkWidget *widget,
 
 	  gtk_widget_size_request (child->widget, &child_requisition);
 
-	  if (box->homogeneous)
+	  if (gtk_box_get_homogeneous (box))
 	    {
 	      width = child_requisition.width + child->padding * 2;
 	      requisition->width = MAX (requisition->width, width);
@@ -726,13 +732,14 @@ static void gdl_dock_bar_size_hrequest (GtkWidget *widget,
 
   if (nvis_children > 0)
     {
-      if (box->homogeneous)
+      if (gtk_box_get_homogeneous (box))
 	requisition->width *= nvis_children;
-      requisition->width += (nvis_children - 1) * box->spacing;
+      requisition->width += (nvis_children - 1) * gtk_box_get_spacing (box);
     }
 
-  requisition->width += GTK_CONTAINER (box)->border_width * 2;
-  requisition->height += GTK_CONTAINER (box)->border_width * 2;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (box));
+  requisition->width += border_width * 2;
+  requisition->height += border_width * 2;
 }
 
 static void gdl_dock_bar_size_hallocate (GtkWidget     *widget,
@@ -748,6 +755,7 @@ static void gdl_dock_bar_size_hallocate (GtkWidget     *widget,
   gint width;
   gint extra;
   gint x;
+  guint border_width;
   GtkTextDirection direction;
 
   box = GTK_BOX (widget);
@@ -757,7 +765,7 @@ static void gdl_dock_bar_size_hallocate (GtkWidget     *widget,
   
   nvis_children = 0;
   nexpand_children = 0;
-  children = box->children;
+  children = gtk_container_get_children (GTK_CONTAINER (box));
 
   while (children)
     {
@@ -772,13 +780,15 @@ static void gdl_dock_bar_size_hallocate (GtkWidget     *widget,
 	}
     }
 
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (box));
+
   if (nvis_children > 0)
     {
-      if (box->homogeneous)
+      if (gtk_box_get_homogeneous (box))
 	{
 	  width = (allocation->width -
-		   GTK_CONTAINER (box)->border_width * 2 -
-		   (nvis_children - 1) * box->spacing);
+		   border_width * 2 -
+		   (nvis_children - 1) * gtk_box_get_spacing (box));
 	  extra = width / nvis_children;
 	}
       else if (nexpand_children > 0)
@@ -792,11 +802,11 @@ static void gdl_dock_bar_size_hallocate (GtkWidget     *widget,
 	  extra = 0;
 	}
 
-      x = allocation->x + GTK_CONTAINER (box)->border_width;
-      child_allocation.y = allocation->y + GTK_CONTAINER (box)->border_width;
-      child_allocation.height = MAX (1, (gint) allocation->height - (gint) GTK_CONTAINER (box)->border_width * 2);
+      x = allocation->x + border_width;
+      child_allocation.y = allocation->y + border_width;
+      child_allocation.height = MAX (1, (gint) allocation->height - (gint) border_width * 2);
 
-      children = box->children;
+      children = gtk_container_get_children (GTK_CONTAINER (box));
       while (children)
 	{
 	  child = children->data;
@@ -804,7 +814,7 @@ static void gdl_dock_bar_size_hallocate (GtkWidget     *widget,
 
 	  if ((child->pack == GTK_PACK_START) && gtk_widget_get_visible (child->widget))
 	    {
-	      if (box->homogeneous)
+	      if (gtk_box_get_homogeneous (box))
 		{
 		  if (nvis_children == 1)
 		    child_width = width;
@@ -853,13 +863,13 @@ static void gdl_dock_bar_size_hallocate (GtkWidget     *widget,
 
 	      gtk_widget_size_allocate (child->widget, &child_allocation);
 
-	      x += child_width + box->spacing;
+	      x += child_width + gtk_box_get_spacing (box);
 	    }
 	}
 
-      x = allocation->x + allocation->width - GTK_CONTAINER (box)->border_width;
+      x = allocation->x + allocation->width - border_width;
 
-      children = box->children;
+      children = gtk_container_get_children (GTK_CONTAINER (box));
       while (children)
 	{
 	  child = children->data;
@@ -870,7 +880,7 @@ static void gdl_dock_bar_size_hallocate (GtkWidget     *widget,
 	      GtkRequisition child_requisition;
 	      gtk_widget_get_child_requisition (child->widget, &child_requisition);
 
-              if (box->homogeneous)
+              if (gtk_box_get_homogeneous (box))
                 {
                   if (nvis_children == 1)
                     child_width = width;
@@ -912,7 +922,7 @@ static void gdl_dock_bar_size_hallocate (GtkWidget     *widget,
 
               gtk_widget_size_allocate (child->widget, &child_allocation);
 
-              x -= (child_width + box->spacing);
+              x -= (child_width + gtk_box_get_spacing (box));
 	    }
 	}
     }
diff --git a/gdl/gdl-dock-placeholder.c b/gdl/gdl-dock-placeholder.c
index 58cf586..4d6202e 100644
--- a/gdl/gdl-dock-placeholder.c
+++ b/gdl/gdl-dock-placeholder.c
@@ -216,8 +216,8 @@ gdl_dock_placeholder_class_init (GdlDockPlaceholderClass *klass)
 static void 
 gdl_dock_placeholder_instance_init (GdlDockPlaceholder *ph)
 {
-    GTK_WIDGET_SET_FLAGS (ph, GTK_NO_WINDOW);
-    GTK_WIDGET_UNSET_FLAGS (ph, GTK_CAN_FOCUS);
+    gtk_widget_set_has_window (GTK_WIDGET (ph), FALSE);
+    gtk_widget_set_can_focus (GTK_WIDGET (ph), FALSE);
     
     ph->_priv = g_new0 (GdlDockPlaceholderPrivate, 1);
 }
@@ -375,6 +375,7 @@ find_biggest_dock_item (GtkContainer *container, GtkWidget **biggest_child,
                         gint *biggest_child_area)
 {
     GList *children, *child;
+    GtkAllocation allocation;
     
     children = gtk_container_get_children (GTK_CONTAINER (container));
     child = children;
@@ -390,7 +391,8 @@ find_biggest_dock_item (GtkContainer *container, GtkWidget **biggest_child,
             child = g_list_next (child);
             continue;
         }
-        area = child_widget->allocation.width * child_widget->allocation.height;
+        gtk_widget_get_allocation (child_widget, &allocation);
+        area = allocation.width * allocation.height;
         
         if (area > *biggest_child_area) {
             *biggest_child_area = area;
@@ -406,8 +408,13 @@ attempt_to_dock_on_host (GdlDockPlaceholder *ph, GdlDockObject *host,
                          gpointer other_data)
 {
     GdlDockObject *parent;
-    gint host_width = GTK_WIDGET (host)->allocation.width;
-    gint host_height = GTK_WIDGET (host)->allocation.height;
+    GtkAllocation  allocation;
+    gint host_width;
+    gint host_height;
+
+    gtk_widget_get_allocation (GTK_WIDGET (host), &allocation);
+    host_width = allocation.width;
+    host_height = allocation.height;
     
     if (placement != GDL_DOCK_CENTER || !GDL_IS_DOCK_PANED (host)) {
         /* we simply act as a proxy for our host */
diff --git a/gdl/gdl-dock-tablabel.c b/gdl/gdl-dock-tablabel.c
index 1de95d2..2a43824 100644
--- a/gdl/gdl-dock-tablabel.c
+++ b/gdl/gdl-dock-tablabel.c
@@ -212,9 +212,9 @@ gdl_dock_tablabel_set_property (GObject      *object,
                     tablabel->drag_handle_size = 0;
                 
                 bin = GTK_BIN (tablabel);
-                if (bin->child && g_object_class_find_property (
-                    G_OBJECT_GET_CLASS (bin->child), "label"))
-                    g_object_set (bin->child, "label", long_name, NULL);
+                if (gtk_bin_get_child (bin) && g_object_class_find_property (
+                    G_OBJECT_GET_CLASS (gtk_bin_get_child (bin)), "label"))
+                    g_object_set (gtk_bin_get_child (bin), "label", long_name, NULL);
                 g_free (long_name);
             };
             break;
@@ -265,9 +265,9 @@ gdl_dock_tablabel_item_notify (GObject    *master,
         tablabel->drag_handle_size = 0;
 
     bin = GTK_BIN (tablabel);
-    if (bin->child && g_object_class_find_property (
-        G_OBJECT_GET_CLASS (bin->child), "label"))
-        g_object_set (bin->child, "label", label, NULL);
+    if (gtk_bin_get_child (bin) && g_object_class_find_property (
+        G_OBJECT_GET_CLASS (gtk_bin_get_child (bin)), "label"))
+        g_object_set (gtk_bin_get_child (bin), "label", label, NULL);
     g_free (label);
 
     gtk_widget_queue_resize (GTK_WIDGET (tablabel));
@@ -280,6 +280,7 @@ gdl_dock_tablabel_size_request (GtkWidget      *widget,
     GtkBin          *bin;
     GtkRequisition   child_req;
     GdlDockTablabel *tablabel;
+    guint            border_width;
 
     g_return_if_fail (widget != NULL);
     g_return_if_fail (GDL_IS_DOCK_TABLABEL (widget));
@@ -291,16 +292,18 @@ gdl_dock_tablabel_size_request (GtkWidget      *widget,
     requisition->width = tablabel->drag_handle_size;
     requisition->height = 0;
 
-    if (bin->child)
-        gtk_widget_size_request (bin->child, &child_req);
+    if (gtk_bin_get_child (bin))
+        gtk_widget_size_request (gtk_bin_get_child (bin), &child_req);
     else
         child_req.width = child_req.height = 0;
         
     requisition->width += child_req.width;
     requisition->height += child_req.height;
 
-    requisition->width += GTK_CONTAINER (widget)->border_width * 2;
-    requisition->height += GTK_CONTAINER (widget)->border_width * 2;
+    border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+
+    requisition->width += border_width * 2;
+    requisition->height += border_width * 2;
 
     widget->requisition = *requisition;
 }
@@ -310,6 +313,7 @@ gdl_dock_tablabel_size_allocate (GtkWidget     *widget,
                                  GtkAllocation *allocation)
 {
     GtkBin          *bin;
+    GtkAllocation    widget_allocation;
     GdlDockTablabel *tablabel;
     gint             border_width;
 
@@ -320,9 +324,9 @@ gdl_dock_tablabel_size_allocate (GtkWidget     *widget,
     bin = GTK_BIN (widget);
     tablabel = GDL_DOCK_TABLABEL (widget);
 
-    border_width = GTK_CONTAINER (widget)->border_width;
+    border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
   
-    widget->allocation = *allocation;
+    gtk_widget_set_allocation (widget, allocation);
 
     if (gtk_widget_get_realized (widget))
         gdk_window_move_resize (tablabel->event_window, 
@@ -331,11 +335,12 @@ gdl_dock_tablabel_size_allocate (GtkWidget     *widget,
                                 allocation->width, 
                                 allocation->height);
 
-    if (bin->child && gtk_widget_get_visible (bin->child)) {
+    if (gtk_bin_get_child (bin) && gtk_widget_get_visible (gtk_bin_get_child (bin))) {
         GtkAllocation  child_allocation;
 
-        child_allocation.x = widget->allocation.x + border_width;
-        child_allocation.y = widget->allocation.y + border_width;
+        gtk_widget_get_allocation (widget, &widget_allocation);
+        child_allocation.x = widget_allocation.x + border_width;
+        child_allocation.y = widget_allocation.y + border_width;
 
         allocation->width = MAX (1, (int) allocation->width - 
                                  (int) tablabel->drag_handle_size);
@@ -346,7 +351,7 @@ gdl_dock_tablabel_size_allocate (GtkWidget     *widget,
         child_allocation.height = 
             MAX (1, (int) allocation->height - 2 * border_width);
 
-        gtk_widget_size_allocate (bin->child, &child_allocation);
+        gtk_widget_size_allocate (gtk_bin_get_child (bin), &child_allocation);
     }
 }
 
@@ -356,20 +361,22 @@ gdl_dock_tablabel_paint (GtkWidget      *widget,
 {
     GdkRectangle     dest, rect;
     GtkBin          *bin;
+    GtkAllocation    widget_allocation;
     GdlDockTablabel *tablabel;
     gint             border_width;
 
     bin = GTK_BIN (widget);
     tablabel = GDL_DOCK_TABLABEL (widget);
-    border_width = GTK_CONTAINER (widget)->border_width;
+    border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
 
-    rect.x = widget->allocation.x + border_width;
-    rect.y = widget->allocation.y + border_width;
+    gtk_widget_get_allocation (widget, &widget_allocation);
+    rect.x = widget_allocation.x + border_width;
+    rect.y = widget_allocation.y + border_width;
     rect.width = tablabel->drag_handle_size * HANDLE_RATIO;
-    rect.height = widget->allocation.height - 2*border_width;
+    rect.height = widget_allocation.height - 2*border_width;
 
     if (gdk_rectangle_intersect (&event->area, &rect, &dest)) {
-        gtk_paint_handle (widget->style, widget->window, 
+        gtk_paint_handle (gtk_widget_get_style (widget), gtk_widget_get_window (widget), 
                           tablabel->active ? GTK_STATE_NORMAL : GTK_STATE_ACTIVE, 
                           GTK_SHADOW_NONE,
                           &dest, widget, "dock-tablabel",
@@ -399,6 +406,7 @@ gdl_dock_tablabel_button_event (GtkWidget      *widget,
                                 GdkEventButton *event)
 {
     GdlDockTablabel *tablabel;
+    GtkAllocation    widget_allocation;
     gboolean         event_handled;
   
     g_return_val_if_fail (widget != NULL, FALSE);
@@ -421,7 +429,7 @@ gdl_dock_tablabel_button_event (GtkWidget      *widget,
                 GtkBin  *bin;
 
                 bin = GTK_BIN (widget);
-                border_width = GTK_CONTAINER (widget)->border_width;
+                border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
 
                 rel_x = event->x - border_width;
                 rel_y = event->y - border_width;
@@ -459,8 +467,9 @@ gdl_dock_tablabel_button_event (GtkWidget      *widget,
 
         e = *event;
         e.window = gtk_widget_get_parent_window (widget);
-        e.x += widget->allocation.x;
-        e.y += widget->allocation.y;
+        gtk_widget_get_allocation (widget, &widget_allocation);
+        e.x += widget_allocation.x;
+        e.y += widget_allocation.y;
         
         gdk_event_put ((GdkEvent *) &e);
     };
@@ -473,6 +482,7 @@ gdl_dock_tablabel_motion_event (GtkWidget      *widget,
                                 GdkEventMotion *event)
 {
     GdlDockTablabel *tablabel;
+    GtkAllocation    widget_allocation;
     gboolean         event_handled;
   
     g_return_val_if_fail (widget != NULL, FALSE);
@@ -507,8 +517,9 @@ gdl_dock_tablabel_motion_event (GtkWidget      *widget,
 
         e = *event;
         e.window = gtk_widget_get_parent_window (widget);
-        e.x += widget->allocation.x;
-        e.y += widget->allocation.y;
+        gtk_widget_get_allocation (widget, &widget_allocation);
+        e.x += widget_allocation.x;
+        e.y += widget_allocation.y;
         
         gdk_event_put ((GdkEvent *) &e);
     };
@@ -521,15 +532,17 @@ gdl_dock_tablabel_realize (GtkWidget *widget)
 {
     GdlDockTablabel *tablabel;
     GdkWindowAttr attributes;
+    GtkAllocation widget_allocation;
     int attributes_mask;
     
     tablabel = GDL_DOCK_TABLABEL (widget);
     
     attributes.window_type = GDK_WINDOW_CHILD;
-    attributes.x = widget->allocation.x;
-    attributes.y = widget->allocation.y;
-    attributes.width = widget->allocation.width;
-    attributes.height = widget->allocation.height;
+    gtk_widget_get_allocation (widget, &widget_allocation);
+    attributes.x = widget_allocation.x;
+    attributes.y = widget_allocation.y;
+    attributes.width = widget_allocation.width;
+    attributes.height = widget_allocation.height;
     attributes.wclass = GDK_INPUT_ONLY;
     attributes.event_mask = gtk_widget_get_events (widget);
     attributes.event_mask |= (GDK_EXPOSURE_MASK | 
@@ -540,8 +553,8 @@ gdl_dock_tablabel_realize (GtkWidget *widget)
                               GDK_LEAVE_NOTIFY_MASK);
     attributes_mask = GDK_WA_X | GDK_WA_Y;
     
-    widget->window = gtk_widget_get_parent_window (widget);
-    g_object_ref (widget->window);
+    gtk_widget_set_window (widget, gtk_widget_get_parent_window (widget));
+    g_object_ref (gtk_widget_get_window (widget));
     
     tablabel->event_window = 
         gdk_window_new (gtk_widget_get_parent_window (widget),
@@ -550,7 +563,7 @@ gdl_dock_tablabel_realize (GtkWidget *widget)
     
     widget->style = gtk_style_attach (widget->style, widget->window);
     
-    GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+    gtk_widget_set_realized (widget, TRUE);
 }
 
 static void   
diff --git a/gdl/gdl-switcher.c b/gdl/gdl-switcher.c
index 74f954f..c7d59b8 100644
--- a/gdl/gdl-switcher.c
+++ b/gdl/gdl-switcher.c
@@ -749,7 +749,7 @@ gdl_switcher_instance_init (GdlSwitcher *switcher)
 {
     GdlSwitcherPrivate *priv;
 
-    GTK_WIDGET_SET_FLAGS (switcher, GTK_NO_WINDOW);
+    gtk_widget_set_has_window (GTK_WIDGET (switcher), FALSE);
   
     priv = g_new0 (GdlSwitcherPrivate, 1);
     switcher->priv = priv;



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