Author: jasper
Date: 2007-06-24 20:19:48 +0000 (Sun, 24 Jun 2007)
New Revision: 25854

Modified:
   xfce4-panel/trunk/NEWS
   xfce4-panel/trunk/libxfce4panel/xfce-itembar.c
   xfce4-panel/trunk/libxfce4panel/xfce-itembar.h
   xfce4-panel/trunk/panel/panel-properties.c
Log:
Make itembar not care about expanded items when panel is not full width.

Modified: xfce4-panel/trunk/NEWS
===================================================================
--- xfce4-panel/trunk/NEWS      2007-06-24 19:36:47 UTC (rev 25853)
+++ xfce4-panel/trunk/NEWS      2007-06-24 20:19:48 UTC (rev 25854)
@@ -1,5 +1,7 @@
 4.5.x
 =====
+- Make itembar not care about expanded items when panel is not full width.
+  (Jasper)
 - Separator can have different styles: space, expanded space, line (default),
   handle and old-style dotted handle. Initial patch by Landry Breuil. (Jasper)
 - Make sure tooltips are set for more than 1 clock instance (bug #3109).

Modified: xfce4-panel/trunk/libxfce4panel/xfce-itembar.c
===================================================================
--- xfce4-panel/trunk/libxfce4panel/xfce-itembar.c      2007-06-24 19:36:47 UTC 
(rev 25853)
+++ xfce4-panel/trunk/libxfce4panel/xfce-itembar.c      2007-06-24 20:19:48 UTC 
(rev 25854)
@@ -75,6 +75,7 @@
 
     gint            drop_index;
     guint           raised : 1;
+    guint           expand_allowed : 1;
 };
 
 struct _XfceItembarChild
@@ -281,6 +282,8 @@
     priv->event_window   = NULL;
     priv->drag_highlight = NULL;
     priv->drop_index     = -1;
+    priv->raised         = FALSE;
+    priv->expand_allowed = FALSE;
 }
 
 
@@ -485,7 +488,7 @@
         {
             height = bar_height;
 
-            if (child->expand)
+            if (child->expand && priv->expand_allowed)
             {
                 n_expand++;
                 max_expand = MAX (max_expand, width);
@@ -499,7 +502,7 @@
         {
             width = bar_height;
 
-            if (child->expand)
+            if (child->expand && priv->expand_allowed)
             {
                 n_expand++;
                 max_expand = MAX (max_expand, height);
@@ -512,7 +515,7 @@
 
         props[i].allocation.width = width;
         props[i].allocation.height = height;
-        props[i].expand = child->expand;
+        props[i].expand = (child->expand && priv->expand_allowed);
     }
 
     total_expand = expand_width;
@@ -1028,6 +1031,30 @@
 
 
 /**
+ * xfce_itembar_set_allow_expand:
+ * @allow : %TRUE when the expansion is allowed.
+ *
+ * Set whether the 'expand' child property is honored.
+ *
+ * See also: xfce_itembar_set_child_expand().
+ **/
+void
+xfce_itembar_set_allow_expand (XfceItembar *itembar,
+                               gboolean     allow)
+{
+    XfceItembarPrivate *priv;
+
+    _panel_return_val_if_fail (XFCE_IS_ITEMBAR (itembar), DEFAULT_ORIENTATION);
+
+    priv = XFCE_ITEMBAR_GET_PRIVATE (itembar);
+
+    priv->expand_allowed = allow;
+    gtk_widget_queue_resize (GTK_WIDGET(itembar));
+}
+
+
+
+/**
  * xfce_itembar_get_orientation:
  * @itembar : an #XfceItembar
  *

Modified: xfce4-panel/trunk/libxfce4panel/xfce-itembar.h
===================================================================
--- xfce4-panel/trunk/libxfce4panel/xfce-itembar.h      2007-06-24 19:36:47 UTC 
(rev 25853)
+++ xfce4-panel/trunk/libxfce4panel/xfce-itembar.h      2007-06-24 20:19:48 UTC 
(rev 25854)
@@ -61,6 +61,9 @@
 
 GtkWidget      *xfce_itembar_new                    (GtkOrientation        
orientation) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
 
+void            xfce_itembar_set_allow_expand       (XfceItembar          
*itembar,
+                                                     gboolean              
allow);
+
 void            xfce_itembar_set_orientation        (XfceItembar          
*itembar,
                                                      GtkOrientation        
orientation);
 

Modified: xfce4-panel/trunk/panel/panel-properties.c
===================================================================
--- xfce4-panel/trunk/panel/panel-properties.c  2007-06-24 19:36:47 UTC (rev 
25853)
+++ xfce4-panel/trunk/panel/panel-properties.c  2007-06-24 20:19:48 UTC (rev 
25854)
@@ -977,6 +977,7 @@
 
     if (priv->full_width > XFCE_PANEL_NORMAL_WIDTH)
     {
+        xfce_itembar_set_allow_expand (XFCE_ITEMBAR (priv->itembar), TRUE);
         if (xfce_screen_position_is_horizontal (priv->screen_position))
         {
             if (priv->full_width == XFCE_PANEL_FULL_WIDTH)
@@ -1201,10 +1202,14 @@
             {
                 case XFCE_PANEL_NORMAL_WIDTH:
                     w = h = -1;
+                    xfce_itembar_set_allow_expand (XFCE_ITEMBAR 
(priv->itembar),
+                                                   FALSE);
                     break;
 
                 case XFCE_PANEL_FULL_WIDTH:
                 case XFCE_PANEL_SPAN_MONITORS:
+                    xfce_itembar_set_allow_expand (XFCE_ITEMBAR 
(priv->itembar), 
+                                                   TRUE);
                     if (xfce_screen_position_is_horizontal (
                                 priv->screen_position))
                     {

_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to