]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkicontheme.c
Merge ssh://git.gnome.org/git/gtk+
[~andy/gtk] / gtk / gtkicontheme.c
index bb678d0b75393d02cac1ad35c12f995c126d83a6..7a32269f2ec13b65d84ef644da3555865407d467 100644 (file)
 #endif /* G_OS_WIN32 */
 
 #include "gtkicontheme.h"
+#include "gtkdebug.h"
 #include "gtkiconfactory.h"
 #include "gtkiconcache.h"
 #include "gtkbuiltincache.h"
 #include "gtkintl.h"
 #include "gtkmain.h"
+#include "gtknumerableiconprivate.h"
 #include "gtksettings.h"
 #include "gtkprivate.h"
-#include "gtkalias.h"
 
 #define DEFAULT_THEME_NAME "hicolor"
 
@@ -110,12 +111,6 @@ struct _GtkIconInfo
   /* Information about the source
    */
   gchar *filename;
-#if defined (G_OS_WIN32) && !defined (_WIN64)
-  /* System codepage version of filename, for DLL ABI backward
-   * compatibility functions.
-   */
-  gchar *cp_filename;
-#endif
   GLoadableIcon *loadable;
   GSList *emblem_infos;
 
@@ -143,6 +138,7 @@ struct _GtkIconInfo
   GdkPixbuf *pixbuf;
   GError *load_error;
   gdouble scale;
+  gboolean emblems_applied;
 
   guint ref_count;
 };
@@ -315,7 +311,6 @@ gtk_icon_theme_get_for_screen (GdkScreen *screen)
   GtkIconTheme *icon_theme;
 
   g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
-  g_return_val_if_fail (!screen->closed, NULL);
 
   icon_theme = g_object_get_data (G_OBJECT (screen), "gtk-icon-theme");
   if (!icon_theme)
@@ -558,9 +553,10 @@ gtk_icon_theme_init (GtkIconTheme *icon_theme)
   GtkIconThemePrivate *priv;
   const gchar * const *xdg_data_dirs;
   int i, j;
-  
-  priv = g_type_instance_get_private ((GTypeInstance *)icon_theme,
-                                     GTK_TYPE_ICON_THEME);
+
+  priv = G_TYPE_INSTANCE_GET_PRIVATE (icon_theme,
+                                      GTK_TYPE_ICON_THEME,
+                                      GtkIconThemePrivate);
   icon_theme->priv = priv;
 
   priv->custom_theme = FALSE;
@@ -610,10 +606,7 @@ reset_styles_idle (gpointer user_data)
   priv = icon_theme->priv;
 
   if (priv->screen && priv->is_screen_singleton)
-    {
-      GtkSettings *settings = gtk_settings_get_for_screen (priv->screen);
-      gtk_rc_reset_styles (settings);
-    }
+    gtk_style_context_reset_widgets (priv->screen);
 
   priv->reset_styles_idle = 0;
 
@@ -744,7 +737,7 @@ gtk_icon_theme_set_search_path (GtkIconTheme *icon_theme,
 /**
  * gtk_icon_theme_get_search_path:
  * @icon_theme: a #GtkIconTheme
- * @path: (array length=n_elements) (out): location to store a list of icon theme path directories or %NULL
+ * @path: (allow-none) (array length=n_elements) (out): location to store a list of icon theme path directories or %NULL
  *        The stored value should be freed with g_strfreev().
  * @n_elements: location to store number of elements
  *              in @path, or %NULL
@@ -1322,10 +1315,6 @@ choose_icon (GtkIconTheme       *icon_theme,
        icon_info->filename = g_strdup (unthemed_icon->svg_filename);
       else if (unthemed_icon->no_svg_filename)
        icon_info->filename = g_strdup (unthemed_icon->no_svg_filename);
-#if defined (G_OS_WIN32) && !defined (_WIN64)
-      icon_info->cp_filename = g_locale_from_utf8 (icon_info->filename,
-                                                  -1, NULL, NULL, NULL);
-#endif
 
       icon_info->dir_type = ICON_THEME_DIR_UNTHEMED;
       icon_info->dir_size = size;
@@ -1495,27 +1484,28 @@ gtk_icon_theme_error_quark (void)
  * @icon_theme: a #GtkIconTheme
  * @icon_name: the name of the icon to lookup
  * @size: the desired icon size. The resulting icon may not be
- *        exactly this size; see gtk_icon_info_load_icon().
+ *     exactly this size; see gtk_icon_info_load_icon().
  * @flags: flags modifying the behavior of the icon lookup
- * @error: Location to store error information on failure, or %NULL.
- * 
+ * @error: (allow-none): Location to store error information on failure,
+ *     or %NULL.
+ *
  * Looks up an icon in an icon theme, scales it to the given size
  * and renders it into a pixbuf. This is a convenience function;
  * if more details about the icon are needed, use
  * gtk_icon_theme_lookup_icon() followed by gtk_icon_info_load_icon().
  *
  * Note that you probably want to listen for icon theme changes and
- * update the icon. This is usually done by connecting to the 
+ * update the icon. This is usually done by connecting to the
  * GtkWidget::style-set signal. If for some reason you do not want to
  * update the icon when the icon theme changes, you should consider
  * using gdk_pixbuf_copy() to make a private copy of the pixbuf
- * returned by this function. Otherwise GTK+ may need to keep the old 
+ * returned by this function. Otherwise GTK+ may need to keep the old
  * icon theme loaded, which would be a waste of memory.
- * 
- * Return value: the rendered icon; this may be a newly created icon
- *  or a new reference to an internal icon, so you must not modify
- *  the icon. Use g_object_unref() to release your reference to the
- *  icon. %NULL if the icon isn't found.
+ *
+ * Return value: (transfer full): the rendered icon; this may be a
+ *     newly created icon or a new reference to an internal icon, so
+ *     you must not modify the icon. Use g_object_unref() to release
+ *     your reference to the icon. %NULL if the icon isn't found.
  *
  * Since: 2.4
  **/
@@ -2209,17 +2199,10 @@ theme_lookup_icon (IconTheme          *theme,
           file = g_strconcat (icon_name, string_from_suffix (suffix), NULL);
           icon_info->filename = g_build_filename (min_dir->dir, file, NULL);
           g_free (file);
-#if defined (G_OS_WIN32) && !defined (_WIN64)
-          icon_info->cp_filename = g_locale_from_utf8 (icon_info->filename,
-                                                  -1, NULL, NULL, NULL);
-#endif
         }
       else
         {
           icon_info->filename = NULL;
-#if defined (G_OS_WIN32) && !defined (_WIN64)
-          icon_info->cp_filename = NULL;
-#endif
         }
       
       if (min_dir->icon_data != NULL)
@@ -2598,19 +2581,10 @@ icon_data_free (GtkIconData *icon_data)
 /*
  * GtkIconInfo
  */
-GType
-gtk_icon_info_get_type (void)
-{
-  static GType our_type = 0;
-  
-  if (our_type == 0)
-    our_type = g_boxed_type_register_static (I_("GtkIconInfo"),
-                                            (GBoxedCopyFunc) gtk_icon_info_copy,
-                                            (GBoxedFreeFunc) gtk_icon_info_free);
 
-
-  return our_type;
-}
+G_DEFINE_BOXED_TYPE (GtkIconInfo, gtk_icon_info,
+                     gtk_icon_info_copy,
+                     gtk_icon_info_free)
 
 static GtkIconInfo *
 icon_info_new (void)
@@ -2675,9 +2649,6 @@ gtk_icon_info_free (GtkIconInfo *icon_info)
     return;
  
   g_free (icon_info->filename);
-#if defined (G_OS_WIN32) && !defined (_WIN64)
-  g_free (icon_info->cp_filename);
-#endif
   if (icon_info->loadable)
     g_object_unref (icon_info->loadable);
   g_slist_foreach (icon_info->emblem_infos, (GFunc)gtk_icon_info_free, NULL);
@@ -2784,6 +2755,9 @@ apply_emblems (GtkIconInfo *info)
   if (info->emblem_infos == NULL)
     return;
 
+  if (info->emblems_applied)
+    return;
+
   w = gdk_pixbuf_get_width (info->pixbuf);
   h = gdk_pixbuf_get_height (info->pixbuf);
 
@@ -2846,6 +2820,8 @@ apply_emblems (GtkIconInfo *info)
       g_object_unref (info->pixbuf);
       info->pixbuf = icon;
     }
+
+  info->emblems_applied = TRUE;
 }
 
 /* This function contains the complicated logic for deciding
@@ -2867,7 +2843,10 @@ icon_info_ensure_scale_and_pixbuf (GtkIconInfo  *icon_info,
     return TRUE;
 
   if (icon_info->pixbuf)
-    return TRUE;
+    {
+      apply_emblems (icon_info);
+      return TRUE;
+    }
 
   if (icon_info->load_error)
     return FALSE;
@@ -3035,8 +3014,9 @@ icon_info_ensure_scale_and_pixbuf (GtkIconInfo  *icon_info,
 /**
  * gtk_icon_info_load_icon:
  * @icon_info: a #GtkIconInfo structure from gtk_icon_theme_lookup_icon()
- * @error: location to store error information on failure, or %NULL.
- * 
+ * @error: (allow-none): location to store error information on failure,
+ *     or %NULL.
+ *
  * Renders an icon previously looked up in an icon theme using
  * gtk_icon_theme_lookup_icon(); the size will be based on the size
  * passed to gtk_icon_theme_lookup_icon(). Note that the resulting
@@ -3047,12 +3027,12 @@ icon_info_ensure_scale_and_pixbuf (GtkIconInfo  *icon_info,
  * up too far. (This maintains sharpness.). This behaviour can be changed
  * by passing the %GTK_ICON_LOOKUP_FORCE_SIZE flag when obtaining
  * the #GtkIconInfo. If this flag has been specified, the pixbuf
- * returned by this function will be scaled to the exact size. 
- * 
- * Return value: the rendered icon; this may be a newly created icon
- *  or a new reference to an internal icon, so you must not modify
- *  the icon. Use g_object_unref() to release your reference to the
- *  icon.
+ * returned by this function will be scaled to the exact size.
+ *
+ * Return value: (transfer full): the rendered icon; this may be a newly
+ *     created icon or a new reference to an internal icon, so you must
+ *     not modify the icon. Use g_object_unref() to release your reference
+ *     to the icon.
  *
  * Since: 2.4
  **/
@@ -3079,6 +3059,346 @@ gtk_icon_info_load_icon (GtkIconInfo *icon_info,
   return g_object_ref (icon_info->pixbuf);
 }
 
+static gchar *
+gdk_color_to_css (GdkColor *color)
+{
+  return g_strdup_printf ("rgb(%d,%d,%d)",
+                          color->red >> 8,
+                          color->green >> 8,
+                          color->blue >> 8);
+}
+
+static gchar *
+gdk_rgba_to_css (GdkRGBA *color)
+{
+  return g_strdup_printf ("rgba(%d,%d,%d,%f)",
+                          (gint)(color->red * 255),
+                          (gint)(color->green * 255),
+                          (gint)(color->blue * 255),
+                          color->alpha);
+}
+
+static GdkPixbuf *
+_gtk_icon_info_load_symbolic_internal (GtkIconInfo  *icon_info,
+                                       const gchar  *css_fg,
+                                       const gchar  *css_success,
+                                       const gchar  *css_warning,
+                                       const gchar  *css_error,
+                                       GError      **error)
+{
+  GInputStream *stream;
+  GdkPixbuf *pixbuf;
+  gchar *data;
+  gchar *success, *warning, *err;
+
+  /* css_fg can't possibly have failed, otherwise
+   * that would mean we have a broken style */
+  g_return_val_if_fail (css_fg != NULL, NULL);
+
+  success = warning = err = NULL;
+
+  if (!css_success)
+    {
+      GdkColor success_default_color = { 0, 0x4e00, 0x9a00, 0x0600 };
+      success = gdk_color_to_css (&success_default_color);
+    }
+  if (!css_warning)
+    {
+      GdkColor warning_default_color = { 0, 0xf500, 0x7900, 0x3e00 };
+      warning = gdk_color_to_css (&warning_default_color);
+    }
+  if (!css_error)
+    {
+      GdkColor error_default_color = { 0, 0xcc00, 0x0000, 0x0000 };
+      err = gdk_color_to_css (&error_default_color);
+    }
+
+
+  data = g_strconcat ("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"
+                      "<svg version=\"1.1\"\n"
+                      "     xmlns=\"http://www.w3.org/2000/svg\"\n"
+                      "     xmlns:xi=\"http://www.w3.org/2001/XInclude\"\n"
+                      "     width=\"16\"\n"
+                      "     height=\"16\">\n"
+                      "  <style type=\"text/css\">\n"
+                      "    rect,path {\n"
+                      "      fill: ", css_fg," !important;\n"
+                      "    }\n"
+                      "    .warning {\n"
+                      "      fill: ", css_warning ? css_warning : warning," !important;\n"
+                      "    }\n"
+                      "    .error {\n"
+                      "      fill: ", css_error ? css_error : err," !important;\n"
+                      "    }\n"
+                      "    .success {\n"
+                      "      fill: ", css_success ? css_success : success," !important;\n"
+                      "    }\n"
+                      "  </style>\n"
+                      "  <xi:include href=\"", icon_info->filename, "\"/>\n"
+                      "</svg>",
+                      NULL);
+  g_free (warning);
+  g_free (err);
+  g_free (success);
+
+  stream = g_memory_input_stream_new_from_data (data, -1, g_free);
+  pixbuf = gdk_pixbuf_new_from_stream_at_scale (stream,
+                                                icon_info->desired_size,
+                                                icon_info->desired_size,
+                                                TRUE,
+                                                NULL,
+                                                error);
+  g_object_unref (stream);
+
+  return pixbuf;
+}
+
+/**
+ * gtk_icon_info_load_symbolic:
+ * @icon_info: a #GtkIconInfo
+ * @fg: a #GdkRGBA representing the foreground color of the icon
+ * @success_color: (allow-none): a #GdkRGBA representing the warning color
+ *     of the icon or %NULL to use the default color
+ * @warning_color: (allow-none): a #GdkRGBA representing the warning color
+ *     of the icon or %NULL to use the default color
+ * @error_color: (allow-none): a #GdkRGBA representing the error color
+ *     of the icon or %NULL to use the default color (allow-none)
+ * @was_symbolic: (allow-none): a #gboolean, returns whether the loaded icon
+ *     was a symbolic one and whether the @fg color was applied to it.
+ * @error: (allow-none): location to store error information on failure,
+ *     or %NULL.
+ *
+ * Loads an icon, modifying it to match the system colours for the foreground,
+ * success, warning and error colors provided. If the icon is not a symbolic
+ * one, the function will return the result from gtk_icon_info_load_icon().
+ *
+ * This allows loading symbolic icons that will match the system theme.
+ *
+ * Unless you are implementing a widget, you will want to use
+ * g_themed_icon_new_with_default_fallbacks() to load the icon.
+ *
+ * As implementation details, the icon loaded needs to be of SVG type,
+ * contain the "symbolic" term as the last component of the icon name,
+ * and use the 'fg', 'success', 'warning' and 'error' CSS styles in the
+ * SVG file itself.
+ *
+ * See the <ulink url="http://www.freedesktop.org/wiki/SymbolicIcons">Symbolic Icons spec</ulink>
+ * for more information about symbolic icons.
+ *
+ * Return value: (transfer full): a #GdkPixbuf representing the loaded icon
+ *
+ * Since: 3.0
+ **/
+GdkPixbuf *
+gtk_icon_info_load_symbolic (GtkIconInfo  *icon_info,
+                             GdkRGBA      *fg,
+                             GdkRGBA      *success_color,
+                             GdkRGBA      *warning_color,
+                             GdkRGBA      *error_color,
+                             gboolean     *was_symbolic,
+                             GError      **error)
+{
+  GdkPixbuf *pixbuf;
+  gchar *css_fg;
+  gchar *css_success;
+  gchar *css_warning;
+  gchar *css_error;
+
+  g_return_val_if_fail (fg != NULL, NULL);
+
+  if (!icon_info->filename ||
+      !g_str_has_suffix (icon_info->filename, "-symbolic.svg"))
+    {
+      if (was_symbolic)
+        *was_symbolic = FALSE;
+      return gtk_icon_info_load_icon (icon_info, error);
+    }
+
+  if (was_symbolic)
+    *was_symbolic = TRUE;
+
+  css_fg = gdk_rgba_to_string (fg);
+
+  css_success = css_warning = css_error = NULL;
+
+  if (warning_color)
+    css_warning = gdk_rgba_to_string (warning_color);
+
+  if (error_color)
+    css_error = gdk_rgba_to_string (error_color);
+
+  if (success_color)
+    css_success = gdk_rgba_to_string (success_color);
+
+  pixbuf = _gtk_icon_info_load_symbolic_internal (icon_info,
+                                                  css_fg, css_success,
+                                                  css_warning, css_error,
+                                                  error);
+  g_free (css_fg);
+  g_free (css_warning);
+  g_free (css_success);
+  g_free (css_error);
+
+  return pixbuf;
+}
+
+/**
+ * gtk_icon_info_load_symbolic_for_context:
+ * @icon_info: a #GtkIconInfo
+ * @context: a #GtkStyleContext
+ * @was_symbolic: (allow-none): a #gboolean, returns whether the loaded icon
+ *     was a symbolic one and whether the @fg color was applied to it.
+ * @error: (allow-none): location to store error information on failure,
+ *     or %NULL.
+ *
+ * Loads an icon, modifying it to match the system colors for the foreground,
+ * success, warning and error colors provided. If the icon is not a symbolic
+ * one, the function will return the result from gtk_icon_info_load_icon().
+ * This function uses the regular foreground color and the symbolic colors
+ * with the names "success_color", "warning_color" and "error_color" from
+ * the context.
+ *
+ * This allows loading symbolic icons that will match the system theme.
+ *
+ * See gtk_icon_info_load_symbolic() for more details.
+ *
+ * Return value: (transfer full): a #GdkPixbuf representing the loaded icon
+ *
+ * Since: 3.0
+ **/
+GdkPixbuf *
+gtk_icon_info_load_symbolic_for_context (GtkIconInfo      *icon_info,
+                                         GtkStyleContext  *context,
+                                         gboolean         *was_symbolic,
+                                         GError          **error)
+{
+  GdkPixbuf *pixbuf;
+  GdkRGBA *color = NULL;
+  GdkRGBA rgba;
+  gchar *css_fg = NULL, *css_success;
+  gchar *css_warning, *css_error;
+  GtkStateFlags state;
+
+  if (!icon_info->filename ||
+      !g_str_has_suffix (icon_info->filename, "-symbolic.svg"))
+    {
+      if (was_symbolic)
+        *was_symbolic = FALSE;
+      return gtk_icon_info_load_icon (icon_info, error);
+    }
+
+  if (was_symbolic)
+    *was_symbolic = TRUE;
+
+  state = gtk_style_context_get_state (context);
+  gtk_style_context_get (context, state, "color", &color, NULL);
+  if (color)
+    {
+      css_fg = gdk_rgba_to_css (color);
+      gdk_rgba_free (color);
+    }
+
+  css_success = css_warning = css_error = NULL;
+
+  if (gtk_style_context_lookup_color (context, "success_color", &rgba))
+    css_success = gdk_rgba_to_css (&rgba);
+
+  if (gtk_style_context_lookup_color (context, "warning_color", &rgba))
+    css_warning = gdk_rgba_to_css (&rgba);
+
+  if (gtk_style_context_lookup_color (context, "error_color", &rgba))
+    css_error = gdk_rgba_to_css (&rgba);
+
+  pixbuf = _gtk_icon_info_load_symbolic_internal (icon_info,
+                                                  css_fg, css_success,
+                                                  css_warning, css_error,
+                                                  error);
+
+  g_free (css_fg);
+  g_free (css_success);
+  g_free (css_warning);
+  g_free (css_error);
+
+  return pixbuf;
+}
+
+/**
+ * gtk_icon_info_load_symbolic_for_style:
+ * @icon_info: a #GtkIconInfo
+ * @style: a #GtkStyle to take the colors from
+ * @state: the widget state to use for colors
+ * @was_symbolic: (allow-none): a #gboolean, returns whether the loaded icon
+ *     was a symbolic one and whether the @fg color was applied to it.
+ * @error: (allow-none): location to store error information on failure,
+ *     or %NULL.
+ *
+ * Loads an icon, modifying it to match the system colours for the foreground,
+ * success, warning and error colors provided. If the icon is not a symbolic
+ * one, the function will return the result from gtk_icon_info_load_icon().
+ *
+ * This allows loading symbolic icons that will match the system theme.
+ *
+ * See gtk_icon_info_load_symbolic() for more details.
+ *
+ * Return value: (transfer full): a #GdkPixbuf representing the loaded icon
+ *
+ * Since: 3.0
+ *
+ * Deprecated: 3.0: Use gtk_icon_info_load_symbolic_for_context() instead
+ **/
+GdkPixbuf *
+gtk_icon_info_load_symbolic_for_style (GtkIconInfo   *icon_info,
+                                       GtkStyle      *style,
+                                       GtkStateType   state,
+                                       gboolean      *was_symbolic,
+                                       GError       **error)
+{
+  GdkPixbuf *pixbuf;
+  GdkColor success_color;
+  GdkColor warning_color;
+  GdkColor error_color;
+  GdkColor *fg;
+  gchar *css_fg, *css_success;
+  gchar *css_warning, *css_error;
+
+  if (!icon_info->filename ||
+      !g_str_has_suffix (icon_info->filename, "-symbolic.svg"))
+    {
+      if (was_symbolic)
+        *was_symbolic = FALSE;
+      return gtk_icon_info_load_icon (icon_info, error);
+    }
+
+  if (was_symbolic)
+    *was_symbolic = TRUE;
+
+  fg = &style->fg[state];
+  css_fg = gdk_color_to_css (fg);
+
+  css_success = css_warning = css_error = NULL;
+
+  if (gtk_style_lookup_color (style, "success_color", &success_color))
+    css_success = gdk_color_to_css (&success_color);
+
+  if (gtk_style_lookup_color (style, "warning_color", &warning_color))
+    css_warning = gdk_color_to_css (&warning_color);
+
+  if (gtk_style_lookup_color (style, "error_color", &error_color))
+    css_error = gdk_color_to_css (&error_color);
+
+  pixbuf = _gtk_icon_info_load_symbolic_internal (icon_info,
+                                                  css_fg, css_success,
+                                                  css_warning, css_error,
+                                                  error);
+
+  g_free (css_fg);
+  g_free (css_success);
+  g_free (css_warning);
+  g_free (css_error);
+
+  return pixbuf;
+}
+
 /**
  * gtk_icon_info_set_raw_coordinates:
  * @icon_info: a #GtkIconInfo
@@ -3192,9 +3512,9 @@ gtk_icon_info_get_embedded_rect (GtkIconInfo  *icon_info,
 /**
  * gtk_icon_info_get_attach_points:
  * @icon_info: a #GtkIconInfo
- * @points: (array length=n_points) (out): location to store pointer to an array of points, or %NULL
+ * @points: (allow-none) (array length=n_points) (out): location to store pointer to an array of points, or %NULL
  *          free the array of points with g_free().
- * @n_points: location to store the number of points in @points, or %NULL
+ * @n_points: (allow-none): location to store the number of points in @points, or %NULL
  * 
  * Fetches the set of attach points for an icon. An attach point
  * is a location in the icon that can be used as anchor points for attaching
@@ -3483,6 +3803,9 @@ gtk_icon_theme_lookup_by_gicon (GtkIconTheme       *icon_theme,
       GList *list, *l;
       GtkIconInfo *emblem_info;
 
+      if (GTK_IS_NUMERABLE_ICON (icon))
+        _gtk_numerable_icon_set_background_icon_size (GTK_NUMERABLE_ICON (icon), size / 2);
+
       base = g_emblemed_icon_get_icon (G_EMBLEMED_ICON (icon));
       info = gtk_icon_theme_lookup_by_gicon (icon_theme, base, size, flags);
       if (info)
@@ -3491,7 +3814,8 @@ gtk_icon_theme_lookup_by_gicon (GtkIconTheme       *icon_theme,
           for (l = list; l; l = l->next)
             {
               emblem = g_emblem_get_icon (G_EMBLEM (l->data));
-              emblem_info = gtk_icon_theme_lookup_by_gicon (icon_theme, emblem, size / 2, flags);
+             /* always force size for emblems */
+              emblem_info = gtk_icon_theme_lookup_by_gicon (icon_theme, emblem, size / 2, flags | GTK_ICON_LOOKUP_FORCE_SIZE);
               if (emblem_info)
                 info->emblem_infos = g_slist_prepend (info->emblem_infos, emblem_info);
             }
@@ -3499,6 +3823,39 @@ gtk_icon_theme_lookup_by_gicon (GtkIconTheme       *icon_theme,
 
       return info;
     }
+  else if (GDK_IS_PIXBUF (icon))
+    {
+      GdkPixbuf *pixbuf;
+
+      pixbuf = GDK_PIXBUF (icon);
+
+      if ((flags & GTK_ICON_LOOKUP_FORCE_SIZE) != 0)
+       {
+         gint width, height, max;
+         gdouble scale;
+         GdkPixbuf *scaled;
+
+         width = gdk_pixbuf_get_width (pixbuf);
+         height = gdk_pixbuf_get_height (pixbuf);
+         max = MAX (width, height);
+         scale = (gdouble) size / (gdouble) max;
+
+         scaled = gdk_pixbuf_scale_simple (pixbuf,
+                                           0.5 + width * scale,
+                                           0.5 + height * scale,
+                                           GDK_INTERP_BILINEAR);
+
+         info = gtk_icon_info_new_for_pixbuf (icon_theme, scaled);
+
+         g_object_unref (scaled);
+       }
+      else
+       {
+         info = gtk_icon_info_new_for_pixbuf (icon_theme, pixbuf);
+       }
+
+      return info;
+    }
 
   return NULL;
 }
@@ -3530,97 +3887,3 @@ gtk_icon_info_new_for_pixbuf (GtkIconTheme *icon_theme,
 
   return info;
 }
-
-#if defined (G_OS_WIN32) && !defined (_WIN64)
-
-/* DLL ABI stability backward compatibility versions */
-
-#undef gtk_icon_theme_set_search_path
-
-void
-gtk_icon_theme_set_search_path (GtkIconTheme *icon_theme,
-                               const gchar  *path[],
-                               gint          n_elements)
-{
-  const gchar **utf8_path;
-  gint i;
-
-  utf8_path = g_new (const gchar *, n_elements);
-
-  for (i = 0; i < n_elements; i++)
-    utf8_path[i] = g_locale_to_utf8 (path[i], -1, NULL, NULL, NULL);
-
-  gtk_icon_theme_set_search_path_utf8 (icon_theme, utf8_path, n_elements);
-
-  for (i = 0; i < n_elements; i++)
-    g_free ((gchar *) utf8_path[i]);
-
-  g_free (utf8_path);
-}
-
-#undef gtk_icon_theme_get_search_path
-
-void
-gtk_icon_theme_get_search_path (GtkIconTheme      *icon_theme,
-                               gchar            **path[],
-                               gint              *n_elements)
-{
-  gint i, n;
-
-  gtk_icon_theme_get_search_path_utf8 (icon_theme, path, &n);
-
-  if (n_elements)
-    *n_elements = n;
-
-  if (path)
-    {
-      for (i = 0; i < n; i++)
-       {
-         gchar *tem = (*path)[i];
-
-         (*path)[i] = g_locale_from_utf8 ((*path)[i], -1, NULL, NULL, NULL);
-         g_free (tem);
-       }
-    }
-}
-
-#undef gtk_icon_theme_append_search_path
-
-void
-gtk_icon_theme_append_search_path (GtkIconTheme *icon_theme,
-                                  const gchar  *path)
-{
-  gchar *utf8_path = g_locale_from_utf8 (path, -1, NULL, NULL, NULL);
-
-  gtk_icon_theme_append_search_path_utf8 (icon_theme, utf8_path);
-
-  g_free (utf8_path);
-}
-
-#undef gtk_icon_theme_prepend_search_path
-
-void
-gtk_icon_theme_prepend_search_path (GtkIconTheme *icon_theme,
-                                   const gchar  *path)
-{
-  gchar *utf8_path = g_locale_from_utf8 (path, -1, NULL, NULL, NULL);
-
-  gtk_icon_theme_prepend_search_path_utf8 (icon_theme, utf8_path);
-
-  g_free (utf8_path);
-}
-
-#undef gtk_icon_info_get_filename
-
-G_CONST_RETURN gchar *
-gtk_icon_info_get_filename (GtkIconInfo *icon_info)
-{
-  g_return_val_if_fail (icon_info != NULL, NULL);
-
-  return icon_info->cp_filename;
-}
-
-#endif
-
-#define __GTK_ICON_THEME_C__
-#include "gtkaliasdef.c"