gboolean gs_plugin_refine (GsPlugin *plugin, GsAppList *list, GsPluginRefineFlags flags, GCancellable *cancellable, GError **error) { g_autoptr(GsApp) app = NULL; g_autoptr(GsAppList) os_updates = gs_app_list_new (); /* not from get_updates() */ if ((flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_UPDATE_DETAILS) == 0) return TRUE; /* do we have any packages left that are not apps? */ for (guint i = 0; i < gs_app_list_length (list); i++) { GsApp *app_tmp = gs_app_list_index (list, i); if (gs_app_has_quirk (app_tmp, GS_APP_QUIRK_IS_WILDCARD)) continue; if (gs_plugin_generic_updates_merge_os_update (app_tmp)) gs_app_list_add (os_updates, app_tmp); } if (gs_app_list_length (os_updates) == 0) return TRUE; /* create new meta object */ app = gs_plugin_generic_updates_get_os_update (plugin); for (guint i = 0; i < gs_app_list_length (os_updates); i++) { GsApp *app_tmp = gs_app_list_index (os_updates, i); gs_app_add_related (app, app_tmp); gs_app_list_remove (list, app_tmp); } gs_app_list_add (list, app); return TRUE; }
gboolean gs_plugin_refine (GsPlugin *plugin, GsAppList *list, GsPluginRefineFlags flags, GCancellable *cancellable, GError **error) { g_autoptr(GsApp) app = NULL; g_autoptr(GsAppList) os_updates = gs_app_list_new (); /* not from get_updates() */ if ((flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_UPDATE_DETAILS) == 0) return TRUE; /* do we have any packages left that are not apps? */ for (guint i = 0; i < gs_app_list_length (list); i++) { GsApp *app_tmp = gs_app_list_index (list, i); if (gs_plugin_generic_updates_merge_os_update (app_tmp)) gs_app_list_add (os_updates, app_tmp); } if (gs_app_list_length (os_updates) == 0) return TRUE; /* create new meta object */ app = gs_plugin_generic_updates_get_os_update (plugin); for (guint i = 0; i < gs_app_list_length (os_updates); i++) { GsApp *app_tmp = gs_app_list_index (os_updates, i); const gchar *id = gs_app_get_unique_id (app_tmp); if (id == NULL) id = gs_app_get_source_default (app_tmp); g_debug ("moving %s to parent %s", id, gs_app_get_unique_id (app)); gs_app_add_related (app, app_tmp); gs_app_list_remove (list, app_tmp); } gs_app_list_add (list, app); return TRUE; }