summary refs log tree commit diff
path: root/pkgs/desktops/xfce4-13/garcon
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/desktops/xfce4-13/garcon')
-rw-r--r--pkgs/desktops/xfce4-13/garcon/12700.patch37
-rw-r--r--pkgs/desktops/xfce4-13/garcon/13785.patch75
-rw-r--r--pkgs/desktops/xfce4-13/garcon/default.nix12
3 files changed, 124 insertions, 0 deletions
diff --git a/pkgs/desktops/xfce4-13/garcon/12700.patch b/pkgs/desktops/xfce4-13/garcon/12700.patch
new file mode 100644
index 000000000000..fda36d696510
--- /dev/null
+++ b/pkgs/desktops/xfce4-13/garcon/12700.patch
@@ -0,0 +1,37 @@
+From: Yegor Timoshenko <yegortimoshenko@gmail.com>
+Date: Thu, 14 Dec 2017 21:13:02 +0000
+Subject: [PATCH] Decrement allocation counter on item unref (#12700)
+
+diff --git a/garcon/garcon-menu-item-pool.c b/garcon/garcon-menu-item-pool.c
+index 2017180..355e520 100644
+--- a/garcon/garcon-menu-item-pool.c
++++ b/garcon/garcon-menu-item-pool.c
+@@ -191,7 +191,12 @@ garcon_menu_item_pool_filter_exclude (const gchar    *desktop_id,
+   g_return_val_if_fail (GARCON_IS_MENU_ITEM (item), FALSE);
+   g_return_val_if_fail (node != NULL, FALSE);
+
+-  return garcon_menu_node_tree_rule_matches (node, item);
++  gboolean matches = garcon_menu_node_tree_rule_matches (node, item);
++
++  if (matches)
++    garcon_menu_item_increment_allocated (item);
++
++  return matches;
+ }
+
+
+diff --git a/garcon/garcon-menu-item.c b/garcon/garcon-menu-item.c
+index ca8cb63..b44acfe 100644
+--- a/garcon/garcon-menu-item.c
++++ b/garcon/garcon-menu-item.c
+@@ -1908,6 +1908,8 @@ garcon_menu_item_unref (GarconMenuItem *item)
+ {
+   g_return_if_fail (GARCON_IS_MENU_ITEM (item));
+
++  garcon_menu_item_decrement_allocated (item);
++
+   /* Decrement the reference counter */
+   g_object_unref (G_OBJECT (item));
+ }
+--
+2.15.1
diff --git a/pkgs/desktops/xfce4-13/garcon/13785.patch b/pkgs/desktops/xfce4-13/garcon/13785.patch
new file mode 100644
index 000000000000..1b723d21d60a
--- /dev/null
+++ b/pkgs/desktops/xfce4-13/garcon/13785.patch
@@ -0,0 +1,75 @@
+From 4387496fe332a50945e7db76bc2196b419656fe3 Mon Sep 17 00:00:00 2001
+From: Stefan Berzl <stefanberzl@gmail.com>
+Date: Mon, 21 Aug 2017 18:39:07 +0300
+Subject: [PATCH] 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>
+---
+ garcon-gtk/garcon-gtk-menu.c | 33 +++++++++++++++++++--------------
+ 1 file changed, 19 insertions(+), 14 deletions(-)
+
+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;
+ }
diff --git a/pkgs/desktops/xfce4-13/garcon/default.nix b/pkgs/desktops/xfce4-13/garcon/default.nix
new file mode 100644
index 000000000000..a88d64702a1a
--- /dev/null
+++ b/pkgs/desktops/xfce4-13/garcon/default.nix
@@ -0,0 +1,12 @@
+{ mkXfceDerivation, gtk2 ? null, gtk3, libxfce4ui, libxfce4util }:
+
+mkXfceDerivation rec {
+  category = "xfce";
+  pname = "garcon";
+  version = "0.6.1";
+
+  sha256 = "19k8bwn29x7hkg882pxv5xxmrbfagdqgkxg166pwz2k0prab6hl8";
+
+  patches = [ ./12700.patch ./13785.patch ];
+  buildInputs = [ gtk2 gtk3 libxfce4ui libxfce4util ];
+}