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




commit f9a1b75f853d58f553c039f240e892b0f544b952
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 63a8b302a..6775a2386 100644
--- a/src/nautilus-app-chooser.c
+++ b/src/nautilus-app-chooser.c
@@ -144,6 +144,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);
 
@@ -169,9 +170,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 b99623822..c66dbe83e 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]