[Xfce4-commits] <xfce4-panel:andrzejr/deskbar2> action buttons plugin: limiting the size of action buttons.

Andrzej noreply at xfce.org
Mon Jan 16 13:04:01 CET 2012


Updating branch refs/heads/andrzejr/deskbar2
         to 4e48f5fdfd743d9eb407e8c8c7b792a1ccc4f024 (commit)
       from 6bdea4b755a7f38bb456ade581311b74562b6e2f (commit)

commit 4e48f5fdfd743d9eb407e8c8c7b792a1ccc4f024
Author: Andrzej <ndrwrdck at gmail.com>
Date:   Mon Jan 16 21:01:21 2012 +0900

    action buttons plugin: limiting the size of action buttons.
    
    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).
    
    
    Button orientation is not changed to minimize difference from
    rev. 4.8. Perhaps the layout mechanism should be reworked anyway.
    
    It would also be nice to have action buttons arranged horizontally
    by default in the deskbar mode.
    
    I've tried that but it collided with the invert-orientation property.
    If the user set invert-orientation=TRUE to have action buttons
    laid out perpendicularly in the horizontal|vertical mode, they would
    become parallel to the panel in the deskbar mode, which is probably
    not what the user intended.

 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