[nautilus/wip/oholy/gnome-42: 21/41] Revert "list-view: Drop HiDPI icon support"




commit 6c6596a988517e288d7afbff4de77c238c967ac6
Author: Ondrej Holy <oholy redhat com>
Date:   Fri Feb 11 14:27:34 2022 +0100

    Revert "list-view: Drop HiDPI icon support"
    
    This reverts commit dfe5e6b806a5317503a159dbfa213a00af6ed74b.

 src/nautilus-list-model.c | 11 +++++------
 src/nautilus-list-view.c  |  7 +++----
 2 files changed, 8 insertions(+), 10 deletions(-)
---
diff --git a/src/nautilus-list-model.c b/src/nautilus-list-model.c
index cf5cfb378..30aac1e21 100644
--- a/src/nautilus-list-model.c
+++ b/src/nautilus-list-model.c
@@ -174,7 +174,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 CAIRO_GOBJECT_TYPE_SURFACE;
         }
 
         case NAUTILUS_LIST_MODEL_FILE_NAME_IS_EDITABLE_COLUMN:
@@ -303,9 +303,6 @@ nautilus_list_model_get_icon_scale (NautilusListModel *model)
         retval = gdk_monitor_get_scale_factor (gdk_display_get_monitor (gdk_display_get_default (), 0));
     }
 
-    /* FIXME: Temporary regression: HiDPI icons not supported, ignore scale. */
-    retval = 1;
-
     return retval;
 }
 
@@ -352,6 +349,7 @@ nautilus_list_model_get_value (GtkTreeModel *tree_model,
     int icon_size, icon_scale;
     NautilusListZoomLevel zoom_level;
     NautilusFileIconFlags flags;
+    cairo_surface_t *surface;
 
     model = NAUTILUS_LIST_MODEL (tree_model);
     priv = nautilus_list_model_get_instance_private (model);
@@ -385,7 +383,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, CAIRO_GOBJECT_TYPE_SURFACE);
 
             if (file != NULL)
             {
@@ -434,7 +432,8 @@ nautilus_list_model_get_value (GtkTreeModel *tree_model,
                     }
                 }
 
-                g_value_set_object (value, icon);
+                surface = gdk_cairo_surface_create_from_pixbuf (icon, icon_scale, NULL);
+                g_value_take_boxed (value, surface);
                 g_object_unref (icon);
             }
         }
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index 28bf86dde..ce6bb7694 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -1909,8 +1909,7 @@ static gint
 get_icon_scale_callback (NautilusListModel *model,
                          NautilusListView  *view)
 {
-    /* FIXME: Temporary regression: HiDPI icons not supported, ignore scale. */
-    return 1;
+    return gtk_widget_get_scale_factor (GTK_WIDGET (view->details->tree_view));
 }
 
 static void
@@ -2177,7 +2176,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),
+                                                 "surface", 
nautilus_list_model_get_column_id_from_zoom_level (view->details->zoom_level),
                                                  NULL);
 
             cell = gtk_cell_renderer_text_new ();
@@ -3348,7 +3347,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,
+                                         "surface", column,
                                          NULL);
     set_up_pixbuf_size (view);
 }


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