[nautilus/wip/antoniof/new_open_with: 27/31] properties-window: Add button to Parent Folder row




commit 2a1d8c61569cb744d97d0cbf968d5f7c3e67ffb8
Author: António Fernandes <antoniof gnome org>
Date:   Sat Jul 23 19:30:40 2022 +0200

    properties-window: Add button to Parent Folder row
    
    Make it open the parent folder and select the file.
    
    Also use a layout which allows to show more of the path. This has been
    accepted by the design team as the best solution we have at the moment,
    but it's not a new row design pattern (yet?).

 src/nautilus-properties-window.c               | 16 ++++++++++
 src/resources/ui/nautilus-properties-window.ui | 43 ++++++++++++++++++++------
 2 files changed, 50 insertions(+), 9 deletions(-)
---
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index 0be4d16c2..723ab2202 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -2400,6 +2400,21 @@ setup_volume_usage_widget (NautilusPropertiesWindow *self)
     }
 }
 
+static void
+open_parent_folder (NautilusPropertiesWindow *self)
+{
+    g_autoptr (GFile) parent_location = NULL;
+
+    parent_location = nautilus_file_get_parent_location (get_target_file (self));
+    g_return_if_fail (parent_location != NULL);
+
+    nautilus_application_open_location_full (NAUTILUS_APPLICATION (g_application_get_default ()),
+                                             parent_location,
+                                             NAUTILUS_OPEN_FLAG_NEW_WINDOW,
+                                             &(GList){get_original_file (self), NULL},
+                                             NULL, NULL);
+}
+
 static void
 open_in_disks (NautilusPropertiesWindow *self)
 {
@@ -4638,6 +4653,7 @@ nautilus_properties_window_class_init (NautilusPropertiesWindowClass *klass)
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, set_as_default_button);
 
     gtk_widget_class_bind_template_callback (widget_class, open_in_disks);
+    gtk_widget_class_bind_template_callback (widget_class, open_parent_folder);
     gtk_widget_class_bind_template_callback (widget_class, navigate_main_page);
     gtk_widget_class_bind_template_callback (widget_class, navigate_permissions_page);
     gtk_widget_class_bind_template_callback (widget_class, navigate_open_with_page);
diff --git a/src/resources/ui/nautilus-properties-window.ui b/src/resources/ui/nautilus-properties-window.ui
index 05ba9dc6c..b27a32f57 100644
--- a/src/resources/ui/nautilus-properties-window.ui
+++ b/src/resources/ui/nautilus-properties-window.ui
@@ -347,16 +347,41 @@
                                     <property name="visible">False</property>
                                     <property name="activatable">False</property>
                                     <property name="selectable">False</property>
-                                    <property name="title" translatable="yes">Parent Folder</property>
-                                    <child>
-                                      <object class="GtkLabel" id="parent_folder_value_label">
-                                        <property name="hexpand">True</property>
-                                        <property name="selectable">True</property>
-                                        <property name="ellipsize">end</property>
-                                        <property name="max-width-chars">24</property>
-                                        <property name="xalign">1</property>
+                                    <child type="prefix">
+                                      <object class="GtkBox">
+                                        <property name="orientation">vertical</property>
+                                        <property name="spacing">3</property>
+                                        <property name="halign">start</property>
+                                        <property name="valign">center</property>
+                                        <child>
+                                          <object class="GtkLabel">
+                                            <property name="label" translatable="yes">Parent 
Folder</property>
+                                            <property name="hexpand">True</property>
+                                            <property name="ellipsize">end</property>
+                                            <property name="halign">start</property>
+                                            <style>
+                                              <class name="caption"/>
+                                              <class name="dim-label"/>
+                                            </style>
+                                          </object>
+                                        </child>
+                                        <child>
+                                          <object class="GtkLabel" id="parent_folder_value_label">
+                                            <property name="hexpand">True</property>
+                                            <property name="selectable">True</property>
+                                            <property name="ellipsize">start</property>
+                                            <property name="halign">start</property>
+                                          </object>
+                                        </child>
+                                      </object>
+                                    </child>
+                                    <child type="suffix">
+                                      <object class="GtkButton">
+                                        <property name="icon-name">folder-open-symbolic</property>
+                                        <property name="valign">center</property>
+                                        <signal name="clicked" handler="open_parent_folder" swapped="yes"/>
                                         <style>
-                                          <class name="dim-label"/>
+                                          <class name="flat"/>
                                         </style>
                                       </object>
                                     </child>


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