From a70393599e5aa4dc6c3e60f2d3dc040d5997f771 Mon Sep 17 00:00:00 2001 From: Debian GNOME Maintainers Date: Wed, 29 Jun 2022 16:00:15 +0800 Subject: [PATCH] user-directory-i18n =================================================================== Gbp-Pq: Name user-directory-i18n.patch --- gio/glocalfileinfo.c | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/gio/glocalfileinfo.c b/gio/glocalfileinfo.c index 2958225..4ad2f77 100644 --- a/gio/glocalfileinfo.c +++ b/gio/glocalfileinfo.c @@ -120,6 +120,9 @@ static GHashTable *gid_cache = NULL; #endif /* !G_OS_WIN32 */ +char* update_xdg_directory_display_name (const char *path, + char *display_name); + char * _g_local_file_info_create_etag (GLocalFileStat *statbuf) { @@ -1724,6 +1727,7 @@ _g_local_file_info_get_nostat (GFileInfo *info, G_FILE_ATTRIBUTE_ID_STANDARD_DISPLAY_NAME)) { char *display_name = g_filename_display_basename (path); + char *xdg_display_name = NULL; /* look for U+FFFD REPLACEMENT CHARACTER */ if (strstr (display_name, "\357\277\275") != NULL) @@ -1732,7 +1736,9 @@ _g_local_file_info_get_nostat (GFileInfo *info, display_name = g_strconcat (display_name, _(" (invalid encoding)"), NULL); g_free (p); } - g_file_info_set_display_name (info, display_name); + xdg_display_name = update_xdg_directory_display_name (path, display_name); + g_file_info_set_display_name (info, xdg_display_name); + g_free (xdg_display_name); g_free (display_name); } @@ -1812,6 +1818,31 @@ get_icon_name (const char *path, return name; } +char *update_xdg_directory_display_name (const char *path, + char *display_name) +{ + char *retval = g_strdup (display_name); + if (g_strcmp0 (path, g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP)) == 0) + { + retval = g_strdup (_("Desktop")); + } else if (g_strcmp0 (path, g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS)) == 0) { + retval = g_strdup (_("Documents")); + } else if (g_strcmp0 (path, g_get_user_special_dir (G_USER_DIRECTORY_DOWNLOAD)) == 0) { + retval = g_strdup (_("Download")); + } else if (g_strcmp0 (path, g_get_user_special_dir (G_USER_DIRECTORY_MUSIC)) == 0) { + retval = g_strdup (_("Music")); + } else if (g_strcmp0 (path, g_get_user_special_dir (G_USER_DIRECTORY_PICTURES)) == 0) { + retval = g_strdup (_("Pictures")); + } else if (g_strcmp0 (path, g_get_user_special_dir (G_USER_DIRECTORY_PUBLIC_SHARE)) == 0) { + retval = g_strdup (_("Public Share")); + } else if (g_strcmp0 (path, g_get_user_special_dir (G_USER_DIRECTORY_TEMPLATES)) == 0) { + retval = g_strdup (_("Templates")); + } else if (g_strcmp0 (path, g_get_user_special_dir (G_USER_DIRECTORY_VIDEOS)) == 0) { + retval = g_strdup (_("Videos")); + } + return retval; +} + static GIcon * get_icon (const char *path, const char *content_type,