diff options
author | Xan Lopez <xan@src.gnome.org> | 2008-11-30 03:14:21 +0800 |
---|---|---|
committer | Xan Lopez <xan@src.gnome.org> | 2008-11-30 03:14:21 +0800 |
commit | 3c970a2230d2bc841e26f55d9bacc707e8bc9529 (patch) | |
tree | cd6cd2876a9c744e723d6c532d8a5760dd5c0eaa /src/ephy-window.c | |
parent | 06eb49ff9adc6a5038abe630da95ffa2f99d91a9 (diff) | |
download | gsoc2013-epiphany-3c970a2230d2bc841e26f55d9bacc707e8bc9529.tar gsoc2013-epiphany-3c970a2230d2bc841e26f55d9bacc707e8bc9529.tar.gz gsoc2013-epiphany-3c970a2230d2bc841e26f55d9bacc707e8bc9529.tar.bz2 gsoc2013-epiphany-3c970a2230d2bc841e26f55d9bacc707e8bc9529.tar.lz gsoc2013-epiphany-3c970a2230d2bc841e26f55d9bacc707e8bc9529.tar.xz gsoc2013-epiphany-3c970a2230d2bc841e26f55d9bacc707e8bc9529.tar.zst gsoc2013-epiphany-3c970a2230d2bc841e26f55d9bacc707e8bc9529.zip |
ephy-window: use new webkit API to create windows on request.
svn path=/trunk/; revision=8620
Diffstat (limited to 'src/ephy-window.c')
-rw-r--r-- | src/ephy-window.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/ephy-window.c b/src/ephy-window.c index a3ccffbdf..4176d78cb 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -2407,6 +2407,46 @@ ephy_window_visibility_cb (EphyEmbed *embed, GParamSpec *pspec, EphyWindow *wind gtk_widget_hide (GTK_WIDGET (window)); } +static gboolean +web_view_ready_cb (WebKitWebView *web_view, + EphyEmbed *embed) +{ + WebKitWebWindowFeatures *features; + GtkWidget *window; + int width, height; + + window = gtk_widget_get_toplevel (GTK_WIDGET (web_view)); + features = webkit_web_view_get_window_features (web_view); + /* FIXME: apply all features when appropriate */ + g_object_get (features, + "width", &width, + "height", &height, + NULL); + + gtk_window_set_default_size (GTK_WINDOW (window), width, height); + gtk_widget_show (window); + + return TRUE; +} + +static WebKitWebView* +create_web_view_cb (WebKitWebView *web_view, + WebKitWebFrame *frame, + EphyWindow *window) +{ + EphyEmbed *embed; + + embed = ephy_shell_new_tab_full (ephy_shell_get_default (), + NULL, NULL, NULL, + EPHY_NEW_TAB_IN_NEW_WINDOW | + EPHY_NEW_TAB_DONT_SHOW_WINDOW, + EPHY_EMBED_CHROME_ALL, + FALSE, + 0); + + return EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed); +} + static void ephy_window_set_active_tab (EphyWindow *window, EphyEmbed *new_embed) { @@ -2433,6 +2473,12 @@ ephy_window_set_active_tab (EphyWindow *window, EphyEmbed *new_embed) g_signal_handlers_disconnect_by_func (web_view, G_CALLBACK (scroll_event_cb), window); + g_signal_handlers_disconnect_by_func (web_view, + G_CALLBACK (create_web_view_cb), + window); + g_signal_handlers_disconnect_by_func (web_view, + G_CALLBACK (web_view_ready_cb), + NULL); g_signal_handlers_disconnect_by_func (embed, G_CALLBACK (sync_tab_popup_windows), @@ -2514,6 +2560,12 @@ ephy_window_set_active_tab (EphyWindow *window, EphyEmbed *new_embed) g_signal_connect_object (web_view, "scroll-event", G_CALLBACK (scroll_event_cb), window, 0); + g_signal_connect_object (web_view, "create-web-view", + G_CALLBACK (create_web_view_cb), + window, 0); + g_signal_connect_object (web_view, "web-view-ready", + G_CALLBACK (web_view_ready_cb), + NULL, 0); g_signal_connect_object (embed, "notify::hidden-popup-count", G_CALLBACK (sync_tab_popup_windows), |