[gnome-software/wip/iainl/ubuntu-xenial: 50/56] Fix size not showing for uninstalled apps
- From: William Hua <williamhua src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/iainl/ubuntu-xenial: 50/56] Fix size not showing for uninstalled apps
- Date: Thu, 14 Apr 2016 06:34:01 +0000 (UTC)
commit e589e25d84eac03751c28f54d9d3d61234257333
Author: Robert Ancell <robert ancell canonical com>
Date: Wed Mar 30 16:26:06 2016 +1300
Fix size not showing for uninstalled apps
src/plugins/gs-plugin-snappy.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/plugins/gs-plugin-snappy.c b/src/plugins/gs-plugin-snappy.c
index a7a7433..8c8fcdf 100644
--- a/src/plugins/gs-plugin-snappy.c
+++ b/src/plugins/gs-plugin-snappy.c
@@ -318,6 +318,7 @@ get_apps (GsPlugin *plugin, const gchar *sources, gchar **search_terms, GList **
const gchar *status, *icon_url;
g_autoptr(GsApp) app = NULL;
g_autoptr(GdkPixbuf) icon_pixbuf = NULL;
+ gint64 size = -1;
package = json_object_get_object_member (packages, id);
if (filter_func != NULL && !filter_func (id, package, user_data))
@@ -336,19 +337,22 @@ get_apps (GsPlugin *plugin, const gchar *sources, gchar **search_terms, GList **
gs_app_set_state (app, AS_APP_STATE_UPDATABLE);
else
gs_app_set_state (app, AS_APP_STATE_INSTALLED);
- gs_app_set_size (app, json_object_get_int_member (package, "installed_size"));
+ size = json_object_get_int_member (package, "installed_size");
}
else if (g_strcmp0 (status, "removed") == 0) {
// A removed app is only available if it can be downloaded (it might have been
sideloaded)
- if (json_object_get_int_member (package, "download_size") > 0)
+ size = json_object_get_int_member (package, "download_size");
+ if (size > 0)
gs_app_set_state (app, AS_APP_STATE_AVAILABLE);
} else if (g_strcmp0 (status, "not installed") == 0) {
gs_app_set_state (app, AS_APP_STATE_AVAILABLE);
- gs_app_set_size (app, json_object_get_int_member (package, "download_size"));
+ size = json_object_get_int_member (package, "download_size");
}
gs_app_set_name (app, GS_APP_QUALITY_HIGHEST, json_object_get_string_member (package,
"name"));
gs_app_set_summary (app, GS_APP_QUALITY_HIGHEST, json_object_get_string_member (package,
"description"));
gs_app_set_version (app, json_object_get_string_member (package, "version"));
+ if (size > 0)
+ gs_app_set_size (app, size);
gs_app_add_quirk (app, AS_APP_QUIRK_PROVENANCE);
icon_url = json_object_get_string_member (package, "icon");
if (g_str_has_prefix (icon_url, "/")) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]