[Xfce4-commits] [xfce/thunar] 01/06: For folders copied always append "copy #" to the end of their names (bug #11862)

noreply at xfce.org noreply at xfce.org
Sun May 3 15:00:13 CEST 2015


This is an automated email from the git hooks/post-receive script.

hjudt pushed a commit to branch master
in repository xfce/thunar.

commit e232de51d70cacfa67afaed4962c0a43ebca5697
Author: Harald Judt <h.judt at gmx.at>
Date:   Fri May 1 09:25:03 2015 +0200

    For folders copied always append "copy #" to the end of their names (bug #11862)
    
    Files usually have extensions, but most folders do not. This is also the
    way the renamer dialog treats filenames, so the behaviour should be the
    same.
---
 thunar/thunar-io-jobs-util.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/thunar/thunar-io-jobs-util.c b/thunar/thunar-io-jobs-util.c
index 8348e12..5ea3da0 100644
--- a/thunar/thunar-io-jobs-util.c
+++ b/thunar/thunar-io-jobs-util.c
@@ -67,7 +67,7 @@ thunar_io_jobs_util_next_duplicate_file (ThunarJob *job,
   const gchar *old_display_name;
   gchar       *display_name;
   gchar       *file_basename;
-  gchar       *dot;
+  gchar       *dot = NULL;
   
   _thunar_return_val_if_fail (THUNAR_IS_JOB (job), NULL);
   _thunar_return_val_if_fail (G_IS_FILE (file), NULL);
@@ -80,7 +80,8 @@ thunar_io_jobs_util_next_duplicate_file (ThunarJob *job,
     return NULL;
 
   /* query the source file info / display name */
-  info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME, 
+  info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_TYPE ","
+                            G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
                             G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
                             exo_job_get_cancellable (EXO_JOB (job)), &err);
 
@@ -94,8 +95,10 @@ thunar_io_jobs_util_next_duplicate_file (ThunarJob *job,
   old_display_name = g_file_info_get_display_name (info);
   if (copy)
     {
-      /* get file extension */
-      dot = thunar_util_str_get_extension (old_display_name);
+      /* get file extension if file is not a directory */
+      if (g_file_info_get_file_type (info) != G_FILE_TYPE_DIRECTORY)
+        dot = thunar_util_str_get_extension (old_display_name);
+
       if (dot != NULL)
         {
           file_basename = g_strndup (old_display_name, dot - old_display_name);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list