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




commit 9041df1474a3cec3e312ec7648f264b09f238690
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 b861bb863..5cc686726 100644
--- a/src/nautilus-app-chooser.c
+++ b/src/nautilus-app-chooser.c
@@ -140,6 +140,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);
 
@@ -168,9 +169,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));
 
     if (self->single_content_type)
     {
diff --git a/src/resources/ui/nautilus-app-chooser.ui b/src/resources/ui/nautilus-app-chooser.ui
index fc7cc4671..56353ba13 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]