diff options
author | Carlos Soriano <csoriano@gnome.org> | 2015-07-20 18:40:07 +0200 |
---|---|---|
committer | Carlos Soriano <csoriano@gnome.org> | 2015-07-20 18:41:48 +0200 |
commit | 3f33d32b75b14d4b5f1fedd14a628e88fad4d332 (patch) | |
tree | 320f183b6f404d373911cc1c68d888c081b6312d /src | |
parent | 46d18fecc33d5a9a85f90ca2aa58d5017f3415de (diff) | |
download | nautilus-3f33d32b75b14d4b5f1fedd14a628e88fad4d332.tar.gz |
list-view: match gtkfilechooser location names
Now we put the relative path, and we don't show the path if
the current location is the same as the target file.
Diffstat (limited to 'src')
-rw-r--r-- | src/nautilus-list-view.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c index 1b4b36d93..f2c740e4d 100644 --- a/src/nautilus-list-view.c +++ b/src/nautilus-list-view.c @@ -1692,24 +1692,29 @@ location_cell_data_func (GtkTreeViewColumn *column, g_object_unref (query); } - if (g_file_equal (home_location, dir_location)) { - where = g_strdup (_("Home")); - } else if (g_file_equal (base_location, dir_location)) { + if (g_file_equal (base_location, dir_location)) { /* Only occurs when search result is * a direct child of the base location */ where = g_strdup (""); + } else if (g_file_equal (home_location, dir_location)) { + where = g_strdup (_("Home")); } else if (g_file_has_prefix (dir_location, base_location)) { - where = g_file_get_basename (dir_location); - } + gchar *relative_path; - if (where != NULL) { - g_object_set (G_OBJECT (renderer), - "text", where, - NULL); + relative_path = g_file_get_relative_path (home_location, dir_location); + where = g_filename_display_name (relative_path); - g_free (where); - } + g_free (relative_path); + } else { + where = g_file_get_path (dir_location); + } + + g_object_set (G_OBJECT (renderer), + "text", where, + NULL); + + g_free (where); g_object_unref (base_location); g_object_unref (dir_location); |