[nautilus/wip/coreyberla/app-picker-followups: 3/5] app-chooser: Use more specific title




commit 720f8eeb00657a87d2708fd0079b6e97e26e4251
Author: Corey Berla <corey berla me>
Date:   Fri Aug 5 12:54:01 2022 -0700

    app-chooser: Use more specific title
    
    Make default title "Open File" or "Open Folder" if it's a folder.
    If we are acting on a mix of items make it "Open Items"

 src/nautilus-app-chooser.c               | 17 +++++++++++++++--
 src/resources/ui/nautilus-app-chooser.ui |  2 +-
 2 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/src/nautilus-app-chooser.c b/src/nautilus-app-chooser.c
index a6b563a6e..8f930596c 100644
--- a/src/nautilus-app-chooser.c
+++ b/src/nautilus-app-chooser.c
@@ -138,6 +138,7 @@ nautilus_app_chooser_constructed (GObject *object)
     NautilusAppChooser *self = NAUTILUS_APP_CHOOSER (object);
     g_autoptr (GAppInfo) info = NULL;
     g_autofree gchar *content_type_description = NULL;
+    gchar *title;
 
     G_OBJECT_CLASS (nautilus_app_chooser_parent_class)->constructed (object);
 
@@ -166,9 +167,21 @@ nautilus_app_chooser_constructed (GObject *object)
                       G_CALLBACK (on_application_selected),
                       self);
 
+    if (!self->single_content_type)
+    {
+        title = _("Open Items");
+    }
+    else if (g_strcmp0 (self->content_type, "inode/directory") == 0)
+    {
+        title = _("Open Folder");
+    }
+    else
+    {
+        title = _("Open File");
+    }
+
     gtk_header_bar_set_title_widget (GTK_HEADER_BAR (gtk_dialog_get_header_bar (GTK_DIALOG (self))),
-                                     adw_window_title_new (gtk_window_get_title (GTK_WINDOW (self)),
-                                                           self->content_type));
+                                     adw_window_title_new (title, NULL));
 
     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);
diff --git a/src/resources/ui/nautilus-app-chooser.ui b/src/resources/ui/nautilus-app-chooser.ui
index b549aeff6..56572096a 100644
--- a/src/resources/ui/nautilus-app-chooser.ui
+++ b/src/resources/ui/nautilus-app-chooser.ui
@@ -2,7 +2,7 @@
 <interface>
   <requires lib="gtk" version="4.0"/>
   <template class="NautilusAppChooser" parent="GtkDialog">
-    <property name="title" translatable="yes">Open With</property>
+    <property name="title" translatable="yes">Open File</property>
     <property name="focusable">False</property>
     <property name="destroy-with-parent">True</property>
     <property name="modal">True</property>


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