[gnome-software] Be more aggressive setting the origin for packages
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Be more aggressive setting the origin for packages
- Date: Thu, 7 Jul 2016 19:39:48 +0000 (UTC)
commit 64fad338bf89c690cb0a958f61c6f04ad1e0b5bf
Author: Richard Hughes <richard hughsie com>
Date: Thu Jul 7 10:10:36 2016 +0100
Be more aggressive setting the origin for packages
I think we avoided doing this as we didn't have origin-ui, and were thus
setting the value later when we had the source information. Either way, this
is probably the right thing to do.
src/plugins/gs-plugin-packagekit-refine.c | 21 +++++++++------------
1 files changed, 9 insertions(+), 12 deletions(-)
---
diff --git a/src/plugins/gs-plugin-packagekit-refine.c b/src/plugins/gs-plugin-packagekit-refine.c
index b3430c4..a53caa1 100644
--- a/src/plugins/gs-plugin-packagekit-refine.c
+++ b/src/plugins/gs-plugin-packagekit-refine.c
@@ -144,23 +144,20 @@ gs_plugin_packagekit_set_metadata_from_package (GsPlugin *plugin,
gs_app_set_management_plugin (app, "packagekit");
gs_app_add_source (app, pk_package_get_name (package));
gs_app_add_source_id (app, pk_package_get_id (package));
- switch (pk_package_get_info (package)) {
- case PK_INFO_ENUM_INSTALLED:
+
+ /* set origin */
+ if (gs_app_get_origin (app) == NULL) {
data = pk_package_get_data (package);
if (g_str_has_prefix (data, "installed:"))
- gs_app_set_origin (app, data + 10);
- break;
- case PK_INFO_ENUM_UNAVAILABLE:
- data = pk_package_get_data (package);
- if (data != NULL)
- gs_app_set_origin (app, data);
+ data += 10;
+ gs_app_set_origin (app, data);
+ }
+
+ /* set unavailable state */
+ if (pk_package_get_info (package) == PK_INFO_ENUM_UNAVAILABLE) {
gs_app_set_state (app, AS_APP_STATE_UNAVAILABLE);
gs_app_set_size_installed (app, GS_APP_SIZE_UNKNOWABLE);
gs_app_set_size_download (app, GS_APP_SIZE_UNKNOWABLE);
- break;
- default:
- /* should we expect anything else? */
- break;
}
if (gs_app_get_version (app) == NULL)
gs_app_set_version (app,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]