[gnome-software/mwleeds/hardcoded-pwa-list] fixup! epiphany: Refine appstream-provided web apps



commit fcdc689beee05c8a60f9022da63a72453e57a3c2
Author: Phaedrus Leeds <mwleeds protonmail com>
Date:   Wed Mar 16 12:27:12 2022 -0700

    fixup! epiphany: Refine appstream-provided web apps

 plugins/epiphany/gs-plugin-epiphany.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
---
diff --git a/plugins/epiphany/gs-plugin-epiphany.c b/plugins/epiphany/gs-plugin-epiphany.c
index 5da3a2913..b4c464cbb 100644
--- a/plugins/epiphany/gs-plugin-epiphany.c
+++ b/plugins/epiphany/gs-plugin-epiphany.c
@@ -703,6 +703,32 @@ refine_thread_cb (GTask        *task,
                refine_app (app, uri, url);
        }
 
+       /* Refine wildcards.
+        *
+        * Use a copy of the list for the loop because a function called
+        * on the plugin may affect the list which can lead to problems
+        * (e.g. inserting an app in the list on every call results in
+        * an infinite loop) */
+       app_list = gs_app_list_copy (list);
+
+       for (guint j = 0; j < gs_app_list_length (app_list); j++) {
+               GsApp *app = gs_app_list_index (app_list, j);
+               g_autoptr(GsApp) new = NULL;
+
+               if (!gs_app_has_quirk (app, GS_APP_QUIRK_IS_WILDCARD))
+                       continue;
+
+               /* not us */
+               if (gs_app_get_kind (app) != AS_COMPONENT_KIND_WEB_APP ||
+                   gs_app_get_bundle_kind (app) == AS_BUNDLE_KIND_PACKAGE)
+                       continue;
+
+               new = gs_epiphany_create_app (self, gs_app_get_id (app));
+
+               gs_app_subsume_metadata (new, app);
+               gs_app_list_add (list, new);
+       }
+
        /* success */
        g_task_return_boolean (task, TRUE);
 }


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