icontheme: Remove crayon APIs
authorBenjamin Otte <otte@redhat.com>
Sat, 1 Feb 2020 23:48:24 +0000 (00:48 +0100)
committerAlexander Larsson <alexl@redhat.com>
Tue, 4 Feb 2020 15:43:59 +0000 (16:43 +0100)
We expose no API to get at any colors for drawing symbolics, so we
shouldn't have APIs to draw with them.

Apart from that, those APIs look like a box of crayons, not like an
icontheme.

docs/reference/gtk/gtk4-sections.txt
gtk/gtkicontheme.c
gtk/gtkicontheme.h
gtk/gtkiconthemeprivate.h
testsuite/gtk/icontheme.c

index b476bcf5b263fcc5950fcbaa6b56cd674e4ba197..8ed0069f720ce7e417542ae7fc8fa2c4e401f7c6 100644 (file)
@@ -5015,8 +5015,6 @@ gtk_icon_get_base_size
 gtk_icon_get_base_scale
 gtk_icon_get_filename
 gtk_icon_is_symbolic
-gtk_icon_snapshot_with_colors
-gtk_icon_download_colored_texture
 gtk_icon_download_texture
 <SUBSECTION Standard>
 GtkIconClass
index f1c60285eef9d2e0c7a9d5f4c11a74a93ba18274..235d3fd7f0dfc7015b125ccb555c8b9d9ee0e383 100644 (file)
@@ -3803,57 +3803,6 @@ init_color_matrix (graphene_matrix_t *color_matrix,
 }
 
 
-/**
- * gtk_icon_download_colored_texture:
- * @self: a #GtkIcon
- * @foreground_color: (allow-none): a #GdkRGBA representing the foreground color
- *      of the icon or %NULL to use the default color.
- * @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)
- * @error: (allow-none): location to store error information on failure,
- *     or %NULL.
- *
- * Tries to access the pixels of an icon, with colors applied to a
- * symbolic icon. This can fail if the icon file is missing or there
- * is some kind of problem loading the icon file.
- *
- * Returns: (transfer full): An texture with the contents of the icon, or %NULL on failure.
- */
-GdkTexture *
-gtk_icon_download_colored_texture (GtkIcon *self,
-                                   const GdkRGBA *foreground_color,
-                                   const GdkRGBA *success_color,
-                                   const GdkRGBA *warning_color,
-                                   const GdkRGBA *error_color,
-                                   GError **error)
-{
-  GdkTexture *texture, *colored_texture;
-  graphene_matrix_t matrix;
-  graphene_vec4_t offset;
-  cairo_surface_t *surface;
-
-  texture = gtk_icon_download_texture (self, error);
-
-  if (texture == NULL || gtk_icon_is_symbolic (self))
-    return texture;
-
-  init_color_matrix (&matrix, &offset,
-                     foreground_color, success_color,
-                     warning_color, error_color);
-
-  surface = gdk_texture_download_surface (texture);
-  gdk_cairo_image_surface_recolor (surface, &matrix, &offset);
-  colored_texture = gdk_texture_new_for_surface (surface);
-  cairo_surface_destroy (surface);
-  g_object_unref (texture);
-
-  return colored_texture;
-}
-
 static void
 icon_paintable_snapshot (GdkPaintable *paintable,
                          GtkSnapshot  *snapshot,
index 442ff8c26c2e7d31f1480d7f48d05e7ef2bdd605..aad41ca274e1937192cf62d44dc97f50ce0cb914 100644 (file)
@@ -165,22 +165,6 @@ gboolean              gtk_icon_is_symbolic        (GtkIcon   *self);
 GDK_AVAILABLE_IN_ALL
 GdkTexture *          gtk_icon_download_texture   (GtkIcon   *self,
                                                    GError       **error);
-GDK_AVAILABLE_IN_ALL
-GdkTexture *         gtk_icon_download_colored_texture (GtkIcon *self,
-                                                        const GdkRGBA *foreground_color,
-                                                        const GdkRGBA *success_color,
-                                                        const GdkRGBA *warning_color,
-                                                        const GdkRGBA *error_color,
-                                                        GError **error);
-GDK_AVAILABLE_IN_ALL
-void                  gtk_icon_snapshot_with_colors (GtkIcon      *icon,
-                                                     GtkSnapshot  *snapshot,
-                                                     double        width,
-                                                     double        height,
-                                                     const GdkRGBA *foreground_color,
-                                                     const GdkRGBA *success_color,
-                                                     const GdkRGBA *warning_color,
-                                                     const GdkRGBA *error_color);
 
 G_END_DECLS
 
index 132d5154ee541b319638574de2d1c16ebd2ceb01..6b3d71b4ca10e802d4ad7c7b26e8914d7ee71f49 100644 (file)
@@ -26,5 +26,13 @@ void        gtk_icon_theme_lookup_symbolic_colors       (GtkCssStyle    *style,
                                                          GdkRGBA        *success_out,
                                                          GdkRGBA        *warning_out,
                                                          GdkRGBA        *error_out);
+void        gtk_icon_snapshot_with_colors               (GtkIcon        *icon,
+                                                         GtkSnapshot    *snapshot,
+                                                         double          width,
+                                                         double          height,
+                                                         const GdkRGBA   *foreground_color,
+                                                         const GdkRGBA   *success_color,
+                                                         const GdkRGBA   *warning_color,
+                                                         const GdkRGBA   *error_color);
 
 #endif /* __GTK_ICON_THEME_PRIVATE_H__ */
index f0dbae4544d398be27110c1bd849853fae1534da..081acbec1e298b53e8871cf134fbd0621843434b 100644 (file)
@@ -670,7 +670,6 @@ test_nonsquare_symbolic (void)
   GtkIcon *info;
   GFile *file;
   GIcon *icon;
-  GdkRGBA black = { 0.0, 0.0, 0.0, 1.0 };
   GError *error = NULL;
   GdkTexture *texture;
   gchar *path = g_build_filename (g_test_get_dir (G_TEST_DIST),
@@ -697,7 +696,7 @@ test_nonsquare_symbolic (void)
   g_assert_nonnull (info);
 
   g_object_unref (pixbuf);
-  texture = gtk_icon_download_colored_texture (info, &black, NULL, NULL, NULL, &error);
+  texture = gtk_icon_download_texture (info, &error);
 
   /* we are loaded successfully */
   g_assert_no_error (error);