aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorXan Lopez <xan@gnome.org>2010-05-02 21:40:16 +0800
committerXan Lopez <xan@gnome.org>2010-05-03 19:40:33 +0800
commit769b30d8448f3b87cdc6967d3c0dbae31e44eaf8 (patch)
tree2c55142283b02f8d28909649018ead1fab82dbc1 /embed
parentd60afa35bed002f98996fbdeb6a34ad01cc5b2cf (diff)
downloadgsoc2013-epiphany-769b30d8448f3b87cdc6967d3c0dbae31e44eaf8.tar
gsoc2013-epiphany-769b30d8448f3b87cdc6967d3c0dbae31e44eaf8.tar.gz
gsoc2013-epiphany-769b30d8448f3b87cdc6967d3c0dbae31e44eaf8.tar.bz2
gsoc2013-epiphany-769b30d8448f3b87cdc6967d3c0dbae31e44eaf8.tar.lz
gsoc2013-epiphany-769b30d8448f3b87cdc6967d3c0dbae31e44eaf8.tar.xz
gsoc2013-epiphany-769b30d8448f3b87cdc6967d3c0dbae31e44eaf8.tar.zst
gsoc2013-epiphany-769b30d8448f3b87cdc6967d3c0dbae31e44eaf8.zip
Move title update to EphyWebView
Does not really make sense for the EphyEmbed container to connect to its child signal and then update its title, let the child itself handle it.
Diffstat (limited to 'embed')
-rw-r--r--embed/ephy-embed.c24
-rw-r--r--embed/ephy-web-view.c35
2 files changed, 35 insertions, 24 deletions
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index 87db4ffe2..e9c210eb2 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -89,29 +89,6 @@ uri_changed_cb (WebKitWebView *web_view,
}
static void
-title_changed_cb (WebKitWebView *web_view,
- GParamSpec *spec,
- EphyEmbed *embed)
-{
- const char *uri;
- char *title;
- WebKitWebFrame *frame;
-
- g_object_get (web_view, "title", &title, NULL);
-
- ephy_web_view_set_title (EPHY_WEB_VIEW (web_view),
- title);
-
- frame = webkit_web_view_get_main_frame (web_view);
- uri = webkit_web_frame_get_uri (frame);
- ephy_history_set_page_title (EPHY_EMBED (embed)->priv->history,
- uri,
- title);
- g_free (title);
-
-}
-
-static void
restore_zoom_level (EphyEmbed *embed,
const char *address)
{
@@ -852,7 +829,6 @@ ephy_embed_constructed (GObject *object)
"signal::hovering-over-link", G_CALLBACK (hovering_over_link_cb), embed,
"signal::download-requested", G_CALLBACK (download_requested_cb), embed,
"signal::notify::zoom-level", G_CALLBACK (zoom_changed_cb), embed,
- "signal::notify::title", G_CALLBACK (title_changed_cb), embed,
"signal::notify::uri", G_CALLBACK (uri_changed_cb), embed,
NULL);
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 4fa85d126..61b973255 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -1300,6 +1300,40 @@ ephy_web_view_finalize (GObject *object)
}
static void
+title_changed_cb (WebKitWebView *web_view,
+ GParamSpec *spec,
+ gpointer data)
+{
+ const char *uri;
+ char *title;
+ WebKitWebFrame *frame;
+ EphyHistory *history = EPHY_HISTORY (ephy_embed_shell_get_global_history (ephy_embed_shell_get_default ()));
+
+ g_object_get (web_view, "title", &title, NULL);
+
+ ephy_web_view_set_title (EPHY_WEB_VIEW (web_view),
+ title);
+
+ frame = webkit_web_view_get_main_frame (web_view);
+ uri = webkit_web_frame_get_uri (frame);
+ ephy_history_set_page_title (history,
+ uri,
+ title);
+ g_free (title);
+
+}
+
+static void
+ephy_web_view_constructed (GObject *object)
+{
+ EphyWebView *web_view = EPHY_WEB_VIEW (object);
+
+ g_object_connect (web_view,
+ "signal::notify::title", G_CALLBACK (title_changed_cb), NULL,
+ NULL);
+}
+
+static void
ephy_web_view_class_init (EphyWebViewClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
@@ -1309,6 +1343,7 @@ ephy_web_view_class_init (EphyWebViewClass *klass)
gobject_class->finalize = ephy_web_view_finalize;
gobject_class->get_property = ephy_web_view_get_property;
gobject_class->set_property = ephy_web_view_set_property;
+ gobject_class->constructed = ephy_web_view_constructed;
widget_class->button_press_event = ephy_web_view_button_press_event;
widget_class->key_press_event = ephy_web_view_key_press_event;