aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGustavo Noronha Silva <gustavo.noronha@collabora.co.uk>2010-08-10 05:55:26 +0800
committerDiego Escalante Urrelo <descalante@igalia.com>2010-08-31 04:43:08 +0800
commited290a2258e880d867ec985476a6522981e1292d (patch)
tree22d9cbbf1c0af42a39bd93a1db113a0fbf4e3f4b
parent1952b09d8479b3daf29c16973d6930f11564c4af (diff)
downloadgsoc2013-epiphany-ed290a2258e880d867ec985476a6522981e1292d.tar
gsoc2013-epiphany-ed290a2258e880d867ec985476a6522981e1292d.tar.gz
gsoc2013-epiphany-ed290a2258e880d867ec985476a6522981e1292d.tar.bz2
gsoc2013-epiphany-ed290a2258e880d867ec985476a6522981e1292d.tar.lz
gsoc2013-epiphany-ed290a2258e880d867ec985476a6522981e1292d.tar.xz
gsoc2013-epiphany-ed290a2258e880d867ec985476a6522981e1292d.tar.zst
gsoc2013-epiphany-ed290a2258e880d867ec985476a6522981e1292d.zip
Only show/hide the inspector window when it is detached
Bug #626489
-rw-r--r--embed/ephy-embed.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index 8a7fc9f8a..e2e8dd629 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -53,9 +53,9 @@ static void ephy_embed_class_init (EphyEmbedClass *klass);
static void ephy_embed_init (EphyEmbed *gs);
static void ephy_embed_constructed (GObject *object);
static gboolean ephy_embed_inspect_show_cb (WebKitWebInspector *inspector,
- GtkWidget *widget);
+ EphyEmbed *embed);
static gboolean ephy_embed_inspect_close_cb (WebKitWebInspector *inspector,
- GtkWidget *widget);
+ EphyEmbed *embed);
#define EPHY_EMBED_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_EMBED, EphyEmbedPrivate))
@@ -69,6 +69,7 @@ struct EphyEmbedPrivate
GtkWidget *inspector_window;
char *loading_uri;
GtkWidget *inspector_scrolled_window;
+ gboolean inspector_attached;
guint is_setting_zoom : 1;
GSList *destroy_on_transition_list;
};
@@ -443,6 +444,8 @@ ephy_embed_attach_inspector_cb (WebKitWebInspector *inspector,
GtkAllocation allocation;
gtk_widget_get_allocation (GTK_WIDGET (embed->priv->scrolled_window), &allocation);
+ embed->priv->inspector_attached = TRUE;
+
if (embed->priv->paned == NULL)
{
embed->priv->paned = GTK_PANED (gtk_vpaned_new ());
@@ -483,10 +486,11 @@ static gboolean
ephy_embed_detach_inspector_cb (WebKitWebInspector *inspector,
EphyEmbed *embed)
{
+ embed->priv->inspector_attached = FALSE;
+
gtk_container_remove (GTK_CONTAINER (embed),
GTK_WIDGET (embed->priv->paned));
-
/* Main view */
gtk_widget_reparent (GTK_WIDGET (embed->priv->scrolled_window),
GTK_WIDGET (embed));
@@ -507,17 +511,21 @@ ephy_embed_detach_inspector_cb (WebKitWebInspector *inspector,
static gboolean
ephy_embed_inspect_show_cb (WebKitWebInspector *inspector,
- GtkWidget *widget)
+ EphyEmbed *embed)
{
- gtk_widget_show (widget);
+ if (!embed->priv->inspector_attached)
+ gtk_widget_show (embed->priv->inspector_window);
+
return TRUE;
}
static gboolean
ephy_embed_inspect_close_cb (WebKitWebInspector *inspector,
- GtkWidget *widget)
+ EphyEmbed *embed)
{
- gtk_widget_hide (widget);
+ if (!embed->priv->inspector_attached)
+ gtk_widget_hide (embed->priv->inspector_window);
+
return TRUE;
}
@@ -1056,9 +1064,9 @@ ephy_embed_constructed (GObject *object)
"signal::inspect-web-view", G_CALLBACK (ephy_embed_inspect_web_view_cb),
embed->priv->inspector_scrolled_window,
"signal::show-window", G_CALLBACK (ephy_embed_inspect_show_cb),
- embed->priv->inspector_window,
+ embed,
"signal::close-window", G_CALLBACK (ephy_embed_inspect_close_cb),
- embed->priv->inspector_window,
+ embed,
"signal::attach-window", G_CALLBACK (ephy_embed_attach_inspector_cb),
embed,
"signal::detach-window", G_CALLBACK (ephy_embed_detach_inspector_cb),