[nautilus/wip/antoniof/new-list-view-without-expanders: 8/12] list-view: Make small icons mode compact




commit 740a36428e084687af537712b8ee0d745a76e1b6
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 | 16 +++++++++++++---
 2 files changed, 22 insertions(+), 3 deletions(-)
---
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index a9b5de03d..03dea2c7a 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -664,6 +664,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 be1ffcbdb..c99fad083 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 .star {
+.nautilus-list-view.compact #NautilusViewCell {
+  padding-top: 3px;
+  padding-bottom: 3px;
+}
+
+.nautilus-list-view:not(.compact) image.star {
   padding: 6px;
 }
 
@@ -216,7 +226,7 @@
   border-radius: 2px;
 }
 
-.view .star:hover {
+.view image.star:hover {
   opacity: 1;
 }
 
@@ -225,6 +235,6 @@
   to {}
 }
 
-.view .star.added {
+.view image.star.added {
   animation: rotate_star 0.4s ease;
 }


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