aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro G. Castro <alex@igalia.com>2010-05-04 18:43:14 +0800
committerAlejandro G. Castro <alex@igalia.com>2010-05-04 19:52:40 +0800
commitc3ce140727235f54c61dca6cc9eb6709422fe3b8 (patch)
treeee8979cb437e2aa836b7d0a153844979ce935608
parent41e747ab437e9aa6d90015314f49d2955a3ef293 (diff)
downloadgsoc2013-epiphany-c3ce140727235f54c61dca6cc9eb6709422fe3b8.tar
gsoc2013-epiphany-c3ce140727235f54c61dca6cc9eb6709422fe3b8.tar.gz
gsoc2013-epiphany-c3ce140727235f54c61dca6cc9eb6709422fe3b8.tar.bz2
gsoc2013-epiphany-c3ce140727235f54c61dca6cc9eb6709422fe3b8.tar.lz
gsoc2013-epiphany-c3ce140727235f54c61dca6cc9eb6709422fe3b8.tar.xz
gsoc2013-epiphany-c3ce140727235f54c61dca6cc9eb6709422fe3b8.tar.zst
gsoc2013-epiphany-c3ce140727235f54c61dca6cc9eb6709422fe3b8.zip
Handle LOAD_FAILED status
Modified the state of the webivew in case the load failed to avoid keeping the old title or icon in that situation. Bug #593743
-rw-r--r--embed/ephy-web-view.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index b10e38a41..669ffd6e6 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -2095,6 +2095,16 @@ load_status_cb (WebKitWebView *web_view,
_ephy_web_view_hook_into_links (view);
break;
+ case WEBKIT_LOAD_FAILED:
+ ephy_web_view_set_link_message (view, NULL);
+ ephy_web_view_set_loading_title (view, NULL, FALSE);
+
+ g_free (priv->status_message);
+ priv->status_message = NULL;
+ g_object_notify (object, "status-message");
+
+ update_navigation_flags (view);
+ break;
default:
break;
}
@@ -2102,6 +2112,28 @@ load_status_cb (WebKitWebView *web_view,
g_object_thaw_notify (object);
}
+ static gboolean
+load_error_cb (WebKitWebView *web_view,
+ WebKitWebFrame *frame,
+ gchar *uri,
+ GError *error,
+ gpointer user_data)
+{
+ if (error->code != WEBKIT_NETWORK_ERROR_CANCELLED) {
+ EphyWebView *view = EPHY_WEB_VIEW (web_view);
+ gchar *message;
+
+ message = g_strdup_printf (_("A problem occurred while loading %s"),
+ uri);
+ ephy_web_view_set_title (view, message);
+ g_free (message);
+
+ _ephy_web_view_set_icon_address (view, NULL);
+ }
+
+ return FALSE;
+}
+
static gboolean
close_web_view_cb (WebKitWebView *web_view,
gpointer user_data)
@@ -2162,6 +2194,10 @@ ephy_web_view_init (EphyWebView *web_view)
G_CALLBACK (close_web_view_cb),
NULL);
+ g_signal_connect (web_view, "load-error",
+ G_CALLBACK (load_error_cb),
+ NULL);
+
g_signal_connect_object (web_view, "icon-loaded",
G_CALLBACK (favicon_cb),
web_view, (GConnectFlags)0);