diff options
author | Diego Escalante Urrelo <diegoe@igalia.com> | 2012-02-09 17:28:22 +0800 |
---|---|---|
committer | Diego Escalante Urrelo <diegoe@igalia.com> | 2012-02-22 23:55:19 +0800 |
commit | a24e4eb2215e6f5ace9f66e2c5105e3260ec77cc (patch) | |
tree | cefd2bd8db44264f0ad3aa844b27bf9906623be4 | |
parent | f1fd22a86d2ff32d78494e68ae7ab865c454b88c (diff) | |
download | gsoc2013-epiphany-a24e4eb2215e6f5ace9f66e2c5105e3260ec77cc.tar gsoc2013-epiphany-a24e4eb2215e6f5ace9f66e2c5105e3260ec77cc.tar.gz gsoc2013-epiphany-a24e4eb2215e6f5ace9f66e2c5105e3260ec77cc.tar.bz2 gsoc2013-epiphany-a24e4eb2215e6f5ace9f66e2c5105e3260ec77cc.tar.lz gsoc2013-epiphany-a24e4eb2215e6f5ace9f66e2c5105e3260ec77cc.tar.xz gsoc2013-epiphany-a24e4eb2215e6f5ace9f66e2c5105e3260ec77cc.tar.zst gsoc2013-epiphany-a24e4eb2215e6f5ace9f66e2c5105e3260ec77cc.zip |
ephy-web-view: don't assume a embed-container in close-web-view
The EphyWebView is not necessarily embedded in an EphyEmbedContainer.
Simplify close_web_view_cb and make it smarter. It now handles
EphyEmbedContainer and random toplevel widgets.
https://bugzilla.gnome.org/show_bug.cgi?id=669737
-rw-r--r-- | embed/ephy-web-view.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c index 2b5272e68..5267ab4a3 100644 --- a/embed/ephy-web-view.c +++ b/embed/ephy-web-view.c @@ -2167,19 +2167,15 @@ static gboolean close_web_view_cb (WebKitWebView *web_view, gpointer user_data) { - EphyEmbedContainer *window; - GList *children; GtkWidget *widget = gtk_widget_get_toplevel (GTK_WIDGET (web_view)); - window = EPHY_EMBED_CONTAINER (widget); - children = ephy_embed_container_get_children (window); + LOG ("close web view"); - if (g_list_length (children) == 1) - gtk_widget_destroy (GTK_WIDGET (window)); + if (EPHY_IS_EMBED_CONTAINER (widget)) + ephy_embed_container_remove_child (EPHY_EMBED_CONTAINER (widget), + EPHY_GET_EMBED_FROM_EPHY_WEB_VIEW (web_view)); else - ephy_embed_container_remove_child (window, EPHY_GET_EMBED_FROM_EPHY_WEB_VIEW (web_view)); - - g_list_free (children); + gtk_widget_destroy (widget); return TRUE; } |