[nautilus/wip/corey/fix-sort: 1/4] column-chooser: Don't allow "name" column to be hidden




commit 0d3918eab3f9b40a8948d0c407e317c267e204fa
Author: Corey Berla <corey berla me>
Date:   Mon Oct 10 12:58:59 2022 -0700

    column-chooser: Don't allow "name" column to be hidden
    
    During the population of the TreeView for the column-chooser,
    the "sensitive" property disallows toggling the toggle for
    the "Name" column.  The ::row-activated signal on the TreeView,
    however, allows the "Name" column to be toggled because the
    ::row-activated signal is on the TreeView itself (rather than
    the cell).  Either we could 1) remove ::row-activated altogether
    (double clicking the display name) or 2) check to make sure
    we aren't toggling "Name".  I chose #2.

 src/nautilus-column-chooser.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/src/nautilus-column-chooser.c b/src/nautilus-column-chooser.c
index 23aa5af5c..9f038ccdc 100644
--- a/src/nautilus-column-chooser.c
+++ b/src/nautilus-column-chooser.c
@@ -155,14 +155,20 @@ toggle_path (NautilusColumnChooser *chooser,
 {
     GtkTreeIter iter;
     gboolean visible;
+    g_autofree gchar *name = NULL;
 
     gtk_tree_model_get_iter (GTK_TREE_MODEL (chooser->store),
                              &iter, path);
-    gtk_tree_model_get (GTK_TREE_MODEL (chooser->store),
-                        &iter, COLUMN_VISIBLE, &visible, -1);
-    gtk_list_store_set (chooser->store,
-                        &iter, COLUMN_VISIBLE, !visible, -1);
-    list_changed (chooser);
+    gtk_tree_model_get (GTK_TREE_MODEL (chooser->store), &iter,
+                        COLUMN_VISIBLE, &visible,
+                        COLUMN_NAME, &name, -1);
+
+    if (g_strcmp0 (name, "name") != 0)
+    {
+        gtk_list_store_set (chooser->store,
+                            &iter, COLUMN_VISIBLE, !visible, -1);
+        list_changed (chooser);
+    }
 }
 
 


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