summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhaedrus Leeds <mwleeds@protonmail.com>2022-02-23 15:43:50 -0800
committerPhaedrus Leeds <mwleeds@protonmail.com>2022-03-21 13:07:44 -0700
commit752aca5ae9a1ab7f85d486f3853d2450345cf5cf (patch)
treeed9bd628b6ca6ec101004410ea75d2f1a13e62d7 /src
parent097e0e3fb6c71aa080112d011c58f74292508a3c (diff)
downloadepiphany-752aca5ae9a1ab7f85d486f3853d2450345cf5cf.tar.gz
Fix web app icon url vs path confusion
Confusingly, the icon_url member of EphyWebApplication is actually a path not a URL or URI. The only place where it gets set to a URI is in prefs-general-page.c when the user changes the icon, and there it is happening erroneously since all the other code that deals with it assumes it is a path. So, rename the struct member and ensure all the use of it treats it as a path.
Diffstat (limited to 'src')
-rw-r--r--src/preferences/prefs-general-page.c24
-rw-r--r--src/profile-migrator/ephy-legacy-web-app-utils.c2
2 files changed, 13 insertions, 13 deletions
diff --git a/src/preferences/prefs-general-page.c b/src/preferences/prefs-general-page.c
index 297201850..ba795bdf3 100644
--- a/src/preferences/prefs-general-page.c
+++ b/src/preferences/prefs-general-page.c
@@ -808,10 +808,10 @@ save_web_application (PrefsGeneralPage *general_page)
changed = TRUE;
}
- text = (const char *)g_object_get_data (G_OBJECT (general_page->webapp_icon), "ephy-webapp-icon-url");
- if (g_strcmp0 (general_page->webapp->icon_url, text) != 0) {
- g_free (general_page->webapp->icon_url);
- general_page->webapp->icon_url = g_strdup (text);
+ text = (const char *)g_object_get_data (G_OBJECT (general_page->webapp_icon), "ephy-webapp-icon-path");
+ if (g_strcmp0 (general_page->webapp->icon_path, text) != 0) {
+ g_free (general_page->webapp->icon_path);
+ general_page->webapp->icon_path = g_strdup (text);
changed = TRUE;
}
@@ -833,9 +833,9 @@ prefs_general_page_save_web_application (PrefsGeneralPage *general_page)
static void
prefs_general_page_update_webapp_icon (PrefsGeneralPage *general_page,
- const char *icon_url)
+ const char *icon_path)
{
- g_autoptr (GdkPixbuf) icon = gdk_pixbuf_new_from_file (icon_url, NULL);
+ g_autoptr (GdkPixbuf) icon = gdk_pixbuf_new_from_file (icon_path, NULL);
if (!icon)
return;
@@ -845,8 +845,8 @@ prefs_general_page_update_webapp_icon (PrefsGeneralPage *general_page,
GTK_ICON_SIZE_DND);
gtk_image_set_pixel_size (GTK_IMAGE (general_page->webapp_icon), 32);
- g_object_set_data_full (G_OBJECT (general_page->webapp_icon), "ephy-webapp-icon-url",
- g_strdup (icon_url), g_free);
+ g_object_set_data_full (G_OBJECT (general_page->webapp_icon), "ephy-webapp-icon-path",
+ g_strdup (icon_path), g_free);
}
static void
@@ -856,11 +856,11 @@ webapp_icon_chooser_response_cb (GtkNativeDialog *file_chooser,
{
if (response == GTK_RESPONSE_ACCEPT) {
g_autoptr (GFile) icon_file = NULL;
- g_autofree char *icon_url = NULL;
+ g_autofree char *icon_path = NULL;
icon_file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (file_chooser));
- icon_url = g_file_get_uri (icon_file);
- prefs_general_page_update_webapp_icon (general_page, icon_url);
+ icon_path = g_file_get_path (icon_file);
+ prefs_general_page_update_webapp_icon (general_page, icon_path);
prefs_general_page_save_web_application (general_page);
}
@@ -1181,7 +1181,7 @@ setup_general_page (PrefsGeneralPage *general_page)
g_assert (general_page->webapp);
if (!g_settings_get_boolean (EPHY_SETTINGS_WEB_APP, EPHY_PREFS_WEB_APP_SYSTEM)) {
- prefs_general_page_update_webapp_icon (general_page, general_page->webapp->icon_url);
+ prefs_general_page_update_webapp_icon (general_page, general_page->webapp->icon_path);
gtk_entry_set_text (GTK_ENTRY (general_page->webapp_url), general_page->webapp->url);
gtk_entry_set_text (GTK_ENTRY (general_page->webapp_title), general_page->webapp->name);
}
diff --git a/src/profile-migrator/ephy-legacy-web-app-utils.c b/src/profile-migrator/ephy-legacy-web-app-utils.c
index c256bf1ac..13b49c78a 100644
--- a/src/profile-migrator/ephy-legacy-web-app-utils.c
+++ b/src/profile-migrator/ephy-legacy-web-app-utils.c
@@ -254,7 +254,7 @@ ephy_legacy_web_application_for_profile_directory (const char *profile_dir)
}
app->name = g_strdup (g_app_info_get_name (G_APP_INFO (desktop_info)));
- app->icon_url = g_desktop_app_info_get_string (desktop_info, "Icon");
+ app->icon_path = g_desktop_app_info_get_string (desktop_info, "Icon");
exec = g_app_info_get_commandline (G_APP_INFO (desktop_info));
if (g_shell_parse_argv (exec, &argc, &argv, NULL))
app->url = g_strdup (argv[argc - 1]);