[gnome-software/1649-support-appstream-merging: 8/13] gs-flatpak: Use gs_appstream_add_current_locales()




commit 4bdad6adbc418ddf75557827385fce6fe08e9c1a
Author: Milan Crha <mcrha redhat com>
Date:   Thu Mar 31 12:09:27 2022 +0200

    gs-flatpak: Use gs_appstream_add_current_locales()

 plugins/flatpak/gs-flatpak.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)
---
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index 3605cf266..1ba4cd76f 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -878,7 +878,6 @@ gs_flatpak_rescan_appstream_store (GsFlatpak *self,
                                   GCancellable *cancellable,
                                   GError **error)
 {
-       const gchar *const *locales = g_get_language_names ();
        g_autofree gchar *blobfn = NULL;
        g_autoptr(GFile) file = NULL;
        g_autoptr(GPtrArray) xremotes = NULL;
@@ -915,9 +914,7 @@ gs_flatpak_rescan_appstream_store (GsFlatpak *self,
                                              XB_SILO_PROFILE_FLAG_DEBUG);
        }
 
-       /* add current locales */
-       for (guint i = 0; locales[i] != NULL; i++)
-               xb_builder_add_locale (builder, locales[i]);
+       gs_appstream_add_current_locales (builder);
 
        /* go through each remote adding metadata */
        xremotes = flatpak_installation_list_remotes (gs_flatpak_get_installation (self, interactive),
@@ -2750,7 +2747,6 @@ gs_flatpak_refine_appstream_from_bytes (GsFlatpak *self,
                                        GCancellable *cancellable,
                                        GError **error)
 {
-       const gchar *const *locales = g_get_language_names ();
        g_autofree gchar *xpath = NULL;
        g_autoptr(XbBuilder) builder = NULL;
        g_autoptr(XbBuilderSource) source = xb_builder_source_new ();
@@ -2775,9 +2771,7 @@ gs_flatpak_refine_appstream_from_bytes (GsFlatpak *self,
                g_main_context_push_thread_default (old_thread_default);
        g_clear_pointer (&old_thread_default, g_main_context_unref);
 
-       /* add current locales */
-       for (guint i = 0; locales[i] != NULL; i++)
-               xb_builder_add_locale (builder, locales[i]);
+       gs_appstream_add_current_locales (builder);
 
        /* decompress data */
        decompressor = g_zlib_decompressor_new (G_ZLIB_COMPRESSOR_FORMAT_GZIP);
@@ -3492,7 +3486,6 @@ gs_flatpak_file_to_app_ref (GsFlatpak *self,
                            GError **error)
 {
        GsApp *runtime;
-       const gchar *const *locales = g_get_language_names ();
        const gchar *remote_name;
        gboolean is_runtime, success;
        gsize len = 0;
@@ -3521,9 +3514,7 @@ gs_flatpak_file_to_app_ref (GsFlatpak *self,
        g_autofree gchar *ref_branch = NULL;
        FlatpakInstallation *installation = gs_flatpak_get_installation (self, interactive);
 
-       /* add current locales */
-       for (guint i = 0; locales[i] != NULL; i++)
-               xb_builder_add_locale (builder, locales[i]);
+       gs_appstream_add_current_locales (builder);
 
        /* get file data */
        if (!g_file_load_contents (file,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]