[gnome-software/1649-support-appstream-merging: 10/18] gs-plugin-appstream: Use a GPtrArray for desktop files dirs
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/1649-support-appstream-merging: 10/18] gs-plugin-appstream: Use a GPtrArray for desktop files dirs
- Date: Mon, 4 Apr 2022 13:58:08 +0000 (UTC)
commit 299a62a3deeb137dc3aa3145b0958fedcffd7278
Author: Milan Crha <mcrha redhat com>
Date: Thu Mar 31 12:02:22 2022 +0200
gs-plugin-appstream: Use a GPtrArray for desktop files dirs
This will be used in a future commit. It also follows the pattern
used by appdata and appstream data paths.
plugins/core/gs-plugin-appstream.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/plugins/core/gs-plugin-appstream.c b/plugins/core/gs-plugin-appstream.c
index 32a4de6d5..176d52b84 100644
--- a/plugins/core/gs-plugin-appstream.c
+++ b/plugins/core/gs-plugin-appstream.c
@@ -564,6 +564,12 @@ gs_plugin_appstream_check_silo (GsPluginAppstream *self,
/* Nothing to watch in the tests */
parent_appstream = g_ptr_array_new_with_free_func (g_free);
} else {
+ g_autoptr(GPtrArray) parent_desktop = g_ptr_array_new ();
+
+ g_ptr_array_add (parent_desktop, (gpointer) DATADIR "/applications");
+ if (g_strcmp0 (DATADIR, "/usr/share") != 0)
+ g_ptr_array_add (parent_desktop, (gpointer) "/usr/share/applications");
+
/* add search paths */
parent_appstream = gs_appstream_get_appstream_data_dirs ();
gs_add_appstream_metainfo_location (parent_appdata, DATADIR);
@@ -588,16 +594,10 @@ gs_plugin_appstream_check_silo (GsPluginAppstream *self,
cancellable, error))
return FALSE;
}
- if (!gs_appstream_load_desktop_files (builder,
- DATADIR "/applications",
- NULL, cancellable, error)) {
- return FALSE;
- }
- if (g_strcmp0 (DATADIR, "/usr/share") != 0 &&
- !gs_appstream_load_desktop_files (builder,
- "/usr/share/applications",
- NULL, cancellable, error)) {
- return FALSE;
+ for (guint i = 0; i < parent_desktop->len; i++) {
+ const gchar *dir = g_ptr_array_index (parent_desktop, i);
+ if (!gs_appstream_load_desktop_files (builder, dir, NULL, cancellable, error))
+ return FALSE;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]