[gtk+] Remove GtkIconFactory



commit ed184b393593059f9c99280fb9ca685a36a483a1
Author: Timm Bäder <mail baedert org>
Date:   Wed Oct 5 18:35:06 2016 +0200

    Remove GtkIconFactory
    
    Move the icon size lookup API into gtkicontheme.c

 docs/reference/gtk/gtk4-sections.txt   |   69 -
 gtk/deprecated/Makefile.inc            |    3 -
 gtk/deprecated/gtkaction.c             |    1 -
 gtk/deprecated/gtkactiongroup.c        |   19 +-
 gtk/deprecated/gtkiconfactory.c        | 2584 --------------------------------
 gtk/deprecated/gtkiconfactory.h        |  217 ---
 gtk/deprecated/gtkiconfactoryprivate.h |   32 -
 gtk/deprecated/gtkstock.c              |    4 +-
 gtk/deprecated/gtkthemingengine.c      |    2 +-
 gtk/gtk.h                              |    1 -
 gtk/gtkcellrendererpixbuf.c            |    1 -
 gtk/gtkcellrendererspinner.c           |    1 -
 gtk/gtkdnd-quartz.c                    |    1 -
 gtk/gtkfilechooserbutton.c             |    1 -
 gtk/gtkiconhelper.c                    |    1 -
 gtk/gtkicontheme.c                     |  148 ++-
 gtk/gtkicontheme.h                     |    8 +
 gtk/gtkrender.c                        |   99 --
 gtk/gtkrender.h                        |    4 -
 gtk/gtkrenderprivate.h                 |    4 -
 gtk/gtkstylecontext.c                  |   32 -
 gtk/gtkstylecontext.h                  |    3 -
 gtk/gtkstyleprovider.c                 |   31 -
 gtk/gtkstyleprovider.h                 |    8 -
 gtk/gtktoolbutton.c                    |    1 +
 gtk/gtkwidget.c                        |   48 -
 gtk/gtkwidget.h                        |    5 -
 testsuite/gtk/builder.c                |   71 +-
 28 files changed, 161 insertions(+), 3238 deletions(-)
---
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index 1e63614..9c137e1 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -5810,7 +5810,6 @@ gtk_style_context_get_font
 gtk_style_context_invalidate
 gtk_style_context_state_is_running
 gtk_style_context_lookup_color
-gtk_style_context_lookup_icon_set
 gtk_style_context_notify_state_change
 gtk_style_context_pop_animatable_region
 gtk_style_context_push_animatable_region
@@ -5865,7 +5864,6 @@ gtk_render_line
 gtk_render_option
 gtk_render_slider
 gtk_render_activity
-gtk_render_icon_pixbuf
 gtk_render_icon_surface
 gtk_render_icon
 gtk_render_insertion_cursor
@@ -6414,73 +6412,6 @@ gtk_icon_theme_error_quark
 </SECTION>
 
 <SECTION>
-<FILE>gtkiconfactory</FILE>
-<TITLE>Themeable Stock Images</TITLE>
-GtkIconSource
-GtkIconFactory
-GtkIconFactoryClass
-GtkIconSet
-GtkIconSize
-gtk_icon_source_copy
-gtk_icon_source_free
-gtk_icon_factory_add
-gtk_icon_factory_add_default
-gtk_icon_factory_lookup
-gtk_icon_factory_lookup_default
-gtk_icon_factory_new
-gtk_icon_factory_remove_default
-gtk_icon_set_add_source
-gtk_icon_set_copy
-gtk_icon_set_new
-gtk_icon_set_new_from_pixbuf
-gtk_icon_set_ref
-gtk_icon_set_render_icon_pixbuf
-gtk_icon_set_render_icon_surface
-gtk_icon_set_unref
-gtk_icon_size_lookup
-gtk_icon_size_lookup_for_settings
-gtk_icon_size_register
-gtk_icon_size_register_alias
-gtk_icon_size_from_name
-gtk_icon_size_get_name
-gtk_icon_set_get_sizes
-gtk_icon_source_get_direction
-gtk_icon_source_get_direction_wildcarded
-gtk_icon_source_get_filename
-gtk_icon_source_get_pixbuf
-gtk_icon_source_get_icon_name
-gtk_icon_source_get_size
-gtk_icon_source_get_size_wildcarded
-gtk_icon_source_get_state
-gtk_icon_source_get_state_wildcarded
-gtk_icon_source_new
-gtk_icon_source_set_direction
-gtk_icon_source_set_direction_wildcarded
-gtk_icon_source_set_filename
-gtk_icon_source_set_pixbuf
-gtk_icon_source_set_icon_name
-gtk_icon_source_set_size
-gtk_icon_source_set_size_wildcarded
-gtk_icon_source_set_state
-gtk_icon_source_set_state_wildcarded
-<SUBSECTION Standard>
-GTK_TYPE_ICON_FACTORY
-GTK_ICON_FACTORY
-GTK_IS_ICON_FACTORY
-GTK_ICON_FACTORY_CLASS
-GTK_ICON_FACTORY_GET_CLASS
-GTK_IS_ICON_FACTORY_CLASS
-GTK_TYPE_ICON_SET
-GTK_TYPE_ICON_SOURCE
-<SUBSECTION Private>
-GtkIconFactoryPrivate
-gtk_icon_factory_get_type
-gtk_icon_set_get_type
-gtk_icon_source_get_type
-</SECTION>
-
-
-<SECTION>
 <FILE>gtkprintoperation</FILE>
 <TITLE>High-level Printing API</TITLE>
 GtkPrintOperation
diff --git a/gtk/deprecated/Makefile.inc b/gtk/deprecated/Makefile.inc
index 932ed2b..beefc36 100644
--- a/gtk/deprecated/Makefile.inc
+++ b/gtk/deprecated/Makefile.inc
@@ -4,7 +4,6 @@ deprecated_h_sources =                  \
        deprecated/gtkactiongroup.h     \
        deprecated/gtkalignment.h       \
        deprecated/gtkgradient.h        \
-       deprecated/gtkiconfactory.h     \
        deprecated/gtkradioaction.h     \
        deprecated/gtkrecentaction.h    \
        deprecated/gtkstock.h           \
@@ -17,7 +16,6 @@ deprecated_h_sources =                        \
 
 deprecated_private_h_sources =                 \
        deprecated/gtkgradientprivate.h         \
-       deprecated/gtkiconfactoryprivate.h      \
        deprecated/gtkstylepropertiesprivate.h  \
        deprecated/gtksymboliccolorprivate.h
 
@@ -27,7 +25,6 @@ deprecated_c_sources =                        \
        deprecated/gtkactiongroup.c     \
        deprecated/gtkalignment.c       \
        deprecated/gtkgradient.c        \
-       deprecated/gtkiconfactory.c     \
        deprecated/gtkradioaction.c     \
        deprecated/gtkrecentaction.c    \
        deprecated/gtkstock.c           \
diff --git a/gtk/deprecated/gtkaction.c b/gtk/deprecated/gtkaction.c
index b684ccd..810c448 100644
--- a/gtk/deprecated/gtkaction.c
+++ b/gtk/deprecated/gtkaction.c
@@ -89,7 +89,6 @@
 #include "gtkactiongroup.h"
 #include "gtkaccellabel.h"
 #include "gtkbutton.h"
-#include "gtkiconfactory.h"
 #include "gtkimage.h"
 #include "gtkintl.h"
 #include "gtklabel.h"
diff --git a/gtk/deprecated/gtkactiongroup.c b/gtk/deprecated/gtkactiongroup.c
index 45eeb1c..d163db2 100644
--- a/gtk/deprecated/gtkactiongroup.c
+++ b/gtk/deprecated/gtkactiongroup.c
@@ -90,7 +90,6 @@
 
 #include "gtkactiongroup.h"
 #include "gtkbuildable.h"
-#include "gtkiconfactory.h"
 #include "gtkicontheme.h"
 #include "gtkstock.h"
 #include "gtktoggleaction.h"
@@ -1314,14 +1313,7 @@ gtk_action_group_add_toggle_actions_full (GtkActionGroup             *action_gro
 
       if (entries[i].stock_id) 
        {
-          G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
-
-         if (gtk_icon_factory_lookup_default (entries[i].stock_id))
-           g_object_set (action, "stock-id", entries[i].stock_id, NULL);
-         else
-           g_object_set (action, "icon-name", entries[i].stock_id, NULL);
-
-          G_GNUC_END_IGNORE_DEPRECATIONS;
+          g_object_set (action, "icon-name", entries[i].stock_id, NULL);
        }
 
       gtk_toggle_action_set_active (action, entries[i].is_active);
@@ -1438,14 +1430,7 @@ gtk_action_group_add_radio_actions_full (GtkActionGroup            *action_group
 
       if (entries[i].stock_id) 
        {
-          G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
-
-         if (gtk_icon_factory_lookup_default (entries[i].stock_id))
-           g_object_set (action, "stock-id", entries[i].stock_id, NULL);
-         else
-           g_object_set (action, "icon-name", entries[i].stock_id, NULL);
-
-          G_GNUC_END_IGNORE_DEPRECATIONS;
+          g_object_set (action, "icon-name", entries[i].stock_id, NULL);
        }
 
       if (i == 0) 
diff --git a/gtk/deprecated/gtkstock.c b/gtk/deprecated/gtkstock.c
index 137fe68..6d0d40e 100644
--- a/gtk/deprecated/gtkstock.c
+++ b/gtk/deprecated/gtkstock.c
@@ -30,8 +30,6 @@
 
 #include "gtkprivate.h"
 #include "gtkstock.h"
-#include "gtkiconfactory.h"
-#include "deprecated/gtkiconfactoryprivate.h"
 #include "gtkintl.h"
 
 /**
@@ -245,7 +243,7 @@ gtk_stock_list_ids (void)
   init_stock_hash ();
 
   ids = g_hash_table_get_keys (stock_hash);
-  icon_ids = _gtk_icon_factory_list_ids ();
+  icon_ids = NULL;
   ids = g_list_concat (ids, icon_ids);
 
   ids = g_list_sort (ids, (GCompareFunc)strcmp);
diff --git a/gtk/deprecated/gtkthemingengine.c b/gtk/deprecated/gtkthemingengine.c
index 24dbc79..aa8e402 100644
--- a/gtk/deprecated/gtkthemingengine.c
+++ b/gtk/deprecated/gtkthemingengine.c
@@ -1183,7 +1183,7 @@ gtk_theming_engine_render_icon_pixbuf (GtkThemingEngine    *engine,
                                        const GtkIconSource *source,
                                        GtkIconSize          size)
 {
-  return gtk_render_icon_pixbuf (engine->priv->context, source, size);
+  return NULL;
 }
 
 static void
diff --git a/gtk/gtk.h b/gtk/gtk.h
index 65eace1..d20ea12 100644
--- a/gtk/gtk.h
+++ b/gtk/gtk.h
@@ -249,7 +249,6 @@
 #include <gtk/deprecated/gtkactiongroup.h>
 #include <gtk/deprecated/gtkalignment.h>
 #include <gtk/deprecated/gtkgradient.h>
-#include <gtk/deprecated/gtkiconfactory.h>
 #include <gtk/deprecated/gtkradioaction.h>
 #include <gtk/deprecated/gtkrecentaction.h>
 #include <gtk/deprecated/gtkstock.h>
diff --git a/gtk/gtkcellrendererpixbuf.c b/gtk/gtkcellrendererpixbuf.c
index 539a6bb..466f482 100644
--- a/gtk/gtkcellrendererpixbuf.c
+++ b/gtk/gtkcellrendererpixbuf.c
@@ -19,7 +19,6 @@
 #include <stdlib.h>
 #include <cairo-gobject.h>
 #include "gtkcellrendererpixbuf.h"
-#include "deprecated/gtkiconfactory.h"
 #include "gtkiconhelperprivate.h"
 #include "gtkicontheme.h"
 #include "gtkintl.h"
diff --git a/gtk/gtkcellrendererspinner.c b/gtk/gtkcellrendererspinner.c
index 1e4c2d1..e9c8148 100644
--- a/gtk/gtkcellrendererspinner.c
+++ b/gtk/gtkcellrendererspinner.c
@@ -28,7 +28,6 @@
 #include "config.h"
 
 #include "gtkcellrendererspinner.h"
-#include "deprecated/gtkiconfactory.h"
 #include "gtkicontheme.h"
 #include "gtkintl.h"
 #include "gtksettings.h"
diff --git a/gtk/gtkdnd-quartz.c b/gtk/gtkdnd-quartz.c
index cfdcb05..b6cd243 100644
--- a/gtk/gtkdnd-quartz.c
+++ b/gtk/gtkdnd-quartz.c
@@ -31,7 +31,6 @@
 
 #include "gtkdnd.h"
 #include "gtkdndprivate.h"
-#include "deprecated/gtkiconfactory.h"
 #include "gtkicontheme.h"
 #include "gtkimageprivate.h"
 #include "gtkinvisible.h"
diff --git a/gtk/gtkfilechooserbutton.c b/gtk/gtkfilechooserbutton.c
index 981b4d4..d201db9 100644
--- a/gtk/gtkfilechooserbutton.c
+++ b/gtk/gtkfilechooserbutton.c
@@ -38,7 +38,6 @@
 #include "gtkdnd.h"
 #include "gtkdragdest.h"
 #include "gtkicontheme.h"
-#include "deprecated/gtkiconfactory.h"
 #include "gtkimage.h"
 #include "gtklabel.h"
 #include "gtkliststore.h"
diff --git a/gtk/gtkiconhelper.c b/gtk/gtkiconhelper.c
index 8a2a91c..1d196d4 100644
--- a/gtk/gtkiconhelper.c
+++ b/gtk/gtkiconhelper.c
@@ -31,7 +31,6 @@
 #include "gtkcsstransientnodeprivate.h"
 #include "gtkiconthemeprivate.h"
 #include "gtkrendericonprivate.h"
-#include "deprecated/gtkiconfactoryprivate.h"
 
 struct _GtkIconHelperPrivate {
   GtkImageDefinition *def;
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c
index 963a258..5dc1401 100644
--- a/gtk/gtkicontheme.c
+++ b/gtk/gtkicontheme.c
@@ -41,7 +41,6 @@
 #include "gtkcsspalettevalueprivate.h"
 #include "gtkcssrgbavalueprivate.h"
 #include "gtkdebug.h"
-#include "deprecated/gtkiconfactory.h"
 #include "gtkiconcache.h"
 #include "gtkintl.h"
 #include "gtkmain.h"
@@ -5554,3 +5553,150 @@ gtk_icon_info_new_for_file (GFile *file,
 
  return info;
 }
+
+typedef struct _IconSize IconSize;
+
+struct _IconSize
+{
+  gint size;
+  gchar *name;
+
+  gint width;
+  gint height;
+};
+
+typedef struct _IconAlias IconAlias;
+
+struct _IconAlias
+{
+  gchar *name;
+  gint   target;
+};
+
+static GHashTable *icon_aliases = NULL;
+static IconSize *icon_sizes = NULL;
+static gint      icon_sizes_allocated = 0;
+static gint      icon_sizes_used = 0;
+
+static void
+init_icon_sizes (void)
+{
+  if (icon_sizes == NULL)
+    {
+#define NUM_BUILTIN_SIZES 7
+      /*gint i;*/
+
+      icon_aliases = g_hash_table_new (g_str_hash, g_str_equal);
+
+      icon_sizes = g_new (IconSize, NUM_BUILTIN_SIZES);
+      icon_sizes_allocated = NUM_BUILTIN_SIZES;
+      icon_sizes_used = NUM_BUILTIN_SIZES;
+
+      icon_sizes[GTK_ICON_SIZE_INVALID].size = 0;
+      icon_sizes[GTK_ICON_SIZE_INVALID].name = NULL;
+      icon_sizes[GTK_ICON_SIZE_INVALID].width = 0;
+      icon_sizes[GTK_ICON_SIZE_INVALID].height = 0;
+
+      /* the name strings aren't copied since we don't ever remove
+       * icon sizes, so we don't need to know whether they're static.
+       * Even if we did I suppose removing the builtin sizes would be
+       * disallowed.
+       */
+
+      icon_sizes[GTK_ICON_SIZE_MENU].size = GTK_ICON_SIZE_MENU;
+      icon_sizes[GTK_ICON_SIZE_MENU].name = "gtk-menu";
+      icon_sizes[GTK_ICON_SIZE_MENU].width = 16;
+      icon_sizes[GTK_ICON_SIZE_MENU].height = 16;
+
+      icon_sizes[GTK_ICON_SIZE_BUTTON].size = GTK_ICON_SIZE_BUTTON;
+      icon_sizes[GTK_ICON_SIZE_BUTTON].name = "gtk-button";
+      icon_sizes[GTK_ICON_SIZE_BUTTON].width = 16;
+      icon_sizes[GTK_ICON_SIZE_BUTTON].height = 16;
+
+      icon_sizes[GTK_ICON_SIZE_SMALL_TOOLBAR].size = GTK_ICON_SIZE_SMALL_TOOLBAR;
+      icon_sizes[GTK_ICON_SIZE_SMALL_TOOLBAR].name = "gtk-small-toolbar";
+      icon_sizes[GTK_ICON_SIZE_SMALL_TOOLBAR].width = 16;
+      icon_sizes[GTK_ICON_SIZE_SMALL_TOOLBAR].height = 16;
+
+      icon_sizes[GTK_ICON_SIZE_LARGE_TOOLBAR].size = GTK_ICON_SIZE_LARGE_TOOLBAR;
+      icon_sizes[GTK_ICON_SIZE_LARGE_TOOLBAR].name = "gtk-large-toolbar";
+      icon_sizes[GTK_ICON_SIZE_LARGE_TOOLBAR].width = 24;
+      icon_sizes[GTK_ICON_SIZE_LARGE_TOOLBAR].height = 24;
+
+      icon_sizes[GTK_ICON_SIZE_DND].size = GTK_ICON_SIZE_DND;
+      icon_sizes[GTK_ICON_SIZE_DND].name = "gtk-dnd";
+      icon_sizes[GTK_ICON_SIZE_DND].width = 32;
+      icon_sizes[GTK_ICON_SIZE_DND].height = 32;
+
+      icon_sizes[GTK_ICON_SIZE_DIALOG].size = GTK_ICON_SIZE_DIALOG;
+      icon_sizes[GTK_ICON_SIZE_DIALOG].name = "gtk-dialog";
+      icon_sizes[GTK_ICON_SIZE_DIALOG].width = 48;
+      icon_sizes[GTK_ICON_SIZE_DIALOG].height = 48;
+
+      g_assert ((GTK_ICON_SIZE_DIALOG + 1) == NUM_BUILTIN_SIZES);
+
+      /* Alias everything to itself. */
+      /*i = 1; [> skip invalid size <]*/
+      /*while (i < NUM_BUILTIN_SIZES)*/
+        /*{*/
+          /*gtk_icon_size_register_alias (icon_sizes[i].name, icon_sizes[i].size);*/
+
+          /*++i;*/
+        /*}*/
+
+#undef NUM_BUILTIN_SIZES
+    }
+}
+
+static gboolean
+icon_size_lookup_intern (GtkIconSize  size,
+                         gint        *widthp,
+                         gint        *heightp)
+{
+  init_icon_sizes ();
+
+  if (size == (GtkIconSize)-1)
+    return FALSE;
+
+  if (size >= icon_sizes_used)
+    return FALSE;
+
+  if (size == GTK_ICON_SIZE_INVALID)
+    return FALSE;
+
+  if (widthp)
+    *widthp = icon_sizes[size].width;
+
+  if (heightp)
+    *heightp = icon_sizes[size].height;
+
+  return TRUE;
+}
+
+/**
+ * gtk_icon_size_lookup:
+ * @size: (type int): an icon size (#GtkIconSize)
+ * @width: (out) (optional): location to store icon width
+ * @height: (out) (optional): location to store icon height
+ *
+ * Obtains the pixel size of a semantic icon size @size:
+ * #GTK_ICON_SIZE_MENU, #GTK_ICON_SIZE_BUTTON, etc.  This function
+ * isn’t normally needed, gtk_icon_theme_load_icon() is the usual
+ * way to get an icon for rendering, then just look at the size of
+ * the rendered pixbuf. The rendered pixbuf may not even correspond to
+ * the width/height returned by gtk_icon_size_lookup(), because themes
+ * are free to render the pixbuf however they like, including changing
+ * the usual size.
+ *
+ * Returns: %TRUE if @size was a valid size
+ */
+gboolean
+gtk_icon_size_lookup (GtkIconSize  size,
+                      gint        *widthp,
+                      gint        *heightp)
+{
+  GTK_NOTE (MULTIHEAD,
+            g_warning ("gtk_icon_size_lookup ()) is not multihead safe"));
+
+  return icon_size_lookup_intern (size, widthp, heightp);
+}
diff --git a/gtk/gtkicontheme.h b/gtk/gtkicontheme.h
index 48a22e6..ba1320e 100644
--- a/gtk/gtkicontheme.h
+++ b/gtk/gtkicontheme.h
@@ -365,6 +365,14 @@ gboolean              gtk_icon_info_get_attach_points (GtkIconInfo    *icon_info
 GDK_DEPRECATED_IN_3_14
 const gchar *         gtk_icon_info_get_display_name  (GtkIconInfo    *icon_info);
 
+#ifndef GDK_MULTIHEAD_SAFE
+GDK_AVAILABLE_IN_ALL
+gboolean gtk_icon_size_lookup (GtkIconSize  size,
+                               gint        *width,
+                               gint        *height);
+#endif /* GDK_MULTIHEAD_SAFE */
+
+
 G_END_DECLS
 
 #endif /* __GTK_ICON_THEME_H__ */
diff --git a/gtk/gtkrender.c b/gtk/gtkrender.c
index ab1dd5c..24f9162 100644
--- a/gtk/gtkrender.c
+++ b/gtk/gtkrender.c
@@ -991,105 +991,6 @@ gtk_render_activity (GtkStyleContext *context,
   gtk_css_style_render_icon (gtk_style_context_lookup_style (context), cr, x, y, width, height, 
GTK_CSS_IMAGE_BUILTIN_SPINNER);
 }
 
-static GdkPixbuf *
-scale_or_ref (GdkPixbuf *src,
-              gint       width,
-              gint       height)
-{
-  if (width == gdk_pixbuf_get_width (src) &&
-      height == gdk_pixbuf_get_height (src))
-    return g_object_ref (src);
-  else
-    return gdk_pixbuf_scale_simple (src,
-                                    width, height,
-                                    GDK_INTERP_BILINEAR);
-}
-
-GdkPixbuf *
-gtk_render_icon_pixbuf_unpacked (GdkPixbuf           *base_pixbuf,
-                                 GtkIconSize          size,
-                                 GtkCssIconEffect     icon_effect)
-{
-  GdkPixbuf *scaled;
-  GdkPixbuf *stated;
-  cairo_surface_t *surface;
-
-  g_return_val_if_fail (base_pixbuf != NULL, NULL);
-
-  /* If the size was wildcarded, and we're allowed to scale, then scale; otherwise,
-   * leave it alone.
-   */
-  if (size != (GtkIconSize) -1)
-    {
-      int width = 1;
-      int height = 1;
-
-      if (!gtk_icon_size_lookup (size, &width, &height))
-        {
-          g_warning (G_STRLOC ": invalid icon size '%d'", size);
-          return NULL;
-        }
-
-      scaled = scale_or_ref (base_pixbuf, width, height);
-    }
-  else
-    {
-      scaled = g_object_ref (base_pixbuf);
-    }
-
-  if (icon_effect != GTK_CSS_ICON_EFFECT_NONE)
-    {
-      surface = gdk_cairo_surface_create_from_pixbuf (scaled, 1, NULL);
-      gtk_css_icon_effect_apply (icon_effect, surface);
-      stated = gdk_pixbuf_get_from_surface (surface, 0, 0,
-                                           cairo_image_surface_get_width (surface),
-                                           cairo_image_surface_get_height (surface));
-      cairo_surface_destroy (surface);
-    }
-  else
-    {
-      stated = scaled;
-    }
-
-  return stated;
-}
-
-/**
- * gtk_render_icon_pixbuf:
- * @context: a #GtkStyleContext
- * @source: the #GtkIconSource specifying the icon to render
- * @size: (type int): the size (#GtkIconSize) to render the icon at.
- *        A size of `(GtkIconSize) -1` means render at the size of the source
- *        and don’t scale.
- *
- * Renders the icon specified by @source at the given @size, returning the result
- * in a pixbuf.
- *
- * Returns: (transfer full): a newly-created #GdkPixbuf containing the rendered icon
- *
- * Since: 3.0
- *
- * Deprecated: 3.10: Use gtk_icon_theme_load_icon() instead.
- **/
-GdkPixbuf *
-gtk_render_icon_pixbuf (GtkStyleContext     *context,
-                        const GtkIconSource *source,
-                        GtkIconSize          size)
-{
-  g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), NULL);
-  g_return_val_if_fail (size > GTK_ICON_SIZE_INVALID || size == (GtkIconSize)-1, NULL);
-  g_return_val_if_fail (source != NULL, NULL);
-
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
-  return gtk_render_icon_pixbuf_unpacked (gtk_icon_source_get_pixbuf (source),
-                                          gtk_icon_source_get_size_wildcarded (source) ? size : -1,
-                                          gtk_icon_source_get_state_wildcarded (source)
-                                          ? _gtk_css_icon_effect_value_get (
-                                             _gtk_style_context_peek_property (context, 
GTK_CSS_PROPERTY_ICON_EFFECT))
-                                          : GTK_CSS_ICON_EFFECT_NONE);
-G_GNUC_END_IGNORE_DEPRECATIONS;
-}
-
 /**
  * gtk_render_icon:
  * @context: a #GtkStyleContext
diff --git a/gtk/gtkrender.h b/gtk/gtkrender.h
index 81566c5..69431f6 100644
--- a/gtk/gtkrender.h
+++ b/gtk/gtkrender.h
@@ -142,10 +142,6 @@ void        gtk_render_activity    (GtkStyleContext     *context,
                                     gdouble              y,
                                     gdouble              width,
                                     gdouble              height);
-GDK_DEPRECATED_IN_3_10_FOR(gtk_icon_theme_load_icon)
-GdkPixbuf * gtk_render_icon_pixbuf (GtkStyleContext     *context,
-                                    const GtkIconSource *source,
-                                    GtkIconSize          size);
 GDK_AVAILABLE_IN_3_2
 void        gtk_render_icon        (GtkStyleContext     *context,
                                     cairo_t             *cr,
diff --git a/gtk/gtkrenderprivate.h b/gtk/gtkrenderprivate.h
index 4747a23..5c851c8 100644
--- a/gtk/gtkrenderprivate.h
+++ b/gtk/gtkrenderprivate.h
@@ -31,8 +31,4 @@ void        gtk_render_content_path             (GtkStyleContext        *context
                                                  double                  width,
                                                  double                  height);
 
-GdkPixbuf * gtk_render_icon_pixbuf_unpacked     (GdkPixbuf              *base_pixbuf,
-                                                 GtkIconSize             size,
-                                                 GtkCssIconEffect        icon_effect);
-
 #endif /* __GTK_RENDER_PRIVATE_H__ */
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 00c597e..a575a24 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -1921,38 +1921,6 @@ gtk_style_context_get_style (GtkStyleContext *context,
   va_end (args);
 }
 
-
-/**
- * gtk_style_context_lookup_icon_set:
- * @context: a #GtkStyleContext
- * @stock_id: an icon name
- *
- * Looks up @stock_id in the icon factories associated to @context and
- * the default icon factory, returning an icon set if found, otherwise
- * %NULL.
- *
- * Returns: (nullable) (transfer none): The looked up %GtkIconSet, or %NULL
- *
- * Deprecated: 3.10: Use gtk_icon_theme_lookup_icon() instead.
- **/
-GtkIconSet *
-gtk_style_context_lookup_icon_set (GtkStyleContext *context,
-                                   const gchar     *stock_id)
-{
-  GtkIconSet *icon_set;
-
-  g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), NULL);
-  g_return_val_if_fail (stock_id != NULL, NULL);
-
-  G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
-
-  icon_set = gtk_icon_factory_lookup_default (stock_id);
-
-  G_GNUC_END_IGNORE_DEPRECATIONS;
-
-  return icon_set;
-}
-
 /**
  * gtk_style_context_set_screen:
  * @context: a #GtkStyleContext
diff --git a/gtk/gtkstylecontext.h b/gtk/gtkstylecontext.h
index 48875a5..3b39d1f 100644
--- a/gtk/gtkstylecontext.h
+++ b/gtk/gtkstylecontext.h
@@ -1127,9 +1127,6 @@ GDK_AVAILABLE_IN_ALL
 void gtk_style_context_get_style          (GtkStyleContext *context,
                                            ...);
 
-GDK_DEPRECATED_IN_3_10_FOR(gtk_icon_theme_lookup_icon)
-GtkIconSet * gtk_style_context_lookup_icon_set (GtkStyleContext *context,
-                                                const gchar     *stock_id);
 GDK_DEPRECATED_IN_3_10
 GdkPixbuf  * gtk_icon_set_render_icon_pixbuf   (GtkIconSet      *icon_set,
                                                 GtkStyleContext *context,
diff --git a/gtk/gtkstyleprovider.c b/gtk/gtkstyleprovider.c
index d522b58..a52d38d 100644
--- a/gtk/gtkstyleprovider.c
+++ b/gtk/gtkstyleprovider.c
@@ -123,34 +123,3 @@ gtk_style_provider_get_style_property (GtkStyleProvider *provider,
 
   return iface->get_style_property (provider, path, state, pspec, value);
 }
-
-/**
- * gtk_style_provider_get_icon_factory:
- * @provider: a #GtkStyleProvider
- * @path: #GtkWidgetPath to query
- *
- * Returns the #GtkIconFactory defined to be in use for @path, or %NULL if none
- * is defined.
- *
- * Returns: (nullable) (transfer none): The icon factory to use for @path, or %NULL
- *
- * Since: 3.0
- *
- * Deprecated: 3.8: Will always return %NULL for all GTK-provided style providers.
- **/
-GtkIconFactory *
-gtk_style_provider_get_icon_factory (GtkStyleProvider *provider,
-                                    GtkWidgetPath    *path)
-{
-  GtkStyleProviderIface *iface;
-
-  g_return_val_if_fail (GTK_IS_STYLE_PROVIDER (provider), NULL);
-  g_return_val_if_fail (path != NULL, NULL);
-
-  iface = GTK_STYLE_PROVIDER_GET_IFACE (provider);
-
-  if (!iface->get_icon_factory)
-    return NULL;
-
-  return iface->get_icon_factory (provider, path);
-}
diff --git a/gtk/gtkstyleprovider.h b/gtk/gtkstyleprovider.h
index cbfd9df..cebee70 100644
--- a/gtk/gtkstyleprovider.h
+++ b/gtk/gtkstyleprovider.h
@@ -24,7 +24,6 @@
 
 #include <glib-object.h>
 #include <gtk/gtkenums.h>
-#include <gtk/deprecated/gtkiconfactory.h>
 #include <gtk/deprecated/gtkstyleproperties.h>
 #include <gtk/gtktypes.h>
 
@@ -110,9 +109,6 @@ struct _GtkStyleProviderIface
                                    GtkStateFlags     state,
                                    GParamSpec       *pspec,
                                    GValue           *value);
-
-  GtkIconFactory * (* get_icon_factory) (GtkStyleProvider *provider,
-                                        GtkWidgetPath    *path);
 };
 
 GDK_AVAILABLE_IN_ALL
@@ -129,10 +125,6 @@ gboolean gtk_style_provider_get_style_property (GtkStyleProvider *provider,
                                                 GParamSpec       *pspec,
                                                 GValue           *value);
 
-GDK_DEPRECATED_IN_3_8_FOR(NULL)
-GtkIconFactory * gtk_style_provider_get_icon_factory (GtkStyleProvider *provider,
-                                                     GtkWidgetPath    *path);
-
 G_END_DECLS
 
 #endif /* __GTK_STYLE_PROVIDER_H__ */
diff --git a/gtk/gtktoolbutton.c b/gtk/gtktoolbutton.c
index 186543e..5499516 100644
--- a/gtk/gtktoolbutton.c
+++ b/gtk/gtktoolbutton.c
@@ -28,6 +28,7 @@
 #include "gtkintl.h"
 #include "gtktoolbarprivate.h"
 #include "deprecated/gtkactivatable.h"
+#include "gtkicontheme.h"
 #include "gtkactionable.h"
 #include "gtkprivate.h"
 
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 04075be..cdedf88 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -9645,54 +9645,6 @@ gtk_widget_create_pango_layout (GtkWidget   *widget,
 }
 
 /**
- * gtk_widget_render_icon_pixbuf:
- * @widget: a #GtkWidget
- * @stock_id: a stock ID
- * @size: (type int): a stock size (#GtkIconSize). A size of `(GtkIconSize)-1`
- *     means render at the size of the source and don’t scale (if there are
- *     multiple source sizes, GTK+ picks one of the available sizes).
- *
- * A convenience function that uses the theme engine and style
- * settings for @widget to look up @stock_id and render it to
- * a pixbuf. @stock_id should be a stock icon ID such as
- * #GTK_STOCK_OPEN or #GTK_STOCK_OK. @size should be a size
- * such as #GTK_ICON_SIZE_MENU.
- *
- * The pixels in the returned #GdkPixbuf are shared with the rest of
- * the application and should not be modified. The pixbuf should be freed
- * after use with g_object_unref().
- *
- * Returns: (transfer full) (nullable): a new pixbuf, or %NULL if the
- *     stock ID wasn’t known
- *
- * Since: 3.0
- *
- * Deprecated: 3.10: Use gtk_icon_theme_load_icon() instead.
- **/
-GdkPixbuf*
-gtk_widget_render_icon_pixbuf (GtkWidget   *widget,
-                               const gchar *stock_id,
-                               GtkIconSize  size)
-{
-  GtkStyleContext *context;
-  GtkIconSet *icon_set;
-
-  g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
-  g_return_val_if_fail (stock_id != NULL, NULL);
-  g_return_val_if_fail (size > GTK_ICON_SIZE_INVALID || size == -1, NULL);
-
-  context = _gtk_widget_get_style_context (widget);
-  G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
-  icon_set = gtk_style_context_lookup_icon_set (context, stock_id);
-
-  if (icon_set == NULL)
-    return NULL;
-
-  return gtk_icon_set_render_icon_pixbuf (icon_set, context, size);
-  G_GNUC_END_IGNORE_DEPRECATIONS;
-}
-
-/**
  * gtk_widget_set_parent_window:
  * @widget: a #GtkWidget.
  * @parent_window: the new parent window.
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index e7a49a7..27ecbb8 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -1111,11 +1111,6 @@ GDK_AVAILABLE_IN_ALL
 PangoLayout  *gtk_widget_create_pango_layout  (GtkWidget   *widget,
                                               const gchar *text);
 
-GDK_DEPRECATED_IN_3_10_FOR(gtk_icon_theme_load_icon)
-GdkPixbuf    *gtk_widget_render_icon_pixbuf   (GtkWidget   *widget,
-                                               const gchar *stock_id,
-                                               GtkIconSize  size);
-
 /* Push/pop pairs, to change default values upon a widget's creation.
  * This will override the values that got set by the
  * gtk_widget_set_default_* () functions.
diff --git a/testsuite/gtk/builder.c b/testsuite/gtk/builder.c
index 96a37e6..b4bba90 100644
--- a/testsuite/gtk/builder.c
+++ b/testsuite/gtk/builder.c
@@ -1858,75 +1858,7 @@ test_reference_counting (void)
   g_object_unref (builder);
 }
 
-static void
-test_icon_factory (void)
-{
-  GtkBuilder *builder;
-  const gchar buffer1[] =
-    "<interface>"
-    "  <object class=\"GtkIconFactory\" id=\"iconfactory1\">"
-    "    <sources>"
-    "      <source stock-id=\"apple-red\" filename=\"apple-red.png\"/>"
-    "    </sources>"
-    "  </object>"
-    "</interface>";
-  const gchar buffer2[] =
-    "<interface>"
-    "  <object class=\"GtkIconFactory\" id=\"iconfactory1\">"
-    "    <sources>"
-    "      <source stock-id=\"sliff\" direction=\"rtl\" state=\"active\""
-    "              size=\"menu\" filename=\"sloff.png\"/>"
-    "      <source stock-id=\"sliff\" direction=\"ltr\" state=\"selected\""
-    "              size=\"dnd\" filename=\"slurf.png\"/>"
-    "    </sources>"
-    "  </object>"
-    "</interface>";
-  GObject *factory;
-  GtkIconSet *icon_set;
-  GtkIconSource *icon_source;
-  GtkWidget *image;
-
-  G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
-
-  builder = builder_new_from_string (buffer1, -1, NULL);
-  factory = gtk_builder_get_object (builder, "iconfactory1");
-  g_assert (factory != NULL);
-
-  icon_set = gtk_icon_factory_lookup (GTK_ICON_FACTORY (factory), "apple-red");
-  g_assert (icon_set != NULL);
-  gtk_icon_factory_add_default (GTK_ICON_FACTORY (factory));
-  image = gtk_image_new_from_icon_name ("audio-volume-high", GTK_ICON_SIZE_BUTTON);
-  g_assert (image != NULL);
-  g_object_ref_sink (image);
-  g_object_unref (image);
-
-  g_object_unref (builder);
-
-  builder = builder_new_from_string (buffer2, -1, NULL);
-  factory = gtk_builder_get_object (builder, "iconfactory1");
-  g_assert (factory != NULL);
-
-  icon_set = gtk_icon_factory_lookup (GTK_ICON_FACTORY (factory), "sliff");
-  g_assert (icon_set != NULL);
-  g_assert (g_slist_length (icon_set->sources) == 2);
-
-  icon_source = icon_set->sources->data;
-  g_assert (gtk_icon_source_get_direction (icon_source) == GTK_TEXT_DIR_RTL);
-  g_assert (gtk_icon_source_get_state (icon_source) == GTK_STATE_ACTIVE);
-  g_assert (gtk_icon_source_get_size (icon_source) == GTK_ICON_SIZE_MENU);
-  g_assert (g_str_has_suffix (gtk_icon_source_get_filename (icon_source), "sloff.png"));
-  
-  icon_source = icon_set->sources->next->data;
-  g_assert (gtk_icon_source_get_direction (icon_source) == GTK_TEXT_DIR_LTR);
-  g_assert (gtk_icon_source_get_state (icon_source) == GTK_STATE_SELECTED);
-  g_assert (gtk_icon_source_get_size (icon_source) == GTK_ICON_SIZE_DND);
-  g_assert (g_str_has_suffix (gtk_icon_source_get_filename (icon_source), "slurf.png"));
-
-  g_object_unref (builder);
-
-  G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
-
-}
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
 
 typedef struct {
   gboolean weight;
@@ -2938,7 +2870,6 @@ main (int argc, char **argv)
   g_test_add_func ("/Builder/Value From String", test_value_from_string);
   g_test_add_func ("/Builder/Reference Counting", test_reference_counting);
   g_test_add_func ("/Builder/Window", test_window);
-  g_test_add_func ("/Builder/IconFactory", test_icon_factory);
   g_test_add_func ("/Builder/PangoAttributes", test_pango_attributes);
   g_test_add_func ("/Builder/Requires", test_requires);
   g_test_add_func ("/Builder/AddObjects", test_add_objects);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]