[Xfce4-commits] <xfce4-panel:devel> Merge branch 'master' of ssh://nick at doppio.foo-projects.org/home/nick/public_html/git/xfce4-panel

Nick Schermer nick at xfce.org
Tue Aug 11 20:24:39 CEST 2009


Updating branch refs/heads/devel
         to d3a5d2a11318fe3934f490bf76418c4de2004d7f (commit)
       from 6237c9782f308e2a991fac629b601853e7d55dd3 (commit)

commit d3a5d2a11318fe3934f490bf76418c4de2004d7f
Merge: 6237c9782f308e2a991fac629b601853e7d55dd3 9830559b2075a4380fa1ed4412f0d020673d32e2
Author: Nick Schermer <nick at xfce.org>
Date:   Wed Oct 8 23:12:36 2008 +0200

    Merge branch 'master' of ssh://nick@doppio.foo-projects.org/home/nick/public_html/git/xfce4-panel

commit 9830559b2075a4380fa1ed4412f0d020673d32e2
Merge: 8811085d9f26ba3597392af1747639bc7ed09bee f8fc340490ee9ec90dcaaf34cc9dc37c85035175
Author: Nick Schermer <nick at xfce.org>
Date:   Wed Oct 8 18:20:23 2008 +0200

    Merge branch 'master' of ssh://nick@doppio.foo-projects.org/home/nick/public_html/git/xfce4-panel

commit 8811085d9f26ba3597392af1747639bc7ed09bee
Author: nick <nick at localhost.localdomain>
Date:   Wed Oct 8 17:46:07 2008 +0200

    * Change tray allocation to revent large tray sizes on startup.

commit c75543c2445a7de07d4790977dda9b552ecc9e0d
Author: nick <nick at localhost.localdomain>
Date:   Wed Oct 8 17:10:38 2008 +0200

    * Use g_slice_new and g_new instead of g_slice_new0 and g_new0
      because we initialize all the variables.

 panel/panel-itembar.c              |    2 +-
 panel/panel-plugin-external.c      |    4 ++--
 plugins/systray/xfce-tray-widget.c |   29 ++++++++---------------------
 3 files changed, 11 insertions(+), 24 deletions(-)

diff --git a/panel/panel-itembar.c b/panel/panel-itembar.c
index f06b973..291cc1d 100644
--- a/panel/panel-itembar.c
+++ b/panel/panel-itembar.c
@@ -793,7 +793,7 @@ panel_itembar_insert (PanelItembar *itembar,
   panel_return_if_fail (widget->parent == NULL);
 
   /* allocate new child */
-  child = g_slice_new0 (PanelItembarChild);
+  child = g_slice_new (PanelItembarChild);
 
   /* set properties */
   child->widget = widget;
diff --git a/panel/panel-plugin-external.c b/panel/panel-plugin-external.c
index bf4e511..6c80d01 100644
--- a/panel/panel-plugin-external.c
+++ b/panel/panel-plugin-external.c
@@ -217,7 +217,7 @@ panel_plugin_external_realize (GtkWidget *widget)
     argc += g_strv_length (external->arguments);
 
   /* allocate argv */
-  argv = g_new0 (gchar *, argc);
+  argv = g_new (gchar *, argc);
 
   /* setup the basic argv */
   argv[0]  = LIBEXECDIR "/xfce4-panel-wrapper";
@@ -477,7 +477,7 @@ panel_plugin_external_set_property (PanelPluginExternal *external,
   else
     {
       /* queue the property */
-      data = g_slice_new0 (QueuedData);
+      data = g_slice_new (QueuedData);
       data->property = property;
       g_value_init (&data->value, G_VALUE_TYPE (value));
       g_value_copy (value, &data->value);
diff --git a/plugins/systray/xfce-tray-widget.c b/plugins/systray/xfce-tray-widget.c
index 04714f0..ab67c14 100644
--- a/plugins/systray/xfce-tray-widget.c
+++ b/plugins/systray/xfce-tray-widget.c
@@ -91,9 +91,6 @@ struct _XfceTrayWidget
     /* hidden childeren counter */
     gint          n_hidden_childeren;
 
-    /* last allocated child size, used to prevent icon overflow */
-    gint          last_alloc_child_size;
-
     /* whether hidden icons are visible */
     guint         show_hidden : 1;
 
@@ -183,7 +180,6 @@ xfce_tray_widget_init (XfceTrayWidget *tray)
     tray->n_hidden_childeren = 0;
     tray->arrow_type = GTK_ARROW_LEFT;
     tray->show_hidden = FALSE;
-    tray->last_alloc_child_size = -1;
 
     /* create hash table */
     tray->names = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
@@ -229,7 +225,7 @@ xfce_tray_widget_size_request (GtkWidget      *widget,
     GSList              *li;
     XfceTrayWidgetChild *child_info;
     gint                 n_columns;
-    gint                 child_size = tray->last_alloc_child_size;
+    gint                 child_size = -1;
     GtkRequisition       child_requisition;
     gint                 n_visible_childeren = 0;
 
@@ -273,12 +269,11 @@ xfce_tray_widget_size_request (GtkWidget      *widget,
             /* count the number of visible childeren */
             if (child_info->hidden == FALSE || tray->show_hidden == TRUE)
             {
-                /* don't use the allocate child size if it's not set yet */
-                if (G_UNLIKELY (tray->last_alloc_child_size == -1))
-                {
-                    /* pick largest icon */
+                /* pick largest icon */
+                if (child_size == -1)
+                    child_size = MAX (child_requisition.width, child_requisition.height);
+                else
                     child_size = MAX (child_size, MAX (child_requisition.width, child_requisition.height));
-                }
 
                 /* increase number of visible childeren */
                 n_visible_childeren++;
@@ -357,17 +352,9 @@ xfce_tray_widget_size_allocate (GtkWidget     *widget,
     child_size -= XFCE_TRAY_WIDGET_SPACING * (tray->rows - 1);
     child_size /= tray->rows;
 
-    /* store or fix the calculated child size */
-    if (child_size > 0)
-    {
-        /* set last allocated child size */
-        tray->last_alloc_child_size = child_size;
-    }
-    else
-    {
-        /* child size is invalid (hidden panel), fall-back on old size */
-        child_size = MAX (1, tray->last_alloc_child_size);
-    }
+    /* don't allocate a zero width icon */
+    if (child_size < 1)
+      child_size = 1;
 
     /* position arrow button */
     if (tray->n_hidden_childeren > 0)



More information about the Xfce4-commits mailing list