[nautilus/wip/ernestask/gtk4-continued: 8/50] file-conflict-dialog: Use textures for file thumbnails



commit fd8f8a3d1d2672cc789b95ba8c2b645e0cbbb608
Author: Ernestas Kulik <ernestask gnome org>
Date:   Wed Jul 25 12:58:05 2018 +0300

    file-conflict-dialog: Use textures for file thumbnails

 src/nautilus-file-conflict-dialog.c  | 18 ++++++++++++------
 src/nautilus-file-conflict-dialog.h  |  6 +++---
 src/nautilus-operations-ui-manager.c | 31 ++++++++++++++-----------------
 3 files changed, 29 insertions(+), 26 deletions(-)
---
diff --git a/src/nautilus-file-conflict-dialog.c b/src/nautilus-file-conflict-dialog.c
index e7d05e5ed..1481bcbb5 100644
--- a/src/nautilus-file-conflict-dialog.c
+++ b/src/nautilus-file-conflict-dialog.c
@@ -86,29 +86,35 @@ nautilus_file_conflict_dialog_set_text (NautilusFileConflictDialog *fcd,
 
 void
 nautilus_file_conflict_dialog_set_images (NautilusFileConflictDialog *fcd,
-                                          GdkPixbuf                  *destination_pixbuf,
-                                          GdkPixbuf                  *source_pixbuf)
+                                          GdkTexture                 *destination_texture,
+                                          GdkTexture                 *source_texture)
 {
     if (fcd->dest_image == NULL)
     {
-        fcd->dest_image = gtk_image_new_from_pixbuf (destination_pixbuf);
+        fcd->dest_image = gtk_image_new_from_paintable (GDK_PAINTABLE (destination_texture));
         gtk_box_pack_start (GTK_BOX (fcd->first_hbox), fcd->dest_image);
+        gtk_image_set_pixel_size (GTK_IMAGE (fcd->dest_image),
+                                  NAUTILUS_CANVAS_ICON_SIZE_SMALL);
         gtk_widget_show (fcd->dest_image);
     }
     else
     {
-        gtk_image_set_from_pixbuf (GTK_IMAGE (fcd->dest_image), destination_pixbuf);
+        gtk_image_set_from_paintable (GTK_IMAGE (fcd->dest_image),
+                                      GDK_PAINTABLE (destination_texture));
     }
 
     if (fcd->src_image == NULL)
     {
-        fcd->src_image = gtk_image_new_from_pixbuf (source_pixbuf);
+        fcd->src_image = gtk_image_new_from_paintable (GDK_PAINTABLE (source_texture));
+        gtk_image_set_pixel_size (GTK_IMAGE (fcd->src_image),
+                                  NAUTILUS_CANVAS_ICON_SIZE_SMALL);
         gtk_box_pack_start (GTK_BOX (fcd->second_hbox), fcd->src_image);
         gtk_widget_show (fcd->src_image);
     }
     else
     {
-        gtk_image_set_from_pixbuf (GTK_IMAGE (fcd->src_image), source_pixbuf);
+        gtk_image_set_from_paintable (GTK_IMAGE (fcd->src_image),
+                                      GDK_PAINTABLE (source_texture));
     }
 }
 
diff --git a/src/nautilus-file-conflict-dialog.h b/src/nautilus-file-conflict-dialog.h
index e54071b02..c438e0a98 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);
+                                               GdkTexture *source_texture,
+                                               GdkTexture *destination_texture);
 void nautilus_file_conflict_dialog_set_file_labels (NautilusFileConflictDialog *fcd,
                                                     gchar *destination_label,
                                                     gchar *source_label);
@@ -55,4 +55,4 @@ void nautilus_file_conflict_dialog_disable_apply_to_all (NautilusFileConflictDia
 char*      nautilus_file_conflict_dialog_get_new_name     (NautilusFileConflictDialog *dialog);
 gboolean   nautilus_file_conflict_dialog_get_apply_to_all (NautilusFileConflictDialog *dialog);
 
-G_END_DECLS
\ No newline at end of file
+G_END_DECLS
diff --git a/src/nautilus-operations-ui-manager.c b/src/nautilus-operations-ui-manager.c
index fbaac05c9..0938d5d3f 100644
--- a/src/nautilus-operations-ui-manager.c
+++ b/src/nautilus-operations-ui-manager.c
@@ -212,27 +212,24 @@ set_copy_move_dialog_text (FileConflictDialogData *data)
 static void
 set_images (FileConflictDialogData *data)
 {
-    GdkPixbuf *source_pixbuf;
-    GdkPixbuf *destination_pixbuf;
+    g_autoptr (GdkTexture) source_texture = NULL;
+    g_autoptr (GdkTexture) destination_texture = NULL;
 
-    destination_pixbuf = nautilus_file_get_icon_pixbuf (data->destination,
-                                                        NAUTILUS_CANVAS_ICON_SIZE_SMALL,
-                                                        TRUE,
-                                                        1,
-                                                        NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS);
+    destination_texture = nautilus_file_get_icon_texture (data->destination,
+                                                          NAUTILUS_CANVAS_ICON_SIZE_SMALL,
+                                                          TRUE,
+                                                          1,
+                                                          NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS);
 
-    source_pixbuf = nautilus_file_get_icon_pixbuf (data->source,
-                                                   NAUTILUS_CANVAS_ICON_SIZE_SMALL,
-                                                   TRUE,
-                                                   1,
-                                                   NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS);
+    source_texture = nautilus_file_get_icon_texture (data->source,
+                                                     NAUTILUS_CANVAS_ICON_SIZE_SMALL,
+                                                     TRUE,
+                                                     1,
+                                                     NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS);
 
     nautilus_file_conflict_dialog_set_images (data->dialog,
-                                              destination_pixbuf,
-                                              source_pixbuf);
-
-    g_object_unref (destination_pixbuf);
-    g_object_unref (source_pixbuf);
+                                              destination_texture,
+                                              source_texture);
 }
 
 static void


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