diff options
author | Xan Lopez <xan@igalia.com> | 2012-06-28 19:44:22 +0800 |
---|---|---|
committer | Xan Lopez <xan@igalia.com> | 2012-06-28 19:44:48 +0800 |
commit | 1a61db4aa5839d921f96727c3c464f6b026221c4 (patch) | |
tree | 06311bf0c0605049164a40c9339211549ad5b7ee /embed/ephy-web-view.c | |
parent | e3f51b0a10803b2c555a7416f63e2376302e991c (diff) | |
download | gsoc2013-epiphany-1a61db4aa5839d921f96727c3c464f6b026221c4.tar.gz gsoc2013-epiphany-1a61db4aa5839d921f96727c3c464f6b026221c4.tar.zst gsoc2013-epiphany-1a61db4aa5839d921f96727c3c464f6b026221c4.zip |
ephy-web-view: set_title can also be made private to its file
Diffstat (limited to 'embed/ephy-web-view.c')
-rw-r--r-- | embed/ephy-web-view.c | 87 |
1 files changed, 40 insertions, 47 deletions
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c index 91ba2ae4b..51509b104 100644 --- a/embed/ephy-web-view.c +++ b/embed/ephy-web-view.c @@ -1117,6 +1117,46 @@ get_title_from_address (const char *address) } 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"); + } +} + +static void +ephy_web_view_set_title (EphyWebView *view, + const char *view_title) +{ + EphyWebViewPrivate *priv = view->priv; + char *title = g_strdup (view_title); + + if (!priv->is_blank && (title == NULL || g_strstrip (title)[0] == '\0')) { + g_free (title); + title = get_title_from_address (priv->address); + + /* Fallback */ + if (title == NULL || title[0] == '\0') { + g_free (title); + title = g_strdup (EMPTY_PAGE); + _ephy_web_view_set_is_blank (view, TRUE); + } + } else if (priv->is_blank) { + g_free (title); + title = g_strdup (EMPTY_PAGE); + } + + g_free (priv->title); + priv->title = ephy_string_shorten (title, MAX_TITLE_LENGTH); + + g_object_notify (G_OBJECT (view), "embed-title"); +} + +static void title_changed_cb (WebKitWebView *web_view, GParamSpec *spec, gpointer data) @@ -1147,18 +1187,6 @@ title_changed_cb (WebKitWebView *web_view, } -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"); - } -} - /** * Sets the view location to be address. Note that this function might * also set the typed-address property to %NULL. @@ -3087,41 +3115,6 @@ ephy_web_view_copy_back_history (EphyWebView *source, } /** - * ephy_web_view_set_title: - * @view: an #EphyWebView - * @view_title: new title for @view - * - * Sets @view title to @view_title. - */ -void -ephy_web_view_set_title (EphyWebView *view, - const char *view_title) -{ - EphyWebViewPrivate *priv = view->priv; - char *title = g_strdup (view_title); - - if (!priv->is_blank && (title == NULL || g_strstrip (title)[0] == '\0')) { - g_free (title); - title = get_title_from_address (priv->address); - - /* Fallback */ - if (title == NULL || title[0] == '\0') { - g_free (title); - title = g_strdup (EMPTY_PAGE); - _ephy_web_view_set_is_blank (view, TRUE); - } - } else if (priv->is_blank) { - g_free (title); - title = g_strdup (EMPTY_PAGE); - } - - g_free (priv->title); - priv->title = ephy_string_shorten (title, MAX_TITLE_LENGTH); - - g_object_notify (G_OBJECT (view), "embed-title"); -} - -/** * ephy_web_view_get_is_blank: * @view: an #EphyWebView * |