diff options
author | Michael Catanzaro <mcatanzaro@redhat.com> | 2023-05-17 21:18:37 -0500 |
---|---|---|
committer | Michael Catanzaro <mcatanzaro@redhat.com> | 2023-05-17 21:40:10 -0500 |
commit | 47f410d9a76ebd39eda4a348b0f5c4b4c59caf8d (patch) | |
tree | 359b2e8305cee55d504f6cd659ab1f2dc8bc20e5 | |
parent | 373a83c145b7ed6137f0bee4acba3d2dd2d0d218 (diff) | |
download | epiphany-47f410d9a76ebd39eda4a348b0f5c4b4c59caf8d.tar.gz |
Fall back to favicon when failing to set web app icon
On the web app creation dialog, if we fail to create a texture for the
web app icon, let's fall back to using a favicon instead rather than
unnecessarily give up entirely.
Also, improve the error reporting for good measure.
Fixes #1989 sort of. This will ensure we don't totally fail to create
the web app when the image format is unrecognized. That will be fixed
next.
-rw-r--r-- | src/window-commands.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/window-commands.c b/src/window-commands.c index 23307b11d..7e8b38bb2 100644 --- a/src/window-commands.c +++ b/src/window-commands.c @@ -1648,8 +1648,11 @@ set_app_icon_from_filename (EphyApplicationDialogData *data, const char *filename) { g_autoptr (GdkPixbuf) pixbuf = NULL; + g_autoptr (GError) error = NULL; - pixbuf = gdk_pixbuf_new_from_file_at_size (filename, DEFAULT_ICON_SIZE, DEFAULT_ICON_SIZE, NULL); + pixbuf = gdk_pixbuf_new_from_file_at_size (filename, DEFAULT_ICON_SIZE, DEFAULT_ICON_SIZE, &error); + if (pixbuf == NULL) + g_warning ("Failed to create pixbuf for %s: %s", filename, error->message); if (pixbuf != NULL) { data->framed_pixbuf = frame_pixbuf (G_ICON (pixbuf), &data->icon_rgba, DEFAULT_ICON_SIZE, DEFAULT_ICON_SIZE); @@ -1658,9 +1661,8 @@ set_app_icon_from_filename (EphyApplicationDialogData *data, create_install_dialog_when_ready (data); } if (data->icon_v == NULL) { - g_warning ("Failed to get icon for web app %s, giving up", data->display_address); - ephy_application_dialog_data_free (data); - return; + g_warning ("Failed to get icon for web app %s, falling back to favicon", data->display_address); + set_image_from_favicon (data); } } |