[gnome-software] Allow storing the update severity in the GsApp object



commit b1bc76db64421266896613b40397ccbf10546f38
Author: Richard Hughes <richard hughsie com>
Date:   Mon Sep 28 09:40:07 2015 +0100

    Allow storing the update severity in the GsApp object

 src/gs-app.c |   27 +++++++++++++++++++++++++++
 src/gs-app.h |   11 +++++++++++
 2 files changed, 38 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-app.c b/src/gs-app.c
index a01d553..57cf84b 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -78,6 +78,7 @@ struct _GsApp
        gchar                   *update_version;
        gchar                   *update_version_ui;
        gchar                   *update_details;
+       GsAppUpdateSeverity      update_severity;
        gchar                   *management_plugin;
        gint                     rating;
        gint                     rating_confidence;
@@ -242,6 +243,10 @@ gs_app_to_string (GsApp *app)
                g_string_append_printf (str, "\tupdate-details:\t%s\n",
                                        app->update_details);
        }
+       if (app->update_severity != GS_APP_UPDATE_SEVERITY_UNKNOWN) {
+               g_string_append_printf (str, "\tupdate-severity:\t%i\n",
+                                       app->update_severity);
+       }
        if (app->summary != NULL)
                g_string_append_printf (str, "\tsummary:\t%s\n", app->summary);
        if (app->description != NULL)
@@ -1503,6 +1508,26 @@ gs_app_set_update_details (GsApp *app, const gchar *update_details)
 }
 
 /**
+ * gs_app_get_update_severity:
+ */
+GsAppUpdateSeverity
+gs_app_get_update_severity (GsApp *app)
+{
+       g_return_val_if_fail (GS_IS_APP (app), GS_APP_UPDATE_SEVERITY_UNKNOWN);
+       return app->update_severity;
+}
+
+/**
+ * gs_app_set_update_severity:
+ */
+void
+gs_app_set_update_severity (GsApp *app, GsAppUpdateSeverity update_severity)
+{
+       g_return_if_fail (GS_IS_APP (app));
+       app->update_severity = update_severity;
+}
+
+/**
  * gs_app_get_management_plugin:
  */
 const gchar *
@@ -2007,6 +2032,8 @@ gs_app_subsume (GsApp *app, GsApp *other)
                gs_app_set_description (app, other->description_quality, other->description);
        if (other->update_details != NULL)
                gs_app_set_update_details (app, other->update_details);
+       if (other->update_severity != GS_APP_UPDATE_SEVERITY_UNKNOWN)
+               gs_app_set_update_severity (app, other->update_severity);
        if (other->update_version != NULL)
                gs_app_set_update_version_internal (app, other->update_version);
        if (other->pixbuf != NULL)
diff --git a/src/gs-app.h b/src/gs-app.h
index d37257a..9b3d42e 100644
--- a/src/gs-app.h
+++ b/src/gs-app.h
@@ -75,6 +75,14 @@ typedef enum {
        GS_APP_KUDO_LAST
 } GsAppKudo;
 
+typedef enum {
+       GS_APP_UPDATE_SEVERITY_UNKNOWN,
+       GS_APP_UPDATE_SEVERITY_NORMAL,
+       GS_APP_UPDATE_SEVERITY_IMPORTANT,
+       GS_APP_UPDATE_SEVERITY_SECURITY,
+       GS_APP_UPDATE_SEVERITY_LAST
+} GsAppUpdateSeverity;
+
 #define        GS_APP_INSTALL_DATE_UNSET               0
 #define        GS_APP_INSTALL_DATE_UNKNOWN             1 /* 1s past the epoch */
 #define        GS_APP_SIZE_UNKNOWN                     0
@@ -173,6 +181,9 @@ void                 gs_app_set_update_version      (GsApp          *app,
 const gchar    *gs_app_get_update_details      (GsApp          *app);
 void            gs_app_set_update_details      (GsApp          *app,
                                                 const gchar    *update_details);
+GsAppUpdateSeverity gs_app_get_update_severity (GsApp          *app);
+void            gs_app_set_update_severity     (GsApp          *app,
+                                                GsAppUpdateSeverity update_severity);
 const gchar    *gs_app_get_management_plugin   (GsApp          *app);
 void            gs_app_set_management_plugin   (GsApp          *app,
                                                 const gchar    *management_plugin);


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