aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorGustavo Noronha Silva <gns@gnome.org>2012-02-11 04:42:07 +0800
committerGustavo Noronha Silva <gns@gnome.org>2012-02-20 00:18:53 +0800
commitbefd8e788df39ba95b0936d1f728c07e8901dacf (patch)
tree4ef7c309c3d0ddcd84f43071a492892033fc81e6 /embed
parent1cde8eafe09d5fcc953241cb8ad6bae8538f3144 (diff)
downloadgsoc2013-epiphany-befd8e788df39ba95b0936d1f728c07e8901dacf.tar
gsoc2013-epiphany-befd8e788df39ba95b0936d1f728c07e8901dacf.tar.gz
gsoc2013-epiphany-befd8e788df39ba95b0936d1f728c07e8901dacf.tar.bz2
gsoc2013-epiphany-befd8e788df39ba95b0936d1f728c07e8901dacf.tar.lz
gsoc2013-epiphany-befd8e788df39ba95b0936d1f728c07e8901dacf.tar.xz
gsoc2013-epiphany-befd8e788df39ba95b0936d1f728c07e8901dacf.tar.zst
gsoc2013-epiphany-befd8e788df39ba95b0936d1f728c07e8901dacf.zip
Make inspector handling real-world compliant
Destroy and recreate the inspector's WebView instead of reusing it, and make it always start windowed. https://bugzilla.gnome.org/show_bug.cgi?id=669835
Diffstat (limited to 'embed')
-rw-r--r--embed/ephy-embed.c40
1 files changed, 30 insertions, 10 deletions
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index 1842be5da..a458e9605 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -486,7 +486,14 @@ ephy_embed_inspect_web_view_cb (WebKitWebInspector *inspector,
WebKitWebView *web_view,
EphyEmbed *embed)
{
- return WEBKIT_WEB_VIEW (embed->priv->inspector_web_view);
+ EphyEmbedPrivate *priv = embed->priv;
+
+ priv->inspector_web_view = ephy_web_view_new();
+
+ gtk_container_add (GTK_CONTAINER (priv->inspector_scrolled_window),
+ priv->inspector_web_view);
+
+ return WEBKIT_WEB_VIEW (priv->inspector_web_view);
}
static gboolean
@@ -508,14 +515,20 @@ ephy_embed_attach_inspector_cb (WebKitWebInspector *inspector,
return TRUE;
}
-static gboolean
-ephy_embed_detach_inspector_cb (WebKitWebInspector *inspector,
- EphyEmbed *embed)
+static void
+ephy_embed_detach_inspector (EphyEmbed *embed, WebKitWebInspector *inspector)
{
embed->priv->inspector_attached = FALSE;
gtk_widget_reparent (GTK_WIDGET (embed->priv->inspector_scrolled_window),
GTK_WIDGET (embed->priv->inspector_window));
+}
+
+static gboolean
+ephy_embed_detach_inspector_cb (WebKitWebInspector *inspector,
+ EphyEmbed *embed)
+{
+ ephy_embed_detach_inspector (embed, inspector);
gtk_widget_show_all (embed->priv->inspector_window);
@@ -539,10 +552,20 @@ static gboolean
ephy_embed_inspect_close_cb (WebKitWebInspector *inspector,
EphyEmbed *embed)
{
- if (!embed->priv->inspector_attached)
- gtk_widget_hide (embed->priv->inspector_window);
+ EphyEmbedPrivate *priv = embed->priv;
+
+ if (!priv->inspector_window)
+ return TRUE;
+
+ gtk_widget_destroy (priv->inspector_web_view);
+ priv->inspector_web_view = NULL;
+
+ if (!priv->inspector_attached)
+ gtk_widget_hide (priv->inspector_window);
else
- gtk_widget_hide (embed->priv->inspector_scrolled_window);
+ gtk_widget_hide (priv->inspector_scrolled_window);
+
+ ephy_embed_detach_inspector (embed, inspector);
return TRUE;
}
@@ -762,7 +785,6 @@ ephy_embed_constructed (GObject *object)
NULL);
/* The inspector */
- priv->inspector_web_view = ephy_web_view_new ();
priv->inspector_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
inspector = webkit_web_view_get_inspector (web_view);
@@ -771,8 +793,6 @@ ephy_embed_constructed (GObject *object)
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (priv->inspector_window),
priv->inspector_scrolled_window);
- gtk_container_add (GTK_CONTAINER (priv->inspector_scrolled_window),
- priv->inspector_web_view);
gtk_window_set_title (GTK_WINDOW (priv->inspector_window),
_("Web Inspector"));