[epiphany/tgt: 8/10] Defined new local page to redirect from the error view
- From: Manuel Rego Casasnovas <manuelrego src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/tgt: 8/10] Defined new local page to redirect from the error view
- Date: Thu, 12 Sep 2013 07:44:58 +0000 (UTC)
commit a894e12eb846fc8824b87cf89c2808770dd28ed8
Author: Lorenzo Tilve Álvaro <ltilve igalia com>
Date: Fri Sep 6 20:05:25 2013 +0200
Defined new local page to redirect from the error view
This is is the address to show after experimenting problems
with the requested URL, once tried the reconnection after the
amount of seconds indicated by "redirect-on-error-delay".
data/org.gnome.epiphany.gschema.xml | 5 +++++
embed/ephy-web-view.c | 14 ++++++++++----
lib/ephy-prefs.h | 1 +
3 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/data/org.gnome.epiphany.gschema.xml b/data/org.gnome.epiphany.gschema.xml
index 71c2643..a58928f 100644
--- a/data/org.gnome.epiphany.gschema.xml
+++ b/data/org.gnome.epiphany.gschema.xml
@@ -79,6 +79,11 @@
<summary>Seconds to automatic redirect after error.</summary>
<description>Delay in seconds to redirect from error page to requested URL. Set to 0
to disable the redirection.</description>
</key>
+ <key type="s" name="local-homepage-url">
+ <default>''</default>
+ <summary>Local home page</summary>
+ <description>Address of the local home page to be redirected from the error
view.</description>
+ </key>
</schema>
<schema path="/org/gnome/epiphany/ui/" id="org.gnome.Epiphany.ui">
<key type="b" name="show-toolbars">
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 23c6001..088006b 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -2434,13 +2434,14 @@ ephy_web_view_set_placeholder (EphyWebView *view,
static gboolean
redirect_on_soup_status_successful (EphyWebView *view)
{
- const gchar *url;
+ const gchar *url, *local_url;
gint status_code;
- gboolean result = TRUE;
- url = ephy_web_view_get_address (view);
-
SoupMessage *message;
SoupSession *session;
+ gboolean result = TRUE;
+
+ url = ephy_web_view_get_address (view);
+ local_url = g_settings_get_string(EPHY_SETTINGS_MAIN, EPHY_PREFS_LOCAL_HOMEPAGE_URL);
session = soup_session_new ();
message = soup_message_new (SOUP_METHOD_HEAD, url);
@@ -2453,6 +2454,11 @@ redirect_on_soup_status_successful (EphyWebView *view)
}
}
+ if (result && g_strcmp0 (local_url, "") && g_strcmp0 (url, local_url)) {
+ ephy_web_view_load_url (view, local_url);
+ result = FALSE;
+ }
+
g_object_unref (message);
g_object_unref (session);
diff --git a/lib/ephy-prefs.h b/lib/ephy-prefs.h
index d0b09e0..076fffb 100644
--- a/lib/ephy-prefs.h
+++ b/lib/ephy-prefs.h
@@ -128,6 +128,7 @@ typedef enum
#define EPHY_PREFS_CUSTOM_HTTP_ERRORS_MANAGEMENT "custom-http-errors-management"
#define EPHY_PREFS_HOMEPAGE_URL "homepage-url"
#define EPHY_PREFS_REDIRECT_ON_ERROR_DELAY "redirect-on-error-delay"
+#define EPHY_PREFS_LOCAL_HOMEPAGE_URL "local-homepage-url"
#define EPHY_PREFS_LOCKDOWN_SCHEMA "org.gnome.Epiphany.lockdown"
#define EPHY_PREFS_LOCKDOWN_FULLSCREEN "disable-fullscreen"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]