[nautilus/wip/antoniof/new-list-view-continuation: 19/23] list-view: Make small icons mode compact




commit e48f244d77047d5acf6d4c77ee071b2be22776eb
Author: António Fernandes <antoniof gnome org>
Date:   Fri Jun 3 20:34:09 2022 +0100

    list-view: Make small icons mode compact
    
    At 16 pixels, icons are as tall as text.
    
    As such, we can use this mode to maximize the number of items shown.

 src/nautilus-list-view.c      |  9 +++++++++
 src/resources/css/Adwaita.css | 12 +++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)
---
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index 7d98b4c54..49ad0f90d 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -680,6 +680,15 @@ set_zoom_level (NautilusListView *self,
     nautilus_list_base_set_icon_size (NAUTILUS_LIST_BASE (self),
                                       get_icon_size_for_zoom_level (new_level));
 
+    if (self->zoom_level == NAUTILUS_LIST_ZOOM_LEVEL_SMALL)
+    {
+        gtk_widget_add_css_class (GTK_WIDGET (self), "compact");
+    }
+    else
+    {
+        gtk_widget_remove_css_class (GTK_WIDGET (self), "compact");
+    }
+
     nautilus_files_view_update_toolbar_menus (NAUTILUS_FILES_VIEW (self));
 }
 
diff --git a/src/resources/css/Adwaita.css b/src/resources/css/Adwaita.css
index b2c93ffc4..47110f38e 100644
--- a/src/resources/css/Adwaita.css
+++ b/src/resources/css/Adwaita.css
@@ -188,6 +188,11 @@
   margin-bottom: 4px;
 }
 
+.nautilus-list-view.compact columnview > listview > row {
+  margin-top: 2px;
+  margin-bottom: 2px;
+}
+
 /* GTK unconditionally sets padding on GtkColumnViewCell, even with .data-table.
  * We don't want this to hpappen because we have event controllers on the child,
  * which should thus cover the whole area of the row. */
@@ -199,7 +204,12 @@
   padding: 6px;
 }
 
-.nautilus-list-view image.star {
+.nautilus-list-view.compact #NautilusViewCell {
+  padding-top: 3px;
+  padding-bottom: 3px;
+}
+
+.nautilus-list-view:not(.compact) image.star {
   padding: 6px;
 }
 


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