diff options
author | Richard Hughes <richard@hughsie.com> | 2016-09-13 16:30:41 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2016-09-13 16:30:42 +0100 |
commit | 6c643f1a662315df12692b16428f53202a26c043 (patch) | |
tree | f0a1b51105d01dc94ba3c37c9493d79715a910a8 /libappstream-glib/as-store.c | |
parent | f408f4dc840281e50438c5daf8baed79dad072f4 (diff) | |
download | appstream-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.c | 31 |
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. |