[nautilus] properties-window: Add more information to File Properties in Trash



commit 66013b38c57080581f674f7f5f15ab6406441b51
Author: George Mocanu <mocanu geo98 gmail com>
Date:   Mon May 14 22:13:10 2018 +0300

    properties-window: Add more information to File Properties in Trash
    
    The File Properties Dialog provides too little information for files in
    Trash. An example for this problem would be not being able to distinguish
    between two files with the same name in Trash.
    
    Add "Trashed on" and "Original folder" labels to File Properties window
    for trashed files.
    
    Closes https://gitlab.gnome.org/GNOME/nautilus/issues/417

 src/nautilus-file.c              | 19 +++++-----------
 src/nautilus-properties-window.c | 48 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+), 13 deletions(-)
---
diff --git a/src/nautilus-file.c b/src/nautilus-file.c
index e85c09694..01e35d9ab 100644
--- a/src/nautilus-file.c
+++ b/src/nautilus-file.c
@@ -5369,26 +5369,19 @@ nautilus_file_get_where_string (NautilusFile *file)
 static char *
 nautilus_file_get_trash_original_file_parent_as_string (NautilusFile *file)
 {
-    NautilusFile *orig_file, *parent;
-    GFile *location;
+    NautilusFile *orig_file;
     char *filename;
 
-    if (file->details->trash_orig_path != NULL)
+    filename = NULL;
+    orig_file = nautilus_file_get_trash_original_file (file);
+    if (orig_file != NULL)
     {
-        orig_file = nautilus_file_get_trash_original_file (file);
-        parent = nautilus_file_get_parent (orig_file);
-        location = nautilus_file_get_location (parent);
+        filename = nautilus_file_get_parent_uri_for_display (orig_file);
 
-        filename = g_file_get_basename (location);
-
-        g_object_unref (location);
-        nautilus_file_unref (parent);
         nautilus_file_unref (orig_file);
-
-        return filename;
     }
 
-    return NULL;
+    return filename;
 }
 
 /**
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index 86978c028..67ae683a9 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -2648,6 +2648,22 @@ should_show_location_info (NautilusPropertiesWindow *window)
     return TRUE;
 }
 
+static gboolean
+should_show_trash_orig_path (NautilusPropertiesWindow *window)
+{
+    GList *l;
+
+    for (l = window->original_files; l != NULL; l = l->next)
+    {
+        if (!nautilus_file_is_in_trash (NAUTILUS_FILE (l->data)))
+        {
+            return FALSE;
+        }
+    }
+
+    return TRUE;
+}
+
 static gboolean
 should_show_accessed_date (NautilusPropertiesWindow *window)
 {
@@ -2663,6 +2679,22 @@ should_show_accessed_date (NautilusPropertiesWindow *window)
     return TRUE;
 }
 
+static gboolean
+should_show_trashed_on (NautilusPropertiesWindow *window)
+{
+    GList *l;
+
+    for (l = window->original_files; l != NULL; l = l->next)
+    {
+        if (!nautilus_file_is_in_trash (NAUTILUS_FILE (l->data)))
+        {
+            return FALSE;
+        }
+    }
+
+    return TRUE;
+}
+
 static gboolean
 should_show_link_target (NautilusPropertiesWindow *window)
 {
@@ -3190,6 +3222,14 @@ create_basic_page (NautilusPropertiesWindow *window)
                                             location_show_original (window));
     }
 
+    if (should_show_trash_orig_path (window))
+    {
+        append_title_and_ellipsizing_value (window, grid, _("Original folder:"),
+                                            "trash_orig_path",
+                                            INCONSISTENT_STATE_STRING,
+                                            FALSE);
+    }
+
     if (should_show_volume_info (window))
     {
         append_title_and_ellipsizing_value (window, grid,
@@ -3199,6 +3239,14 @@ create_basic_page (NautilusPropertiesWindow *window)
                                             FALSE);
     }
 
+    if (should_show_trashed_on (window))
+    {
+        append_title_and_ellipsizing_value (window, grid, _("Trashed on:"),
+                                            "trashed_on_full",
+                                            INCONSISTENT_STATE_STRING,
+                                            FALSE);
+    }
+
     if (should_show_accessed_date (window))
     {
         append_blank_row (grid);


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