webkit2: Implement notify::title handler
Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
ffeafc0872
commit
c0c4685d50
1 changed files with 17 additions and 3 deletions
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
struct browser_context {
|
struct browser_context {
|
||||||
GtkWidget *win;
|
GtkWidget *win;
|
||||||
|
WebKitWebView *view;
|
||||||
int success;
|
int success;
|
||||||
int progress;
|
int progress;
|
||||||
char *hover_link;
|
char *hover_link;
|
||||||
|
@ -221,7 +222,19 @@ static void view_cb_hovering_over_link(WebKitWebView *view, gchar *title,
|
||||||
#endif /* USE_WEBKIT2 */
|
#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,
|
static void view_cb_title_changed(WebKitWebView *view, WebKitWebFrame *frame,
|
||||||
const char *title,
|
const char *title,
|
||||||
struct browser_context *ctx)
|
struct browser_context *ctx)
|
||||||
|
@ -270,6 +283,7 @@ int hs20_web_browser(const char *url, int ignore_tls)
|
||||||
G_CALLBACK(win_cb_destroy), &ctx);
|
G_CALLBACK(win_cb_destroy), &ctx);
|
||||||
|
|
||||||
view = WEBKIT_WEB_VIEW(webkit_web_view_new());
|
view = WEBKIT_WEB_VIEW(webkit_web_view_new());
|
||||||
|
ctx.view = view;
|
||||||
g_signal_connect(G_OBJECT(view), "notify::progress",
|
g_signal_connect(G_OBJECT(view), "notify::progress",
|
||||||
G_CALLBACK(view_cb_notify_progress), &ctx);
|
G_CALLBACK(view_cb_notify_progress), &ctx);
|
||||||
g_signal_connect(G_OBJECT(view), "notify::load-status",
|
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_CALLBACK(view_cb_mime_type_policy_decision), &ctx);
|
||||||
g_signal_connect(G_OBJECT(view), "mouse-target-changed",
|
g_signal_connect(G_OBJECT(view), "mouse-target-changed",
|
||||||
G_CALLBACK(view_cb_mouse_target_changed), &ctx);
|
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?
|
/* TODO: Implement these?
|
||||||
g_signal_connect(G_OBJECT(view), "download-started",
|
g_signal_connect(G_OBJECT(view), "download-started",
|
||||||
G_CALLBACK(view_cb_download_requested), &ctx);
|
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 */
|
#else /* USE_WEBKIT2 */
|
||||||
g_signal_connect(G_OBJECT(view), "resource-request-starting",
|
g_signal_connect(G_OBJECT(view), "resource-request-starting",
|
||||||
|
|
Loading…
Reference in a new issue