[gnome-software/1164-packagekit-recognize-urgent-updates] packagekit: Recognize urgent updates
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/1164-packagekit-recognize-urgent-updates] packagekit: Recognize urgent updates
- Date: Fri, 21 May 2021 06:21:58 +0000 (UTC)
commit 84a099c696c355af39a6fc074d009047b793aa8d
Author: Milan Crha <mcrha redhat com>
Date: Fri May 21 08:18:04 2021 +0200
packagekit: Recognize urgent updates
Check update severity in PackageKit, once Software is build with PackageKit,
which provides the new API for it.
meson.build | 3 +++
plugins/packagekit/gs-plugin-packagekit-refine.c | 20 ++++++++++++++++++++
2 files changed, 23 insertions(+)
---
diff --git a/meson.build b/meson.build
index 2c9f475e9..d806ddc83 100644
--- a/meson.build
+++ b/meson.build
@@ -196,6 +196,9 @@ if get_option('packagekit')
else
conf.set('GS_PACKAGEKIT_AUTOREMOVE', 'FALSE')
endif
+ if meson.get_compiler('c').has_function('pk_package_get_update_severity', prefix: '#include
<packagekit-glib2/packagekit.h>', dependencies: packagekit)
+ conf.set('HAVE_PK_PACKAGE_GET_UPDATE_SEVERITY', '1')
+ endif
endif
if get_option('eos_updater')
diff --git a/plugins/packagekit/gs-plugin-packagekit-refine.c
b/plugins/packagekit/gs-plugin-packagekit-refine.c
index fa3e09d07..1f0388032 100644
--- a/plugins/packagekit/gs-plugin-packagekit-refine.c
+++ b/plugins/packagekit/gs-plugin-packagekit-refine.c
@@ -439,6 +439,25 @@ gs_plugin_packagekit_refine_update_urgency (GsPlugin *plugin,
pkg = pk_package_sack_find_by_id (sack, package_id);
if (pkg == NULL)
continue;
+ #ifdef HAVE_PK_PACKAGE_GET_UPDATE_SEVERITY
+ switch (pk_package_get_update_severity (pkg)) {
+ case PK_INFO_ENUM_LOW:
+ gs_app_set_update_urgency (app, AS_URGENCY_KIND_LOW);
+ break;
+ case PK_INFO_ENUM_NORMAL:
+ gs_app_set_update_urgency (app, AS_URGENCY_KIND_MEDIUM);
+ break;
+ case PK_INFO_ENUM_IMPORTANT:
+ gs_app_set_update_urgency (app, AS_URGENCY_KIND_HIGH);
+ break;
+ case PK_INFO_ENUM_CRITICAL:
+ gs_app_set_update_urgency (app, AS_URGENCY_KIND_CRITICAL);
+ break;
+ default:
+ gs_app_set_update_urgency (app, AS_URGENCY_KIND_UNKNOWN);
+ break;
+ }
+ #else
switch (pk_package_get_info (pkg)) {
case PK_INFO_ENUM_AVAILABLE:
case PK_INFO_ENUM_NORMAL:
@@ -461,6 +480,7 @@ gs_plugin_packagekit_refine_update_urgency (GsPlugin *plugin,
pk_info_enum_to_string (pk_package_get_info (pkg)));
break;
}
+ #endif
}
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]