[nautilus/wip/antoniof/properties-followup: 10/21] properties-window: Make Link target row consistent
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/antoniof/properties-followup: 10/21] properties-window: Make Link target row consistent
- Date: Fri, 5 Aug 2022 20:14:12 +0000 (UTC)
commit a4134ffe187be0e38b604d19a254b8509d75f642
Author: António Fernandes <antoniof gnome org>
Date: Thu Aug 4 07:19:39 2022 +0100
properties-window: Make Link target row consistent
With the Parent Location row. Also adds action to show link target in
its original location in a new window.
src/nautilus-properties-window.c | 23 ++++++++++++++
src/resources/ui/nautilus-properties-window.ui | 43 ++++++++++++++++++++------
2 files changed, 57 insertions(+), 9 deletions(-)
---
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index 527f58785..f9790d403 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -2414,6 +2414,28 @@ open_parent_folder (NautilusPropertiesWindow *self)
NULL, NULL);
}
+static void
+open_link_target (NautilusPropertiesWindow *self)
+{
+ g_autofree gchar *link_target_uri = NULL;
+ g_autoptr (GFile) link_target_location = NULL;
+ g_autoptr (NautilusFile) link_target_file = NULL;
+ g_autoptr (GFile) parent_location = NULL;
+
+ link_target_uri = nautilus_file_get_symbolic_link_target_uri (get_target_file (self));
+ g_return_if_fail (link_target_uri != NULL);
+ link_target_location = g_file_new_for_uri (link_target_uri);
+ link_target_file = nautilus_file_get (link_target_location);
+ parent_location = nautilus_file_get_parent_location (link_target_file);
+ 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){link_target_file, NULL},
+ NULL, NULL);
+}
+
static void
open_in_disks (NautilusPropertiesWindow *self)
{
@@ -4273,6 +4295,7 @@ nautilus_properties_window_class_init (NautilusPropertiesWindowClass *klass)
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, open_link_target);
gtk_widget_class_bind_template_callback (widget_class, navigate_main_page);
gtk_widget_class_bind_template_callback (widget_class, navigate_permissions_page);
}
diff --git a/src/resources/ui/nautilus-properties-window.ui b/src/resources/ui/nautilus-properties-window.ui
index f1ac303ce..3e1c41968 100644
--- a/src/resources/ui/nautilus-properties-window.ui
+++ b/src/resources/ui/nautilus-properties-window.ui
@@ -309,16 +309,41 @@
<property name="visible">False</property>
<property name="activatable">False</property>
<property name="selectable">False</property>
- <property name="title" translatable="yes">Link Target</property>
- <child>
- <object class="GtkLabel" id="link_target_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">Link Target</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="link_target_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_link_target" 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]