parent
3bea15b0b9
commit
62fead4f69
@ -0,0 +1,74 @@
|
||||
# Calculate format=diff merge(xfce-base/garcon)=>0.6.1,0.6.2
|
||||
commit 4387496fe332a50945e7db76bc2196b419656fe3
|
||||
Author: Stefan Berzl <stefanberzl@gmail.com>
|
||||
Date: Mon Aug 21 18:39:07 2017 +0300
|
||||
|
||||
fix: some menu icons are too big (Bug #13785)
|
||||
|
||||
Some packages only provide icons in sizes much bigger than the standard
|
||||
GTK menu size of 16px.
|
||||
|
||||
The clipboard manager qlipper for example provides the following icon:
|
||||
/usr/share/icons/hicolor/128x128/apps/qlipper.png
|
||||
|
||||
In GTK 3.22.18 the function gtk_image_new_from_icon_name when given
|
||||
GTK_ICON_SIZE_MENU as second argument still returns an image with 128x128.
|
||||
|
||||
The patch I have supplied uses existing code to scale such an image.
|
||||
|
||||
Signed-off-by: Eric Koegel <eric.koegel@gmail.com>
|
||||
|
||||
diff --git a/garcon-gtk/garcon-gtk-menu.c b/garcon-gtk/garcon-gtk-menu.c
|
||||
index 41990f2..f31a1ed 100644
|
||||
--- a/garcon-gtk/garcon-gtk-menu.c
|
||||
+++ b/garcon-gtk/garcon-gtk-menu.c
|
||||
@@ -650,7 +650,11 @@ garcon_gtk_menu_load_icon (const gchar *icon_name)
|
||||
gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &w, &h);
|
||||
size = MIN (w, h);
|
||||
|
||||
- if (! gtk_icon_theme_has_icon (icon_theme, icon_name))
|
||||
+ if (gtk_icon_theme_has_icon (icon_theme, icon_name))
|
||||
+ {
|
||||
+ pixbuf = gtk_icon_theme_load_icon (icon_theme, icon_name, size, 0, NULL);;
|
||||
+ }
|
||||
+ else
|
||||
{
|
||||
if (g_path_is_absolute (icon_name))
|
||||
{
|
||||
@@ -684,22 +688,23 @@ garcon_gtk_menu_load_icon (const gchar *icon_name)
|
||||
g_free (name);
|
||||
}
|
||||
}
|
||||
+ }
|
||||
|
||||
- /* Turn the pixbuf into a gtk_image */
|
||||
- if (G_LIKELY (pixbuf))
|
||||
- {
|
||||
- /* scale the pixbuf down if it needs it */
|
||||
- GdkPixbuf *tmp = gdk_pixbuf_scale_simple (pixbuf, w, h, GDK_INTERP_BILINEAR);
|
||||
- g_object_unref (pixbuf);
|
||||
- pixbuf = tmp;
|
||||
+ /* Turn the pixbuf into a gtk_image */
|
||||
+ if (G_LIKELY (pixbuf))
|
||||
+ {
|
||||
+ /* scale the pixbuf down if it needs it */
|
||||
+ GdkPixbuf *pixbuf_scaled = gdk_pixbuf_scale_simple (pixbuf, w, h, GDK_INTERP_BILINEAR);
|
||||
+ g_object_unref (G_OBJECT (pixbuf));
|
||||
|
||||
- image = gtk_image_new_from_pixbuf (pixbuf);
|
||||
- g_object_unref (G_OBJECT (pixbuf));
|
||||
- }
|
||||
+ image = gtk_image_new_from_pixbuf (pixbuf_scaled);
|
||||
+ g_object_unref (G_OBJECT (pixbuf_scaled));
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ /* display the placeholder at least */
|
||||
+ image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
|
||||
}
|
||||
-
|
||||
- if (image == NULL)
|
||||
- image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
|
||||
|
||||
return image;
|
||||
}
|
Loading…
Reference in new issue