[nautilus/wip/antoniof/switch-to-gtk4: 32/33] general: GdkPixbuf -> GdkPaintable/GdkTexture




commit fcb40bdac64f1514b59b2a412443b4fa753ed0ca
Author: António Fernandes <antoniof gnome org>
Date:   Sat Jan 1 17:06:19 2022 +0000

    general: GdkPixbuf -> GdkPaintable/GdkTexture
    
    Generally we should be able to use any paintable.
    
    Unfortunately GtkCellRendererPixbuf doesn't accept paintables other
    than textures.
    
    The other two usages of textures require a GIcon. We could create a
    GThemedIcon using GtkIconPaintable:icon-name, but to keep changes
    at a minimum short here, that's left for a later enhancement.

 src/nautilus-file-conflict-dialog.c  |   8 +-
 src/nautilus-file-conflict-dialog.h  |   4 +-
 src/nautilus-file.c                  |  25 ++++--
 src/nautilus-file.h                  |   6 +-
 src/nautilus-files-view.c            |   8 +-
 src/nautilus-icon-info.c             | 142 +++++++++++++++--------------------
 src/nautilus-icon-info.h             |   5 +-
 src/nautilus-list-model.c            |  10 ++-
 src/nautilus-list-view.c             |   4 +-
 src/nautilus-operations-ui-manager.c |  28 +++----
 src/nautilus-properties-window.c     |  14 ++--
 src/nautilus-shell-search-provider.c |   6 +-
 src/nautilus-view-icon-item-ui.c     |   6 +-
 13 files changed, 133 insertions(+), 133 deletions(-)
---
diff --git a/src/nautilus-file-conflict-dialog.c b/src/nautilus-file-conflict-dialog.c
index 816498611..327c5c69b 100644
--- a/src/nautilus-file-conflict-dialog.c
+++ b/src/nautilus-file-conflict-dialog.c
@@ -69,11 +69,11 @@ nautilus_file_conflict_dialog_set_text (NautilusFileConflictDialog *fcd,
 
 void
 nautilus_file_conflict_dialog_set_images (NautilusFileConflictDialog *fcd,
-                                          GdkPixbuf                  *destination_pixbuf,
-                                          GdkPixbuf                  *source_pixbuf)
+                                          GdkPaintable               *destination_paintable,
+                                          GdkPaintable               *source_paintable)
 {
-    gtk_image_set_from_pixbuf (GTK_IMAGE (fcd->dest_image), destination_pixbuf);
-    gtk_image_set_from_pixbuf (GTK_IMAGE (fcd->src_image), source_pixbuf);
+    gtk_image_set_from_paintable (GTK_IMAGE (fcd->dest_image), destination_paintable);
+    gtk_image_set_from_paintable (GTK_IMAGE (fcd->src_image), source_paintable);
 }
 
 void
diff --git a/src/nautilus-file-conflict-dialog.h b/src/nautilus-file-conflict-dialog.h
index c62b43018..70f81d0b3 100644
--- a/src/nautilus-file-conflict-dialog.h
+++ b/src/nautilus-file-conflict-dialog.h
@@ -38,8 +38,8 @@ void nautilus_file_conflict_dialog_set_text (NautilusFileConflictDialog *fcd,
                                              gchar *primary_text,
                                              gchar *secondary_text);
 void nautilus_file_conflict_dialog_set_images (NautilusFileConflictDialog *fcd,
-                                               GdkPixbuf *source_pixbuf,
-                                               GdkPixbuf *destination_pixbuf);
+                                               GdkPaintable *source_paintable,
+                                               GdkPaintable *destination_paintable);
 void nautilus_file_conflict_dialog_set_file_labels (NautilusFileConflictDialog *fcd,
                                                     gchar *destination_label,
                                                     gchar *source_label);
diff --git a/src/nautilus-file.c b/src/nautilus-file.c
index 011842bd1..36c1462e4 100644
--- a/src/nautilus-file.c
+++ b/src/nautilus-file.c
@@ -5378,17 +5378,30 @@ out:
     return icon;
 }
 
-GdkPixbuf *
-nautilus_file_get_icon_pixbuf (NautilusFile          *file,
-                               int                    size,
-                               int                    scale,
-                               NautilusFileIconFlags  flags)
+GdkTexture *
+nautilus_file_get_icon_texture (NautilusFile          *file,
+                                int                    size,
+                                int                    scale,
+                                NautilusFileIconFlags  flags)
 {
     g_autoptr (NautilusIconInfo) info = NULL;
 
     info = nautilus_file_get_icon (file, size, scale, flags);
 
-    return nautilus_icon_info_get_pixbuf_at_size (info, size);
+    return nautilus_icon_info_get_texture (info);
+}
+
+GdkPaintable *
+nautilus_file_get_icon_paintable (NautilusFile          *file,
+                                  int                    size,
+                                  int                    scale,
+                                  NautilusFileIconFlags  flags)
+{
+    g_autoptr (NautilusIconInfo) info = NULL;
+
+    info = nautilus_file_get_icon (file, size, scale, flags);
+
+    return nautilus_icon_info_get_paintable (info);
 }
 
 gboolean
diff --git a/src/nautilus-file.h b/src/nautilus-file.h
index a50d27df0..e2af19e94 100644
--- a/src/nautilus-file.h
+++ b/src/nautilus-file.h
@@ -473,7 +473,11 @@ NautilusIconInfo *      nautilus_file_get_icon                          (Nautilu
                                                                         int                             size,
                                                                         int                             
scale,
                                                                         NautilusFileIconFlags           
flags);
-GdkPixbuf *             nautilus_file_get_icon_pixbuf                   (NautilusFile                   
*file,
+GdkTexture *            nautilus_file_get_icon_texture                  (NautilusFile                   
*file,
+                                                                        int                             size,
+                                                                        int                             
scale,
+                                                                        NautilusFileIconFlags           
flags);
+GdkPaintable *          nautilus_file_get_icon_paintable                (NautilusFile                   
*file,
                                                                         int                             size,
                                                                         int                             
scale,
                                                                         NautilusFileIconFlags           
flags);
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 4b489eea5..c02ddd595 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -4872,13 +4872,13 @@ nautilus_files_view_get_directory_as_file (NautilusFilesView *view)
     return priv->directory_as_file;
 }
 
-static GdkPixbuf *
+static GdkTexture *
 get_menu_icon_for_file (NautilusFile *file,
                         GtkWidget    *widget)
 {
     int scale = gtk_widget_get_scale_factor (widget);
 
-    return nautilus_file_get_icon_pixbuf (file, 16, scale, 0);
+    return nautilus_file_get_icon_texture (file, 16, scale, 0);
 }
 
 static GList *
@@ -5284,7 +5284,7 @@ add_script_to_scripts_menus (NautilusFilesView *view,
     gchar *name;
     g_autofree gchar *uri = NULL;
     g_autofree gchar *escaped_uri = NULL;
-    GdkPixbuf *mimetype_icon;
+    GdkTexture *mimetype_icon;
     gchar *action_name, *detailed_action_name;
     ScriptLaunchParameters *launch_parameters;
     GAction *action;
@@ -5529,7 +5529,7 @@ add_template_to_templates_menus (NautilusFilesView *view,
     NautilusFilesViewPrivate *priv;
     char *tmp, *uri, *name;
     g_autofree gchar *escaped_uri = NULL;
-    GdkPixbuf *mimetype_icon;
+    GdkTexture *mimetype_icon;
     char *action_name, *detailed_action_name;
     CreateTemplateParameters *parameters;
     GAction *action;
diff --git a/src/nautilus-icon-info.c b/src/nautilus-icon-info.c
index fee560806..0831ae168 100644
--- a/src/nautilus-icon-info.c
+++ b/src/nautilus-icon-info.c
@@ -25,7 +25,7 @@ struct _NautilusIconInfo
 
     gboolean sole_owner;
     gint64 last_use_time;
-    GdkPixbuf *pixbuf;
+    GdkPaintable *paintable;
 
     char *icon_name;
 
@@ -48,13 +48,13 @@ nautilus_icon_info_init (NautilusIconInfo *icon)
 gboolean
 nautilus_icon_info_is_fallback (NautilusIconInfo *icon)
 {
-    return icon->pixbuf == NULL;
+    return icon->paintable == NULL;
 }
 
 static void
-pixbuf_toggle_notify (gpointer  info,
-                      GObject  *object,
-                      gboolean  is_last_ref)
+paintable_toggle_notify (gpointer  info,
+                         GObject  *object,
+                         gboolean  is_last_ref)
 {
     NautilusIconInfo *icon = info;
 
@@ -62,7 +62,7 @@ pixbuf_toggle_notify (gpointer  info,
     {
         icon->sole_owner = TRUE;
         g_object_remove_toggle_ref (object,
-                                    pixbuf_toggle_notify,
+                                    paintable_toggle_notify,
                                     info);
         icon->last_use_time = g_get_monotonic_time ();
         schedule_reap_cache ();
@@ -76,16 +76,16 @@ nautilus_icon_info_finalize (GObject *object)
 
     icon = NAUTILUS_ICON_INFO (object);
 
-    if (!icon->sole_owner && icon->pixbuf)
+    if (!icon->sole_owner && icon->paintable)
     {
-        g_object_remove_toggle_ref (G_OBJECT (icon->pixbuf),
-                                    pixbuf_toggle_notify,
+        g_object_remove_toggle_ref (G_OBJECT (icon->paintable),
+                                    paintable_toggle_notify,
                                     icon);
     }
 
-    if (icon->pixbuf)
+    if (icon->paintable)
     {
-        g_object_unref (icon->pixbuf);
+        g_object_unref (icon->paintable);
     }
     g_free (icon->icon_name);
 
@@ -112,7 +112,7 @@ nautilus_icon_info_new_for_pixbuf (GdkPixbuf *pixbuf,
 
     if (pixbuf)
     {
-        icon->pixbuf = g_object_ref (pixbuf);
+        icon->paintable = GDK_PAINTABLE (gdk_texture_new_for_pixbuf (pixbuf));
     }
 
     icon->orig_scale = scale;
@@ -121,21 +121,21 @@ nautilus_icon_info_new_for_pixbuf (GdkPixbuf *pixbuf,
 }
 
 static NautilusIconInfo *
-nautilus_icon_info_new_for_icon_info (GtkIconInfo *icon_info,
-                                      gint         scale)
+nautilus_icon_info_new_for_icon_paintable (GtkIconPaintable *icon_paintable,
+                                           gint              scale)
 {
     NautilusIconInfo *icon;
-    const char *filename;
+    g_autoptr (GFile) file = NULL;
     char *basename, *p;
 
     icon = g_object_new (NAUTILUS_TYPE_ICON_INFO, NULL);
 
-    icon->pixbuf = gtk_icon_info_load_icon (icon_info, NULL);
+    icon->paintable = GDK_PAINTABLE (g_object_ref (icon_paintable));
 
-    filename = gtk_icon_info_get_filename (icon_info);
-    if (filename != NULL)
+    file = gtk_icon_paintable_get_file (icon_paintable);
+    if (file != NULL)
     {
-        basename = g_path_get_basename (filename);
+        basename = g_file_get_basename (file);
         p = strrchr (basename, '.');
         if (p)
         {
@@ -143,6 +143,10 @@ nautilus_icon_info_new_for_icon_info (GtkIconInfo *icon_info,
         }
         icon->icon_name = basename;
     }
+    else
+    {
+        icon->icon_name = g_strdup (gtk_icon_paintable_get_icon_name (icon_paintable));
+    }
 
     icon->orig_scale = scale;
 
@@ -159,7 +163,7 @@ typedef struct
 
 typedef struct
 {
-    char *filename;
+    char *icon_name;
     int scale;
     int size;
 } ThemedIconKey;
@@ -296,7 +300,7 @@ loadable_icon_key_free (LoadableIconKey *key)
 static guint
 themed_icon_key_hash (ThemedIconKey *key)
 {
-    return g_str_hash (key->filename) ^ key->size;
+    return g_str_hash (key->icon_name) ^ key->size;
 }
 
 static gboolean
@@ -305,18 +309,18 @@ themed_icon_key_equal (const ThemedIconKey *a,
 {
     return a->size == b->size &&
            a->scale == b->scale &&
-           g_str_equal (a->filename, b->filename);
+           g_str_equal (a->icon_name, b->icon_name);
 }
 
 static ThemedIconKey *
-themed_icon_key_new (const char *filename,
+themed_icon_key_new (const char *icon_name,
                      int         scale,
                      int         size)
 {
     ThemedIconKey *key;
 
     key = g_slice_new (ThemedIconKey);
-    key->filename = g_strdup (filename);
+    key->icon_name = g_strdup (icon_name);
     key->scale = scale;
     key->size = size;
 
@@ -326,7 +330,7 @@ themed_icon_key_new (const char *filename,
 static void
 themed_icon_key_free (ThemedIconKey *key)
 {
-    g_free (key->filename);
+    g_free (key->icon_name);
     g_slice_free (ThemedIconKey, key);
 }
 
@@ -336,7 +340,7 @@ nautilus_icon_info_lookup (GIcon *icon,
                            int    scale)
 {
     NautilusIconInfo *icon_info;
-    g_autoptr (GtkIconInfo) gtkicon_info = NULL;
+    g_autoptr (GtkIconPaintable) icon_paintable = NULL;
 
     if (G_IS_LOADABLE_ICON (icon))
     {
@@ -386,9 +390,9 @@ nautilus_icon_info_lookup (GIcon *icon,
         return g_object_ref (icon_info);
     }
 
-    gtkicon_info = gtk_icon_theme_lookup_by_gicon_for_scale (gtk_icon_theme_get_default (),
-                                                             icon, size, scale, 0);
-    if (gtkicon_info == NULL)
+    icon_paintable = gtk_icon_theme_lookup_by_gicon (gtk_icon_theme_get_for_display (gdk_display_get_default 
()),
+                                                     icon, size, scale, GTK_TEXT_DIR_NONE, 0);
+    if (icon_paintable == NULL)
     {
         return nautilus_icon_info_new_for_pixbuf (NULL, scale);
     }
@@ -397,7 +401,7 @@ nautilus_icon_info_lookup (GIcon *icon,
     {
         ThemedIconKey lookup_key;
         ThemedIconKey *key;
-        const char *filename;
+        const char *icon_name;
 
         if (themed_icon_cache == NULL)
         {
@@ -408,23 +412,18 @@ nautilus_icon_info_lookup (GIcon *icon,
                                        (GDestroyNotify) g_object_unref);
         }
 
-        filename = gtk_icon_info_get_filename (gtkicon_info);
-        if (filename == NULL)
-        {
-            g_object_unref (gtkicon_info);
-            return nautilus_icon_info_new_for_pixbuf (NULL, scale);
-        }
+        icon_name = gtk_icon_paintable_get_icon_name (icon_paintable);
 
-        lookup_key.filename = (char *) filename;
+        lookup_key.icon_name = (char *) icon_name;
         lookup_key.scale = scale;
         lookup_key.size = size;
 
         icon_info = g_hash_table_lookup (themed_icon_cache, &lookup_key);
         if (!icon_info)
         {
-            icon_info = nautilus_icon_info_new_for_icon_info (gtkicon_info, scale);
+            icon_info = nautilus_icon_info_new_for_icon_paintable (icon_paintable, scale);
 
-            key = themed_icon_key_new (filename, scale, size);
+            key = themed_icon_key_new (icon_name, scale, size);
             g_hash_table_insert (themed_icon_cache, key, icon_info);
         }
 
@@ -432,31 +431,28 @@ nautilus_icon_info_lookup (GIcon *icon,
     }
     else
     {
-        g_autoptr (GdkPixbuf) pixbuf = NULL;
-
-        pixbuf = gtk_icon_info_load_icon (gtkicon_info, NULL);
-        return nautilus_icon_info_new_for_pixbuf (pixbuf, scale);
+        return nautilus_icon_info_new_for_icon_paintable (icon_paintable, scale);
     }
 }
 
-static GdkPixbuf *
-nautilus_icon_info_get_pixbuf_nodefault (NautilusIconInfo *icon)
+static GdkPaintable *
+nautilus_icon_info_get_paintable_nodefault (NautilusIconInfo *icon)
 {
-    GdkPixbuf *res;
+    GdkPaintable *res;
 
-    if (icon->pixbuf == NULL)
+    if (icon->paintable == NULL)
     {
         res = NULL;
     }
     else
     {
-        res = g_object_ref (icon->pixbuf);
+        res = g_object_ref (icon->paintable);
 
         if (icon->sole_owner)
         {
             icon->sole_owner = FALSE;
             g_object_add_toggle_ref (G_OBJECT (res),
-                                     pixbuf_toggle_notify,
+                                     paintable_toggle_notify,
                                      icon);
         }
     }
@@ -464,51 +460,37 @@ nautilus_icon_info_get_pixbuf_nodefault (NautilusIconInfo *icon)
     return res;
 }
 
-
-GdkPixbuf *
-nautilus_icon_info_get_pixbuf (NautilusIconInfo *icon)
+GdkPaintable *
+nautilus_icon_info_get_paintable (NautilusIconInfo *icon)
 {
-    GdkPixbuf *res;
+    GdkPaintable *res;
 
-    res = nautilus_icon_info_get_pixbuf_nodefault (icon);
+    res = nautilus_icon_info_get_paintable_nodefault (icon);
     if (res == NULL)
     {
-        res = gdk_pixbuf_new_from_resource ("/org/gnome/nautilus/text-x-preview.png",
-                                            NULL);
+        res = GDK_PAINTABLE (gdk_texture_new_from_resource ("/org/gnome/nautilus/text-x-preview.png"));
     }
 
     return res;
 }
 
-GdkPixbuf *
-nautilus_icon_info_get_pixbuf_at_size (NautilusIconInfo *icon,
-                                       gsize             forced_size)
+GdkTexture *
+nautilus_icon_info_get_texture (NautilusIconInfo *icon)
 {
-    GdkPixbuf *pixbuf, *scaled_pixbuf;
-    int w, h, s;
-    double scale;
+    g_autoptr (GdkPaintable) paintable = NULL;
+    GdkTexture *res;
 
-    pixbuf = nautilus_icon_info_get_pixbuf (icon);
-
-    w = gdk_pixbuf_get_width (pixbuf) / icon->orig_scale;
-    h = gdk_pixbuf_get_height (pixbuf) / icon->orig_scale;
-    s = MAX (w, h);
-    if (s == forced_size)
+    paintable = nautilus_icon_info_get_paintable_nodefault (icon);
+    if (GDK_IS_TEXTURE (paintable))
     {
-        return pixbuf;
+        res = GDK_TEXTURE (g_steal_pointer (&paintable));
+    }
+    else
+    {
+        res = gdk_texture_new_from_resource ("/org/gnome/nautilus/text-x-preview.png");
     }
 
-    scale = (double) forced_size / s;
-
-    /* Neither of these can be 0. */
-    w = MAX (w * scale, 1);
-    h = MAX (h * scale, 1);
-
-    scaled_pixbuf = gdk_pixbuf_scale_simple (pixbuf,
-                                             w, h,
-                                             GDK_INTERP_BILINEAR);
-    g_object_unref (pixbuf);
-    return scaled_pixbuf;
+    return res;
 }
 
 const char *
diff --git a/src/nautilus-icon-info.h b/src/nautilus-icon-info.h
index 518db76a9..e5fab7a6b 100644
--- a/src/nautilus-icon-info.h
+++ b/src/nautilus-icon-info.h
@@ -23,9 +23,8 @@ NautilusIconInfo *    nautilus_icon_info_lookup                       (GIcon
                                                                       int                size,
                                                                       int                scale);
 gboolean              nautilus_icon_info_is_fallback                  (NautilusIconInfo  *icon);
-GdkPixbuf *           nautilus_icon_info_get_pixbuf                   (NautilusIconInfo  *icon);
-GdkPixbuf *           nautilus_icon_info_get_pixbuf_at_size           (NautilusIconInfo  *icon,
-                                                                      gsize              forced_size);
+GdkPaintable *        nautilus_icon_info_get_paintable                (NautilusIconInfo  *icon);
+GdkTexture *          nautilus_icon_info_get_texture                  (NautilusIconInfo  *icon);
 const char *          nautilus_icon_info_get_used_name                (NautilusIconInfo  *icon);
 
 void                  nautilus_icon_info_clear_caches                 (void);
diff --git a/src/nautilus-list-model.c b/src/nautilus-list-model.c
index 701fc3eaf..953998e38 100644
--- a/src/nautilus-list-model.c
+++ b/src/nautilus-list-model.c
@@ -176,7 +176,7 @@ nautilus_list_model_get_column_type (GtkTreeModel *tree_model,
         case NAUTILUS_LIST_MODEL_LARGE_ICON_COLUMN:
         case NAUTILUS_LIST_MODEL_LARGER_ICON_COLUMN:
         {
-            return GDK_TYPE_PIXBUF;
+            return GDK_TYPE_TEXTURE;
         }
 
         case NAUTILUS_LIST_MODEL_FILE_NAME_IS_EDITABLE_COLUMN:
@@ -350,7 +350,7 @@ nautilus_list_model_get_value (GtkTreeModel *tree_model,
     FileEntry *file_entry;
     NautilusFile *file;
     char *str;
-    GdkPixbuf *icon, *rendered_icon;
+    GdkTexture *icon;
     int icon_size, icon_scale;
     NautilusListZoomLevel zoom_level;
     NautilusFileIconFlags flags;
@@ -387,7 +387,7 @@ nautilus_list_model_get_value (GtkTreeModel *tree_model,
         case NAUTILUS_LIST_MODEL_LARGE_ICON_COLUMN:
         case NAUTILUS_LIST_MODEL_LARGER_ICON_COLUMN:
         {
-            g_value_init (value, GDK_TYPE_PIXBUF);
+            g_value_init (value, GDK_TYPE_TEXTURE);
 
             if (file != NULL)
             {
@@ -421,8 +421,9 @@ nautilus_list_model_get_value (GtkTreeModel *tree_model,
                     }
                 }
 
-                icon = nautilus_file_get_icon_pixbuf (file, icon_size, icon_scale, flags);
+                icon = nautilus_file_get_icon_texture (file, icon_size, icon_scale, flags);
 
+#if 0 && NAUTILUS_CLIPBOARD_NEEDS_GTK4_REIMPLEMENTATION
                 if (priv->highlight_files != NULL &&
                     g_list_find_custom (priv->highlight_files,
                                         file, (GCompareFunc) nautilus_file_compare_location))
@@ -435,6 +436,7 @@ nautilus_list_model_get_value (GtkTreeModel *tree_model,
                         icon = rendered_icon;
                     }
                 }
+#endif
 
                 g_value_set_object (value, icon);
                 g_object_unref (icon);
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index 6961b8705..5c6d66771 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -2181,7 +2181,7 @@ create_and_set_up_tree_view (NautilusListView *view)
             gtk_tree_view_column_pack_start (view->details->file_name_column, cell, FALSE);
             gtk_tree_view_column_set_attributes (view->details->file_name_column,
                                                  cell,
-                                                 "pixbuf", nautilus_list_model_get_column_id_from_zoom_level 
(view->details->zoom_level),
+                                                 "texture", 
nautilus_list_model_get_column_id_from_zoom_level (view->details->zoom_level),
                                                  NULL);
 
             cell = gtk_cell_renderer_text_new ();
@@ -3354,7 +3354,7 @@ nautilus_list_view_set_zoom_level (NautilusListView      *view,
     column = nautilus_list_model_get_column_id_from_zoom_level (new_level);
     gtk_tree_view_column_set_attributes (view->details->file_name_column,
                                          GTK_CELL_RENDERER (view->details->pixbuf_cell),
-                                         "pixbuf", column,
+                                         "texture", column,
                                          NULL);
     set_up_pixbuf_size (view);
 }
diff --git a/src/nautilus-operations-ui-manager.c b/src/nautilus-operations-ui-manager.c
index ed5c6a094..2371339a5 100644
--- a/src/nautilus-operations-ui-manager.c
+++ b/src/nautilus-operations-ui-manager.c
@@ -223,25 +223,25 @@ set_copy_move_dialog_text (FileConflictDialogData *data)
 static void
 set_images (FileConflictDialogData *data)
 {
-    GdkPixbuf *source_pixbuf;
-    GdkPixbuf *destination_pixbuf;
+    GdkPaintable *source_paintable;
+    GdkPaintable *destination_paintable;
 
-    destination_pixbuf = nautilus_file_get_icon_pixbuf (data->destination,
-                                                        NAUTILUS_GRID_ICON_SIZE_SMALL,
-                                                        1,
-                                                        NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS);
+    destination_paintable = nautilus_file_get_icon_paintable (data->destination,
+                                                              NAUTILUS_GRID_ICON_SIZE_SMALL,
+                                                              1,
+                                                              NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS);
 
-    source_pixbuf = nautilus_file_get_icon_pixbuf (data->source,
-                                                   NAUTILUS_GRID_ICON_SIZE_SMALL,
-                                                   1,
-                                                   NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS);
+    source_paintable = nautilus_file_get_icon_paintable (data->source,
+                                                         NAUTILUS_GRID_ICON_SIZE_SMALL,
+                                                         1,
+                                                         NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS);
 
     nautilus_file_conflict_dialog_set_images (data->dialog,
-                                              destination_pixbuf,
-                                              source_pixbuf);
+                                              destination_paintable,
+                                              source_paintable);
 
-    g_object_unref (destination_pixbuf);
-    g_object_unref (source_pixbuf);
+    g_object_unref (destination_paintable);
+    g_object_unref (source_paintable);
 }
 
 static void
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index 12678b692..04ca6c79e 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -395,7 +395,7 @@ get_target_file (NautilusPropertiesWindow *self)
 static void
 get_image_for_properties_window (NautilusPropertiesWindow  *self,
                                  char                     **icon_name,
-                                 GdkPixbuf                **icon_pixbuf)
+                                 GdkPaintable             **icon_paintable)
 {
     g_autoptr (NautilusIconInfo) icon = NULL;
     GList *l;
@@ -444,9 +444,9 @@ get_image_for_properties_window (NautilusPropertiesWindow  *self,
         *icon_name = g_strdup (nautilus_icon_info_get_used_name (icon));
     }
 
-    if (icon_pixbuf != NULL)
+    if (icon_paintable != NULL)
     {
-        *icon_pixbuf = nautilus_icon_info_get_pixbuf_at_size (icon, NAUTILUS_GRID_ICON_SIZE_STANDARD);
+        *icon_paintable = nautilus_icon_info_get_paintable (icon);
     }
 }
 
@@ -454,18 +454,18 @@ get_image_for_properties_window (NautilusPropertiesWindow  *self,
 static void
 update_properties_window_icon (NautilusPropertiesWindow *self)
 {
-    g_autoptr (GdkPixbuf) pixbuf = NULL;
+    g_autoptr (GdkPaintable) paintable = NULL;
     g_autofree char *name = NULL;
 
-    get_image_for_properties_window (self, &name, &pixbuf);
+    get_image_for_properties_window (self, &name, &paintable);
 
     if (name != NULL)
     {
         gtk_window_set_icon_name (GTK_WINDOW (self), name);
     }
 
-    gtk_image_set_from_pixbuf (GTK_IMAGE (self->icon_image), pixbuf);
-    gtk_image_set_from_pixbuf (GTK_IMAGE (self->icon_button_image), pixbuf);
+    gtk_image_set_from_paintable (GTK_IMAGE (self->icon_image), paintable);
+    gtk_image_set_from_paintable (GTK_IMAGE (self->icon_button_image), paintable);
 }
 
 #if 0 && NAUTILUS_DND_NEEDS_GTK4_REIMPLEMENTATION
diff --git a/src/nautilus-shell-search-provider.c b/src/nautilus-shell-search-provider.c
index 081896520..90fdaa33b 100644
--- a/src/nautilus-shell-search-provider.c
+++ b/src/nautilus-shell-search-provider.c
@@ -658,9 +658,9 @@ result_list_attributes_ready_cb (GList    *file_list,
 
         if (gicon == NULL)
         {
-            gicon = G_ICON (nautilus_file_get_icon_pixbuf (file, 128,
-                                                           icon_scale,
-                                                           NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS));
+            gicon = G_ICON (nautilus_file_get_icon_texture (file, 128,
+                                                            icon_scale,
+                                                            NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS));
         }
 
         g_variant_builder_add (&meta, "{sv}",
diff --git a/src/nautilus-view-icon-item-ui.c b/src/nautilus-view-icon-item-ui.c
index 29a4a1bd2..344e0fc2a 100644
--- a/src/nautilus-view-icon-item-ui.c
+++ b/src/nautilus-view-icon-item-ui.c
@@ -33,7 +33,7 @@ static void
 update_icon (NautilusViewIconItemUi *self)
 {
     NautilusFileIconFlags flags;
-    g_autoptr (GdkPixbuf) icon_pixbuf = NULL;
+    g_autoptr (GdkPaintable) icon_paintable = NULL;
     GtkStyleContext *style_context;
     NautilusFile *file;
     guint icon_size;
@@ -46,8 +46,8 @@ update_icon (NautilusViewIconItemUi *self)
             NAUTILUS_FILE_ICON_FLAGS_USE_EMBLEMS |
             NAUTILUS_FILE_ICON_FLAGS_USE_ONE_EMBLEM;
 
-    icon_pixbuf = nautilus_file_get_icon_pixbuf (file, icon_size, 1, flags);
-    gtk_image_set_from_pixbuf (GTK_IMAGE (self->icon), icon_pixbuf);
+    icon_paintable = nautilus_file_get_icon_paintable (file, icon_size, 1, flags);
+    gtk_image_set_from_paintable (GTK_IMAGE (self->icon), icon_paintable);
 
     gtk_widget_set_size_request (self->fixed_height_box, icon_size, icon_size);
     if (icon_size < NAUTILUS_GRID_ICON_SIZE_LARGEST)


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