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

alex pushed a 
commit to branch 
master
in repository xfce/thunar.

commit 6785723678c3e32cfe87e905d200aa70381ddcbc
Author: Alexander Schwinn <ac...@gmx.de>
Date:   Wed Nov 22 23:00:13 2017 +0100

    replaced gtk3 deprecation "gtk_style_render_icon".
    Since almost impossible to replace it with
    suggested "gtk_icon_theme_load_icon", a more simple approach is used now
    to render icons insensitive.
---
 thunar/thunar-icon-renderer.c | 44 +++++++++++++++++++++++++------------------
 1 file changed, 26 insertions(+), 18 deletions(-)

diff --git a/thunar/thunar-icon-renderer.c b/thunar/thunar-icon-renderer.c
index 42b62f7..5338ef4 100644
--- a/thunar/thunar-icon-renderer.c
+++ b/thunar/thunar-icon-renderer.c
@@ -299,6 +299,30 @@ thunar_icon_renderer_get_preferred_height (GtkCellRenderer 
*renderer,
 
 
 static void
+thunar_icon_renderer_color_insensitive (cairo_t   *cr,
+                                        GtkWidget *widget)
+{
+  cairo_pattern_t *source;
+  GdkRGBA          *color;
+  GtkStyleContext *context = gtk_widget_get_style_context (widget);
+
+  cairo_save (cr);
+
+  source = cairo_pattern_reference (cairo_get_source (cr));
+  gtk_style_context_get (context, GTK_STATE_FLAG_INSENSITIVE, 
GTK_STYLE_PROPERTY_COLOR, &color, NULL);
+  gdk_cairo_set_source_rgba (cr, color);
+  gdk_rgba_free (color);
+  cairo_set_operator (cr, CAIRO_OPERATOR_MULTIPLY);
+
+  cairo_mask (cr, source);
+
+  cairo_pattern_destroy (source);
+  cairo_restore (cr);
+}
+
+
+
+static void
 thunar_icon_renderer_color_selected (cairo_t   *cr,
                                      GtkWidget *widget)
 {
@@ -356,7 +380,6 @@ thunar_icon_renderer_render (GtkCellRenderer     *renderer,
   ThunarFileIconState     icon_state;
   ThunarIconRenderer     *icon_renderer = THUNAR_ICON_RENDERER (renderer);
   ThunarIconFactory      *icon_factory;
-  GtkIconSource          *icon_source;
   GtkIconTheme           *icon_theme;
   GdkRectangle            emblem_area;
   GdkRectangle            icon_area;
@@ -449,23 +472,8 @@ thunar_icon_renderer_render (GtkCellRenderer     *renderer,
       g_object_unref (G_OBJECT (clipboard));
 
       /* check if we should render an insensitive icon */
-      if (G_UNLIKELY (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE 
|| !gtk_cell_renderer_get_sensitive (renderer)))
-        {
-          /* allocate an icon source */
-          icon_source = gtk_icon_source_new ();
-          gtk_icon_source_set_pixbuf (icon_source, icon);
-          gtk_icon_source_set_size_wildcarded (icon_source, FALSE);
-          gtk_icon_source_set_size (icon_source, GTK_ICON_SIZE_SMALL_TOOLBAR);
-
-          /* render the insensitive icon */
-          temp = gtk_style_render_icon (gtk_widget_get_style (widget), 
icon_source, gtk_widget_get_direction (widget),
-                                        GTK_STATE_INSENSITIVE, -1, widget, 
"gtkcellrendererpixbuf");
-          g_object_unref (G_OBJECT (icon));
-          icon = temp;
-
-          /* release the icon source */
-          gtk_icon_source_free (icon_source);
-        }
+      if (G_UNLIKELY (gtk_widget_get_state_flags (widget) == 
GTK_STATE_FLAG_INSENSITIVE || !gtk_cell_renderer_get_sensitive (renderer)))
+        thunar_icon_renderer_color_insensitive(cr,widget);
 
       /* render the invalid parts of the icon */
       thunar_gdk_cairo_set_source_pixbuf (cr, icon, icon_area.x, icon_area.y);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits

Reply via email to