summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2016-03-31 18:53:38 +0100
committerRichard Hughes <richard@hughsie.com>2016-03-31 18:54:11 +0100
commitd896d50d42e83463a741e0a26e60016c4f32afa8 (patch)
tree6a2cbbfb7e7aeb6164868fee0e4d310cb39c91c4
parentd196fc01e467af2d206ade417f1c38818be1d3f0 (diff)
downloadappstream-glib-d896d50d42e83463a741e0a26e60016c4f32afa8.tar.gz
Add as_store_remove_apps_with_veto()
This might be useful to libappstream-builder and gnome-software.
-rw-r--r--libappstream-glib/as-store.c13
-rw-r--r--libappstream-glib/as-store.h1
2 files changed, 13 insertions, 1 deletions
diff --git a/libappstream-glib/as-store.c b/libappstream-glib/as-store.c
index c808751..5763ddb 100644
--- a/libappstream-glib/as-store.c
+++ b/libappstream-glib/as-store.c
@@ -1590,14 +1590,23 @@ as_store_check_apps_for_veto (AsStore *store)
/**
* as_store_remove_apps_with_veto:
+ * @store: a #AsStore instance.
+ *
+ * Removes any applications from the store if they have any vetos.
+ *
+ * Since: 0.5.13
**/
-static void
+void
as_store_remove_apps_with_veto (AsStore *store)
{
guint i;
AsApp *app;
AsStorePrivate *priv = GET_PRIVATE (store);
+ _cleanup_uninhibit_ guint32 *tok = NULL;
+ /* don't shortcut the list as we have to use as_store_remove_app()
+ * rather than just removing from the GPtrArray */
+ tok = as_store_changed_inhibit (store);
do {
for (i = 0; i < priv->array->len; i++) {
app = g_ptr_array_index (priv->array, i);
@@ -1609,6 +1618,8 @@ as_store_remove_apps_with_veto (AsStore *store)
}
}
} while (i < priv->array->len);
+ as_store_changed_uninhibit (&tok);
+ as_store_perhaps_emit_changed (store, "remove-apps-with-veto");
}
/**
diff --git a/libappstream-glib/as-store.h b/libappstream-glib/as-store.h
index f716f8d..bb40b77 100644
--- a/libappstream-glib/as-store.h
+++ b/libappstream-glib/as-store.h
@@ -180,6 +180,7 @@ void as_store_remove_app (AsStore *store,
AsApp *app);
void as_store_remove_app_by_id (AsStore *store,
const gchar *id);
+void as_store_remove_apps_with_veto (AsStore *store);
GString *as_store_to_xml (AsStore *store,
AsNodeToXmlFlags flags);
gboolean as_store_to_file (AsStore *store,