[nautilus/wip/antoniof/gtk4-preparation-drop-libgd: 42/45] general: Replace thumbnail frame with shadow




commit afc0a8adf5e4287ed636eb9e615a93ea3085ddc9
Author: António Fernandes <antoniof gnome org>
Date:   Tue Nov 2 21:57:50 2021 +0000

    general: Replace thumbnail frame with shadow
    
    Shadows are present in design mockups, frame is not.
    
    Also, shadows can be done with CSS, instead of transforming pixbufs.
    
    Furthermore, this removes another use of libgd, which we want to stop
    depending on as part of the GTK 3-to-4 migration.

 icons/thumbnail_frame.png            | Bin 482 -> 0 bytes
 src/nautilus-file.c                  |   4 ----
 src/nautilus-ui-utilities.c          |  25 -------------------------
 src/nautilus-ui-utilities.h          |   1 -
 src/resources/css/Adwaita.css        |   8 ++++++++
 src/resources/nautilus.gresource.xml |   1 -
 6 files changed, 8 insertions(+), 31 deletions(-)
---
diff --git a/src/nautilus-file.c b/src/nautilus-file.c
index 3f5d1399c..9498e81e4 100644
--- a/src/nautilus-file.c
+++ b/src/nautilus-file.c
@@ -5261,10 +5261,6 @@ nautilus_file_get_thumbnail_icon (NautilusFile          *file,
                     {
                         nautilus_ui_frame_video (&pixbuf);
                     }
-                    else
-                    {
-                        nautilus_ui_frame_image (&pixbuf);
-                    }
                 }
             }
 
diff --git a/src/nautilus-ui-utilities.c b/src/nautilus-ui-utilities.c
index 195f765f9..79a624a14 100644
--- a/src/nautilus-ui-utilities.c
+++ b/src/nautilus-ui-utilities.c
@@ -28,7 +28,6 @@
 
 #include <gio/gio.h>
 #include <gtk/gtk.h>
-#include <libgd/gd.h>
 #include <string.h>
 #include <glib/gi18n.h>
 
@@ -68,30 +67,6 @@ nautilus_gmenu_set_from_model (GMenu      *target_menu,
     }
 }
 
-#define NAUTILUS_THUMBNAIL_FRAME_LEFT 3
-#define NAUTILUS_THUMBNAIL_FRAME_TOP 3
-#define NAUTILUS_THUMBNAIL_FRAME_RIGHT 3
-#define NAUTILUS_THUMBNAIL_FRAME_BOTTOM 3
-
-void
-nautilus_ui_frame_image (GdkPixbuf **pixbuf)
-{
-    GtkBorder border;
-    GdkPixbuf *pixbuf_with_frame;
-
-    border.left = NAUTILUS_THUMBNAIL_FRAME_LEFT;
-    border.top = NAUTILUS_THUMBNAIL_FRAME_TOP;
-    border.right = NAUTILUS_THUMBNAIL_FRAME_RIGHT;
-    border.bottom = NAUTILUS_THUMBNAIL_FRAME_BOTTOM;
-
-    pixbuf_with_frame = gd_embed_image_in_frame (*pixbuf,
-                                                 "resource:///org/gnome/nautilus/icons/thumbnail_frame.png",
-                                                 &border, &border);
-    g_object_unref (*pixbuf);
-
-    *pixbuf = pixbuf_with_frame;
-}
-
 static GdkPixbuf *filmholes_left = NULL;
 static GdkPixbuf *filmholes_right = NULL;
 
diff --git a/src/nautilus-ui-utilities.h b/src/nautilus-ui-utilities.h
index 1136e1de6..ed00f5fc7 100644
--- a/src/nautilus-ui-utilities.h
+++ b/src/nautilus-ui-utilities.h
@@ -28,7 +28,6 @@
 void        nautilus_gmenu_set_from_model           (GMenu             *target_menu,
                                                      GMenuModel        *source_model);
 
-void        nautilus_ui_frame_image                 (GdkPixbuf        **pixbuf);
 void        nautilus_ui_frame_video                 (GdkPixbuf        **pixbuf);
 
 gboolean    nautilus_file_date_in_between           (guint64            file_unix_time,
diff --git a/src/resources/css/Adwaita.css b/src/resources/css/Adwaita.css
index 4bc40e21b..3dccaddeb 100644
--- a/src/resources/css/Adwaita.css
+++ b/src/resources/css/Adwaita.css
@@ -12,6 +12,10 @@
     border-radius: 5px;
 }
 
+.nautilus-canvas-item.thumbnail {
+  -gtk-icon-shadow: 0px 1px 2px darker(@borders);
+}
+
 .nautilus-canvas-item.dim-label {
     color: mix (@theme_fg_color, @theme_bg_color, 0.50);
 }
@@ -174,6 +178,10 @@ entry.search > * {
     border-bottom: 1px solid @theme_bg_color;
 }
 
+.nautilus-list-view.thumbnail {
+  -gtk-icon-shadow: 0px 1px 2px darker(@borders);
+}
+
 .search-information {
   background-color: @theme_selected_bg_color;
   color:white;
diff --git a/src/resources/nautilus.gresource.xml b/src/resources/nautilus.gresource.xml
index a0cd28876..ccb2ef6ff 100644
--- a/src/resources/nautilus.gresource.xml
+++ b/src/resources/nautilus.gresource.xml
@@ -28,7 +28,6 @@
     <file>ui/nautilus-operations-ui-manager-request-passphrase.ui</file>
     <file alias="gtk/ui/nautilusgtkplacesview.ui">../gtk/nautilusgtkplacesview.ui</file>
     <file alias="gtk/ui/nautilusgtkplacesviewrow.ui">../gtk/nautilusgtkplacesviewrow.ui</file>
-    <file alias="icons/thumbnail_frame.png">../../icons/thumbnail_frame.png</file>
     <file alias="icons/filmholes.png">../../icons/filmholes.png</file>
     <file>css/Adwaita.css</file>
     <file>css/nautilus.css</file>


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