[gnome-software/wip/jrocha/fix-updates-list: 1/2] Add a method to quickly check if an app is updatable
- From: Joaquim Manuel Pereira Rocha <jrocha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/jrocha/fix-updates-list: 1/2] Add a method to quickly check if an app is updatable
- Date: Tue, 18 Oct 2016 16:33:51 +0000 (UTC)
commit c7efefc59cf4fd8725f7fe2f425db8b66aa50317
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.
src/gs-app.c | 23 +++++++++++++++++++++++
src/gs-app.h | 1 +
2 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-app.c b/src/gs-app.c
index d0aef4a..e1ef272 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -2801,6 +2801,29 @@ 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.22
+ **/
+gboolean
+gs_app_is_updatable (GsApp *app)
+{
+ AsAppState state;
+
+ g_return_val_if_fail (GS_IS_APP (app), FALSE);
+
+ state = gs_app_get_state (app);
+
+ return (state == AS_APP_STATE_UPDATABLE) ||
+ (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 6b89e6f..3e3cc22 100644
--- a/src/gs-app.h
+++ b/src/gs-app.h
@@ -284,6 +284,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]