From 8b3a74b6f052a82edb1c13c406be626c26fdf85b Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Fri, 15 May 2009 01:18:14 +0200 Subject: [PATCH] Update address and actions properly when navigating in-page --- midori/midori-browser.c | 13 +++++++++++++ midori/midori-view.c | 27 +++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/midori/midori-browser.c b/midori/midori-browser.c index 2ed6fbe1..8cd62669 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -509,6 +509,17 @@ midori_view_context_ready_cb (GtkWidget* view, g_signal_emit (browser, signals[CONTEXT_READY], 0, js_context); } +static void +midori_view_notify_uri_cb (GtkWidget* view, + GParamSpec* pspec, + MidoriBrowser* browser) +{ + const gchar* uri = midori_view_get_display_uri (MIDORI_VIEW (view)); + GtkAction* action = _action_by_name (browser, "Location"); + midori_location_action_set_uri (MIDORI_LOCATION_ACTION (action), uri); + _midori_browser_update_interface (browser); +} + static void midori_view_notify_title_cb (GtkWidget* view, GParamSpec* pspec, @@ -1376,6 +1387,8 @@ _midori_browser_add_tab (MidoriBrowser* browser, midori_view_notify_progress_cb, browser, "signal::context-ready", midori_view_context_ready_cb, browser, + "signal::notify::uri", + midori_view_notify_uri_cb, browser, "signal::notify::title", midori_view_notify_title_cb, browser, "signal::notify::zoom-level", diff --git a/midori/midori-view.c b/midori/midori-view.c index 867cb227..f8aa4c54 100644 --- a/midori/midori-view.c +++ b/midori/midori-view.c @@ -793,6 +793,25 @@ webkit_web_view_load_finished_cb (WebKitWebView* web_view, g_object_thaw_notify (G_OBJECT (view)); } +#if WEBKIT_CHECK_VERSION (1, 1, 4) +static void +webkit_web_view_notify_uri_cb (WebKitWebView* web_view, + GParamSpec* pspec, + MidoriView* view) +{ + g_object_get (web_view, "uri", &view->uri, NULL); + g_object_notify (G_OBJECT (view), "uri"); +} + +static void +webkit_web_view_notify_title_cb (WebKitWebView* web_view, + GParamSpec* pspec, + MidoriView* view) +{ + g_object_get (web_view, "title", &view->title, NULL); + g_object_notify (G_OBJECT (view), "title"); +} +#else static void webkit_web_view_title_changed_cb (WebKitWebView* web_view, WebKitWebFrame* web_frame, @@ -801,6 +820,7 @@ webkit_web_view_title_changed_cb (WebKitWebView* web_view, { g_object_set (view, "title", title, NULL); } +#endif static void webkit_web_view_statusbar_text_changed_cb (WebKitWebView* web_view, @@ -1904,8 +1924,15 @@ midori_view_construct_web_view (MidoriView* view) webkit_web_view_progress_changed_cb, view, "signal::load-finished", webkit_web_view_load_finished_cb, view, + #if WEBKIT_CHECK_VERSION (1, 1, 4) + "signal::notify::uri", + webkit_web_view_notify_uri_cb, view, + "signal::notify::title", + webkit_web_view_notify_title_cb, view, + #else "signal::title-changed", webkit_web_view_title_changed_cb, view, + #endif "signal::status-bar-text-changed", webkit_web_view_statusbar_text_changed_cb, view, "signal::hovering-over-link", -- 2.39.5