libegg r882 - in trunk: . libegg/toolpalette



Author: jap
Date: Thu Jun 19 14:31:30 2008
New Revision: 882
URL: http://svn.gnome.org/viewvc/libegg?rev=882&view=rev

Log:
2008-06-19  Jan Arne Petersen  <jpetersen jpetersen org>

	* libegg/toolpalette/eggtoolitemgroup.c
	  (egg_tool_item_group_is_item_visible): Add special handling of
	  orientation==HORZIONTAL style==TEXT case. Fixes required size in
	  this case.
	  (egg_tool_item_group_real_size_query,
	  egg_tool_item_group_real_size_allocate,
	  egg_tool_item_group_get_drop_item,
	  _egg_tool_item_group_item_size_request): Update calls of the
	  egg_tool_item_group_is_item_visible function. Remove special
	  handling of orientation==HORZIONTAL style==TEXT case.



Modified:
   trunk/ChangeLog
   trunk/libegg/toolpalette/eggtoolitemgroup.c

Modified: trunk/libegg/toolpalette/eggtoolitemgroup.c
==============================================================================
--- trunk/libegg/toolpalette/eggtoolitemgroup.c	(original)
+++ trunk/libegg/toolpalette/eggtoolitemgroup.c	Thu Jun 19 14:31:30 2008
@@ -483,14 +483,26 @@
 }
 
 static gboolean
-egg_tool_item_group_is_item_visible (GtkToolItem    *item,
-                                     GtkOrientation  orientation)
+egg_tool_item_group_is_item_visible (EggToolItemGroup      *group,
+                                     EggToolItemGroupChild *child)
 {
+  GtkToolbarStyle style;
+  GtkOrientation orientation;
+
+  orientation = gtk_tool_shell_get_orientation (GTK_TOOL_SHELL (group));
+  style = gtk_tool_shell_get_style (GTK_TOOL_SHELL (group));
+
+  /* horizontal tool palettes with text style support only homogeneous items */
+  if (!child->homogeneous &&
+      GTK_ORIENTATION_HORIZONTAL == orientation &&
+      GTK_TOOLBAR_TEXT == style)
+    return FALSE;
+
   return
-    (GTK_WIDGET_VISIBLE (item)) &&
+    (GTK_WIDGET_VISIBLE (child->item)) &&
     (GTK_ORIENTATION_VERTICAL == orientation ?
-     gtk_tool_item_get_visible_vertical (item) :
-     gtk_tool_item_get_visible_horizontal (item));
+     gtk_tool_item_get_visible_vertical (child->item) :
+     gtk_tool_item_get_visible_horizontal (child->item));
 }
 
 static void
@@ -543,7 +555,7 @@
             {
               EggToolItemGroupChild *child = it->data;
 
-              if (!egg_tool_item_group_is_item_visible (child->item, orientation))
+              if (!egg_tool_item_group_is_item_visible (group, child))
                 continue;
 
               if (new_row || child->new_row)
@@ -598,7 +610,7 @@
             {
               EggToolItemGroupChild *child = it->data;
 
-              if (!egg_tool_item_group_is_item_visible (child->item, orientation))
+              if (!egg_tool_item_group_is_item_visible (group, child))
                 continue;
 
               if (new_row || child->new_row)
@@ -622,10 +634,6 @@
                   GtkRequisition req = {0};
                   guint width;
 
-                  /* in horizontal text mode non homogneneous items are not supported */
-                  if (GTK_TOOLBAR_TEXT == style)
-                    continue;
-
                   gtk_widget_size_request (GTK_WIDGET (child->item), &req);
 
                   width = (guint) ceil (1.0 * req.width / item_size.width);
@@ -655,7 +663,7 @@
                 {
                   EggToolItemGroupChild *child = it->data;
 
-                  if (!egg_tool_item_group_is_item_visible (child->item, orientation))
+                  if (!egg_tool_item_group_is_item_visible (group, child))
                     continue;
 
                   if (new_row || child->new_row)
@@ -679,10 +687,6 @@
                       GtkRequisition req = {0};
                       guint width;
 
-                      /* in horizontal text mode non homogneneous items are not supported */
-                      if (GTK_TOOLBAR_TEXT == style)
-                        continue;
-
                       gtk_widget_size_request (GTK_WIDGET (child->item), &req);
 
                       width = (guint) ceil (1.0 * req.width / item_size.width);
@@ -826,7 +830,7 @@
         {
           EggToolItemGroupChild *child = it->data;
 
-          if (!egg_tool_item_group_is_item_visible (child->item, orientation))
+          if (!egg_tool_item_group_is_item_visible (group, child))
             {
               gtk_widget_set_child_visible (GTK_WIDGET (child->item), FALSE);
 
@@ -837,13 +841,6 @@
           child_requisition.width = 0;
 	  if (!child->homogeneous)
             {
-              /* in horizontal text mode non homogneneous items are not supported */
-              if (GTK_ORIENTATION_HORIZONTAL == orientation && GTK_TOOLBAR_TEXT == style)
-                {
-                  gtk_widget_set_child_visible (GTK_WIDGET (child->item), FALSE);
-                  continue;
-                }
-
               gtk_widget_size_request (GTK_WIDGET (child->item), &child_requisition);
               child_requisition.width = MIN (child_requisition.width, item_area.width);
             }
@@ -1677,7 +1674,7 @@
       GtkToolItem *item = child->item;
       gint x0, y0;
 
-      if (!item || !egg_tool_item_group_is_item_visible (item, orientation))
+      if (!item || !egg_tool_item_group_is_item_visible (group, child))
         continue;
 
       allocation = &GTK_WIDGET (item)->allocation;
@@ -1704,18 +1701,21 @@
   guint rows = 0;
   gboolean new_row = TRUE;
   GtkOrientation orientation;
+  GtkToolbarStyle style;
 
   g_return_if_fail (EGG_IS_TOOL_ITEM_GROUP (group));
   g_return_if_fail (NULL != item_size);
 
   orientation = gtk_tool_shell_get_orientation (GTK_TOOL_SHELL (group));
+  style = gtk_tool_shell_get_style (GTK_TOOL_SHELL (group));
+
   item_size->width = item_size->height = 0;
 
   for (it = group->priv->children; it != NULL; it = it->next)
     {
       EggToolItemGroupChild *child = it->data;
 
-      if (!egg_tool_item_group_is_item_visible (child->item, orientation))
+      if (!egg_tool_item_group_is_item_visible (group, child))
         continue;
 
       if (child->new_row || new_row)



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