summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-09-17 00:31:24 (EDT)
committer Patrick McDermott <pj@pehjota.net>2017-09-17 00:31:24 (EDT)
commit7503fd68c560ba49f0c0e321699033afa8527cef (patch)
tree8d9ed69fc7572002a9dd2de2e25b1e85f8304082 /src
parent996ad39cc5bde753cb704b94a35b898ed73ae3bc (diff)
downloadmarquee-7503fd68c560ba49f0c0e321699033afa8527cef.zip
marquee-7503fd68c560ba49f0c0e321699033afa8527cef.tar.gz
marquee-7503fd68c560ba49f0c0e321699033afa8527cef.tar.bz2
load_changed_cb(): New function
This completes the previous commit by hiding the progress bar once the Web page finishes loading. It also updates the URI bar when a new Web page is loaded.
Diffstat (limited to 'src')
-rw-r--r--src/tab-chrome.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/tab-chrome.c b/src/tab-chrome.c
index d71b5c1..6671835 100644
--- a/src/tab-chrome.c
+++ b/src/tab-chrome.c
@@ -88,6 +88,24 @@ mq_tab_chrome_get_container(MqTabChrome *chrome)
}
static void
+load_changed_cb(WebKitWebView *web_view, WebKitLoadEvent load_event,
+ MqTabChrome *chrome)
+{
+ switch (load_event) {
+ case WEBKIT_LOAD_STARTED:
+ case WEBKIT_LOAD_REDIRECTED:
+ case WEBKIT_LOAD_COMMITTED:
+ gtk_entry_set_text(GTK_ENTRY(chrome->uri_entry),
+ webkit_web_view_get_uri(web_view));
+ break;
+ case WEBKIT_LOAD_FINISHED:
+ gtk_entry_set_progress_fraction(
+ GTK_ENTRY(chrome->uri_entry), 0.0);
+ break;
+ }
+}
+
+static void
load_progress_cb(WebKitWebView *web_view,
GParamSpec __attribute__((unused)) *paramspec, MqTabChrome *chrome)
{
@@ -98,6 +116,8 @@ load_progress_cb(WebKitWebView *web_view,
static void
connect_web_view(MqTabChrome *chrome)
{
+ g_signal_connect(chrome->web_view, "load-changed",
+ G_CALLBACK(load_changed_cb), chrome);
g_signal_connect(chrome->web_view, "notify::estimated-load-progress",
G_CALLBACK(load_progress_cb), chrome);
}