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




commit 417f47fec4b36cc6d804932138aef0b6cb73c283
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 | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/nautilus-column-chooser.c b/src/nautilus-column-chooser.c
index 23aa5af5c..72e18bcc3 100644
--- a/src/nautilus-column-chooser.c
+++ b/src/nautilus-column-chooser.c
@@ -155,11 +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_tree_model_get (GTK_TREE_MODEL (chooser->store), &iter,
+                        COLUMN_VISIBLE, &visible,
+                        COLUMN_NAME, &name, -1);
+
+    if (g_strcmp0 (name, "name") == 0)
+    {
+        /* Don't allow name column to be disabled. */
+        return;
+    }
+
     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]