[gnome-software/mwleeds/pwa-plugin] fixup! Revive webapp support



commit 2555048f15b911b24b319928d8e16a240539ff15
Author: Phaedrus Leeds <mwleeds protonmail com>
Date:   Fri Feb 25 13:35:21 2022 -0800

    fixup! Revive webapp support

 plugins/epiphany/gs-plugin-epiphany.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/plugins/epiphany/gs-plugin-epiphany.c b/plugins/epiphany/gs-plugin-epiphany.c
index 8f537afe2..9eea0a14e 100644
--- a/plugins/epiphany/gs-plugin-epiphany.c
+++ b/plugins/epiphany/gs-plugin-epiphany.c
@@ -427,6 +427,7 @@ list_installed_apps_thread_cb (GTask        *task,
                int argc;
                g_auto(GStrv) argv = NULL;
                guint64 install_date = 0;
+               goffset desktop_size = 0, icon_size = 0;
                g_autoptr(GsApp) app = NULL;
                g_autoptr(GDesktopAppInfo) desktop_info = NULL;
                g_autoptr(GFileInfo) file_info = NULL;
@@ -462,8 +463,13 @@ list_installed_apps_thread_cb (GTask        *task,
 
                /* FIXME: this should use TIME_CREATED but it does not seem to
                 * be working (copied from Epiphany) */
-               file_info = g_file_query_info (desktop_file, G_FILE_ATTRIBUTE_TIME_MODIFIED, 0, NULL, NULL);
-               install_date = g_file_info_get_attribute_uint64 (file_info, G_FILE_ATTRIBUTE_TIME_MODIFIED);
+               file_info = g_file_query_info (desktop_file,
+                                              G_FILE_ATTRIBUTE_TIME_MODIFIED "," 
G_FILE_ATTRIBUTE_STANDARD_SIZE,
+                                              0, NULL, NULL);
+               if (file_info) {
+                       install_date = g_file_info_get_attribute_uint64 (file_info, 
G_FILE_ATTRIBUTE_TIME_MODIFIED);
+                       desktop_size = g_file_info_get_size (file_info);
+               }
 
                app = gs_epiphany_create_app (self, desktop_file_id);
                gs_app_set_state (app, GS_APP_STATE_INSTALLED);
@@ -485,6 +491,13 @@ list_installed_apps_thread_cb (GTask        *task,
                        const char *x;
                        int size = 0;
 
+                       g_clear_object (&file_info);
+                       file_info = g_file_query_info (icon_file,
+                                                      G_FILE_ATTRIBUTE_STANDARD_SIZE,
+                                                      0, NULL, NULL);
+                       if (file_info)
+                               icon_size = g_file_info_get_size (file_info);
+
                        /* dir should be either scalable or e.g. 512x512 */
                        if (g_strcmp0 (icon_dir_basename, "scalable") == 0) {
                                /* Ensure scalable icons are preferred */
@@ -504,6 +517,9 @@ list_installed_apps_thread_cb (GTask        *task,
                if (install_date) {
                        gs_app_set_install_date (app, install_date);
                }
+               if (desktop_size > 0 || icon_size > 0) {
+                       gs_app_set_size_installed (app, desktop_size + installed_size);
+               }
                gs_app_list_add (list, app);
        }
 


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