[epiphany] Move the window geometry handling from EphyEmbed to EphyWindow



commit 49277944be5d7dee1eee237ab2c9459900370ba0
Author: Carlos Garcia Campos <cgarcia igalia com>
Date:   Tue Jan 28 12:36:13 2014 +0100

    Move the window geometry handling from EphyEmbed to EphyWindow
    
    EphyEmbed should not change the window geometry.

 embed/ephy-embed.c |   28 ----------------------------
 src/ephy-window.c  |   17 +++++++++++++++++
 2 files changed, 17 insertions(+), 28 deletions(-)
---
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index 34bb0c6..b28cf00 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -551,28 +551,6 @@ status_message_notify_cb (EphyWebView *view, GParamSpec *pspec, EphyEmbed *embed
   }
 }
 
-static void
-window_geometry_changed (WebKitWindowProperties *properties, GParamSpec *pspec, EphyEmbed *embed)
-{
-  GtkWidget *window;
-  gboolean is_popup;
-  GdkRectangle geometry;
-
-  window = gtk_widget_get_toplevel (GTK_WIDGET (embed));
-  if (!window || !gtk_widget_is_toplevel (window))
-    return;
-
-  g_object_get (window, "is-popup", &is_popup, NULL);
-  if (!is_popup)
-    return;
-
-  webkit_window_properties_get_geometry (properties, &geometry);
-  if (geometry.x >= 0 && geometry.y >= 0)
-    gtk_window_move (GTK_WINDOW (window), geometry.x, geometry.y);
-  if (geometry.width > 0 && geometry.height > 0)
-    gtk_window_resize (GTK_WINDOW (window), geometry.width, geometry.height);
-}
-
 static gboolean
 clear_progress_cb (EphyEmbed *embed)
 {
@@ -659,7 +637,6 @@ ephy_embed_constructed (GObject *object)
   EphyEmbedShell *shell = ephy_embed_shell_get_default ();
   GtkWidget *paned;
   WebKitWebView *web_view;
-  WebKitWindowProperties *window_properties;
   WebKitWebInspector *inspector;
   GtkWidget *overlay;
 
@@ -750,11 +727,6 @@ ephy_embed_constructed (GObject *object)
   priv->status_handler_id = g_signal_connect (web_view, "notify::status-message",
                                               G_CALLBACK (status_message_notify_cb),
                                               embed);
-  /* Window properties */
-  window_properties = webkit_web_view_get_window_properties (web_view);
-  g_signal_connect (window_properties, "notify::geometry",
-                    G_CALLBACK (window_geometry_changed),
-                    embed);
 
   /* The inspector */
   inspector = webkit_web_view_get_inspector (web_view);
diff --git a/src/ephy-window.c b/src/ephy-window.c
index da4ff3b..ddd7395 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -1984,6 +1984,20 @@ ephy_window_set_is_popup (EphyWindow *window,
 }
 
 static void
+window_properties_geometry_changed (WebKitWindowProperties *properties,
+                                   GParamSpec *pspec,
+                                   EphyWindow *window)
+{
+       GdkRectangle geometry;
+
+       webkit_window_properties_get_geometry (properties, &geometry);
+       if (geometry.x >= 0 && geometry.y >= 0)
+               gtk_window_move (GTK_WINDOW (window), geometry.x, geometry.y);
+       if (geometry.width > 0 && geometry.height > 0)
+               gtk_window_resize (GTK_WINDOW (window), geometry.width, geometry.height);
+}
+
+static void
 ephy_window_configure_for_view (EphyWindow *window,
                                WebKitWebView *web_view)
 {
@@ -2008,6 +2022,9 @@ ephy_window_configure_for_view (EphyWindow *window,
 
                window->priv->is_popup = TRUE;
                window->priv->chrome = chrome_mask;
+               g_signal_connect (properties, "notify::geometry",
+                                 G_CALLBACK (window_properties_geometry_changed),
+                                 window);
 
                sync_chromes_visibility (window);
        }


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