[gnome-software] Store the application runtime on the main GsApp object



commit 4df86d4f9305c773f2bc1002d3d075c7f55a4628
Author: Richard Hughes <richard hughsie com>
Date:   Tue Feb 16 16:46:01 2016 +0000

    Store the application runtime on the main GsApp object

 src/gs-app.c |   29 +++++++++++++++++++++++++++++
 src/gs-app.h |    3 +++
 2 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-app.c b/src/gs-app.c
index a04a6c3..ae82e66 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -102,6 +102,7 @@ struct _GsApp
        gboolean                 to_be_installed;
        gboolean                 provenance;
        gboolean                 licence_is_free;
+       GsApp                   *runtime;
 };
 
 enum {
@@ -326,6 +327,13 @@ gs_app_to_string (GsApp *app)
                                        (const gchar *) l->data, tmp);
        }
        g_list_free (keys);
+
+       /* print runtime data too */
+       if (app->runtime != NULL) {
+               g_autofree gchar *runtime = gs_app_to_string (app->runtime);
+               g_string_append_printf (str, "\n\tRuntime:\n\t%s\n", runtime);
+       }
+
        return g_string_free (str, FALSE);
 }
 
@@ -954,6 +962,26 @@ gs_app_set_icon (GsApp *app, AsIcon *icon)
 }
 
 /**
+ * gs_app_get_runtime:
+ */
+GsApp *
+gs_app_get_runtime (GsApp *app)
+{
+       g_return_val_if_fail (GS_IS_APP (app), NULL);
+       return app->runtime;
+}
+
+/**
+ * gs_app_set_runtime:
+ */
+void
+gs_app_set_runtime (GsApp *app, GsApp *runtime)
+{
+       g_return_if_fail (GS_IS_APP (app));
+       g_set_object (&app->runtime, runtime);
+}
+
+/**
  * gs_app_load_icon:
  */
 gboolean
@@ -2256,6 +2284,7 @@ gs_app_dispose (GObject *object)
        GsApp *app = GS_APP (object);
 
        g_clear_object (&app->icon);
+       g_clear_object (&app->runtime);
        g_clear_object (&app->pixbuf);
 
        g_clear_pointer (&app->addons, g_ptr_array_unref);
diff --git a/src/gs-app.h b/src/gs-app.h
index 3b5ccb7..e5e514b 100644
--- a/src/gs-app.h
+++ b/src/gs-app.h
@@ -187,6 +187,9 @@ void                 gs_app_set_pixbuf              (GsApp          *app,
 AsIcon         *gs_app_get_icon                (GsApp          *app);
 void            gs_app_set_icon                (GsApp          *app,
                                                 AsIcon         *icon);
+GsApp          *gs_app_get_runtime             (GsApp          *app);
+void            gs_app_set_runtime             (GsApp          *app,
+                                                GsApp          *runtime);
 gboolean        gs_app_load_icon               (GsApp          *app,
                                                 gint            scale,
                                                 GError         **error);


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