[gnome-software] trivial: Fall back to the update runtime if the app is not installed



commit 2fe0232f80adb0f442f8c0280925c87849661a41
Author: Richard Hughes <richard hughsie com>
Date:   Mon Jan 9 16:50:47 2017 +0000

    trivial: Fall back to the update runtime if the app is not installed

 src/gs-app.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-app.c b/src/gs-app.c
index db3bf37..7f9bb4b 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -1458,7 +1458,8 @@ gs_app_set_content_rating (GsApp *app, AsContentRating *content_rating)
  * gs_app_get_runtime:
  * @app: a #GsApp
  *
- * Gets the runtime for the installed application.
+ * Gets the runtime for the installed application if the application is already
+ * installed, or the runtime for the available application otherwise.
  *
  * Returns: (transfer none): a #GsApp, or %NULL for unset
  *
@@ -1468,7 +1469,9 @@ GsApp *
 gs_app_get_runtime (GsApp *app)
 {
        g_return_val_if_fail (GS_IS_APP (app), NULL);
-       return app->runtime;
+       if (gs_app_is_installed (app))
+               return app->runtime;
+       return app->update_runtime;
 }
 
 /**


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]