aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorAlejandro G. Castro <alex@igalia.com>2010-04-30 01:24:20 +0800
committerAlejandro G. Castro <alex@igalia.com>2010-05-02 23:09:56 +0800
commit4e914078cd832490b1d31804836f3ac2274fdaf0 (patch)
tree1925b670adeedbbab429ad189786b9d503b83919 /embed
parente355b448ed3f5002ba11e7e76a9de9c0d9630e6f (diff)
downloadgsoc2013-epiphany-4e914078cd832490b1d31804836f3ac2274fdaf0.tar
gsoc2013-epiphany-4e914078cd832490b1d31804836f3ac2274fdaf0.tar.gz
gsoc2013-epiphany-4e914078cd832490b1d31804836f3ac2274fdaf0.tar.bz2
gsoc2013-epiphany-4e914078cd832490b1d31804836f3ac2274fdaf0.tar.lz
gsoc2013-epiphany-4e914078cd832490b1d31804836f3ac2274fdaf0.tar.xz
gsoc2013-epiphany-4e914078cd832490b1d31804836f3ac2274fdaf0.tar.zst
gsoc2013-epiphany-4e914078cd832490b1d31804836f3ac2274fdaf0.zip
Removed the EphyWebViewNetState enum
We can use the webkit load status (WebKitLoadStatus) and avoid defining our own enum to check the net states. Bug #593743
Diffstat (limited to 'embed')
-rw-r--r--embed/ephy-embed.c13
-rw-r--r--embed/ephy-web-view.c33
-rw-r--r--embed/ephy-web-view.h18
3 files changed, 12 insertions, 52 deletions
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index 8f2c4738b..878cd36f1 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -245,7 +245,6 @@ load_status_changed_cb (WebKitWebView *view,
ephy_web_view_set_security_level (EPHY_WEB_VIEW (view), security_level);
} else if (status == WEBKIT_LOAD_PROVISIONAL || status == WEBKIT_LOAD_FINISHED) {
- EphyWebViewNetState estate = EPHY_WEB_VIEW_STATE_UNKNOWN;
char *loading_uri = NULL;
if (status == WEBKIT_LOAD_PROVISIONAL) {
@@ -262,12 +261,6 @@ load_status_changed_cb (WebKitWebView *view,
* we will want to use it in WEBKIT_LOAD_FINISHED, because if a
* load fails we may never get to committed */
priv->loading_uri = g_strdup (loading_uri);
-
- estate = (EphyWebViewNetState) (estate |
- EPHY_WEB_VIEW_STATE_START |
- EPHY_WEB_VIEW_STATE_NEGOTIATING |
- EPHY_WEB_VIEW_STATE_IS_REQUEST |
- EPHY_WEB_VIEW_STATE_IS_NETWORK);
g_signal_emit_by_name (EPHY_WEB_VIEW (view), "new-document-now", loading_uri);
} else if (status == WEBKIT_LOAD_FINISHED) {
@@ -276,15 +269,11 @@ load_status_changed_cb (WebKitWebView *view,
/* Will be freed below */
priv->loading_uri = NULL;
- estate = (EphyWebViewNetState) (estate |
- EPHY_WEB_VIEW_STATE_STOP |
- EPHY_WEB_VIEW_STATE_IS_DOCUMENT |
- EPHY_WEB_VIEW_STATE_IS_NETWORK);
}
ephy_web_view_update_from_net_state (EPHY_WEB_VIEW (view),
loading_uri,
- (EphyWebViewNetState)estate);
+ status);
g_free (loading_uri);
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 2e084801e..26c5f3dd5 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -2340,7 +2340,7 @@ ensure_page_info (EphyWebView *view, const char *address)
}
static void
-update_net_state_message (EphyWebView *view, const char *uri, EphyWebViewNetState flags)
+update_net_state_message (EphyWebView *view, const char *uri, WebKitLoadStatus status)
{
const char *msg = NULL;
char *host = NULL;
@@ -2350,25 +2350,12 @@ update_net_state_message (EphyWebView *view, const char *uri, EphyWebViewNetStat
if (host == NULL) goto out;
- /* IS_REQUEST and IS_NETWORK can be both set */
- if (flags & EPHY_WEB_VIEW_STATE_IS_REQUEST) {
- if (flags & EPHY_WEB_VIEW_STATE_REDIRECTING) {
- msg = _ ("Redirecting to “%s”…");
- } else if (flags & EPHY_WEB_VIEW_STATE_TRANSFERRING) {
- msg = _ ("Transferring data from “%s”…");
- } else if (flags & EPHY_WEB_VIEW_STATE_NEGOTIATING) {
- msg = _ ("Waiting for authorization from “%s”…");
- }
- }
-
- if (flags & EPHY_WEB_VIEW_STATE_IS_NETWORK) {
- if (flags & EPHY_WEB_VIEW_STATE_START) {
+ /* FIXME: add REDIRECTING and NEGOTIATING states to WebKitGTK */
+ if (status == WEBKIT_LOAD_PROVISIONAL) {
msg = _ ("Loading “%s”…");
}
- }
- if ((flags & EPHY_WEB_VIEW_STATE_IS_NETWORK) &&
- (flags & EPHY_WEB_VIEW_STATE_STOP)) {
+ if (status == WEBKIT_LOAD_FINISHED) {
g_free (view->priv->status_message);
view->priv->status_message = NULL;
g_object_notify (G_OBJECT (view), "status-message");
@@ -2390,21 +2377,21 @@ update_net_state_message (EphyWebView *view, const char *uri, EphyWebViewNetStat
* ephy_web_view_update_from_net_state:
* @view: an #EphyWebView
* @uri: the uri associated with @view
- * @state: an #EphyWebViewNetState
+ * @state: a #WebKitLoadStatus
*
* Update @view at @uri with info from @state.
**/
void
ephy_web_view_update_from_net_state (EphyWebView *view,
const char *uri,
- EphyWebViewNetState state)
+ WebKitLoadStatus status)
{
EphyWebViewPrivate *priv = view->priv;
- update_net_state_message (view, uri, state);
+ update_net_state_message (view, uri, status);
- if (state & EPHY_WEB_VIEW_STATE_IS_NETWORK) {
- if (state & EPHY_WEB_VIEW_STATE_START) {
+ if (status == WEBKIT_LOAD_PROVISIONAL || status == WEBKIT_LOAD_FINISHED) {
+ if (status == WEBKIT_LOAD_PROVISIONAL) {
GObject *object = G_OBJECT (view);
g_object_freeze_notify (object);
@@ -2416,7 +2403,7 @@ ephy_web_view_update_from_net_state (EphyWebView *view,
g_object_notify (object, "embed-title");
g_object_thaw_notify (object);
- } else if (state & EPHY_WEB_VIEW_STATE_STOP) {
+ } else if (status == WEBKIT_LOAD_FINISHED) {
GObject *object = G_OBJECT (view);
g_object_freeze_notify (object);
diff --git a/embed/ephy-web-view.h b/embed/ephy-web-view.h
index 5b6a28d4c..4079ebd4c 100644
--- a/embed/ephy-web-view.h
+++ b/embed/ephy-web-view.h
@@ -54,22 +54,6 @@ typedef enum
typedef enum
{
- EPHY_WEB_VIEW_STATE_UNKNOWN = 0,
- EPHY_WEB_VIEW_STATE_START = 1 << 0,
- EPHY_WEB_VIEW_STATE_REDIRECTING = 1 << 1,
- EPHY_WEB_VIEW_STATE_TRANSFERRING = 1 << 2,
- EPHY_WEB_VIEW_STATE_NEGOTIATING = 1 << 3,
- EPHY_WEB_VIEW_STATE_STOP = 1 << 4,
-
- EPHY_WEB_VIEW_STATE_IS_REQUEST = 1 << 5,
- EPHY_WEB_VIEW_STATE_IS_DOCUMENT = 1 << 6,
- EPHY_WEB_VIEW_STATE_IS_NETWORK = 1 << 7,
- EPHY_WEB_VIEW_STATE_IS_WINDOW = 1 << 8,
- EPHY_WEB_VIEW_STATE_RESTORING = 1 << 9
-} EphyWebViewNetState;
-
-typedef enum
-{
EPHY_WEB_VIEW_CHROME_MENUBAR = 1 << 0,
EPHY_WEB_VIEW_CHROME_TOOLBAR = 1 << 1,
EPHY_WEB_VIEW_CHROME_STATUSBAR = 1 << 2,
@@ -198,7 +182,7 @@ void ephy_web_view_set_address (EphyWebView
const char *address);
void ephy_web_view_update_from_net_state (EphyWebView *view,
const char *uri,
- EphyWebViewNetState state);
+ WebKitLoadStatus state);
void ephy_web_view_location_changed (EphyWebView *view,
const char *location);
void ephy_web_view_set_loading_title (EphyWebView *view,