[nautilus/wip/coreyberla/app-chooser-fixes: 2/8] app-chooser: Don't allow changing default on a folder




commit d1865b9c2aecea51f27a41738ff773bc6c82f4dc
Author: Corey Berla <corey berla me>
Date:   Sun Aug 7 21:07:04 2022 -0700

    app-chooser: Don't allow changing default on a folder
    
    Nautilus opens folders natively regardless of the default file type.
    Don't allow users to change the default association for a folder
    which would otherwise give a false impression.
    
    Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2413

 src/nautilus-app-chooser.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/nautilus-app-chooser.c b/src/nautilus-app-chooser.c
index bebc8def0..929d60a8d 100644
--- a/src/nautilus-app-chooser.c
+++ b/src/nautilus-app-chooser.c
@@ -143,6 +143,12 @@ nautilus_app_chooser_init (NautilusAppChooser *self)
     gtk_widget_set_name (GTK_WIDGET (self), "NautilusAppChooser");
 }
 
+static gboolean
+content_type_is_folder (NautilusAppChooser *self)
+{
+    return g_strcmp0 (self->content_type, "inode/directory") == 0;
+}
+
 static void
 nautilus_app_chooser_constructed (GObject *object)
 {
@@ -187,7 +193,7 @@ nautilus_app_chooser_constructed (GObject *object)
     {
         title = _("Open Items");
     }
-    else if (g_strcmp0 (self->content_type, "inode/directory") == 0)
+    else if (content_type_is_folder (self))
     {
         title = _("Open Folder");
     }
@@ -199,7 +205,7 @@ nautilus_app_chooser_constructed (GObject *object)
     gtk_header_bar_set_title_widget (GTK_HEADER_BAR (gtk_dialog_get_header_bar (GTK_DIALOG (self))),
                                      adw_window_title_new (title, NULL));
 
-    if (self->single_content_type)
+    if (self->single_content_type && !content_type_is_folder (self))
     {
         content_type_description = g_content_type_get_description (self->content_type);
         gtk_label_set_label (GTK_LABEL (self->label_content_type_description), content_type_description);


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