[gnome-software/gnome-3-22] Add a method to quickly check if an app is updatable
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/gnome-3-22] Add a method to quickly check if an app is updatable
- Date: Mon, 7 Nov 2016 13:39:43 +0000 (UTC)
commit ba037a9d3fc6757688f80e8e6902fb9b610624a0
Author: Joaquim Rocha <jrocha endlessm com>
Date: Tue Oct 18 18:18:56 2016 +0200
Add a method to quickly check if an app is updatable
This is a convenience function to avoid having to check the
GS_APP_STATE_UPDATABLE and GS_APP_STATE_UPDATABLE_LIVE states.
(cherry picked from commit 3f9bad69b4a6b1e9510ee1b05f07eff00ddc41fa)
src/gs-app.c | 21 +++++++++++++++++++++
src/gs-app.h | 1 +
2 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-app.c b/src/gs-app.c
index 4c0491b..0345b2d 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -2764,6 +2764,27 @@ gs_app_is_installed (GsApp *app)
}
/**
+ * gs_app_is_updatable:
+ * @app: a #GsApp
+ *
+ * Gets whether the app is updatable or not.
+ *
+ * Returns: %TRUE if the app is updatable, %FALSE otherwise.
+ *
+ * Since: 3.24
+ **/
+gboolean
+gs_app_is_updatable (GsApp *app)
+{
+ AsAppState state;
+
+ g_return_val_if_fail (GS_IS_APP (app), FALSE);
+
+ return (app->state == AS_APP_STATE_UPDATABLE) ||
+ (app->state == AS_APP_STATE_UPDATABLE_LIVE);
+}
+
+/**
* gs_app_get_categories:
* @app: a #GsApp
*
diff --git a/src/gs-app.h b/src/gs-app.h
index d7bc7ef..7324e18 100644
--- a/src/gs-app.h
+++ b/src/gs-app.h
@@ -281,6 +281,7 @@ void gs_app_add_quirk (GsApp *app,
void gs_app_remove_quirk (GsApp *app,
AsAppQuirk quirk);
gboolean gs_app_is_installed (GsApp *app);
+gboolean gs_app_is_updatable (GsApp *app);
G_END_DECLS
#endif /* __GS_APP_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]