[epiphany/gnome-2-30] Only show/hide the inspector window when it is detached



commit ed290a2258e880d867ec985476a6522981e1292d
Author: Gustavo Noronha Silva <gustavo noronha collabora co uk>
Date:   Mon Aug 9 18:55:26 2010 -0300

    Only show/hide the inspector window when it is detached
    
    Bug #626489

 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 8a7fc9f..e2e8dd6 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),



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]