gdl r552 - in trunk: . gdl



Author: jhs
Date: Thu Apr 16 08:20:59 2009
New Revision: 552
URL: http://svn.gnome.org/viewvc/gdl?rev=552&view=rev

Log:
The End (use git log instead)

2009-04-16  Joel Holdsworth <joel airwebreathe org uk>

	reviewed by: Johannes Schmid  <jhs gnome org>

	* gdl/gdl-dock-item-grip.c (gdl_dock_item_grip_size_allocate):
  #579057 â Grip layout bug where negative rectangles are possible

Modified:
   trunk/ChangeLog
   trunk/README
   trunk/gdl/gdl-dock-item-grip.c

Modified: trunk/README
==============================================================================
--- trunk/README	(original)
+++ trunk/README	Thu Apr 16 08:20:59 2009
@@ -1,20 +1,9 @@
-Gnome Devtool Libraries
-=======================
+Gnome Docking library
+=====================
 
-This package contains components and libraries that are intended to be
-shared between GNOME development tools, including gnome-debug,
-gnome-build, and anjuta2.
+Provides docking features for gtk+. Currently used by anjuta and lumiera.
 
-The current pieces of GDL include:
-
- - A symbol browser bonobo component (symbol-browser-control).
-
- - A docking widget (gdl).
-
- - A utility library that also contains the stubs and skels for
-   the symbol browser and text editor components (gdl, idl).
-
-Discussion of GDL development takes place on the gnome-devtools gnome org
-mailing list and on #devel-apps at irc.gnome.org.
+Discussion of GDL development takes place on the gnome-devtools gnome org or
+anjuta-devel lists sf net mailing list and on #anjuta at irc.gnome.org.
 
 GDL is licensed under the terms of the GPL.

Modified: trunk/gdl/gdl-dock-item-grip.c
==============================================================================
--- trunk/gdl/gdl-dock-item-grip.c	(original)
+++ trunk/gdl/gdl-dock-item-grip.c	Thu Apr 16 08:20:59 2009
@@ -430,7 +430,8 @@
 {
     GdlDockItemGrip *grip;
     GtkContainer    *container;
-    GtkRequisition   button_requisition = { 0, };
+    GtkRequisition   close_requisition = { 0, };
+    GtkRequisition   iconify_requisition = { 0, };
     GtkAllocation    child_allocation;
     GdkRectangle     label_area;
 
@@ -442,42 +443,64 @@
 
     GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
 
+    gtk_widget_size_request (grip->_priv->close_button,
+        &close_requisition);
+    gtk_widget_size_request (grip->_priv->iconify_button,
+        &iconify_requisition);
+    
+    /* Calculate the Minimum Width where buttons will fit */
+    int min_width = close_requisition.width + iconify_requisition.width
+        + container->border_width * 2;
+    if(grip->_priv->handle_shown)
+      min_width += DRAG_HANDLE_SIZE;
+    const gboolean space_for_buttons = (allocation->width >= min_width);
+        
+    /* Set up the rolling child_allocation rectangle */
     if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
         child_allocation.x = container->border_width/* + ALIGN_BORDER*/;
     else
         child_allocation.x = allocation->width - container->border_width;
     child_allocation.y = container->border_width;
 
+    /* Layout Close Button */
     if (GTK_WIDGET_VISIBLE (grip->_priv->close_button)) {
-        gtk_widget_size_request (grip->_priv->close_button, &button_requisition);
 
-        if (gtk_widget_get_direction (widget) != GTK_TEXT_DIR_RTL)
-            child_allocation.x -= button_requisition.width;
-    
-        child_allocation.width = button_requisition.width;
-        child_allocation.height = button_requisition.height;
+        if(space_for_buttons) {
+            if (gtk_widget_get_direction (widget) != GTK_TEXT_DIR_RTL)
+                child_allocation.x -= close_requisition.width;
+        
+            child_allocation.width = close_requisition.width;
+            child_allocation.height = close_requisition.height;
+        } else {
+            child_allocation.width = 0;
+        }
         
         gtk_widget_size_allocate (grip->_priv->close_button, &child_allocation);
 
         if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
-            child_allocation.x += button_requisition.width;
+            child_allocation.x += close_requisition.width;
     }    
 
+    /* Layout Iconify Button */
     if (GTK_WIDGET_VISIBLE (grip->_priv->iconify_button)) {
-        gtk_widget_size_request (grip->_priv->iconify_button, &button_requisition);
-
-        if (gtk_widget_get_direction (widget) != GTK_TEXT_DIR_RTL)
-            child_allocation.x -= button_requisition.width;
 
-        child_allocation.width = button_requisition.width;
-        child_allocation.height = button_requisition.height;
+        if(space_for_buttons) {
+            if (gtk_widget_get_direction (widget) != GTK_TEXT_DIR_RTL)
+                child_allocation.x -= iconify_requisition.width;
+
+            child_allocation.width = iconify_requisition.width;
+            child_allocation.height = iconify_requisition.height;
+        } else {
+            child_allocation.width = 0;
+        }
 
         gtk_widget_size_allocate (grip->_priv->iconify_button, &child_allocation);
 
         if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
-            child_allocation.x += button_requisition.width;
+            child_allocation.x += iconify_requisition.width;
     }
     
+    /* Layout the Grip Handle*/
     if (gtk_widget_get_direction (widget) != GTK_TEXT_DIR_RTL) {
         child_allocation.width = child_allocation.x;
         child_allocation.x = container->border_width/* + ALIGN_BORDER*/;
@@ -495,6 +518,9 @@
             child_allocation.width -= DRAG_HANDLE_SIZE;
     }
     
+    if(child_allocation.width < 0)
+      child_allocation.width = 0;
+    
     child_allocation.y = container->border_width;
     child_allocation.height = allocation->height - container->border_width * 2;
     if(grip->_priv->label) {



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