webkit2: Implement notify::title handler

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2020-02-16 18:06:20 +02:00
parent ffeafc0872
commit c0c4685d50

View File

@ -19,6 +19,7 @@
struct browser_context {
GtkWidget *win;
WebKitWebView *view;
int success;
int progress;
char *hover_link;
@ -221,7 +222,19 @@ static void view_cb_hovering_over_link(WebKitWebView *view, gchar *title,
#endif /* USE_WEBKIT2 */
#ifndef USE_WEBKIT2
#ifdef USE_WEBKIT2
static void view_cb_notify_title(WebKitWebView *view, GParamSpec *ps,
struct browser_context *ctx)
{
const char *title;
title = webkit_web_view_get_title(ctx->view);
wpa_printf(MSG_DEBUG, "BROWSER:%s title=%s", __func__, title);
os_free(ctx->title);
ctx->title = os_strdup(title);
browser_update_title(ctx);
}
#else /* USE_WEBKIT2 */
static void view_cb_title_changed(WebKitWebView *view, WebKitWebFrame *frame,
const char *title,
struct browser_context *ctx)
@ -270,6 +283,7 @@ int hs20_web_browser(const char *url, int ignore_tls)
G_CALLBACK(win_cb_destroy), &ctx);
view = WEBKIT_WEB_VIEW(webkit_web_view_new());
ctx.view = view;
g_signal_connect(G_OBJECT(view), "notify::progress",
G_CALLBACK(view_cb_notify_progress), &ctx);
g_signal_connect(G_OBJECT(view), "notify::load-status",
@ -281,11 +295,11 @@ int hs20_web_browser(const char *url, int ignore_tls)
G_CALLBACK(view_cb_mime_type_policy_decision), &ctx);
g_signal_connect(G_OBJECT(view), "mouse-target-changed",
G_CALLBACK(view_cb_mouse_target_changed), &ctx);
g_signal_connect(G_OBJECT(view), "notify::title",
G_CALLBACK(view_cb_notify_title), &ctx);
/* TODO: Implement these?
g_signal_connect(G_OBJECT(view), "download-started",
G_CALLBACK(view_cb_download_requested), &ctx);
g_signal_connect(G_OBJECT(view), "notify::title",
G_CALLBACK(view_cb_title_changed), &ctx);
*/
#else /* USE_WEBKIT2 */
g_signal_connect(G_OBJECT(view), "resource-request-starting",