mirror of https://gitee.com/openkylin/glib2.0.git
user-directory-i18n
=================================================================== Gbp-Pq: Name user-directory-i18n.patch
This commit is contained in:
parent
d3c09df1b3
commit
a70393599e
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue