diff options
author | Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> | 2010-08-10 05:55:26 +0800 |
---|---|---|
committer | Gustavo Noronha Silva <gns@gnome.org> | 2010-08-25 00:36:45 +0800 |
commit | 8ca4ab2fc2585c678857860fb698dd52cafc569a (patch) | |
tree | 69627991307a7a9be0f726a02d4d89c140b5b21b | |
parent | 3865f08781c9c30a2deb8dc1448d0d95923ad430 (diff) | |
download | gsoc2013-epiphany-8ca4ab2fc2585c678857860fb698dd52cafc569a.tar.gz gsoc2013-epiphany-8ca4ab2fc2585c678857860fb698dd52cafc569a.tar.zst gsoc2013-epiphany-8ca4ab2fc2585c678857860fb698dd52cafc569a.zip |
Only show/hide the inspector window when it is detached
Bug #626489
-rw-r--r-- | embed/ephy-embed.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c index 06bc0f40f..f342df4f7 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)) @@ -68,6 +68,7 @@ struct EphyEmbedPrivate EphyHistory *history; GtkWidget *inspector_window; GtkWidget *inspector_scrolled_window; + gboolean inspector_attached; guint is_setting_zoom : 1; GSList *destroy_on_transition_list; }; @@ -312,6 +313,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 ()); @@ -352,10 +355,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)); @@ -376,17 +380,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; } @@ -922,9 +930,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), |