[gnome-panel] status-notifier: scale down pixbuf icons in menu items
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel] status-notifier: scale down pixbuf icons in menu items
- Date: Thu, 28 Dec 2017 23:54:10 +0000 (UTC)
commit 3c41e566e11941e25b1b97b30442082a30086959
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Fri Dec 29 01:11:32 2017 +0200
status-notifier: scale down pixbuf icons in menu items
We are setting 16px size for icons created from icon names. Do
same for icons created from GdkPixbuf. We don't want 32x32px
icons for menu items.
modules/status-notifier/sn-image-menu-item.c | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/modules/status-notifier/sn-image-menu-item.c b/modules/status-notifier/sn-image-menu-item.c
index 90f16ed..9e61343 100644
--- a/modules/status-notifier/sn-image-menu-item.c
+++ b/modules/status-notifier/sn-image-menu-item.c
@@ -220,8 +220,30 @@ void
sn_image_menu_item_set_image_from_icon_pixbuf (SnImageMenuItem *item,
GdkPixbuf *pixbuf)
{
+ gint width;
+ gint height;
+
+ g_object_ref (pixbuf);
+
+ width = gdk_pixbuf_get_width (pixbuf);
+ height = gdk_pixbuf_get_height (pixbuf);
+
+ if (width > 16 || height > 16)
+ {
+ GdkPixbuf *scaled;
+
+ scaled = gdk_pixbuf_scale_simple (pixbuf, 16, 16, GDK_INTERP_BILINEAR);
+
+ if (scaled != NULL)
+ {
+ g_object_unref (pixbuf);
+ pixbuf = scaled;
+ }
+ }
+
gtk_image_set_from_pixbuf (GTK_IMAGE (item->image), pixbuf);
gtk_widget_show (item->image);
+ g_object_unref (pixbuf);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]