diff options
author | Richard Hughes <richard@hughsie.com> | 2015-03-02 11:20:42 +0000 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2015-03-02 11:20:42 +0000 |
commit | aa9ae7eb94053dc5317f7cebe01dead77bddd2c9 (patch) | |
tree | d208065555dfc5a4b61e467becb2eff5b391ec9e | |
parent | 5fc540f5a05980b5da08b25af0d1a5613eaa1a0d (diff) | |
download | appstream-glib-aa9ae7eb94053dc5317f7cebe01dead77bddd2c9.tar.gz |
Add as_app_get_release()
-rw-r--r-- | libappstream-glib/as-app.c | 26 | ||||
-rw-r--r-- | libappstream-glib/as-app.h | 2 |
2 files changed, 28 insertions, 0 deletions
diff --git a/libappstream-glib/as-app.c b/libappstream-glib/as-app.c index 843ad0b..2c93e8c 100644 --- a/libappstream-glib/as-app.c +++ b/libappstream-glib/as-app.c @@ -608,6 +608,32 @@ as_app_get_releases (AsApp *app) } /** + * as_app_get_release: + * @app: a #AsApp instance. + * @version: a version string + * + * Gets a specific release from the application. + * + * Returns: (transfer none): a release, or %NULL + * + * Since: 0.3.5 + **/ +AsRelease * +as_app_get_release (AsApp *app, const gchar *version) +{ + AsAppPrivate *priv = GET_PRIVATE (app); + AsRelease *release; + guint i; + + for (i = 0; i < priv->releases->len; i++) { + release = g_ptr_array_index (priv->releases, i); + if (g_strcmp0 (as_release_get_version (release), version) == 0) + return release; + } + return NULL; +} + +/** * as_app_get_provides: * @app: a #AsApp instance. * diff --git a/libappstream-glib/as-app.h b/libappstream-glib/as-app.h index 47ba797..32d9ce0 100644 --- a/libappstream-glib/as-app.h +++ b/libappstream-glib/as-app.h @@ -417,6 +417,8 @@ AsIcon *as_app_get_icon_for_size (AsApp *app, guint width, guint height); AsBundle *as_app_get_bundle_default (AsApp *app); +AsRelease *as_app_get_release (AsApp *app, + const gchar *version); gboolean as_app_convert_icons (AsApp *app, AsIconKind kind, GError **error); |