diff options
-rw-r--r-- | embed/ephy-web-view.c | 87 | ||||
-rw-r--r-- | embed/ephy-web-view.h | 2 |
2 files changed, 40 insertions, 49 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 * diff --git a/embed/ephy-web-view.h b/embed/ephy-web-view.h index a1147ede0..41b59f839 100644 --- a/embed/ephy-web-view.h +++ b/embed/ephy-web-view.h @@ -160,8 +160,6 @@ void ephy_web_view_get_security_level (EphyWebView EphyWebViewSecurityLevel *level, char **description); void ephy_web_view_print (EphyWebView *view); -void ephy_web_view_set_title (EphyWebView *view, - const char *view_title); const char * ephy_web_view_get_title (EphyWebView *view); const char * ephy_web_view_get_address (EphyWebView *view); const char * ephy_web_view_get_title_composite (EphyWebView *view); |