[Xfce4-commits] [panel-plugins/xfce4-pulseaudio-plugin] 01/01: Add size steps for the panel icon

noreply at xfce.org noreply at xfce.org
Thu Mar 5 22:07:06 CET 2015


This is an automated email from the git hooks/post-receive script.

andrzejr pushed a commit to branch master
in repository panel-plugins/xfce4-pulseaudio-plugin.

commit 7870c5623bcdd837b11106622f61fe2fd3773d94
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Thu Mar 5 21:59:49 2015 +0100

    Add size steps for the panel icon
    
    Since symbolic icons are usually only 16px, the size steps
    help to keep the icon sharp.
---
 panel-plugin/pulseaudio-button.c |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/panel-plugin/pulseaudio-button.c b/panel-plugin/pulseaudio-button.c
index bb221dc..0e8a81f 100644
--- a/panel-plugin/pulseaudio-button.c
+++ b/panel-plugin/pulseaudio-button.c
@@ -335,6 +335,7 @@ pulseaudio_button_set_size (PulseaudioButton *button,
   GtkStyleContext  *context;
   GtkBorder         padding;
   GtkBorder         border;
+  gint              width;
   gint              xthickness;
   gint              ythickness;
 
@@ -348,7 +349,18 @@ pulseaudio_button_set_size (PulseaudioButton *button,
   xthickness = padding.left+padding.right+border.left+border.right;
   ythickness = padding.top+padding.bottom+border.top+border.bottom;
 
-  button->icon_size = size - 2* MAX (xthickness, ythickness);
+  width = size - 2* MAX (xthickness, ythickness);
+  /* Since symbolic icons are usually only provided in 16px we
+   * try to be clever and use size steps */
+  if (width <= 21)
+      button->icon_size = 16;
+  else if (width >=22 && width <= 29)
+      button->icon_size = 24;
+  else if (width >= 30 && width <= 40)
+      button->icon_size = 32;
+  else
+      button->icon_size = width;
+
   gtk_widget_set_size_request (GTK_WIDGET (button), size, size);
   pulseaudio_button_update_icons (button);
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list