--- gtkicontheme.c.orig	2008-06-12 21:27:10.000000000 -0400
+++ gtkicontheme.c	2008-06-12 21:31:46.000000000 -0400
@@ -1,3 +1,5 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
 /* GtkIconTheme - a loader for icon themes
  * gtk-icon-theme.c Copyright (C) 2002, 2003 Red Hat, Inc.
  *
@@ -141,6 +143,8 @@ struct _GtkIconInfo
   gdouble scale;
 
   guint ref_count;
+
+  GtkIconInfo *composite_front_icon_info;
 };
 
 typedef struct
@@ -2653,6 +2657,9 @@ gtk_icon_info_free (GtkIconInfo *icon_in
   if (icon_info->cache_pixbuf)
     g_object_unref (icon_info->cache_pixbuf);
 
+  if (icon_info->composite_front_icon_info)
+    gtk_icon_info_free (icon_info->composite_front_icon_info);
+
   g_slice_free (GtkIconInfo, icon_info);
 }
 
@@ -2817,7 +2824,12 @@ icon_info_ensure_scale_and_pixbuf (GtkIc
           g_object_unref (stream);
         }
 
-      return icon_info->pixbuf != NULL;
+      if (icon_info->pixbuf == NULL)
+        return FALSE;
+
+      image_width = icon_info->desired_size;
+      image_height = icon_info->desired_size;
+      goto add_front_icon;
     }
 
   /* In many cases, the scale can be determined without actual access
@@ -2908,6 +2920,31 @@ icon_info_ensure_scale_and_pixbuf (GtkIc
       g_object_unref (source_pixbuf);
     }
 
+ add_front_icon:
+
+  /* paint front icon on top */
+  if (icon_info->pixbuf != NULL && icon_info->composite_front_icon_info != NULL)
+    {
+      if (icon_info_ensure_scale_and_pixbuf (icon_info->composite_front_icon_info, FALSE))
+        {
+          if (icon_info->composite_front_icon_info->pixbuf != NULL)
+            {
+              /* can't modify a cached version; make a copy */
+              if (icon_info->cache_pixbuf == icon_info->pixbuf)
+                {
+                  g_object_unref (icon_info->pixbuf);
+                  icon_info->pixbuf = gdk_pixbuf_copy (icon_info->cache_pixbuf);
+                }
+              gdk_pixbuf_composite (icon_info->composite_front_icon_info->pixbuf,
+                                    icon_info->pixbuf,
+                                    0, 0, image_width, image_height,
+                                    0, 0, 1.0, 1.0,
+                                    GDK_INTERP_BILINEAR,
+                                    255);
+            }
+        }
+    }
+
   return TRUE;
 }
 
@@ -3355,6 +3392,41 @@ gtk_icon_theme_lookup_by_gicon (GtkIconT
 
       return info;
     }
+  else if (G_IS_COMPOSITED_ICON (icon))
+    {
+      GIcon *back_icon;
+
+      back_icon = g_composited_icon_get_back_icon (G_COMPOSITED_ICON (icon));
+      if (back_icon != NULL)
+        {
+          info = gtk_icon_theme_lookup_by_gicon (icon_theme, back_icon, size, flags);
+          g_object_unref (back_icon);
+          if (info != NULL)
+            {
+              GIcon *front_icon;
+              GtkIconInfo *front_info;
+
+              front_icon = g_composited_icon_get_front_icon (G_COMPOSITED_ICON (icon));
+              if (front_icon == NULL)
+                {
+                  gtk_icon_info_free (info);
+                  return NULL;
+                }
+              else
+                {
+                  front_info = gtk_icon_theme_lookup_by_gicon (icon_theme, front_icon, size, flags);
+                  g_object_unref (front_icon);
+                  if (front_info == NULL)
+                    {
+                      gtk_icon_info_free (info);
+                      return NULL;
+                    }
+                  info->composite_front_icon_info = front_info;
+                }
+            }
+          return info;
+        }
+    }
 
   return NULL;
 }
