[gtk: 11/31] GtkBuilder: Directly load the fallback missing image



commit 6ff9f2198d5284f1597a64a4c7d53ef4205df078
Author: Alexander Larsson <alexl redhat com>
Date:   Thu Feb 6 10:28:12 2020 +0100

    GtkBuilder: Directly load the fallback missing image
    
    No need for all this complexity with the icon theme, especially when
    its now a lot more work to get the texture back. We can just load
    the pixbuf.

 gtk/gtkbuilder.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)
---
diff --git a/gtk/gtkbuilder.c b/gtk/gtkbuilder.c
index 62e3e7ad7c..1702a37aa9 100644
--- a/gtk/gtkbuilder.c
+++ b/gtk/gtkbuilder.c
@@ -223,6 +223,8 @@
 #include "gtkprivate.h"
 #include "gtktypebuiltins.h"
 #include "gtkicontheme.h"
+#include "gtkiconthemeprivate.h"
+#include "gdkpixbufutilsprivate.h"
 
 static void gtk_builder_finalize       (GObject         *object);
 static void gtk_builder_set_property   (GObject         *object,
@@ -2159,25 +2161,11 @@ gtk_builder_value_from_string_type (GtkBuilder   *builder,
 
           if (pixbuf == NULL)
             {
-              GtkIconTheme *theme;
-              GtkIconPaintable *icon;
-              GdkTexture *texture;
-
               g_warning ("Could not load image '%s': %s",
                          string, tmp_error->message);
               g_error_free (tmp_error);
 
-              /* fall back to a missing image */
-              /* FIXME: this should be using the correct display */
-              theme = gtk_icon_theme_get_for_display (gdk_display_get_default ());
-
-              icon = gtk_icon_theme_lookup_icon (theme, "image-missing", NULL, 16, 1,
-                                                 GTK_TEXT_DIR_NONE,
-                                                 0);
-              texture = gtk_icon_paintable_download_texture (icon);
-              pixbuf = gdk_pixbuf_get_from_texture (texture);
-              g_object_unref (icon);
-              g_object_unref (texture);
+              pixbuf = _gdk_pixbuf_new_from_resource (IMAGE_MISSING_RESOURCE_PATH, "png", NULL);
             }
 
           if (pixbuf)


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