[gnome-software] Allow plugins to remove applications when resolving
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Allow plugins to remove applications when resolving
- Date: Fri, 31 Jan 2014 15:19:25 +0000 (UTC)
commit 68577a2be5c603a882cf5e367071986fec820e6a
Author: Richard Hughes <richard hughsie com>
Date: Fri Jan 31 14:17:37 2014 +0000
Allow plugins to remove applications when resolving
src/gs-plugin-loader.c | 25 +++++++++++++----------
src/gs-plugin.c | 2 +-
src/gs-plugin.h | 4 +-
src/plugins/gs-plugin-appdata.c | 4 +-
src/plugins/gs-plugin-appstream.c | 4 +-
src/plugins/gs-plugin-datadir-apps.c | 4 +-
src/plugins/gs-plugin-datadir-filename-local.c | 4 +-
src/plugins/gs-plugin-datadir-filename.c | 4 +-
src/plugins/gs-plugin-desktopdb.c | 4 +-
src/plugins/gs-plugin-dummy.c | 4 +-
src/plugins/gs-plugin-epiphany.c | 4 +-
src/plugins/gs-plugin-fedora-tagger-ratings.c | 4 +-
src/plugins/gs-plugin-hardcoded-kind.c | 4 +-
src/plugins/gs-plugin-local-ratings.c | 4 +-
src/plugins/gs-plugin-menu-spec-refine.c | 4 +-
src/plugins/gs-plugin-packagekit-history.c | 4 +-
src/plugins/gs-plugin-packagekit-refine.c | 10 ++++----
src/plugins/gs-plugin-self-test.c | 4 +-
18 files changed, 50 insertions(+), 47 deletions(-)
---
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index 1888f5e..abc83d2 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -154,7 +154,7 @@ static gboolean
gs_plugin_loader_run_refine_plugin (GsPluginLoader *plugin_loader,
GsPlugin *plugin,
const gchar *function_name_parent,
- GList *list,
+ GList **list,
GsPluginRefineFlags flags,
GCancellable *cancellable,
GError **error)
@@ -221,7 +221,7 @@ out:
static gboolean
gs_plugin_loader_run_refine (GsPluginLoader *plugin_loader,
const gchar *function_name_parent,
- GList *list,
+ GList **list,
GsPluginRefineFlags flags,
GCancellable *cancellable,
GError **error)
@@ -230,9 +230,11 @@ gs_plugin_loader_run_refine (GsPluginLoader *plugin_loader,
GsPlugin *plugin;
gboolean ret = TRUE;
guint i;
+ GList *freeze_list;
/* freeze all apps */
- for (l = list; l != NULL; l = l->next)
+ freeze_list = gs_plugin_list_copy (*list);
+ for (l = freeze_list; l != NULL; l = l->next)
g_object_freeze_notify (G_OBJECT (l->data));
/* run each plugin */
@@ -252,12 +254,13 @@ gs_plugin_loader_run_refine (GsPluginLoader *plugin_loader,
}
/* now emit all the changed signals */
- for (l = list; l != NULL; l = l->next)
+ for (l = freeze_list; l != NULL; l = l->next)
g_object_thaw_notify (G_OBJECT (l->data));
/* dedupe applications we already know about */
- gs_plugin_loader_list_dedupe (plugin_loader, list);
+ gs_plugin_loader_list_dedupe (plugin_loader, *list);
out:
+ gs_plugin_list_free (freeze_list);
return ret;
}
@@ -353,7 +356,7 @@ gs_plugin_loader_run_results (GsPluginLoader *plugin_loader,
/* run refine() on each one */
ret = gs_plugin_loader_run_refine (plugin_loader,
function_name,
- list,
+ &list,
flags,
cancellable,
error);
@@ -1376,7 +1379,7 @@ gs_plugin_loader_search_thread_cb (GSimpleAsyncResult *res,
/* run refine() on each one */
ret = gs_plugin_loader_run_refine (plugin_loader,
function_name,
- state->list,
+ &state->list,
state->flags,
cancellable,
&error);
@@ -1702,7 +1705,7 @@ gs_plugin_loader_get_category_apps_thread_cb (GSimpleAsyncResult *res,
/* run refine() on each one */
ret = gs_plugin_loader_run_refine (plugin_loader,
function_name,
- state->list,
+ &state->list,
state->flags,
cancellable,
&error);
@@ -1863,7 +1866,7 @@ gs_plugin_loader_app_refine_thread_cb (GSimpleAsyncResult *res,
gs_plugin_add_app (&list, state->app);
state->ret = gs_plugin_loader_run_refine (plugin_loader,
NULL,
- list,
+ &list,
state->flags,
cancellable,
&error);
@@ -2074,7 +2077,7 @@ load_install_queue (GsPluginLoader *plugin_loader, GError **error)
if (list != NULL) {
ret = gs_plugin_loader_run_refine (plugin_loader,
NULL,
- list,
+ &list,
GS_PLUGIN_REFINE_FLAGS_DEFAULT,
NULL, //FIXME?
error);
@@ -3143,7 +3146,7 @@ gs_plugin_loader_filename_to_app_thread_cb (GSimpleAsyncResult *res,
/* run refine() on each one */
ret = gs_plugin_loader_run_refine (plugin_loader,
function_name,
- state->list,
+ &state->list,
state->flags,
cancellable,
&error);
diff --git a/src/gs-plugin.c b/src/gs-plugin.c
index 8acd6ab..28fa778 100644
--- a/src/gs-plugin.c
+++ b/src/gs-plugin.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
- * Copyright (C) 2013 Richard Hughes <richard hughsie com>
+ * Copyright (C) 2013-2014 Richard Hughes <richard hughsie com>
*
* Licensed under the GNU General Public License Version 2
*
diff --git a/src/gs-plugin.h b/src/gs-plugin.h
index f88b73e..a698738 100644
--- a/src/gs-plugin.h
+++ b/src/gs-plugin.h
@@ -128,7 +128,7 @@ typedef gboolean (*GsPluginActionFunc) (GsPlugin *plugin,
GCancellable *cancellable,
GError **error);
typedef gboolean (*GsPluginRefineFunc) (GsPlugin *plugin,
- GList *list,
+ GList **list,
GsPluginRefineFlags flags,
GCancellable *cancellable,
GError **error);
@@ -198,7 +198,7 @@ gboolean gs_plugin_add_featured (GsPlugin *plugin,
GCancellable *cancellable,
GError **error);
gboolean gs_plugin_refine (GsPlugin *plugin,
- GList *list,
+ GList **list,
GsPluginRefineFlags flags,
GCancellable *cancellable,
GError **error);
diff --git a/src/plugins/gs-plugin-appdata.c b/src/plugins/gs-plugin-appdata.c
index 02f438c..9f865dc 100644
--- a/src/plugins/gs-plugin-appdata.c
+++ b/src/plugins/gs-plugin-appdata.c
@@ -352,7 +352,7 @@ out:
*/
gboolean
gs_plugin_refine (GsPlugin *plugin,
- GList *list,
+ GList **list,
GsPluginRefineFlags flags,
GCancellable *cancellable,
GError **error)
@@ -371,7 +371,7 @@ gs_plugin_refine (GsPlugin *plugin,
goto out;
}
- for (l = list; l != NULL; l = l->next) {
+ for (l = *list; l != NULL; l = l->next) {
app = GS_APP (l->data);
id = gs_app_get_id (app);
if (id == NULL)
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index ba843a6..c0e1a5b 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -677,7 +677,7 @@ out:
*/
gboolean
gs_plugin_refine (GsPlugin *plugin,
- GList *list,
+ GList **list,
GsPluginRefineFlags flags,
GCancellable *cancellable,
GError **error)
@@ -695,7 +695,7 @@ gs_plugin_refine (GsPlugin *plugin,
}
gs_profile_start (plugin->profile, "appstream::refine");
- for (l = list; l != NULL; l = l->next) {
+ for (l = *list; l != NULL; l = l->next) {
app = GS_APP (l->data);
ret = gs_plugin_refine_from_id (plugin, app, error);
if (!ret) {
diff --git a/src/plugins/gs-plugin-datadir-apps.c b/src/plugins/gs-plugin-datadir-apps.c
index 3dc4544..4520353 100644
--- a/src/plugins/gs-plugin-datadir-apps.c
+++ b/src/plugins/gs-plugin-datadir-apps.c
@@ -296,7 +296,7 @@ out:
*/
gboolean
gs_plugin_refine (GsPlugin *plugin,
- GList *list,
+ GList **list,
GsPluginRefineFlags flags,
GCancellable *cancellable,
GError **error)
@@ -306,7 +306,7 @@ gs_plugin_refine (GsPlugin *plugin,
GsApp *app;
gboolean ret;
- for (l = list; l != NULL; l = l->next) {
+ for (l = *list; l != NULL; l = l->next) {
app = GS_APP (l->data);
ret = gs_plugin_refine_app (plugin,
app,
diff --git a/src/plugins/gs-plugin-datadir-filename-local.c b/src/plugins/gs-plugin-datadir-filename-local.c
index e24410d..0819b42 100644
--- a/src/plugins/gs-plugin-datadir-filename-local.c
+++ b/src/plugins/gs-plugin-datadir-filename-local.c
@@ -49,7 +49,7 @@ gs_plugin_get_deps (GsPlugin *plugin)
*/
gboolean
gs_plugin_refine (GsPlugin *plugin,
- GList *list,
+ GList **list,
GsPluginRefineFlags flags,
GCancellable *cancellable,
GError **error)
@@ -58,7 +58,7 @@ gs_plugin_refine (GsPlugin *plugin,
GList *l;
GsApp *app;
- for (l = list; l != NULL; l = l->next) {
+ for (l = *list; l != NULL; l = l->next) {
app = GS_APP (l->data);
if (gs_app_get_state (app) != GS_APP_STATE_UNKNOWN)
continue;
diff --git a/src/plugins/gs-plugin-datadir-filename.c b/src/plugins/gs-plugin-datadir-filename.c
index bf2d12c..1564080 100644
--- a/src/plugins/gs-plugin-datadir-filename.c
+++ b/src/plugins/gs-plugin-datadir-filename.c
@@ -133,7 +133,7 @@ out:
*/
gboolean
gs_plugin_refine (GsPlugin *plugin,
- GList *list,
+ GList **list,
GsPluginRefineFlags flags,
GCancellable *cancellable,
GError **error)
@@ -142,7 +142,7 @@ gs_plugin_refine (GsPlugin *plugin,
GList *l;
GsApp *app;
- for (l = list; l != NULL; l = l->next) {
+ for (l = *list; l != NULL; l = l->next) {
app = GS_APP (l->data);
if (gs_app_get_name (app) != NULL)
continue;
diff --git a/src/plugins/gs-plugin-desktopdb.c b/src/plugins/gs-plugin-desktopdb.c
index ba68d79..041ac0a 100644
--- a/src/plugins/gs-plugin-desktopdb.c
+++ b/src/plugins/gs-plugin-desktopdb.c
@@ -140,7 +140,7 @@ out:
*/
gboolean
gs_plugin_refine (GsPlugin *plugin,
- GList *list,
+ GList **list,
GsPluginRefineFlags flags,
GCancellable *cancellable,
GError **error)
@@ -162,7 +162,7 @@ gs_plugin_refine (GsPlugin *plugin,
}
/* can we convert a package to an application */
- for (l = list; l != NULL; l = l->next) {
+ for (l = *list; l != NULL; l = l->next) {
app = GS_APP (l->data);
if (gs_app_get_metadata_item (app, "DataDir::desktop-filename") != NULL)
continue;
diff --git a/src/plugins/gs-plugin-dummy.c b/src/plugins/gs-plugin-dummy.c
index a160af0..ebc426d 100644
--- a/src/plugins/gs-plugin-dummy.c
+++ b/src/plugins/gs-plugin-dummy.c
@@ -167,7 +167,7 @@ gs_plugin_add_popular (GsPlugin *plugin,
*/
gboolean
gs_plugin_refine (GsPlugin *plugin,
- GList *list,
+ GList **list,
GsPluginRefineFlags flags,
GCancellable *cancellable,
GError **error)
@@ -175,7 +175,7 @@ gs_plugin_refine (GsPlugin *plugin,
GsApp *app;
GList *l;
- for (l = list; l != NULL; l = l->next) {
+ for (l = *list; l != NULL; l = l->next) {
app = GS_APP (l->data);
if (gs_app_get_name (app) == NULL) {
if (g_strcmp0 (gs_app_get_id (app), "gnome-boxes") == 0) {
diff --git a/src/plugins/gs-plugin-epiphany.c b/src/plugins/gs-plugin-epiphany.c
index 6c3f982..074285c 100644
--- a/src/plugins/gs-plugin-epiphany.c
+++ b/src/plugins/gs-plugin-epiphany.c
@@ -680,7 +680,7 @@ out:
*/
gboolean
gs_plugin_refine (GsPlugin *plugin,
- GList *list,
+ GList **list,
GsPluginRefineFlags flags,
GCancellable *cancellable,
GError **error)
@@ -698,7 +698,7 @@ gs_plugin_refine (GsPlugin *plugin,
goto out;
}
- for (l = list; l != NULL; l = l->next) {
+ for (l = *list; l != NULL; l = l->next) {
app = GS_APP (l->data);
if (gs_app_get_id_kind (app) != GS_APP_ID_KIND_WEBAPP)
continue;
diff --git a/src/plugins/gs-plugin-fedora-tagger-ratings.c b/src/plugins/gs-plugin-fedora-tagger-ratings.c
index e44c647..772e9ff 100644
--- a/src/plugins/gs-plugin-fedora-tagger-ratings.c
+++ b/src/plugins/gs-plugin-fedora-tagger-ratings.c
@@ -674,7 +674,7 @@ out:
*/
gboolean
gs_plugin_refine (GsPlugin *plugin,
- GList *list,
+ GList **list,
GsPluginRefineFlags flags,
GCancellable *cancellable,
GError **error)
@@ -701,7 +701,7 @@ gs_plugin_refine (GsPlugin *plugin,
}
/* add any missing ratings data */
- for (l = list; l != NULL; l = l->next) {
+ for (l = *list; l != NULL; l = l->next) {
app = GS_APP (l->data);
if (gs_app_get_rating (app) != -1)
continue;
diff --git a/src/plugins/gs-plugin-hardcoded-kind.c b/src/plugins/gs-plugin-hardcoded-kind.c
index 6bb1859..fdfde29 100644
--- a/src/plugins/gs-plugin-hardcoded-kind.c
+++ b/src/plugins/gs-plugin-hardcoded-kind.c
@@ -49,7 +49,7 @@ gs_plugin_get_deps (GsPlugin *plugin)
*/
gboolean
gs_plugin_refine (GsPlugin *plugin,
- GList *list,
+ GList **list,
GsPluginRefineFlags flags,
GCancellable *cancellable,
GError **error)
@@ -93,7 +93,7 @@ gs_plugin_refine (GsPlugin *plugin,
NULL };
/* just mark each one as core */
- for (l = list; l != NULL; l = l->next) {
+ for (l = *list; l != NULL; l = l->next) {
app = GS_APP (l->data);
for (i = 0; apps[i] != NULL; i++) {
if (g_strcmp0 (apps[i], gs_app_get_id (app)) == 0) {
diff --git a/src/plugins/gs-plugin-local-ratings.c b/src/plugins/gs-plugin-local-ratings.c
index 0b87455..e0dda05 100644
--- a/src/plugins/gs-plugin-local-ratings.c
+++ b/src/plugins/gs-plugin-local-ratings.c
@@ -205,7 +205,7 @@ out:
*/
gboolean
gs_plugin_refine (GsPlugin *plugin,
- GList *list,
+ GList **list,
GsPluginRefineFlags flags,
GCancellable *cancellable,
GError **error)
@@ -229,7 +229,7 @@ gs_plugin_refine (GsPlugin *plugin,
}
/* add any missing ratings data */
- for (l = list; l != NULL; l = l->next) {
+ for (l = *list; l != NULL; l = l->next) {
app = GS_APP (l->data);
if (gs_app_get_id (app) == NULL)
continue;
diff --git a/src/plugins/gs-plugin-menu-spec-refine.c b/src/plugins/gs-plugin-menu-spec-refine.c
index f6aa49f..b4507cc 100644
--- a/src/plugins/gs-plugin-menu-spec-refine.c
+++ b/src/plugins/gs-plugin-menu-spec-refine.c
@@ -114,7 +114,7 @@ gs_plugin_refine_app (GsPlugin *plugin, GsApp *app)
*/
gboolean
gs_plugin_refine (GsPlugin *plugin,
- GList *list,
+ GList **list,
GsPluginRefineFlags flags,
GCancellable *cancellable,
GError **error)
@@ -123,7 +123,7 @@ gs_plugin_refine (GsPlugin *plugin,
GsApp *app;
gboolean ret;
- for (l = list; l != NULL; l = l->next) {
+ for (l = *list; l != NULL; l = l->next) {
app = GS_APP (l->data);
if (gs_app_get_menu_path (app) == NULL) {
ret = gs_plugin_refine_app (plugin, app);
diff --git a/src/plugins/gs-plugin-packagekit-history.c b/src/plugins/gs-plugin-packagekit-history.c
index a0c7a00..5ef7641 100644
--- a/src/plugins/gs-plugin-packagekit-history.c
+++ b/src/plugins/gs-plugin-packagekit-history.c
@@ -274,7 +274,7 @@ out:
*/
gboolean
gs_plugin_refine (GsPlugin *plugin,
- GList *list,
+ GList **list,
GsPluginRefineFlags flags,
GCancellable *cancellable,
GError **error)
@@ -289,7 +289,7 @@ gs_plugin_refine (GsPlugin *plugin,
goto out;
/* add any missing history data */
- for (l = list; l != NULL; l = l->next) {
+ for (l = *list; l != NULL; l = l->next) {
app = GS_APP (l->data);
sources = gs_app_get_sources (app);
if (sources->len == 0)
diff --git a/src/plugins/gs-plugin-packagekit-refine.c b/src/plugins/gs-plugin-packagekit-refine.c
index 4bfd168..fcdc121 100644
--- a/src/plugins/gs-plugin-packagekit-refine.c
+++ b/src/plugins/gs-plugin-packagekit-refine.c
@@ -632,7 +632,7 @@ gs_plugin_refine_requires_package_id (GsApp *app, GsPluginRefineFlags flags)
*/
gboolean
gs_plugin_refine (GsPlugin *plugin,
- GList *list,
+ GList **list,
GsPluginRefineFlags flags,
GCancellable *cancellable,
GError **error)
@@ -647,7 +647,7 @@ gs_plugin_refine (GsPlugin *plugin,
/* can we resolve in one go? */
gs_profile_start (plugin->profile, "packagekit-refine[name->id]");
- for (l = list; l != NULL; l = l->next) {
+ for (l = *list; l != NULL; l = l->next) {
app = GS_APP (l->data);
if (gs_app_get_source_id_default (app) != NULL)
continue;
@@ -674,7 +674,7 @@ gs_plugin_refine (GsPlugin *plugin,
/* set the package-id for an installed desktop file */
gs_profile_start (plugin->profile, "packagekit-refine[desktop-filename->id]");
- for (l = list; l != NULL; l = l->next) {
+ for (l = *list; l != NULL; l = l->next) {
if ((flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_SETUP_ACTION) == 0)
continue;
app = GS_APP (l->data);
@@ -695,7 +695,7 @@ gs_plugin_refine (GsPlugin *plugin,
/* any update details missing? */
gs_profile_start (plugin->profile, "packagekit-refine[id->update-details]");
- for (l = list; l != NULL; l = l->next) {
+ for (l = *list; l != NULL; l = l->next) {
app = GS_APP (l->data);
if (gs_app_get_state (app) != GS_APP_STATE_UPDATABLE)
continue;
@@ -718,7 +718,7 @@ gs_plugin_refine (GsPlugin *plugin,
(flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_SIZE) > 0 ||
(flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_DESCRIPTION) > 0) {
ret = gs_plugin_refine_require_details (plugin,
- list,
+ *list,
cancellable,
error);
if (!ret)
diff --git a/src/plugins/gs-plugin-self-test.c b/src/plugins/gs-plugin-self-test.c
index f5a0401..96e9eec 100644
--- a/src/plugins/gs-plugin-self-test.c
+++ b/src/plugins/gs-plugin-self-test.c
@@ -49,7 +49,7 @@ gs_plugin_initialize (GsPlugin *plugin)
*/
gboolean
gs_plugin_refine (GsPlugin *plugin,
- GList *list,
+ GList **list,
GsPluginRefineFlags flags,
GCancellable *cancellable,
GError **error)
@@ -57,7 +57,7 @@ gs_plugin_refine (GsPlugin *plugin,
GsApp *app;
GList *l;
- for (l = list; l != NULL; l = l->next) {
+ for (l = *list; l != NULL; l = l->next) {
app = GS_APP (l->data);
if (gs_app_get_state (app) == GS_APP_STATE_UNKNOWN) {
gs_app_set_state (app, GS_APP_STATE_INSTALLED);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]