Revert "app-cache: Fix cache for folder translations"

Existing folders as created by gnome-software (including the
default ones) all have the .directory suffix, so dropping
the suffix from the keys broke those folders.

This reverts commit 343b3351f1.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2623
This commit is contained in:
Florian Müllner 2020-04-13 15:41:54 +02:00 committed by Georges Basile Stavracas Neto
parent c422d82752
commit c2b518929d

View File

@ -109,17 +109,11 @@ load_folder (GHashTable *folders,
while ((name = g_dir_read_name (dir))) while ((name = g_dir_read_name (dir)))
{ {
g_autofree gchar *stripped_name = NULL;
g_autofree gchar *filename = NULL; g_autofree gchar *filename = NULL;
g_autoptr(GKeyFile) keyfile = NULL; g_autoptr(GKeyFile) keyfile = NULL;
if (!g_str_has_suffix (name, ".directory"))
continue;
stripped_name = g_strndup (name, strlen (name) - strlen (".directory"));
/* First added wins */ /* First added wins */
if (g_hash_table_contains (folders, stripped_name)) if (g_hash_table_contains (folders, name))
continue; continue;
filename = g_build_filename (path, name, NULL); filename = g_build_filename (path, name, NULL);
@ -134,8 +128,7 @@ load_folder (GHashTable *folders,
NULL, NULL); NULL, NULL);
if (translated != NULL) if (translated != NULL)
g_hash_table_insert (folders, g_steal_pointer (&stripped_name), g_hash_table_insert (folders, g_strdup (name), translated);
translated);
} }
} }
} }