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

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

commit c7c6e7dbe9a3c3d7c2fbc2156b6c16d7c0f71ae5
Author: Andre Miranda <andre...@xfce.org>
Date:   Mon Feb 12 22:13:43 2018 -0300

    Do not translate "Trash" files and folders (Bug #14211)
---
 thunar/thunar-file.c           |  8 ++++----
 thunar/thunar-gio-extensions.c | 42 +++++++++++++++++++++++++-----------------
 thunar/thunar-gio-extensions.h |  1 +
 3 files changed, 30 insertions(+), 21 deletions(-)

diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c
index e8a36cc..7259527 100644
--- a/thunar/thunar-file.c
+++ b/thunar/thunar-file.c
@@ -1067,21 +1067,21 @@ thunar_file_info_reload (ThunarFile   *file,
   /* determine the display name */
   if (file->display_name == NULL)
     {
-      if (G_LIKELY (file->info != NULL))
+      if (G_UNLIKELY (thunar_g_file_is_trash (file->gfile)))
+        file->display_name = g_strdup (_("Trash"));
+      else if (G_LIKELY (file->info != NULL))
         {
           display_name = g_file_info_get_display_name (file->info);
           if (G_LIKELY (display_name != NULL))
             {
               if (strcmp (display_name, "/") == 0)
                 file->display_name = g_strdup (_("File System"));
-              else if (strcmp (display_name, "Trash") == 0)
-                file->display_name = g_strdup (_("Trash"));
               else
                 file->display_name = g_strdup (display_name);
             }
         }
 
-      /* faccl back to a name for the gfile */
+      /* fall back to a name for the gfile */
       if (file->display_name == NULL)
         file->display_name = thunar_g_file_get_display_name (file->gfile);
     }
diff --git a/thunar/thunar-gio-extensions.c b/thunar/thunar-gio-extensions.c
index 42326b0..629ec01 100644
--- a/thunar/thunar-gio-extensions.c
+++ b/thunar/thunar-gio-extensions.c
@@ -131,6 +131,23 @@ thunar_g_file_is_home (GFile *file)
 
 
 
+gboolean
+thunar_g_file_is_trash (GFile *file)
+{
+  char *uri;
+  gboolean is_trash = FALSE;
+
+  _thunar_return_val_if_fail (G_IS_FILE (file), FALSE);
+
+  uri = g_file_get_uri (file);
+  is_trash = g_strcmp0 (uri, "trash:///") == 0;
+  g_free (uri);
+
+  return is_trash;
+}
+
+
+
 GKeyFile *
 thunar_g_file_query_key_file (GFile              *file,
                               GCancellable       *cancellable,
@@ -233,24 +250,15 @@ thunar_g_file_get_display_name (GFile *file)
   if (G_LIKELY (base_name != NULL))
     {
       if (strcmp (base_name, "/") == 0)
-        {
-          display_name = g_strdup (_("File System"));
-          g_free (base_name);
-        }
-      else if (strcmp (base_name, "Trash") == 0)
-        {
-          display_name = g_strdup (_("Trash"));
-          g_free (base_name);
-        }
+        display_name = g_strdup (_("File System"));
+      else if (thunar_g_file_is_trash (file))
+        display_name = g_strdup (_("Trash"));
       else if (g_utf8_validate (base_name, -1, NULL))
-       {
-         display_name = base_name;
-       }
-     else
-       {
-         display_name = g_uri_escape_string (base_name, 
G_URI_RESERVED_CHARS_ALLOWED_IN_PATH, TRUE);
-         g_free (base_name);
-       }
+        display_name = g_strdup (base_name);
+      else
+        display_name = g_uri_escape_string (base_name, 
G_URI_RESERVED_CHARS_ALLOWED_IN_PATH, TRUE);
+
+      g_free (base_name);
    }
  else
    {
diff --git a/thunar/thunar-gio-extensions.h b/thunar/thunar-gio-extensions.h
index 7d8922d..053faa6 100644
--- a/thunar/thunar-gio-extensions.h
+++ b/thunar/thunar-gio-extensions.h
@@ -34,6 +34,7 @@ GFile    *thunar_g_file_new_for_bookmarks        (void);
 gboolean  thunar_g_file_is_root                  (GFile                *file);
 gboolean  thunar_g_file_is_trashed               (GFile                *file);
 gboolean  thunar_g_file_is_home                  (GFile                *file);
+gboolean  thunar_g_file_is_trash                 (GFile                *file);
 
 GKeyFile *thunar_g_file_query_key_file           (GFile                *file,
                                                   GCancellable         
*cancellable,

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits

Reply via email to