[epiphany/overview: 14/24] Move implementation of EmbedContainer from Window to Notebook



commit ba8b9214543043848c3488f3307461efde4cc94d
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Thu May 3 15:28:56 2012 +0300

    Move implementation of EmbedContainer from Window to Notebook
    
    The properties that made sense in window were already moved there
    in the previous commit, everything else makes more sense in notebook.

 embed/ephy-embed.c                   |   16 ++++++
 embed/ephy-embed.h                   |    2 +
 embed/ephy-web-view.c                |   21 +++++---
 src/ephy-encoding-dialog.c           |    3 +-
 src/ephy-encoding-menu.c             |    6 +-
 src/ephy-extensions-manager.c        |    9 ++--
 src/ephy-location-controller.c       |    4 +-
 src/ephy-lockdown.c                  |    2 +-
 src/ephy-navigation-history-action.c |    3 +-
 src/ephy-notebook.c                  |   77 ++++++++++++++++++++++++++-
 src/ephy-session.c                   |   11 +++--
 src/ephy-shell.c                     |    5 +-
 src/ephy-window.c                    |   98 +++------------------------------
 src/popup-commands.c                 |   18 +++---
 src/window-commands.c                |   58 +++++++++++---------
 15 files changed, 183 insertions(+), 150 deletions(-)
---
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index f3ac543..0383fe1 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -799,3 +799,19 @@ ephy_embed_remove_top_widget (EphyEmbed *embed, GtkWidget *widget)
   gtk_container_remove (GTK_CONTAINER (embed->priv->top_widgets_vbox),
                         GTK_WIDGET (widget));
 }
+
+/**
+ * ephy_embed_get_container:
+ * @embed: a #EphyEmbed
+ *
+ * Returns the container where @embed is
+ *
+ * Return value: (transfer none): the container
+ **/
+GtkWidget *
+ephy_embed_get_container (EphyEmbed *embed)
+{
+  g_return_val_if_fail (EPHY_IS_EMBED (embed), NULL);
+
+  return gtk_widget_get_parent (GTK_WIDGET (embed));
+}
diff --git a/embed/ephy-embed.h b/embed/ephy-embed.h
index 9e6b373..01648e4 100644
--- a/embed/ephy-embed.h
+++ b/embed/ephy-embed.h
@@ -59,6 +59,8 @@ void         ephy_embed_remove_top_widget        (EphyEmbed  *embed,
                                                   GtkWidget  *widget);
 void         ephy_embed_auto_download_url        (EphyEmbed  *embed,
                                                   const char *url);
+GtkWidget * ephy_embed_get_container (EphyEmbed *embed);
+
 G_END_DECLS
 
 #endif
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 038f8ce..fbf6869 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -187,11 +187,13 @@ popups_manager_new_window_info (EphyEmbedContainer *container)
 {
   EphyEmbed *embed;
   EphyWebViewChrome chrome;
+  GtkWidget *window;
   GtkAllocation allocation;
   gboolean is_popup;
   char *features;
 
-  g_object_get (container, "chrome", &chrome, "is-popup", &is_popup, NULL);
+  window = gtk_widget_get_toplevel (GTK_WIDGET (container));
+  g_object_get (window, "chrome", &chrome, "is-popup", &is_popup, NULL);
   g_return_val_if_fail (is_popup, g_strdup (""));
 
   embed = ephy_embed_container_get_active_child (container);
@@ -254,6 +256,7 @@ popups_manager_hide (EphyEmbedContainer *container,
   EphyEmbed *embed;
   char *location;
   char *features;
+  GtkWidget *window;
 
   embed = ephy_embed_container_get_active_child (container);
   g_return_if_fail (EPHY_IS_EMBED (embed));
@@ -264,8 +267,8 @@ popups_manager_hide (EphyEmbedContainer *container,
   features = popups_manager_new_window_info (container);
 
   popups_manager_add (parent_view, location, "" /* FIXME? maybe _blank? */, features);
-
-  gtk_widget_destroy (GTK_WIDGET (container));
+  window = gtk_widget_get_toplevel (GTK_WIDGET (container));
+  gtk_widget_destroy (GTK_WIDGET (window));
 
   g_free (location);
   g_free (features);
@@ -1638,8 +1641,8 @@ new_window_cb (EphyWebView *view,
 
   g_return_if_fail (new_view != NULL);
 
-  container = EPHY_EMBED_CONTAINER (gtk_widget_get_toplevel (GTK_WIDGET (new_view)));
-  g_return_if_fail (container != NULL || !gtk_widget_is_toplevel (GTK_WIDGET (container)));
+  container = EPHY_EMBED_CONTAINER
+    (ephy_embed_get_container (EPHY_GET_EMBED_FROM_EPHY_WEB_VIEW (new_view)));
 
   popups_manager_add_window (view, container);
 }
@@ -2264,13 +2267,17 @@ static gboolean
 close_web_view_cb (WebKitWebView *web_view,
                    gpointer user_data)
 {
-  GtkWidget *widget = gtk_widget_get_toplevel (GTK_WIDGET (web_view));
+  GtkWidget *widget;
+  EphyEmbed *embed;
 
   LOG ("close web view");
 
+  embed = EPHY_GET_EMBED_FROM_EPHY_WEB_VIEW (web_view);
+  widget = ephy_embed_get_container (embed);
+
   if (EPHY_IS_EMBED_CONTAINER (widget))
     ephy_embed_container_remove_child (EPHY_EMBED_CONTAINER (widget),
-                                       EPHY_GET_EMBED_FROM_EPHY_WEB_VIEW (web_view));
+                                       embed);
   else
     gtk_widget_destroy (widget);
 
diff --git a/src/ephy-encoding-dialog.c b/src/ephy-encoding-dialog.c
index 0579f45..7c91835 100644
--- a/src/ephy-encoding-dialog.c
+++ b/src/ephy-encoding-dialog.c
@@ -149,7 +149,8 @@ sync_active_tab (EphyWindow *window, GParamSpec *pspec, EphyEncodingDialog *dial
 {
 	EphyEmbed *embed;
 
-	embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (dialog->priv->window));
+	embed = ephy_embed_container_get_active_child
+		(EPHY_EMBED_CONTAINER (ephy_window_get_notebook (dialog->priv->window)));
 
 	g_object_set (G_OBJECT (dialog), "embed", embed, NULL);
 }
diff --git a/src/ephy-encoding-menu.c b/src/ephy-encoding-menu.c
index b55e398..28b277d 100644
--- a/src/ephy-encoding-menu.c
+++ b/src/ephy-encoding-menu.c
@@ -132,7 +132,7 @@ update_encoding_menu_cb (GtkAction *dummy, EphyEncodingMenu *menu)
 	/* get most recently used encodings */
 	recent = ephy_encodings_get_recent (p->encodings);
 
-	embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (p->window));
+	embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (ephy_window_get_notebook (p->window)));
 	view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
 	encoding = webkit_web_view_get_custom_encoding (view);
 	if (encoding == NULL)
@@ -246,7 +246,7 @@ encoding_activate_cb (GtkAction *action, EphyEncodingMenu *menu)
 	name = gtk_action_get_name (GTK_ACTION (action));
 	encoding = name + strlen("Encoding");
 
-	embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (menu->priv->window));
+	embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (ephy_window_get_notebook (menu->priv->window)));
 
 	view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
 	webkit_web_view_set_custom_encoding (view, encoding);
@@ -318,7 +318,7 @@ ephy_encoding_menu_automatic_cb (GtkAction *action, EphyEncodingMenu *menu)
 	}
 
 	embed = ephy_embed_container_get_active_child 
-          (EPHY_EMBED_CONTAINER (menu->priv->window));
+	   (EPHY_EMBED_CONTAINER (ephy_window_get_notebook (menu->priv->window)));
 
 	/* setting NULL will clear the forced encoding */
 	view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
diff --git a/src/ephy-extensions-manager.c b/src/ephy-extensions-manager.c
index d45d2d2..0dd4bd3 100644
--- a/src/ephy-extensions-manager.c
+++ b/src/ephy-extensions-manager.c
@@ -517,7 +517,7 @@ attach_window (EphyWindow *window,
 	ephy_extension_attach_window (extension, window);
 
 	tabs = ephy_embed_container_get_children 
-          (EPHY_EMBED_CONTAINER (window));
+	   (EPHY_EMBED_CONTAINER (ephy_window_get_notebook (window)));
 	for (l = tabs; l; l = l->next)
 	{
 		ephy_extension_attach_tab (extension, window,
@@ -580,8 +580,8 @@ detach_window (EphyWindow *window,
 {
 	GList *tabs, *l;
 
-	tabs = ephy_embed_container_get_children 
-          (EPHY_EMBED_CONTAINER (window));
+	tabs = ephy_embed_container_get_children
+		(EPHY_EMBED_CONTAINER (ephy_window_get_notebook (window)));
 	for (l = tabs; l; l = l->next)
 	{
 		ephy_extension_detach_tab (extension, window,
@@ -1074,7 +1074,8 @@ impl_detach_window (EphyExtension *extension,
 	g_object_ref (window);
 
 	/* Detach tabs (uses impl_detach_tab) */
-	tabs = ephy_embed_container_get_children (EPHY_EMBED_CONTAINER (window));
+	tabs = ephy_embed_container_get_children
+		(EPHY_EMBED_CONTAINER (ephy_window_get_notebook (window)));
 	for (l = tabs; l; l = l->next)
 	{
 		ephy_extension_detach_tab (extension, window,
diff --git a/src/ephy-location-controller.c b/src/ephy-location-controller.c
index 8ebdc74..1127055 100644
--- a/src/ephy-location-controller.c
+++ b/src/ephy-location-controller.c
@@ -271,7 +271,7 @@ get_location_cb (EphyLocationEntry *entry,
 	EphyEmbed *embed;
 	
 	embed = ephy_embed_container_get_active_child 
-	  (EPHY_EMBED_CONTAINER (priv->window));
+	  (EPHY_EMBED_CONTAINER (ephy_window_get_notebook (priv->window)));
 
 	return g_strdup (ephy_web_view_get_address (ephy_embed_get_web_view (embed)));
 }
@@ -283,7 +283,7 @@ get_title_cb (EphyLocationEntry *entry,
 	EphyEmbed *embed;
 
 	embed = ephy_embed_container_get_active_child 
-	  (EPHY_EMBED_CONTAINER (controller->priv->window));
+	  (EPHY_EMBED_CONTAINER (ephy_window_get_notebook (controller->priv->window)));
 
 	return g_strdup (ephy_web_view_get_title (ephy_embed_get_web_view (embed)));
 }
diff --git a/src/ephy-lockdown.c b/src/ephy-lockdown.c
index 0d03607..39fddc6 100644
--- a/src/ephy-lockdown.c
+++ b/src/ephy-lockdown.c
@@ -72,7 +72,7 @@ arbitrary_url_cb (GSettings *settings,
 	/* Restore the real web page address when disabling entry */
 	if (g_settings_get_boolean (settings, key))
 	{
-		embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
+		embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (ephy_window_get_notebook (window)));
 		/* embed is NULL on startup */
 		if (embed == NULL)
 			return;
diff --git a/src/ephy-navigation-history-action.c b/src/ephy-navigation-history-action.c
index bbf6c72..064663d 100644
--- a/src/ephy-navigation-history-action.c
+++ b/src/ephy-navigation-history-action.c
@@ -87,7 +87,8 @@ action_activate (GtkAction *action)
 
   history_action = EPHY_NAVIGATION_HISTORY_ACTION (action);
   window = ephy_window_action_get_window (EPHY_WINDOW_ACTION (action));
-  embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
+  embed = ephy_embed_container_get_active_child
+    (EPHY_EMBED_CONTAINER (ephy_window_get_notebook (window)));
   g_return_if_fail (embed != NULL);
 
   web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
diff --git a/src/ephy-notebook.c b/src/ephy-notebook.c
index 8d5af72..7e1aad4 100644
--- a/src/ephy-notebook.c
+++ b/src/ephy-notebook.c
@@ -25,6 +25,7 @@
 
 #include "ephy-debug.h"
 #include "ephy-dnd.h"
+#include "ephy-embed-container.h"
 #include "ephy-embed-utils.h"
 #include "ephy-embed.h"
 #include "ephy-file-helpers.h"
@@ -77,7 +78,8 @@ static const GtkTargetEntry url_drag_types [] =
 enum
 {
 	PROP_0,
-	PROP_SHOW_TABS
+	PROP_SHOW_TABS,
+	PROP_ACTIVE_CHILD,
 };
 
 enum
@@ -88,9 +90,76 @@ enum
 
 static guint signals[LAST_SIGNAL];
 
+static int
+impl_add_child (EphyEmbedContainer *container,
+		EphyEmbed *child,
+		int position,
+		gboolean active)
+{
+	EphyWindow *window;
+	EphyNotebook *notebook = EPHY_NOTEBOOK (container);
+
+	window = EPHY_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (container)));
+	g_return_val_if_fail (!ephy_window_get_is_popup (window) ||
+			      gtk_notebook_get_n_pages (GTK_NOTEBOOK (notebook)) < 1, -1);
+
+	return ephy_notebook_add_tab (EPHY_NOTEBOOK (notebook),
+				      child, position, active);
+}
+
+static void
+impl_set_active_child (EphyEmbedContainer *container,
+		       EphyEmbed *child)
+{
+	int page;
+	GtkNotebook *notebook;
+
+	notebook = GTK_NOTEBOOK (container);
+
+	page = gtk_notebook_page_num (notebook, GTK_WIDGET (child));
+	gtk_notebook_set_current_page (notebook, page);
+}
+
+static void
+impl_remove_child (EphyEmbedContainer *container,
+		   EphyEmbed *child)
+{
+	g_signal_emit_by_name (container, "tab-close-request",
+			       child);
+}
+
+static EphyEmbed *
+impl_get_active_child (EphyEmbedContainer *container)
+{
+	EphyNotebook *notebook = EPHY_NOTEBOOK (container);
+	int active;
+
+	active = gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook));
+	return EPHY_EMBED (gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), active));
+}
+
+/* Fixme: I'd remove this method from the interface altogether. */
+static GList *
+impl_get_children (EphyEmbedContainer *container)
+{
+	return gtk_container_get_children (GTK_CONTAINER (container));
+}
+
+static void
+ephy_notebook_embed_container_iface_init (EphyEmbedContainerIface *iface)
+{
+	iface->add_child = impl_add_child;
+	iface->set_active_child = impl_set_active_child;
+	iface->remove_child = impl_remove_child;
+	iface->get_active_child = impl_get_active_child;
+	iface->get_children = impl_get_children;
+}
+
 G_DEFINE_TYPE_WITH_CODE (EphyNotebook, ephy_notebook, GTK_TYPE_NOTEBOOK,
 			 G_IMPLEMENT_INTERFACE (EPHY_TYPE_LINK,
-						NULL))
+						NULL)
+			 G_IMPLEMENT_INTERFACE (EPHY_TYPE_EMBED_CONTAINER,
+						ephy_notebook_embed_container_iface_init))
 
 static void
 ephy_notebook_get_property (GObject *object,
@@ -157,6 +226,10 @@ ephy_notebook_class_init (EphyNotebookClass *klass)
 							       TRUE,
 							       G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
 
+	g_object_class_override_property (object_class,
+					  PROP_ACTIVE_CHILD,
+					  "active-child");
+
 	g_type_class_add_private (object_class, sizeof (EphyNotebookPrivate));
 }
 
diff --git a/src/ephy-session.c b/src/ephy-session.c
index 92ad59b..9405d8d 100644
--- a/src/ephy-session.c
+++ b/src/ephy-session.c
@@ -348,7 +348,8 @@ session_command_open_uris (EphySession *session,
 		{
 			EphyWebView *web_view;
 			
-			embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (priv->resume_window));
+			embed = ephy_embed_container_get_active_child
+			  (EPHY_EMBED_CONTAINER (ephy_window_get_notebook (EPHY_WINDOW (priv->resume_window))));
 			web_view = ephy_embed_get_web_view (embed);
 			ephy_web_view_load_url (web_view, url);
 		}
@@ -766,8 +767,8 @@ write_ephy_window (xmlTextWriterPtr writer,
 	const char *role;
 	int ret;
 
-	tabs = ephy_embed_container_get_children (EPHY_EMBED_CONTAINER (window));
 	notebook = ephy_window_get_notebook (window);
+	tabs = ephy_embed_container_get_children (EPHY_EMBED_CONTAINER (notebook));
 
 	/* Do not save an empty EphyWindow.
 	 * This only happens when the window was newly opened.
@@ -959,7 +960,8 @@ parse_embed (xmlNodePtr child,
 					EphyWebView *web_view;
 					EphyEmbed *embed;
 
-					embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (priv->resume_window));
+					embed = ephy_embed_container_get_active_child
+					  (EPHY_EMBED_CONTAINER (ephy_window_get_notebook (EPHY_WINDOW (priv->resume_window))));
 					web_view = ephy_embed_get_web_view (embed);
 					ephy_web_view_load_url(web_view, recover_url);
 
@@ -1140,7 +1142,8 @@ ephy_session_load (EphySession *session,
 				}
 			}
 
-			active_child = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
+			active_child = ephy_embed_container_get_active_child
+			  (EPHY_EMBED_CONTAINER (ephy_window_get_notebook (window)));
 			gtk_widget_grab_focus (GTK_WIDGET (active_child));
 			gtk_widget_show (widget);
 		}
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index c8f3c27..d20a035 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -722,7 +722,7 @@ ephy_shell_new_tab_full (EphyShell *shell,
 
   if (flags & EPHY_NEW_TAB_FROM_EXTERNAL) {
     /* If the active embed is blank, us e that to open the url and jump to it */
-    embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
+    embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (ephy_window_get_notebook (window)));
     if (embed != NULL) {
       if (ephy_web_view_get_is_blank (ephy_embed_get_web_view (embed)) &&
           ephy_web_view_is_loading (ephy_embed_get_web_view (embed)) == FALSE) {
@@ -736,7 +736,8 @@ ephy_shell_new_tab_full (EphyShell *shell,
     g_assert (embed != NULL);
     gtk_widget_show (GTK_WIDGET (embed));
 
-    ephy_embed_container_add_child (EPHY_EMBED_CONTAINER (window), embed, position, jump_to);
+    ephy_embed_container_add_child (EPHY_EMBED_CONTAINER (ephy_window_get_notebook (window)),
+                                    embed, position, jump_to);
   }
 
   if (copy_history && previous_embed != NULL) {
diff --git a/src/ephy-window.c b/src/ephy-window.c
index ec3f24c..f989ef2 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -366,7 +366,6 @@ struct _EphyWindowPrivate
 enum
 {
 	PROP_0,
-	PROP_ACTIVE_CHILD,
 	PROP_CHROME,
 	PROP_IS_POPUP,
 	PROP_OVERVIEW_MODE
@@ -383,36 +382,6 @@ enum
 	SENS_FLAG_IS_BLANK	= 1 << 5
 };
 
-static gint
-impl_add_child (EphyEmbedContainer *container,
-		EphyEmbed *child,
-		gint position,
-		gboolean jump_to)
-{
-	EphyWindow *window = EPHY_WINDOW (container);
-
-	g_return_val_if_fail (!window->priv->is_popup ||
-			      gtk_notebook_get_n_pages (GTK_NOTEBOOK (window->priv->notebook)) < 1, -1);
-
-	return ephy_notebook_add_tab (EPHY_NOTEBOOK (window->priv->notebook),
-				      child, position, jump_to);
-}
-
-static void
-impl_set_active_child (EphyEmbedContainer *container,
-		       EphyEmbed *child)
-{
-	int page;
-	EphyWindow *window;
-
-	window = EPHY_WINDOW (container);
-
-	page = gtk_notebook_page_num
-		(window->priv->notebook, GTK_WIDGET (child));
-	gtk_notebook_set_current_page
-		(window->priv->notebook, page);
-}
-
 static GtkWidget *
 construct_confirm_close_dialog (EphyWindow *window,
 				const char *title,
@@ -483,42 +452,6 @@ confirm_close_with_downloads (EphyWindow *window)
 	return response == GTK_RESPONSE_ACCEPT;
 }
 
-static void
-impl_remove_child (EphyEmbedContainer *container,
-		   EphyEmbed *child)
-{
-	EphyWindow *window;
-
-	window = EPHY_WINDOW (container);
-	g_signal_emit_by_name (window->priv->notebook,
-			       "tab-close-request",
-			       child, window);
-}
-
-static EphyEmbed *
-impl_get_active_child (EphyEmbedContainer *container)
-{
-	return EPHY_WINDOW (container)->priv->active_embed;
-}
-
-static GList *
-impl_get_children (EphyEmbedContainer *container)
-{
-	EphyWindow *window = EPHY_WINDOW (container);
-
-	return gtk_container_get_children (GTK_CONTAINER (window->priv->notebook));
-}
-
-static void
-ephy_window_embed_container_iface_init (EphyEmbedContainerIface *iface)
-{
-	iface->add_child = impl_add_child;
-	iface->set_active_child = impl_set_active_child;
-	iface->remove_child = impl_remove_child;
-	iface->get_active_child = impl_get_active_child;
-	iface->get_children = impl_get_children;
-}
-
 /**
  * ephy_window_get_is_popup:
  * @window: a #EphyWindow
@@ -635,9 +568,7 @@ ephy_window_link_iface_init (EphyLinkIface *iface)
 
 G_DEFINE_TYPE_WITH_CODE (EphyWindow, ephy_window, GTK_TYPE_APPLICATION_WINDOW,
 			 G_IMPLEMENT_INTERFACE (EPHY_TYPE_LINK,
-						ephy_window_link_iface_init)
-			 G_IMPLEMENT_INTERFACE (EPHY_TYPE_EMBED_CONTAINER,
-						ephy_window_embed_container_iface_init))
+						ephy_window_link_iface_init))
 
 /* FIXME: fix this! */
 static void
@@ -1043,7 +974,7 @@ ephy_window_delete_event (GtkWidget *widget,
 	if (g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
 				    EPHY_PREFS_LOCKDOWN_QUIT)) return TRUE;
 
-	tabs = impl_get_children (EPHY_EMBED_CONTAINER (window));
+	tabs = ephy_embed_container_get_children (EPHY_EMBED_CONTAINER (window->priv->notebook));
 	for (l = tabs; l != NULL; l = l->next)
 	{
 		EphyEmbed *embed = (EphyEmbed *) l->data;
@@ -1062,8 +993,8 @@ ephy_window_delete_event (GtkWidget *widget,
 	if (modified)
 	{
 		/* jump to the first tab with modified forms */
-		impl_set_active_child (EPHY_EMBED_CONTAINER (window),
-				       modified_embed);
+		ephy_embed_container_set_active_child (EPHY_EMBED_CONTAINER (window->priv->notebook),
+						       modified_embed);
 
 		if (confirm_close_with_modified_forms (window) == FALSE)
 		{
@@ -2277,7 +2208,7 @@ policy_decision_required_cb (WebKitWebView *web_view,
 		}
 
 		embed = ephy_embed_container_get_active_child
-			(EPHY_EMBED_CONTAINER (window));
+			(EPHY_EMBED_CONTAINER (window->priv->notebook));
 
 		ephy_shell_new_tab_full (ephy_shell_get_default (),
 					 window,
@@ -2472,7 +2403,7 @@ ephy_window_set_active_tab (EphyWindow *window, EphyEmbed *new_embed)
 					 G_CALLBACK (ephy_window_visibility_cb),
 					 window, 0);
 
-		g_object_notify (G_OBJECT (window), "active-child");
+		g_object_notify (G_OBJECT (window->priv->notebook), "active-child");
 	}
 }
 
@@ -2486,7 +2417,7 @@ embed_modal_alert_cb (EphyEmbed *embed,
 	 * (since the alert is modal, the user won't be able to do anything
 	 * with his current window anyway :|)
 	 */
-	impl_set_active_child (EPHY_EMBED_CONTAINER (window), embed);
+	ephy_embed_container_set_active_child (EPHY_EMBED_CONTAINER (window->priv->notebook), embed);
 	gtk_window_present (GTK_WINDOW (window));
 
 	/* make sure the location entry shows the real URL of the tab's page */
@@ -3015,10 +2946,6 @@ ephy_window_set_property (GObject *object,
 
 	switch (prop_id)
 	{
-		case PROP_ACTIVE_CHILD:
-			impl_set_active_child (EPHY_EMBED_CONTAINER (window),
-					       g_value_get_object (value));
-			break;
 		case PROP_CHROME:
 			ephy_window_set_chrome (window, g_value_get_flags (value));
 			break;
@@ -3044,9 +2971,6 @@ ephy_window_get_property (GObject *object,
 
 	switch (prop_id)
 	{
-		case PROP_ACTIVE_CHILD:
-			g_value_set_object (value, window->priv->active_embed);
-			break;
 		case PROP_CHROME:
 			g_value_set_flags (value, window->priv->chrome);
 			break;
@@ -3178,7 +3102,7 @@ allow_popups_notifier (GSettings *settings,
 
 	g_return_if_fail (EPHY_IS_WINDOW (window));
 
-	tabs = impl_get_children (EPHY_EMBED_CONTAINER (window));
+	tabs = ephy_embed_container_get_children (EPHY_EMBED_CONTAINER (window->priv->notebook));
 
 	for (; tabs; tabs = g_list_next (tabs))
 	{
@@ -3216,7 +3140,7 @@ sync_user_input_cb (EphyLocationController *action,
 
 	if (priv->updating_address) return;
 
-	embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
+	embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window->priv->notebook));
 	g_assert (EPHY_IS_EMBED (embed));
 
 	address = ephy_location_controller_get_address (action);
@@ -3544,10 +3468,6 @@ ephy_window_class_init (EphyWindowClass *klass)
 	widget_class->window_state_event = ephy_window_state_event;
 	widget_class->delete_event = ephy_window_delete_event;
 
-	g_object_class_override_property (object_class,
-					  PROP_ACTIVE_CHILD,
-					  "active-child");
-
 	g_object_class_install_property (object_class,
 					 PROP_CHROME,
 					 g_param_spec_flags ("chrome", NULL, NULL,
diff --git a/src/popup-commands.c b/src/popup-commands.c
index 1690628..568f42e 100644
--- a/src/popup-commands.c
+++ b/src/popup-commands.c
@@ -46,8 +46,8 @@ popup_cmd_link_in_new_window (GtkAction *action,
 	EphyEmbed *embed;
 	GValue value = { 0, };
 
-	embed = ephy_embed_container_get_active_child 
-		(EPHY_EMBED_CONTAINER (window));
+	embed = ephy_embed_container_get_active_child
+		(EPHY_EMBED_CONTAINER (ephy_window_get_notebook (window)));
 
 	event = ephy_window_get_context_event (window);
 	g_return_if_fail (event != NULL);
@@ -70,7 +70,7 @@ popup_cmd_link_in_new_tab (GtkAction *action,
 	GValue value = { 0, };
 
 	embed = ephy_embed_container_get_active_child
-		(EPHY_EMBED_CONTAINER (window));
+		(EPHY_EMBED_CONTAINER (ephy_window_get_notebook (window)));
 
 	event = ephy_window_get_context_event (window);
 	g_return_if_fail (event != NULL);
@@ -261,8 +261,8 @@ popup_cmd_open_link (GtkAction *action,
 	GValue value = { 0, };
 	EphyEmbed *embed;
 
-	embed = ephy_embed_container_get_active_child 
-		(EPHY_EMBED_CONTAINER (window));
+	embed = ephy_embed_container_get_active_child
+		(EPHY_EMBED_CONTAINER (ephy_window_get_notebook (window)));
 	g_return_if_fail (embed != NULL);
 
 	event = ephy_window_get_context_event (window);
@@ -455,8 +455,8 @@ popup_replace_spelling (GtkAction *action,
 	WebKitDOMDocument *document;
 	WebKitDOMDOMWindow *default_view;
 
-	embed = ephy_embed_container_get_active_child 
-		(EPHY_EMBED_CONTAINER (window));
+	embed = ephy_embed_container_get_active_child
+		(EPHY_EMBED_CONTAINER (ephy_window_get_notebook (window)));
 	g_return_if_fail (embed != NULL);
 
 	view = WEBKIT_WEB_VIEW (ephy_embed_get_web_view (embed));
@@ -485,7 +485,7 @@ popup_cmd_open_image (GtkAction *action,
 	g_return_if_fail (event != NULL);
 
 	embed = ephy_embed_container_get_active_child 
-		(EPHY_EMBED_CONTAINER (window));
+		(EPHY_EMBED_CONTAINER (ephy_window_get_notebook (window)));
 	g_return_if_fail (embed != NULL);
 
 	ephy_embed_event_get_property (event, "image-uri", &value);
@@ -522,7 +522,7 @@ popup_cmd_inspect_element (GtkAction *action, EphyWindow *window)
 	guint x, y;
 
 	embed = ephy_embed_container_get_active_child
-		(EPHY_EMBED_CONTAINER (window));
+		(EPHY_EMBED_CONTAINER (ephy_window_get_notebook (window)));
 
 	event = ephy_window_get_context_event (window);
 	g_return_if_fail (event != NULL);
diff --git a/src/window-commands.c b/src/window-commands.c
index b60a4b0..5ffab82 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -67,7 +67,7 @@ window_cmd_file_print (GtkAction *action,
 	EphyWebView *view;
 
 	embed = ephy_embed_container_get_active_child 
-          (EPHY_EMBED_CONTAINER (window));
+	  (EPHY_EMBED_CONTAINER (ephy_window_get_notebook (window)));
 	g_return_if_fail (EPHY_IS_EMBED (embed));
 	view = ephy_embed_get_web_view (embed);
 
@@ -85,7 +85,7 @@ window_cmd_file_send_to	(GtkAction *action,
 	GError *error = NULL;
 
 	embed = ephy_embed_container_get_active_child 
-          (EPHY_EMBED_CONTAINER (window));
+	  (EPHY_EMBED_CONTAINER (ephy_window_get_notebook (window)));
 	g_return_if_fail (embed != NULL);
 
 	location = ephy_web_view_get_address (ephy_embed_get_web_view (embed));
@@ -159,8 +159,8 @@ window_cmd_view_stop (GtkAction *action,
 {
 	EphyEmbed *embed;
 	
-	embed = ephy_embed_container_get_active_child 
-          (EPHY_EMBED_CONTAINER (window));
+	embed = ephy_embed_container_get_active_child
+	  (EPHY_EMBED_CONTAINER (ephy_window_get_notebook (window)));
 	g_return_if_fail (embed != NULL);
 
 	gtk_widget_grab_focus (GTK_WIDGET (embed));
@@ -176,7 +176,7 @@ window_cmd_view_reload (GtkAction *action,
 	WebKitWebView *view;
 
 	embed = ephy_embed_container_get_active_child 
-          (EPHY_EMBED_CONTAINER (window));
+	  (EPHY_EMBED_CONTAINER (ephy_window_get_notebook (window)));
 	g_return_if_fail (embed != NULL);
 
 	gtk_widget_grab_focus (GTK_WIDGET (embed));
@@ -194,8 +194,8 @@ window_cmd_file_bookmark_page (GtkAction *action,
 {
 	EphyEmbed *embed;
 
-	embed = ephy_embed_container_get_active_child 
-          (EPHY_EMBED_CONTAINER (window));
+	embed = ephy_embed_container_get_active_child
+	  (EPHY_EMBED_CONTAINER (ephy_window_get_notebook (window)));
 	g_return_if_fail (embed != NULL);
 
 	ephy_bookmarks_ui_add_bookmark (GTK_WINDOW (window),
@@ -310,7 +310,8 @@ window_cmd_file_save_as (GtkAction *action,
 	char *suggested_filename;
 	EphyWebView *view;
 
-	embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
+	embed = ephy_embed_container_get_active_child
+	  (EPHY_EMBED_CONTAINER (ephy_window_get_notebook (window)));
 	g_return_if_fail (embed != NULL);
 
 	dialog = ephy_file_chooser_new (_("Save"),
@@ -559,7 +560,8 @@ window_cmd_file_save_as_application (GtkAction *action,
 	EphyWebView *view;
 	EphyApplicationDialogData *data;
 
-	embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
+	embed = ephy_embed_container_get_active_child
+	  (EPHY_EMBED_CONTAINER (ephy_window_get_notebook (window)));
 	g_return_if_fail (embed != NULL);
 
 	view = EPHY_WEB_VIEW (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed));
@@ -637,7 +639,8 @@ window_cmd_file_close_window (GtkAction *action,
 		return;
 	}
 
-	embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
+	embed = ephy_embed_container_get_active_child
+	  (EPHY_EMBED_CONTAINER (ephy_window_get_notebook (window)));
 	g_return_if_fail (embed != NULL);
 
 	g_signal_emit_by_name (notebook, "tab-close-request", embed);
@@ -706,7 +709,9 @@ window_cmd_edit_cut (GtkAction *action,
 	else
 	{
 		EphyEmbed *embed;
-		embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
+
+		embed = ephy_embed_container_get_active_child
+		  (EPHY_EMBED_CONTAINER (ephy_window_get_notebook (window)));
 		g_return_if_fail (embed != NULL);
 
 		webkit_web_view_cut_clipboard (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed));
@@ -727,7 +732,8 @@ window_cmd_edit_copy (GtkAction *action,
 	{
 		EphyEmbed *embed;
 
-		embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
+		embed = ephy_embed_container_get_active_child
+		  (EPHY_EMBED_CONTAINER (ephy_window_get_notebook (window)));
 		g_return_if_fail (embed != NULL);
 
 		webkit_web_view_copy_clipboard (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed));
@@ -748,7 +754,8 @@ window_cmd_edit_paste (GtkAction *action,
 	{
 		EphyEmbed *embed;
 
-		embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
+		embed = ephy_embed_container_get_active_child
+		  (EPHY_EMBED_CONTAINER (ephy_window_get_notebook (window)));
 		g_return_if_fail (embed != NULL);
 
 		webkit_web_view_paste_clipboard (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed));
@@ -769,7 +776,8 @@ window_cmd_edit_delete (GtkAction *action,
 	{
 		EphyEmbed *embed;
 
-		embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
+		embed = ephy_embed_container_get_active_child
+		  (EPHY_EMBED_CONTAINER (ephy_window_get_notebook (window)));
 		g_return_if_fail (embed != NULL);
 
 		/* FIXME: TODO */
@@ -794,8 +802,8 @@ window_cmd_edit_select_all (GtkAction *action,
 	{
 		EphyEmbed *embed;
 
-		embed = ephy_embed_container_get_active_child 
-                  (EPHY_EMBED_CONTAINER (window));
+		embed = ephy_embed_container_get_active_child
+		  (EPHY_EMBED_CONTAINER (ephy_window_get_notebook (window)));
 		g_return_if_fail (embed != NULL);
 
 		webkit_web_view_select_all (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed));
@@ -1069,8 +1077,8 @@ window_cmd_view_page_source (GtkAction *action,
 	const char *address;
 	guint32 user_time;
 
-	embed = ephy_embed_container_get_active_child 
-          (EPHY_EMBED_CONTAINER (window));
+	embed = ephy_embed_container_get_active_child
+	  (EPHY_EMBED_CONTAINER (ephy_window_get_notebook (window)));
 	g_return_if_fail (embed != NULL);
 
 	address = ephy_web_view_get_address (ephy_embed_get_web_view (embed));
@@ -1308,13 +1316,13 @@ window_cmd_tabs_detach  (GtkAction *action,
         if (gtk_notebook_get_n_pages (notebook) <= 1)
                 return;
 
-        embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
-
+	embed = ephy_embed_container_get_active_child
+	  (EPHY_EMBED_CONTAINER (ephy_window_get_notebook (window)));
         g_object_ref_sink (embed);
         gtk_notebook_remove_page (notebook, gtk_notebook_page_num (notebook, GTK_WIDGET (embed)));
 
         new_window = ephy_window_new ();
-        ephy_embed_container_add_child (EPHY_EMBED_CONTAINER (new_window), embed, 0, FALSE);
+        ephy_embed_container_add_child (EPHY_EMBED_CONTAINER (ephy_window_get_notebook (window)), embed, 0, FALSE);
         g_object_unref (embed);
 
         gtk_window_present (GTK_WINDOW (new_window));
@@ -1339,7 +1347,7 @@ window_cmd_load_location (GtkAction *action,
 		g_return_if_fail (address != NULL);
 
 		ephy_link_open (EPHY_LINK (window), address,
-			        ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window)),
+			        ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (ephy_window_get_notebook (window))),
 				ephy_link_flags_from_current_event ());
 	}
 }
@@ -1351,9 +1359,9 @@ window_cmd_browse_with_caret (GtkAction *action,
 	gboolean active;
 	EphyEmbed *embed;
 
-	embed = ephy_embed_container_get_active_child 
-		(EPHY_EMBED_CONTAINER (window));
-	
+	embed = ephy_embed_container_get_active_child
+	  (EPHY_EMBED_CONTAINER (ephy_window_get_notebook (window)));
+
 	active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
 
 	/* FIXME: perhaps a bit of a kludge; we check if there's an



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