summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2021-09-17 04:07:59 +0200
committerBenjamin Otte <otte@redhat.com>2021-09-17 04:31:46 +0200
commit37a7c6780ace8ae719cd10bc46898bd23a2b0f04 (patch)
tree32d3048831c0e833a086dc555cec605f9de4f301
parent1b85b5597b09f7a189a321ac0ff117ea51dda981 (diff)
downloadgtk+-37a7c6780ace8ae719cd10bc46898bd23a2b0f04.tar.gz
icontheme: Implement gtk_icon_theme_lookup_by_gicon() for textures
More feature parity. Before this, it would have worked just as well - just going via a PNG bytes step inbetween.
-rw-r--r--gtk/gtkicontheme.c26
1 files changed, 8 insertions, 18 deletions
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c
index eaeb8e4063..1c2d83125c 100644
--- a/gtk/gtkicontheme.c
+++ b/gtk/gtkicontheme.c
@@ -4084,20 +4084,6 @@ gtk_icon_paintable_new_for_file (GFile *file,
return icon;
}
-static GtkIconPaintable *
-gtk_icon_paintable_new_for_pixbuf (GtkIconTheme *icon_theme,
- GdkPixbuf *pixbuf,
- int size,
- int scale)
-{
- GtkIconPaintable *icon;
-
- icon = icon_paintable_new (NULL, size, scale);
- icon->texture = gdk_texture_new_for_pixbuf (pixbuf);
-
- return icon;
-}
-
/**
* gtk_icon_theme_lookup_by_gicon:
* @self: a `GtkIconTheme`
@@ -4135,11 +4121,15 @@ gtk_icon_theme_lookup_by_gicon (GtkIconTheme *self,
gicon = g_emblemed_icon_get_icon (G_EMBLEMED_ICON (gicon));
g_assert (gicon); /* shut up gcc -Wnull-dereference */
- if (GDK_IS_PIXBUF (gicon))
+ if (GDK_IS_TEXTURE (gicon))
{
- GdkPixbuf *pixbuf = GDK_PIXBUF (gicon);
-
- icon = gtk_icon_paintable_new_for_pixbuf (self, pixbuf, size, scale);
+ icon = icon_paintable_new (NULL, size, scale);
+ icon->texture = g_object_ref (GDK_TEXTURE (icon));
+ }
+ else if (GDK_IS_PIXBUF (gicon))
+ {
+ icon = icon_paintable_new (NULL, size, scale);
+ icon->texture = gdk_texture_new_for_pixbuf (GDK_PIXBUF (icon));
}
else if (G_IS_FILE_ICON (gicon))
{