summaryrefslogtreecommitdiff
path: root/embed/ephy-web-view.c
diff options
context:
space:
mode:
authorCarlos Garcia Campos <cgarcia@igalia.com>2014-03-04 12:30:01 +0100
committerCarlos Garcia Campos <carlosgc@gnome.org>2014-03-10 11:17:03 +0100
commit0d89197cd0d1516d3003eb3e8c6d9ac0118c5712 (patch)
tree5c0f922a56be473fb9ffb968c16f56d36bf1504b /embed/ephy-web-view.c
parent0c6c6bcef6d6f0bbd0f20659ea9bec94a59cc658 (diff)
downloadepiphany-0d89197cd0d1516d3003eb3e8c6d9ac0118c5712.tar.gz
ephy-web-view: Move embed-title property to EphyEmbed
Since it's the embed title what it represents. The web view already has a title property inherited from WebKitWebView. https://bugzilla.gnome.org/show_bug.cgi?id=725649
Diffstat (limited to 'embed/ephy-web-view.c')
-rw-r--r--embed/ephy-web-view.c79
1 files changed, 6 insertions, 73 deletions
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 404b6e48c..f58b6b03c 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -61,8 +61,6 @@
*/
#define MAX_HIDDEN_POPUPS 5
-#define MAX_TITLE_LENGTH 512 /* characters */
-#define EMPTY_PAGE _("Blank page") /* Title for the empty page */
#define EPHY_PAGE_TEMPLATE_ERROR "/org/gnome/epiphany/page-templates/error.html"
@@ -80,7 +78,6 @@ struct _EphyWebViewPrivate {
char *address;
char *typed_address;
- char *title;
char *loading_message;
char *link_message;
GdkPixbuf *icon;
@@ -131,7 +128,6 @@ enum {
PROP_POPUPS_ALLOWED,
PROP_SECURITY,
PROP_STATUS_MESSAGE,
- PROP_EMBED_TITLE,
PROP_TYPED_ADDRESS,
PROP_IS_BLANK,
};
@@ -368,9 +364,6 @@ ephy_web_view_get_property (GObject *object,
case PROP_ADDRESS:
g_value_set_string (value, priv->address);
break;
- case PROP_EMBED_TITLE:
- g_value_set_string (value, priv->title);
- break;
case PROP_TYPED_ADDRESS:
g_value_set_string (value, priv->typed_address);
break;
@@ -430,7 +423,6 @@ ephy_web_view_set_property (GObject *object,
case PROP_NAVIGATION:
case PROP_SECURITY:
case PROP_STATUS_MESSAGE:
- case PROP_EMBED_TITLE:
case PROP_IS_BLANK:
/* read only */
break;
@@ -762,7 +754,6 @@ ephy_web_view_finalize (GObject *object)
g_free (priv->address);
g_free (priv->typed_address);
- g_free (priv->title);
g_free (priv->link_message);
g_free (priv->loading_message);
@@ -782,52 +773,26 @@ _ephy_web_view_set_is_blank (EphyWebView *view,
}
static void
-ephy_web_view_set_title (EphyWebView *view,
- const char *view_title)
-{
- EphyWebViewPrivate *priv = view->priv;
- char *title = g_strdup (view_title);
-
- if (title == NULL || g_strstrip (title)[0] == '\0') {
- g_free (title);
- title = priv->address ? ephy_embed_utils_get_title_from_address (priv->address) : NULL;
-
- if (title == NULL || title[0] == '\0') {
- 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)
{
const char *uri;
- char *title;
+ const char *title;
+ char *title_from_address = NULL;
EphyWebView *webview = EPHY_WEB_VIEW (web_view);
EphyHistoryService *history = webview->priv->history_service;
uri = webkit_web_view_get_uri (web_view);
+ title = webkit_web_view_get_title (web_view);
- g_object_get (web_view, "title", &title, NULL);
-
- ephy_web_view_set_title (webview, title);
-
if (!title && uri)
- title = ephy_embed_utils_get_title_from_address (uri);
+ title = title_from_address = ephy_embed_utils_get_title_from_address (uri);
if (uri && title && !ephy_web_view_is_history_frozen (webview))
ephy_history_service_set_url_title (history, uri, title, NULL, NULL, NULL);
- g_free (title);
-
+ g_free (title_from_address);
}
/*
@@ -973,19 +938,6 @@ ephy_web_view_class_init (EphyWebViewClass *klass)
G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
/**
- * EphyWebView:embed-title:
- *
- * Title for this embed.
- **/
- g_object_class_install_property (gobject_class,
- PROP_EMBED_TITLE,
- g_param_spec_string ("embed-title",
- "Title",
- "The view's title",
- EMPTY_PAGE,
- G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
-
-/**
* EphyWebView:security-level:
*
* One of #EphyWebViewSecurityLevel, determining view's current security level.
@@ -1545,7 +1497,6 @@ ephy_web_view_location_changed (EphyWebView *view,
if (location == NULL || location[0] == '\0') {
ephy_web_view_set_address (view, NULL);
- ephy_web_view_set_title (view, EMPTY_PAGE);
} else if (g_str_has_prefix (location, EPHY_ABOUT_SCHEME":applications")) {
SoupURI *uri = soup_uri_new (location);
char *new_address;
@@ -1655,9 +1606,6 @@ load_changed_cb (WebKitWebView *web_view,
case WEBKIT_LOAD_FINISHED:
ephy_web_view_set_loading_message (view, NULL);
- if (priv->is_blank || !webkit_web_view_get_title (web_view))
- ephy_web_view_set_title (view, NULL);
-
/* Ensure we load the icon for this web view, if available. */
_ephy_web_view_update_icon (view);
@@ -1819,8 +1767,6 @@ ephy_web_view_load_error_page (EphyWebView *view,
}
g_free (hostname);
- ephy_web_view_set_title (view, page_title);
-
_ephy_web_view_update_icon (view);
stylesheet = get_style_sheet ();
@@ -1961,7 +1907,6 @@ ephy_web_view_init (EphyWebView *web_view)
priv->is_blank = TRUE;
priv->ever_committed = FALSE;
- priv->title = g_strdup (EMPTY_PAGE);
priv->document_type = EPHY_WEB_VIEW_DOCUMENT_HTML;
priv->security_level = EPHY_WEB_VIEW_STATE_IS_UNKNOWN;
@@ -2190,18 +2135,6 @@ ephy_web_view_get_address (EphyWebView *view)
}
/**
- * ephy_web_view_get_title:
- * @view: an #EphyWebView
- *
- * Return value: the title of the web page displayed in @view
- **/
-const char *
-ephy_web_view_get_title (EphyWebView *view)
-{
- return view->priv->title;
-}
-
-/**
* ephy_web_view_is_loading:
* @view: an #EphyWebView
*
@@ -2731,7 +2664,7 @@ ephy_web_view_print (EphyWebView *view)
settings = gtk_print_settings_new ();
gtk_print_settings_set (settings,
GTK_PRINT_SETTINGS_OUTPUT_BASENAME,
- ephy_web_view_get_title (view));
+ webkit_web_view_get_title (WEBKIT_WEB_VIEW (view)));
webkit_print_operation_set_print_settings (operation, settings);
webkit_print_operation_run_dialog (operation, NULL);
g_object_unref (operation);