From: Daniel Carl <danielcarl@gmx.de>
Date: Mon, 31 Dec 2012 16:38:10 +0000 (+0100)
Subject: Show the websites title as window title.
X-Git-Url: https://git.owens.tech/about.html/about.html/git?a=commitdiff_plain;h=778d02eb2a96c60488140986998b17c265e2c110;p=vimb.git

Show the websites title as window title.
---

diff --git a/src/main.c b/src/main.c
index 4553cdb..1765fcf 100644
--- a/src/main.c
+++ b/src/main.c
@@ -49,6 +49,7 @@ static gboolean vp_new_window_policy_cb(
 static WebKitWebView* vp_create_new_webview_cb(WebKitWebView* webview, WebKitWebFrame* frame, gpointer data);
 static void vp_create_new_webview_uri_cb(WebKitWebView* view, GParamSpec param_spec);
 static void vp_hover_link_cb(WebKitWebView* webview, const gchar* title, const char* link, gpointer data);
+static void vp_title_changed_cb(WebKitWebView* webview, WebKitWebFrame* frame, const gchar* title, gpointer data);
 
 /* functions */
 static gboolean vp_process_input(const char* input);
@@ -624,6 +625,7 @@ static void vp_setup_signals(void)
         "signal::new-window-policy-decision-requested", G_CALLBACK(vp_new_window_policy_cb), NULL,
         "signal::create-web-view", G_CALLBACK(vp_create_new_webview_cb), NULL,
         "signal::hovering-over-link", G_CALLBACK(vp_hover_link_cb), NULL,
+        "signal::title-changed", G_CALLBACK(vp_title_changed_cb), NULL,
         NULL
     );
 
@@ -726,6 +728,11 @@ static void vp_hover_link_cb(WebKitWebView* webview, const gchar* title, const c
     }
 }
 
+static void vp_title_changed_cb(WebKitWebView* webview, WebKitWebFrame* frame, const gchar* title, gpointer data)
+{
+    gtk_window_set_title(GTK_WINDOW(vp.gui.window), title);
+}
+
 int main(int argc, char* argv[])
 {
     static gchar* winid = NULL;