[nautilus/wip/antoniof/gtk4-pre-switch-regressions: 3/4] list-view: Drop HiDPI icon support




commit 6433ec253cdbccf1117b43a8e86d53b0ec82a8bd
Author: António Fernandes <antoniof gnome org>
Date:   Wed Dec 15 16:59:02 2021 +0000

    list-view: Drop HiDPI icon support
    
    gdk_cairo_surface_create_from_pixbuf() is gone in GDK 4. A replacement
    cannot be easily implemented in GTK 3 which would be portable to GTK 4.
    
    Take this temporary regression, to be fixed with paintables in GTK 4.

 src/nautilus-list-model.c | 11 ++++++-----
 src/nautilus-list-view.c  |  7 ++++---
 2 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/src/nautilus-list-model.c b/src/nautilus-list-model.c
index 7e2aeeeee..ebafcebf8 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 CAIRO_GOBJECT_TYPE_SURFACE;
+            return GDK_TYPE_PIXBUF;
         }
 
         case NAUTILUS_LIST_MODEL_FILE_NAME_IS_EDITABLE_COLUMN:
@@ -303,6 +303,9 @@ 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;
 }
 
@@ -349,7 +352,6 @@ 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);
@@ -383,7 +385,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, CAIRO_GOBJECT_TYPE_SURFACE);
+            g_value_init (value, GDK_TYPE_PIXBUF);
 
             if (file != NULL)
             {
@@ -432,8 +434,7 @@ nautilus_list_model_get_value (GtkTreeModel *tree_model,
                     }
                 }
 
-                surface = gdk_cairo_surface_create_from_pixbuf (icon, icon_scale, NULL);
-                g_value_take_boxed (value, surface);
+                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 1df7223b0..b105761dc 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -2046,7 +2046,8 @@ static gint
 get_icon_scale_callback (NautilusListModel *model,
                          NautilusListView  *view)
 {
-    return gtk_widget_get_scale_factor (GTK_WIDGET (view->details->tree_view));
+    /* FIXME: Temporary regression: HiDPI icons not supported, ignore scale. */
+    return 1;
 }
 
 static void
@@ -2306,7 +2307,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,
-                                                 "surface", 
nautilus_list_model_get_column_id_from_zoom_level (view->details->zoom_level),
+                                                 "pixbuf", nautilus_list_model_get_column_id_from_zoom_level 
(view->details->zoom_level),
                                                  NULL);
 
             cell = gtk_cell_renderer_text_new ();
@@ -3482,7 +3483,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),
-                                         "surface", column,
+                                         "pixbuf", column,
                                          NULL);
     set_up_pixbuf_size (view);
 }


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