aboutsummaryrefslogtreecommitdiffstats
path: root/embed/ephy-web-view.c
diff options
context:
space:
mode:
authorDiego Escalante Urrelo <diegoe@igalia.com>2012-01-23 07:41:47 +0800
committerDiego Escalante Urrelo <diegoe@igalia.com>2012-01-24 01:14:10 +0800
commit7511ee0b55d81858cb62c798854df29b135b517f (patch)
treeaa553ea8babde32a1f096f0d551c79fd12e2c01a /embed/ephy-web-view.c
parentd626c6f1b880beabd1631f10891562067d287e28 (diff)
downloadgsoc2013-epiphany-7511ee0b55d81858cb62c798854df29b135b517f.tar.gz
gsoc2013-epiphany-7511ee0b55d81858cb62c798854df29b135b517f.tar.zst
gsoc2013-epiphany-7511ee0b55d81858cb62c798854df29b135b517f.zip
ephy-window: sync page actions with is-blank property
Add ::is-blank property to EphyWebView and update EphyWindow to sync some of the page menu actions with it. There's no point in enabling save/reload/bookmark/etc on about:blank. https://bugzilla.gnome.org/show_bug.cgi?id=668105
Diffstat (limited to 'embed/ephy-web-view.c')
-rw-r--r--embed/ephy-web-view.c45
1 files changed, 42 insertions, 3 deletions
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 4a031648e..7c2e89ec4 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -125,6 +125,7 @@ enum {
PROP_EMBED_TITLE,
PROP_TYPED_ADDRESS,
PROP_VISIBLE,
+ PROP_IS_BLANK,
};
#define EPHY_WEB_VIEW_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_WEB_VIEW, EphyWebViewPrivate))
@@ -448,6 +449,9 @@ ephy_web_view_get_property (GObject *object,
case PROP_VISIBLE:
g_value_set_boolean (value, priv->visibility);
break;
+ case PROP_IS_BLANK:
+ g_value_set_boolean (value, priv->is_blank);
+ break;
default:
break;
}
@@ -477,6 +481,7 @@ ephy_web_view_set_property (GObject *object,
case PROP_STATUS_MESSAGE:
case PROP_EMBED_TITLE:
case PROP_VISIBLE:
+ case PROP_IS_BLANK:
/* read only */
break;
default:
@@ -1301,6 +1306,19 @@ ephy_web_view_class_init (EphyWebViewClass *klass)
G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
/**
+ * EphyWebView:is-blank:
+ *
+ * Whether the view is showing the blank address.
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_IS_BLANK,
+ g_param_spec_boolean ("is-blank",
+ "Is blank",
+ "If the EphyWebView is blank",
+ FALSE,
+ G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+
+/**
* EphyWebView::new-window:
* @view: the #EphyWebView that received the signal
* @new_view: the newly opened #EphyWebView
@@ -2489,6 +2507,25 @@ ephy_web_view_clear_history (EphyWebView *view)
}
/**
+ * ephy_web_view_set_is_blank:
+ * @view: an #EphyWebView
+ * @is_blank: if @view is the blank page
+ *
+ * Sets whether the @view's address is "blank".
+ **/
+static void
+_ephy_web_view_set_is_blank (EphyWebView *view,
+ gboolean is_blank)
+{
+ EphyWebViewPrivate *priv = view->priv;
+
+ if (priv->is_blank != is_blank) {
+ priv->is_blank = is_blank;
+ g_object_notify (G_OBJECT (view), "is-blank");
+ }
+}
+
+/**
* ephy_web_view_set_address:
* @view: an #EphyWebView
* @address: address to set @view to
@@ -2502,12 +2539,14 @@ ephy_web_view_set_address (EphyWebView *view,
{
EphyWebViewPrivate *priv = view->priv;
GObject *object = G_OBJECT (view);
+ gboolean is_blank;
g_free (priv->address);
priv->address = g_strdup (address);
- priv->is_blank = address == NULL ||
- strcmp (address, "about:blank") == 0;
+ is_blank = address == NULL ||
+ strcmp (address, "about:blank") == 0;
+ _ephy_web_view_set_is_blank (view, is_blank);
if (ephy_web_view_is_loading (view) &&
priv->expire_address_now == TRUE &&
@@ -2554,7 +2593,7 @@ ephy_web_view_set_title (EphyWebView *view,
if (title == NULL || title[0] == '\0') {
g_free (title);
title = g_strdup (EMPTY_PAGE);
- priv->is_blank = TRUE;
+ _ephy_web_view_set_is_blank (view, TRUE);
}
} else if (priv->is_blank) {
g_free (title);