[Xfce4-commits] <thunar:master> End with a / in the path entry.

Nick Schermer noreply at xfce.org
Mon Oct 22 17:48:08 CEST 2012


Updating branch refs/heads/master
         to fbf167517fe0ab87ad68562038eabe23217781df (commit)
       from f0fbe0baf68374535f976cf4d58ed29885d4d7de (commit)

commit fbf167517fe0ab87ad68562038eabe23217781df
Author: Nick Schermer <nick at xfce.org>
Date:   Mon Oct 22 17:36:18 2012 +0200

    End with a / in the path entry.
    
    This has 2 advantages:
    - You probably want to navigate in the directory you've
      just entered, so this saves typing a /.
    - The code doesn't load the parent directory, saving
      a job to collect all the files and their information
      (ThunarFolder is shared).

 thunar/thunar-path-entry.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/thunar/thunar-path-entry.c b/thunar/thunar-path-entry.c
index 0f628b4..6a559de 100644
--- a/thunar/thunar-path-entry.c
+++ b/thunar/thunar-path-entry.c
@@ -1154,6 +1154,7 @@ thunar_path_entry_set_current_file (ThunarPathEntry *path_entry,
   GFile *file;
   gchar *text;
   gchar *unescaped;
+  gchar *tmp;
 
   _thunar_return_if_fail (THUNAR_IS_PATH_ENTRY (path_entry));
   _thunar_return_if_fail (current_file == NULL || THUNAR_IS_FILE (current_file));
@@ -1181,6 +1182,16 @@ thunar_path_entry_set_current_file (ThunarPathEntry *path_entry,
           /* not a native file, use the URI */
           text = g_file_get_uri (file);
         }
+
+      /* if the file is a directory, end with a / to avoid loading the parent
+       * directory which is probably not something the user wants */
+      if (thunar_file_is_directory (current_file)
+          && !g_str_has_suffix (text, "/"))
+        {
+          tmp = g_strconcat (text, "/", NULL);
+          g_free (text);
+          text = tmp;
+        }
     }
 
   unescaped = g_uri_unescape_string (text, NULL);


More information about the Xfce4-commits mailing list