[nautilus/wip/antoniof/view-item-state-styling: 4/5] file: Drop folder-drag-accept icon usage




commit 397bdbe818a78bf3de5536fb22864f368ccf6c28
Author: António Fernandes <antoniof gnome org>
Date:   Wed Aug 3 10:48:54 2022 +0100

    file: Drop folder-drag-accept icon usage
    
    Problems:
     - Changing icon without animation is crude.
     - If the folder has a custom icon, it doesn't change, which is
       inconsistent
     - And archives, which can accept drops, don't change icon, which is
       inconsistent.
    
    We already have css styling for drop targets so, which suffices.
    
    As per design review in https://gitlab.gnome.org/GNOME/nautilus/-/issues/2347

 src/nautilus-file.c      |  8 +-------
 src/nautilus-file.h      |  7 +++----
 src/nautilus-grid-cell.c | 15 ---------------
 src/nautilus-name-cell.c |  9 ---------
 4 files changed, 4 insertions(+), 35 deletions(-)
---
diff --git a/src/nautilus-file.c b/src/nautilus-file.c
index e03d78f90..f6e2b5736 100644
--- a/src/nautilus-file.c
+++ b/src/nautilus-file.c
@@ -5064,8 +5064,7 @@ nautilus_file_get_gicon (NautilusFile          *file,
     {
         icon = NULL;
 
-        if (((flags & NAUTILUS_FILE_ICON_FLAGS_FOR_DRAG_ACCEPT) ||
-             (flags & NAUTILUS_FILE_ICON_FLAGS_FOR_OPEN_FOLDER) ||
+        if (((flags & NAUTILUS_FILE_ICON_FLAGS_FOR_OPEN_FOLDER) ||
              (flags & NAUTILUS_FILE_ICON_FLAGS_USE_MOUNT_ICON)) &&
             G_IS_THEMED_ICON (file->details->icon))
         {
@@ -5098,11 +5097,6 @@ nautilus_file_get_gicon (NautilusFile          *file,
             {
                 g_ptr_array_add (prepend_array, "folder-open");
             }
-            if (is_folder &&
-                (flags & NAUTILUS_FILE_ICON_FLAGS_FOR_DRAG_ACCEPT))
-            {
-                g_ptr_array_add (prepend_array, "folder-drag-accept");
-            }
 
             if (prepend_array->len)
             {
diff --git a/src/nautilus-file.h b/src/nautilus-file.h
index 088d57d4b..02cda5535 100644
--- a/src/nautilus-file.h
+++ b/src/nautilus-file.h
@@ -81,12 +81,11 @@ typedef enum {
        NAUTILUS_FILE_ICON_FLAGS_NONE = 0,
        NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS = (1<<0),
        NAUTILUS_FILE_ICON_FLAGS_IGNORE_VISITING = (1<<1),
-       NAUTILUS_FILE_ICON_FLAGS_FOR_DRAG_ACCEPT = (1<<2),
-       NAUTILUS_FILE_ICON_FLAGS_FOR_OPEN_FOLDER = (1<<3),
+       NAUTILUS_FILE_ICON_FLAGS_FOR_OPEN_FOLDER = (1<<2),
        /* whether the thumbnail size must match the display icon size */
-       NAUTILUS_FILE_ICON_FLAGS_FORCE_THUMBNAIL_SIZE = (1<<4),
+       NAUTILUS_FILE_ICON_FLAGS_FORCE_THUMBNAIL_SIZE = (1<<3),
        /* uses the icon of the mount if present */
-       NAUTILUS_FILE_ICON_FLAGS_USE_MOUNT_ICON = (1<<5),
+       NAUTILUS_FILE_ICON_FLAGS_USE_MOUNT_ICON = (1<<4),
 } NautilusFileIconFlags;       
 
 #define NAUTILUS_THUMBNAIL_MINIMUM_ICON_SIZE 32
diff --git a/src/nautilus-grid-cell.c b/src/nautilus-grid-cell.c
index 0eb20e281..4ed8455fb 100644
--- a/src/nautilus-grid-cell.c
+++ b/src/nautilus-grid-cell.c
@@ -30,7 +30,6 @@ update_icon (NautilusGridCell *self)
 {
     NautilusViewItem *item;
     NautilusFileIconFlags flags;
-    gboolean drag_accept;
     g_autoptr (GdkPaintable) icon_paintable = NULL;
     GtkStyleContext *style_context;
     NautilusFile *file;
@@ -44,12 +43,6 @@ update_icon (NautilusGridCell *self)
     flags = NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS |
             NAUTILUS_FILE_ICON_FLAGS_FORCE_THUMBNAIL_SIZE;
 
-    g_object_get (item, "drag-accept", &drag_accept, NULL);
-    if (drag_accept)
-    {
-        flags |= NAUTILUS_FILE_ICON_FLAGS_FOR_DRAG_ACCEPT;
-    }
-
     icon_paintable = nautilus_file_get_icon_paintable (file, icon_size, 1, flags);
     gtk_picture_set_paintable (GTK_PICTURE (self->icon), icon_paintable);
 
@@ -153,12 +146,6 @@ on_item_size_changed (NautilusGridCell *self)
     update_captions (self);
 }
 
-static void
-on_item_drag_accept_changed (NautilusGridCell *self)
-{
-    update_icon (self);
-}
-
 static void
 on_item_is_cut_changed (NautilusGridCell *self)
 {
@@ -216,8 +203,6 @@ nautilus_grid_cell_init (NautilusGridCell *self)
     self->item_signal_group = g_signal_group_new (NAUTILUS_TYPE_VIEW_ITEM);
     g_signal_group_connect_swapped (self->item_signal_group, "notify::icon-size",
                                     (GCallback) on_item_size_changed, self);
-    g_signal_group_connect_swapped (self->item_signal_group, "notify::drag-accept",
-                                    (GCallback) on_item_drag_accept_changed, self);
     g_signal_group_connect_swapped (self->item_signal_group, "notify::is-cut",
                                     (GCallback) on_item_is_cut_changed, self);
     g_signal_group_connect_swapped (self->item_signal_group, "file-changed",
diff --git a/src/nautilus-name-cell.c b/src/nautilus-name-cell.c
index 1a0720ea6..be07aab37 100644
--- a/src/nautilus-name-cell.c
+++ b/src/nautilus-name-cell.c
@@ -134,7 +134,6 @@ static void
 update_icon (NautilusNameCell *self)
 {
     NautilusFileIconFlags flags;
-    gboolean drag_accept;
     g_autoptr (GdkPaintable) icon_paintable = NULL;
     GtkStyleContext *style_context;
     NautilusViewItem *item;
@@ -152,12 +151,6 @@ update_icon (NautilusNameCell *self)
     flags = NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS |
             NAUTILUS_FILE_ICON_FLAGS_FORCE_THUMBNAIL_SIZE;
 
-    g_object_get (item, "drag-accept", &drag_accept, NULL);
-    if (drag_accept)
-    {
-        flags |= NAUTILUS_FILE_ICON_FLAGS_FOR_DRAG_ACCEPT;
-    }
-
     icon_paintable = nautilus_file_get_icon_paintable (file, icon_size, 1, flags);
     gtk_picture_set_paintable (GTK_PICTURE (self->icon), icon_paintable);
 
@@ -248,8 +241,6 @@ on_item_drag_accept_changed (NautilusNameCell *self)
     {
         gtk_widget_unset_state_flags (list_row, GTK_STATE_FLAG_DROP_ACTIVE);
     }
-
-    update_icon (self);
 }
 
 static void


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