summaryrefslogtreecommitdiff
path: root/libappstream-glib/as-store.c
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2016-09-13 16:30:41 +0100
committerRichard Hughes <richard@hughsie.com>2016-09-13 16:30:42 +0100
commit6c643f1a662315df12692b16428f53202a26c043 (patch)
treef0a1b51105d01dc94ba3c37c9493d79715a910a8 /libappstream-glib/as-store.c
parentf408f4dc840281e50438c5daf8baed79dad072f4 (diff)
downloadappstream-glib-6c643f1a662315df12692b16428f53202a26c043.tar.gz
Add as_store_add_apps()
This allows us to add lots of apps without issuing a 'changed' signal for each.
Diffstat (limited to 'libappstream-glib/as-store.c')
-rw-r--r--libappstream-glib/as-store.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/libappstream-glib/as-store.c b/libappstream-glib/as-store.c
index 33278a8..082af45 100644
--- a/libappstream-glib/as-store.c
+++ b/libappstream-glib/as-store.c
@@ -893,6 +893,37 @@ _as_app_is_perhaps_merge_component (AsApp *app)
}
/**
+ * as_store_add_apps:
+ * @store: a #AsStore instance.
+ * @apps: (element-type AsApp): an array of apps
+ *
+ * Adds several applications to the store.
+ *
+ * Additionally only applications where the kind is known will be added.
+ *
+ * Since: 0.6.4
+ **/
+void
+as_store_add_apps (AsStore *store, GPtrArray *apps)
+{
+ guint i;
+ _cleanup_uninhibit_ guint32 *tok = NULL;
+
+ g_return_if_fail (AS_IS_STORE (store));
+
+ /* emit once when finished */
+ tok = as_store_changed_inhibit (store);
+ for (i = 0; i < apps->len; i++) {
+ AsApp *app = g_ptr_array_index (apps, i);
+ as_store_add_app (store, app);
+ }
+
+ /* this store has changed */
+ as_store_changed_uninhibit (&tok);
+ as_store_perhaps_emit_changed (store, "add-apps");
+}
+
+/**
* as_store_add_app:
* @store: a #AsStore instance.
* @app: a #AsApp instance.