[nautilus/wip/oholy/gnome-42: 22/41] Revert "properties-window: Drop HiDPI icon support"




commit c70fd032f18b0921798ee8eb9069d308cbde0f9b
Author: Ondrej Holy <oholy redhat com>
Date:   Fri Feb 11 14:27:53 2022 +0100

    Revert "properties-window: Drop HiDPI icon support"
    
    This reverts commit f3fea0fe1574b8a290bc1d58c5a1c6dd67dd7077.

 src/nautilus-properties-window.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index 2a6e7b6ff..804a993bb 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -401,8 +401,6 @@ get_image_for_properties_window (NautilusPropertiesWindow  *self,
     gint icon_scale;
 
     icon_scale = gtk_widget_get_scale_factor (GTK_WIDGET (self->notebook));
-    /* FIXME: Temporary regression: HiDPI icons not supported, ignore scale. */
-    icon_scale = 1;
 
     for (l = self->original_files; l != NULL; l = l->next)
     {
@@ -454,6 +452,7 @@ static void
 update_properties_window_icon (NautilusPropertiesWindow *self)
 {
     g_autoptr (GdkPixbuf) pixbuf = NULL;
+    cairo_surface_t *surface;
     g_autofree char *name = NULL;
 
     get_image_for_properties_window (self, &name, &pixbuf);
@@ -463,8 +462,12 @@ update_properties_window_icon (NautilusPropertiesWindow *self)
         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);
+    surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, gtk_widget_get_scale_factor (GTK_WIDGET (self)),
+                                                    gtk_widget_get_window (GTK_WIDGET (self)));
+    gtk_image_set_from_surface (GTK_IMAGE (self->icon_image), surface);
+    gtk_image_set_from_surface (GTK_IMAGE (self->icon_button_image), surface);
+
+    cairo_surface_destroy (surface);
 }
 
 /* utility to test if a uri refers to a local image */


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