[epiphany/kiosk-mode] Add new home/back buttons to standard error page
- From: Manuel Rego Casasnovas <manuelrego src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/kiosk-mode] Add new home/back buttons to standard error page
- Date: Wed, 28 Aug 2013 07:38:44 +0000 (UTC)
commit 39b49e9d18e9154ed9e42c5ee1367043259c8fe1
Author: Lorenzo Tilve Álvaro <ltilve igalia com>
Date: Wed Jul 17 11:02:43 2013 +0200
Add new home/back buttons to standard error page
Adds new buttons to go back (if navigation is not locked down)
and return to the home page (the overview or the configured
homepage-url if its corresponding gsetting is defined).
https://bugzilla.gnome.org/show_bug.cgi?id=705180
data/pages/error.html | 12 +++++++++++-
embed/ephy-web-view.c | 32 ++++++++++++++++++++++++++++----
2 files changed, 39 insertions(+), 5 deletions(-)
---
diff --git a/data/pages/error.html b/data/pages/error.html
index 71660b0..b211f62 100644
--- a/data/pages/error.html
+++ b/data/pages/error.html
@@ -75,6 +75,14 @@
{
window.location = '%s';
}
+ function go_home()
+ {
+ window.location= '%s';
+ }
+ function go_back()
+ {
+ window.history.back();
+ }
</script>
</head>
<body class="%s">
@@ -89,7 +97,9 @@
</div>
<div class="buttonbox">
- <button onclick="javascript:load_anyway()">%s</button>
+ <!-- Reload -->%s
+ <!-- Back -->%s
+ <!-- Home -->%s
</div>
</div>
</div>
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index f68685b..6b6e108 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -2433,7 +2433,10 @@ ephy_web_view_load_error_page (EphyWebView *view,
char *page_title;
char *msg_title;
char *msg;
- char *button_label;
+ char *button_reload;
+ char *button_home;
+ char *button_back;
+ char *home_address;
const char *custom_class;
const char *html_file;
const char *stock_icon;
@@ -2453,8 +2456,25 @@ ephy_web_view_load_error_page (EphyWebView *view,
lang = g_strdup (pango_language_to_string (gtk_get_default_language ()));
g_strdelimit (lang, "_-@", '\0');
+ home_address = g_settings_get_string (EPHY_SETTINGS_MAIN, EPHY_PREFS_HOMEPAGE_URL);
+ if (home_address == NULL || home_address[0] == '\0') {
+ g_free (home_address);
+ home_address = g_strdup ("ephy-about:overview");
+ }
+
+ button_home = g_strdup_printf ("<button onclick=\"javascript:go_home()\">%s</button>",
+ _("Go home"));
+
+ button_reload = g_strdup_printf ("<button onclick=\"javascript:load_anyway()\">%s</button>",
+ _("Try again"));
+
+ if (!g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN, EPHY_PREFS_LOCKDOWN_HISTORY))
+ button_back = g_strdup_printf ("<button onclick=\"javascript:go_back()\">%s</button>",
+ _("Go Back"));
+ else
+ button_back = g_strdup ("");
+
html_file = ephy_file ("error.html");
- button_label = g_strdup (_("Try again"));
custom_class = "error";
switch (page) {
@@ -2529,16 +2549,20 @@ ephy_web_view_load_error_page (EphyWebView *view,
((gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL) ? "rtl" : "ltr"),
page_title,
uri,
+ home_address,
custom_class,
image_data ? image_data : "",
- msg_title, msg, button_label);
+ msg_title, msg, button_reload, button_home, button_back);
g_free (template);
g_free (lang);
g_free (page_title);
g_free (msg_title);
g_free (msg);
- g_free (button_label);
+ g_free (home_address);
+ g_free (button_reload);
+ g_free (button_home);
+ g_free (button_back);
g_free (image_data);
if (icon_info)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]