[Xfce4-commits] <xfce4-panel:master> Actions: Limit size of action buttons to row size.

Nick Schermer noreply at xfce.org
Fri Feb 24 16:38:02 CET 2012


Updating branch refs/heads/master
         to 0bd4a57aff4bd07611245040df2426b58d7521ac (commit)
       from 6df7c6339ee5aba39a075dc8cf0a1ef21f689a87 (commit)

commit 0bd4a57aff4bd07611245040df2426b58d7521ac
Author: Andrzej <ndrwrdck at gmail.com>
Date:   Fri Feb 24 16:30:29 2012 +0100

    Actions: Limit size of action buttons to row size.
    
    Action buttons size is set to max panel_size / nrows.
    Previously buttons were scaled up to the whole panel size,
    which was inconsistent with other plugins (app menu, launchers etc).

 plugins/actions/actions.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/plugins/actions/actions.c b/plugins/actions/actions.c
index a3414e2..0e27864 100644
--- a/plugins/actions/actions.c
+++ b/plugins/actions/actions.c
@@ -431,9 +431,11 @@ actions_plugin_size_changed (XfcePanelPlugin *panel_plugin,
   GList         *children, *li;
   gint           n_children;
   gint           child_size;
+  gint           max_size;
 
   if (plugin->type == APPEARANCE_TYPE_BUTTONS)
     {
+      max_size = size / xfce_panel_plugin_get_nrows (panel_plugin);
       box = gtk_bin_get_child (GTK_BIN (plugin));
       if (box != NULL)
         {
@@ -446,8 +448,9 @@ actions_plugin_size_changed (XfcePanelPlugin *panel_plugin,
 
               for (li = children; li != NULL; li = li->next)
                 {
-                  child_size = size / n_children--;
+                  child_size = MIN (size / n_children, max_size);
                   size -= child_size;
+                  n_children--;
 
                   gtk_widget_set_size_request (GTK_WIDGET (li->data),
                                                child_size, child_size);
@@ -457,7 +460,7 @@ actions_plugin_size_changed (XfcePanelPlugin *panel_plugin,
             {
               gtk_container_foreach (GTK_CONTAINER (box),
                   actions_plugin_size_changed_child,
-                  GINT_TO_POINTER (size));
+                  GINT_TO_POINTER (max_size));
             }
         }
     }


More information about the Xfce4-commits mailing list