aboutsummaryrefslogtreecommitdiffstats
path: root/embed/ephy-web-view.c
diff options
context:
space:
mode:
Diffstat (limited to 'embed/ephy-web-view.c')
-rw-r--r--embed/ephy-web-view.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index ce0312ad1..92cdb3896 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -63,6 +63,10 @@
#define MAX_TITLE_LENGTH 512 /* characters */
#define EMPTY_PAGE _("Blank page") /* Title for the empty page */
+#define EPHY_PAGE_TEMPLATE_ERROR "/org/gnome/epiphany/page-templates/error.html"
+#define EPHY_PAGE_TEMPLATE_RECOVERY "/org/gnome/epiphany/page-templates/recovery.html"
+#define EPHY_PAGE_TEMPLATE_PROCESS_CRASH "/org/gnome/epiphany/page-templates/process-crash.html"
+
struct _EphyWebViewPrivate {
EphyWebViewSecurityLevel security_level;
EphyWebViewDocumentType document_type;
@@ -1699,22 +1703,17 @@ ephy_web_view_load_error_page (EphyWebView *view,
{
GString *html = g_string_new ("");
const char *reason;
-
char *hostname;
char *lang;
-
char *page_title;
char *msg_title;
char *msg;
char *button_label;
- const char *html_file;
+ GBytes *html_file;
const char *stock_icon;
-
GtkIconInfo *icon_info;
char *image_data;
- char *template;
-
if (error)
reason = error->message;
else
@@ -1741,7 +1740,7 @@ ephy_web_view_load_error_page (EphyWebView *view,
button_label = g_strdup (_("Try again"));
- html_file = ephy_file ("error.html");
+ html_file = g_resources_lookup_data (EPHY_PAGE_TEMPLATE_ERROR, 0, NULL);
stock_icon = "dialog-error";
break;
case EPHY_WEB_VIEW_ERROR_PAGE_CRASH:
@@ -1759,7 +1758,7 @@ ephy_web_view_load_error_page (EphyWebView *view,
button_label = g_strdup (_("Load again anyway"));
- html_file = ephy_file ("recovery.html");
+ html_file = g_resources_lookup_data (EPHY_PAGE_TEMPLATE_RECOVERY, 0, NULL);
stock_icon = "dialog-information";
break;
case EPHY_WEB_VIEW_ERROR_PROCESS_CRASH:
@@ -1768,7 +1767,7 @@ ephy_web_view_load_error_page (EphyWebView *view,
msg = g_strdup (_("Something went wrong while displaying this page. Please reload or visit a different page to continue."));
button_label = NULL;
- html_file = ephy_file ("process_crash.html");
+ html_file = g_resources_lookup_data (EPHY_PAGE_TEMPLATE_PROCESS_CRASH, 0, NULL);
stock_icon = "computer-fail-symbolic";
break;
@@ -1785,13 +1784,12 @@ ephy_web_view_load_error_page (EphyWebView *view,
image_data = icon_info ? ephy_file_create_data_uri_for_filename (gtk_icon_info_get_filename (icon_info), NULL) : NULL;
- g_file_get_contents (html_file, &template, NULL, NULL);
-
ephy_web_view_set_title (view, page_title);
_ephy_web_view_update_icon (view);
- g_string_printf (html, template,
+ g_string_printf (html,
+ g_bytes_get_data (html_file, NULL),
lang, lang,
((gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL) ? "rtl" : "ltr"),
page_title,
@@ -1799,7 +1797,7 @@ ephy_web_view_load_error_page (EphyWebView *view,
image_data ? image_data : "",
msg_title, msg, button_label);
- g_free (template);
+ g_bytes_unref (html_file);
g_free (lang);
g_free (page_title);
g_free (msg_title);