[nautilus/wip/ernestask/gtk4-continued: 6/50] view-icon-item-ui: Use GdkTexture for thumbnail



commit 51d08981a24f8213c61ee6d577106ec3bf14d5b5
Author: Ernestas Kulik <ernestask gnome org>
Date:   Wed Jul 25 09:15:02 2018 +0300

    view-icon-item-ui: Use GdkTexture for thumbnail

 src/nautilus-view-icon-item-ui.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/src/nautilus-view-icon-item-ui.c b/src/nautilus-view-icon-item-ui.c
index afcc0b32a..e9049ef75 100644
--- a/src/nautilus-view-icon-item-ui.c
+++ b/src/nautilus-view-icon-item-ui.c
@@ -28,8 +28,8 @@ static GtkWidget *
 create_icon (NautilusViewIconItemUi *self)
 {
     NautilusFileIconFlags flags;
-    g_autoptr (GdkPixbuf) icon_pixbuf = NULL;
-    GtkImage *icon;
+    g_autoptr (GdkTexture) texture = NULL;
+    GtkWidget *icon;
     GtkBox *fixed_height_box;
     GtkStyleContext *style_context;
     NautilusFile *file;
@@ -42,11 +42,10 @@ create_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,
-                                                 TRUE, 1, flags);
-    icon = GTK_IMAGE (gtk_image_new_from_pixbuf (icon_pixbuf));
-    gtk_widget_set_hexpand (GTK_WIDGET (icon), TRUE);
-    gtk_widget_set_vexpand (GTK_WIDGET (icon), TRUE);
+    texture = nautilus_file_get_icon_texture (file, icon_size, TRUE, 1, flags);
+    icon = gtk_image_new_from_paintable (GDK_PAINTABLE (texture));
+    gtk_widget_set_hexpand (icon, TRUE);
+    gtk_widget_set_vexpand (icon, TRUE);
 
     fixed_height_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 0));
     gtk_widget_set_valign (GTK_WIDGET (fixed_height_box), GTK_ALIGN_CENTER);
@@ -60,7 +59,7 @@ create_icon (NautilusViewIconItemUi *self)
         gtk_style_context_add_class (style_context, "icon-background");
     }
 
-    gtk_box_pack_start (fixed_height_box, GTK_WIDGET (icon));
+    gtk_box_pack_start (fixed_height_box, icon);
 
     return GTK_WIDGET (fixed_height_box);
 }


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