[gnome-software] trivial: Use AsUrgencyKind from libappstream-glib
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] trivial: Use AsUrgencyKind from libappstream-glib
- Date: Tue, 22 Dec 2015 15:30:11 +0000 (UTC)
commit cb30af665a684e4bc7719c869c7ced84a3a18b8e
Author: Richard Hughes <richard hughsie com>
Date: Tue Dec 22 15:27:26 2015 +0000
trivial: Use AsUrgencyKind from libappstream-glib
src/gs-app.c | 28 ++++++++++++++--------------
src/gs-app.h | 14 +++-----------
src/gs-update-monitor.c | 4 ++--
src/plugins/gs-plugin-packagekit-refine.c | 18 ++++++++++--------
4 files changed, 29 insertions(+), 35 deletions(-)
---
diff --git a/src/gs-app.c b/src/gs-app.c
index 49453b8..cd6784a 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -79,7 +79,7 @@ struct _GsApp
gchar *update_version;
gchar *update_version_ui;
gchar *update_details;
- GsAppUpdateSeverity update_severity;
+ AsUrgencyKind update_urgency;
gchar *management_plugin;
gint rating;
gint rating_confidence;
@@ -252,9 +252,9 @@ 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->update_urgency != AS_URGENCY_KIND_UNKNOWN) {
+ g_string_append_printf (str, "\tupdate-urgency:\t%i\n",
+ app->update_urgency);
}
if (app->summary != NULL)
g_string_append_printf (str, "\tsummary:\t%s\n", app->summary);
@@ -1582,23 +1582,23 @@ gs_app_set_update_details (GsApp *app, const gchar *update_details)
}
/**
- * gs_app_get_update_severity:
+ * gs_app_get_update_urgency:
*/
-GsAppUpdateSeverity
-gs_app_get_update_severity (GsApp *app)
+AsUrgencyKind
+gs_app_get_update_urgency (GsApp *app)
{
- g_return_val_if_fail (GS_IS_APP (app), GS_APP_UPDATE_SEVERITY_UNKNOWN);
- return app->update_severity;
+ g_return_val_if_fail (GS_IS_APP (app), AS_URGENCY_KIND_UNKNOWN);
+ return app->update_urgency;
}
/**
- * gs_app_set_update_severity:
+ * gs_app_set_update_urgency:
*/
void
-gs_app_set_update_severity (GsApp *app, GsAppUpdateSeverity update_severity)
+gs_app_set_update_urgency (GsApp *app, AsUrgencyKind update_urgency)
{
g_return_if_fail (GS_IS_APP (app));
- app->update_severity = update_severity;
+ app->update_urgency = update_urgency;
}
/**
@@ -2126,8 +2126,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_urgency != AS_URGENCY_KIND_UNKNOWN)
+ gs_app_set_update_urgency (app, other->update_urgency);
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 233809d..0acf6bb 100644
--- a/src/gs-app.h
+++ b/src/gs-app.h
@@ -78,14 +78,6 @@ 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
@@ -186,9 +178,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);
+AsUrgencyKind gs_app_get_update_urgency (GsApp *app);
+void gs_app_set_update_urgency (GsApp *app,
+ AsUrgencyKind update_urgency);
const gchar *gs_app_get_management_plugin (GsApp *app);
void gs_app_set_management_plugin (GsApp *app,
const gchar *management_plugin);
diff --git a/src/gs-update-monitor.c b/src/gs-update-monitor.c
index 6ddfd34..46782e9 100644
--- a/src/gs-update-monitor.c
+++ b/src/gs-update-monitor.c
@@ -114,8 +114,8 @@ has_important_updates (GsAppList *apps)
for (l = apps; l != NULL; l = l->next) {
app = GS_APP (l->data);
- if (gs_app_get_update_severity (app) == GS_APP_UPDATE_SEVERITY_SECURITY ||
- gs_app_get_update_severity (app) == GS_APP_UPDATE_SEVERITY_IMPORTANT)
+ if (gs_app_get_update_urgency (app) == AS_URGENCY_KIND_CRITICAL ||
+ gs_app_get_update_urgency (app) == AS_URGENCY_KIND_HIGH)
return TRUE;
}
diff --git a/src/plugins/gs-plugin-packagekit-refine.c b/src/plugins/gs-plugin-packagekit-refine.c
index a6e46df..78f5169 100644
--- a/src/plugins/gs-plugin-packagekit-refine.c
+++ b/src/plugins/gs-plugin-packagekit-refine.c
@@ -582,10 +582,10 @@ gs_plugin_packagekit_refine_details (GsPlugin *plugin,
}
/**
- * gs_plugin_packagekit_refine_update_severity:
+ * gs_plugin_packagekit_refine_update_urgency:
*/
static gboolean
-gs_plugin_packagekit_refine_update_severity (GsPlugin *plugin,
+gs_plugin_packagekit_refine_update_urgency (GsPlugin *plugin,
GList *list,
GCancellable *cancellable,
GError **error)
@@ -625,19 +625,21 @@ gs_plugin_packagekit_refine_update_severity (GsPlugin *plugin,
switch (pk_package_get_info (pkg)) {
case PK_INFO_ENUM_AVAILABLE:
case PK_INFO_ENUM_NORMAL:
+ case PK_INFO_ENUM_LOW:
case PK_INFO_ENUM_ENHANCEMENT:
+ gs_app_set_update_urgency (app, AS_URGENCY_KIND_LOW);
+ break;
case PK_INFO_ENUM_BUGFIX:
- case PK_INFO_ENUM_LOW:
- gs_app_set_update_severity (app, GS_APP_UPDATE_SEVERITY_NORMAL);
+ gs_app_set_update_urgency (app, AS_URGENCY_KIND_MEDIUM);
break;
case PK_INFO_ENUM_SECURITY:
- gs_app_set_update_severity (app, GS_APP_UPDATE_SEVERITY_SECURITY);
+ gs_app_set_update_urgency (app, AS_URGENCY_KIND_CRITICAL);
break;
case PK_INFO_ENUM_IMPORTANT:
- gs_app_set_update_severity (app, GS_APP_UPDATE_SEVERITY_IMPORTANT);
+ gs_app_set_update_urgency (app, AS_URGENCY_KIND_HIGH);
break;
default:
- gs_app_set_update_severity (app, GS_APP_UPDATE_SEVERITY_UNKNOWN);
+ gs_app_set_update_urgency (app, AS_URGENCY_KIND_UNKNOWN);
g_warning ("unhandled info state %s",
pk_info_enum_to_string (pk_package_get_info (pkg)));
break;
@@ -1010,7 +1012,7 @@ gs_plugin_refine (GsPlugin *plugin,
/* get the update severity */
if ((flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_UPDATE_SEVERITY) > 0) {
- ret = gs_plugin_packagekit_refine_update_severity (plugin,
+ ret = gs_plugin_packagekit_refine_update_urgency (plugin,
*list,
cancellable,
error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]