[gtk+] Use the new texture utils here
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Use the new texture utils here
- Date: Thu, 30 Nov 2017 12:55:33 +0000 (UTC)
commit 2edd3741f6dc3b476bbfb5e61e5cdca4ea45a5da
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Nov 30 07:54:52 2017 -0500
Use the new texture utils here
One less place where we juggle pixbufs.
gtk/gtkcssimagerecolor.c | 38 ++++++++++----------------------------
1 files changed, 10 insertions(+), 28 deletions(-)
---
diff --git a/gtk/gtkcssimagerecolor.c b/gtk/gtkcssimagerecolor.c
index 48cae0d..b3c3423 100644
--- a/gtk/gtkcssimagerecolor.c
+++ b/gtk/gtkcssimagerecolor.c
@@ -107,41 +107,23 @@ gtk_css_image_recolor_load_texture (GtkCssImageRecolor *recolor,
uri = g_file_get_uri (recolor->file);
- if (g_str_has_suffix (uri, ".symbolic.png"))
+ if (g_file_has_uri_scheme (recolor->file, "resource"))
{
- if (g_file_has_uri_scheme (recolor->file, "resource"))
- {
- char *resource_path = g_uri_unescape_string (uri + strlen ("resource://"), NULL);
-
- recolor->texture = gdk_texture_new_from_resource (resource_path);
+ char *resource_path = g_uri_unescape_string (uri + strlen ("resource://"), NULL);
- g_free (resource_path);
- }
+ if (g_str_has_suffix (uri, ".symbolic.png"))
+ recolor->texture = gdk_texture_new_from_resource (resource_path);
else
- {
- recolor->texture = gdk_texture_new_from_file (recolor->file, NULL);
- }
+ recolor->texture = gtk_make_symbolic_texture_from_resource (resource_path, 0, 0, 1.0, NULL);
+
+ g_free (resource_path);
}
else
{
- GdkPixbuf *pixbuf;
-
- if (g_file_has_uri_scheme (recolor->file, "resource"))
- {
- char *resource_path = g_uri_unescape_string (uri + strlen ("resource://"), NULL);
-
- pixbuf = gtk_make_symbolic_pixbuf_from_resource (resource_path, 0, 0, 1.0, NULL);
-
- g_free (resource_path);
- }
+ if (g_str_has_suffix (uri, ".symbolic.png"))
+ recolor->texture = gdk_texture_new_from_file (recolor->file, NULL);
else
- {
- pixbuf = gtk_make_symbolic_pixbuf_from_file (recolor->file, 0, 0, 1.0, NULL);
- }
-
- recolor->texture = gdk_texture_new_for_pixbuf (pixbuf);
-
- g_object_unref (pixbuf);
+ recolor->texture = gtk_make_symbolic_texture_from_file (recolor->file, 0, 0, 1.0, NULL);
}
g_free (uri);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]