[gnome-software/mwleeds/pwa-plugin: 130/132] fixup! Revive webapp support
- From: Phaedrus Leeds <mwleeds src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/mwleeds/pwa-plugin: 130/132] fixup! Revive webapp support
- Date: Tue, 15 Feb 2022 23:31:57 +0000 (UTC)
commit 3ff88c3b89868338bc812534f775ce67b4904e89
Author: Phaedrus Leeds <mwleeds protonmail com>
Date: Tue Feb 8 16:20:40 2022 -0800
fixup! Revive webapp support
lib/gs-utils.c | 30 ----------------------
lib/gs-utils.h | 1 -
plugins/epiphany/gs-plugin-epiphany.c | 23 ++++++++++++++---
.../epiphany/org.gnome.Epiphany.WebAppProvider.xml | 2 +-
4 files changed, 21 insertions(+), 35 deletions(-)
---
diff --git a/lib/gs-utils.c b/lib/gs-utils.c
index c604d3eb9..9dfc7cf4e 100644
--- a/lib/gs-utils.c
+++ b/lib/gs-utils.c
@@ -1440,36 +1440,6 @@ gs_utils_pixbuf_blur (GdkPixbuf *src, guint radius, guint iterations)
gs_pixbuf_blur_private (src, tmp, radius, div_kernel_size);
}
-/**
- * gs_utils_file_icon_ensure_size:
- * @icon: the #GIcon created with g_file_icon_new()
- *
- * This ensures that gs_icon_set_width() and gs_icon_set_height() have been
- * called on @icon, by loading the width and height from the underlying file if
- * needed.
- **/
-void
-gs_utils_file_icon_ensure_size (GIcon *icon)
-{
- GFile *file;
- g_autofree char *file_path = NULL;
- g_autoptr(GdkPixbuf) pixbuf = NULL;
-
- if (gs_icon_get_width (icon) != 0)
- return;
-
- file = g_file_icon_get_file (G_FILE_ICON (icon));
- g_assert (G_IS_FILE (file));
- file_path = g_file_get_path (file);
- pixbuf = gdk_pixbuf_new_from_file (file_path, NULL);
- if (pixbuf == NULL)
- g_warning ("%s: Failed to load pixbuf from %s", G_STRFUNC, file_path);
- else {
- gs_icon_set_width (icon, gdk_pixbuf_get_width (pixbuf));
- gs_icon_set_height (icon, gdk_pixbuf_get_height (pixbuf));
- }
-}
-
/**
* gs_utils_get_file_size:
* @filename: a file name to get the size of; it can be a file or a directory
diff --git a/lib/gs-utils.h b/lib/gs-utils.h
index 2159a08d9..ef33ed9ac 100644
--- a/lib/gs-utils.h
+++ b/lib/gs-utils.h
@@ -111,7 +111,6 @@ gchar *gs_utils_build_unique_id (AsComponentScope scope,
void gs_utils_pixbuf_blur (GdkPixbuf *src,
guint radius,
guint iterations);
-void gs_utils_file_icon_ensure_size (GIcon *icon);
/**
* GsFileSizeIncludeFunc:
diff --git a/plugins/epiphany/gs-plugin-epiphany.c b/plugins/epiphany/gs-plugin-epiphany.c
index 154348506..8547586ef 100644
--- a/plugins/epiphany/gs-plugin-epiphany.c
+++ b/plugins/epiphany/gs-plugin-epiphany.c
@@ -395,7 +395,24 @@ list_installed_apps_thread_cb (GTask *task,
if (icon_path) {
g_autoptr(GFile) icon_file = g_file_new_for_path (icon_path);
g_autoptr(GIcon) icon = g_file_icon_new (icon_file);
- gs_utils_file_icon_ensure_size (icon);
+ g_autofree char *icon_dir = g_path_get_dirname (icon_path);
+ const char *x;
+ int size = 0;
+
+ /* dir should be either scalable or e.g. 512x512 */
+ if (g_strcmp0 (icon_dir, "scalable") == 0) {
+ /* Ensure scalable icons are preferred */
+ size = 4096;
+ } else if ((x = strchr (icon_dir, 'x')) != NULL) {
+ size = atoi (x + 1);
+ }
+ if (size > 0 && size <= 4096) {
+ gs_icon_set_width (icon, size);
+ gs_icon_set_height (icon, size);
+ } else {
+ g_warning ("Unexpectedly unable to determine size of icon %s", icon_path);
+ }
+
gs_app_add_icon (app, icon);
}
if (install_date) {
@@ -504,8 +521,8 @@ gs_plugin_app_install (GsPlugin *plugin,
g_variant_builder_init (&opt_builder, G_VARIANT_TYPE_VARDICT);
token_v = g_dbus_proxy_call_sync (self->launcher_portal_proxy,
"RequestInstallToken",
- g_variant_new ("(svsa{sv})",
- name, icon_v, icon_format, &opt_builder),
+ g_variant_new ("(sva{sv})",
+ name, icon_v, &opt_builder),
G_DBUS_CALL_FLAGS_NONE,
-1, cancellable, error);
if (token_v == NULL) {
diff --git a/plugins/epiphany/org.gnome.Epiphany.WebAppProvider.xml
b/plugins/epiphany/org.gnome.Epiphany.WebAppProvider.xml
index e61cf840a..15c6c4465 100644
--- a/plugins/epiphany/org.gnome.Epiphany.WebAppProvider.xml
+++ b/plugins/epiphany/org.gnome.Epiphany.WebAppProvider.xml
@@ -67,7 +67,7 @@
and `org.gnome.Epiphany.WebAppProvider.Error.Failed`.
-->
<method name="Uninstall">
- <arg type="s" name="desktop_path" direction="in" />
+ <arg type="s" name="desktop_file_id" direction="in" />
</method>
<!--
Version:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]