Allow setting the locale subpaths in repo config

Read an xa.languages key from the [core] section of
the repo config to determine which subpaths to install
for Locales. This lets us maintain a list of system
languages without inventing a new file in /etc, and
will also work for alternative install locations.
tingping/wmclass
Matthias Clasen 2017-07-07 23:32:50 -04:00
parent 261ff03b63
commit 3874a29d74
2 changed files with 18 additions and 1 deletions

View File

@ -8581,7 +8581,7 @@ add_related (FlatpakDir *self,
if (g_str_has_suffix (extension, ".Locale"))
{
g_autofree char ** current_subpaths = flatpak_get_current_locale_subpaths ();
g_autofree char ** current_subpaths = flatpak_dir_get_locale_subpaths (self);
for (i = 0; current_subpaths[i] != NULL; i++)
{
g_autofree char *subpath = current_subpaths[i];
@ -8849,3 +8849,18 @@ flatpak_dir_find_local_related (FlatpakDir *self,
return g_steal_pointer (&related);
}
char **
flatpak_dir_get_locale_subpaths (FlatpakDir *self)
{
GKeyFile *config = ostree_repo_get_config (self->repo);
char **subpaths = NULL;
if (config)
subpaths = g_key_file_get_string_list (config, "core", "xa.languages", NULL, NULL);
if (!subpaths)
subpaths = flatpak_get_current_locale_subpaths ();
return subpaths;
}

View File

@ -577,4 +577,6 @@ gboolean flatpak_dir_lookup_repo_metadata (FlatpakDir *self,
const char *format_string,
...);
char ** flatpak_dir_get_locale_subpaths (FlatpakDir *self);
#endif /* __FLATPAK_DIR_H__ */