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



commit 3d7454085430dbb15484bfec0fd587ba9986b9b9
Author: Phaedrus Leeds <mwleeds protonmail com>
Date:   Wed Mar 16 14:50:26 2022 -0700

    fixup! epiphany: Refine appstream-provided web apps

 plugins/epiphany/gs-plugin-epiphany.c | 38 ++++++++++-------------------------
 1 file changed, 11 insertions(+), 27 deletions(-)
---
diff --git a/plugins/epiphany/gs-plugin-epiphany.c b/plugins/epiphany/gs-plugin-epiphany.c
index b2c2bdb86..c00afa5a0 100644
--- a/plugins/epiphany/gs-plugin-epiphany.c
+++ b/plugins/epiphany/gs-plugin-epiphany.c
@@ -703,7 +703,6 @@ refine_thread_cb (GTask        *task,
        GsPluginEpiphany *self = GS_PLUGIN_EPIPHANY (source_object);
        GsPluginRefineData *data = task_data;
        GsAppList *list = data->list;
-       g_autoptr(GsAppList) app_list = NULL;
        g_autoptr(GError) local_error = NULL;
 
        assert_in_worker (self);
@@ -718,33 +717,18 @@ refine_thread_cb (GTask        *task,
 
                gs_epiphany_refine_app (app);
                gs_epiphany_refine_app_state (GS_PLUGIN (self), app);
-       }
-
-       /* 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_epiphany_refine_app (new);
-               gs_epiphany_refine_app_state (GS_PLUGIN (self), new);
-               gs_app_subsume_metadata (new, app);
-               gs_app_list_add (list, new);
+               /* Usually the way to refine wildcard apps is to create a new
+                * GsApp and add it to the results list, but in this case we
+                * need to use the app that was refined by the appstream plugin
+                * as it has all the metadata set already, and this is the only
+                * plugin for dealing with web apps, so it should be safe to
+                * adopt the wildcard app.
+                */
+               if (gs_app_has_quirk (app, GS_APP_QUIRK_IS_WILDCARD)) {
+                       gs_app_remove_quirk (app, GS_APP_QUIRK_IS_WILDCARD);
+                       gs_app_set_management_plugin (app, GS_PLUGIN (self));
+               }
        }
 
        /* success */


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