[gnome-software/wip/temp/ubuntu-xenial-rebased-corrected: 177/331] Fix size not showing for uninstalled apps



commit 905e0c00a0631aa83cd5fb9852df3391e1962fc3
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 |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/plugins/gs-plugin-snappy.c b/src/plugins/gs-plugin-snappy.c
index ac6135b..36a6b82 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))
@@ -335,15 +336,16 @@ 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"));


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