[Xfce4-commits] <xfce4-indicator-plugin:master> Improved icon sizing.
Andrzej
noreply at xfce.org
Mon Apr 22 23:48:01 CEST 2013
Updating branch refs/heads/master
to 46f43f340b4a3d91dcd09b2e8da9cc3967e5f1b6 (commit)
from 816b45af390e7265996f842a4a6726cbe9860f5d (commit)
commit 46f43f340b4a3d91dcd09b2e8da9cc3967e5f1b6
Author: Andrzej <ndrwrdck at gmail.com>
Date: Mon Apr 22 22:46:59 2013 +0100
Improved icon sizing.
panel-plugin/indicator-button.c | 29 ++++++++++++++++++++---------
1 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/panel-plugin/indicator-button.c b/panel-plugin/indicator-button.c
index a15c694..93c49c8 100644
--- a/panel-plugin/indicator-button.c
+++ b/panel-plugin/indicator-button.c
@@ -256,7 +256,7 @@ xfce_indicator_button_update_icon (XfceIndicatorButton *button)
{
GdkPixbuf *pixbuf_s, *pixbuf_d;
gdouble aspect;
- gint w, h, size;
+ gint w, h, w2, h2, size;
gint border_thickness;
GtkStyleContext *ctx;
GtkBorder padding, border;
@@ -266,6 +266,9 @@ xfce_indicator_button_update_icon (XfceIndicatorButton *button)
size = xfce_indicator_button_get_icon_size (button);
+ if (size > 22 && size <= 26)
+ size = 22;
+
#if 0
if (size > 16 && size < 22)
size = 16;
@@ -297,17 +300,25 @@ xfce_indicator_button_update_icon (XfceIndicatorButton *button)
if (indicator_config_get_panel_orientation (button->config) == GTK_ORIENTATION_VERTICAL &&
size * aspect > indicator_config_get_panel_size (button->config) - border_thickness)
{
- w = indicator_config_get_panel_size (button->config) - border_thickness;
- h = (gint) (w / aspect);
+ w2 = indicator_config_get_panel_size (button->config) - border_thickness;
+ h2 = (gint) (w2 / aspect);
+ }
+ else
+ {
+ h2 = size;
+ w2 = (gint) (h2 * aspect);
+ }
+
+ if (h2 == h)
+ {
+ gtk_image_set_from_pixbuf (GTK_IMAGE (button->icon), pixbuf_s);
}
else
{
- h = size;
- w = (gint) (h * aspect);
+ pixbuf_d = gdk_pixbuf_scale_simple (pixbuf_s, w2, h2, GDK_INTERP_BILINEAR);
+ gtk_image_set_from_pixbuf (GTK_IMAGE (button->icon), pixbuf_d);
+ g_object_unref (G_OBJECT (pixbuf_d));
}
- pixbuf_d = gdk_pixbuf_scale_simple (pixbuf_s, w, h, GDK_INTERP_BILINEAR);
- gtk_image_set_from_pixbuf (GTK_IMAGE (button->icon), pixbuf_d);
- g_object_unref (G_OBJECT (pixbuf_d));
}
else
{
@@ -402,7 +413,7 @@ xfce_indicator_button_set_image (XfceIndicatorButton *button,
button->icon = gtk_image_new ();
xfce_indicator_button_update_icon (button);
- gtk_box_pack_start (GTK_BOX (button->box), button->icon, TRUE, FALSE, 1);
+ gtk_box_pack_start (GTK_BOX (button->box), button->icon, TRUE, FALSE, 2);
gtk_widget_show (button->icon);
xfce_indicator_button_update_layout (button);
More information about the Xfce4-commits
mailing list