[epiphany/overview: 14/28] Move implementation of EmbedContainer from Window to Notebook
- From: Claudio Saavedra <csaavedra src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/overview: 14/28] Move implementation of EmbedContainer from Window to Notebook
- Date: Fri, 3 Aug 2012 09:45:04 +0000 (UTC)
commit 5468439486e6ebea726b85996ddc0802210711c6
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 | 1 +
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, 182 insertions(+), 150 deletions(-)
---
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index 352294b..c7d9d0d 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -1012,3 +1012,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 91fc06e..a4988f8 100644
--- a/embed/ephy-embed.h
+++ b/embed/ephy-embed.h
@@ -61,6 +61,7 @@ void ephy_embed_auto_download_url (EphyEmbed *embed,
const char *url);
void ephy_embed_entering_fullscreen (EphyEmbed *embed);
void ephy_embed_leaving_fullscreen (EphyEmbed *embed);
+GtkWidget* ephy_embed_get_container (EphyEmbed *embed);
G_END_DECLS
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index dfc05aa..1037cca 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -185,11 +185,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);
@@ -250,6 +252,7 @@ popups_manager_hide (EphyEmbedContainer *container,
EphyEmbed *embed;
const char *location;
char *features;
+ GtkWidget *window;
embed = ephy_embed_container_get_active_child (container);
g_return_if_fail (EPHY_IS_EMBED (embed));
@@ -260,8 +263,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 (features);
}
@@ -1694,8 +1697,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);
}
@@ -2595,13 +2598,17 @@ close_web_view_cb (WebKitWebView *web_view,
gpointer user_data)
#endif
{
- 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 58e03f5..929c0e2 100644
--- a/src/ephy-encoding-dialog.c
+++ b/src/ephy-encoding-dialog.c
@@ -195,7 +195,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 e276f4a..983435b 100644
--- a/src/ephy-encoding-menu.c
+++ b/src/ephy-encoding-menu.c
@@ -133,7 +133,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);
#ifdef HAVE_WEBKIT2
encoding = webkit_web_view_get_custom_charset (view);
@@ -251,7 +251,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);
#ifdef HAVE_WEBKIT2
@@ -325,7 +325,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 71a888f..8f9cbff 100644
--- a/src/ephy-extensions-manager.c
+++ b/src/ephy-extensions-manager.c
@@ -496,7 +496,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,
@@ -559,8 +559,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,
@@ -1053,7 +1053,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 463606e..48c55c5 100644
--- a/src/ephy-location-controller.c
+++ b/src/ephy-location-controller.c
@@ -230,7 +230,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)));
}
@@ -242,7 +242,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 d48f13f..1bbe72f 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 f8892bf..52dbdb4 100644
--- a/src/ephy-navigation-history-action.c
+++ b/src/ephy-navigation-history-action.c
@@ -91,7 +91,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 6a43412..f72af06 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_TABS_ALLOWED
+ PROP_TABS_ALLOWED,
+ 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 69f665a..32a5561 100644
--- a/src/ephy-session.c
+++ b/src/ephy-session.c
@@ -376,7 +376,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);
}
@@ -796,8 +797,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.
@@ -989,7 +990,8 @@ parse_embed (xmlNodePtr child,
EphyWebView *web_view;
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 (EPHY_WINDOW (window))));
web_view = ephy_embed_get_web_view (embed);
ephy_web_view_load_url (web_view, recover_url);
@@ -1180,7 +1182,8 @@ ephy_session_load_from_string (EphySession *session,
if (ephy_embed_shell_get_mode (embed_shell) != EPHY_EMBED_SHELL_MODE_TEST)
{
- 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 56c524d..4eacd37 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -752,7 +752,7 @@ ephy_shell_new_tab_full (EphyShell *shell,
if (flags & EPHY_NEW_TAB_FROM_EXTERNAL) {
/* If the active embed is blank, use 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) {
@@ -766,7 +766,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 74d635b..2a781b1 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -370,7 +370,6 @@ struct _EphyWindowPrivate
enum
{
PROP_0,
- PROP_ACTIVE_CHILD,
PROP_CHROME,
PROP_IS_POPUP,
PROP_OVERVIEW_MODE
@@ -387,36 +386,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,
@@ -487,42 +456,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
@@ -643,9 +576,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
@@ -1006,7 +937,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;
@@ -1025,8 +956,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)
{
@@ -2533,7 +2464,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,
@@ -2651,7 +2582,7 @@ ephy_window_connect_active_embed (EphyWindow *window)
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");
}
static void
@@ -2771,7 +2702,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 */
@@ -3312,10 +3243,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;
@@ -3341,9 +3268,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;
@@ -3443,7 +3367,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))
{
@@ -3481,7 +3405,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);
@@ -3807,10 +3731,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 a052138..f0dda01 100644
--- a/src/popup-commands.c
+++ b/src/popup-commands.c
@@ -50,8 +50,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);
@@ -74,7 +74,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);
@@ -264,8 +264,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);
@@ -462,8 +462,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));
@@ -493,7 +493,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);
@@ -533,7 +533,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 dc98392..b43208b 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -72,7 +72,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);
@@ -90,7 +90,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));
@@ -164,8 +164,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));
@@ -181,7 +181,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));
@@ -199,8 +199,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),
@@ -336,7 +336,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"),
@@ -629,7 +630,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));
@@ -707,7 +709,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);
@@ -784,7 +787,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);
#ifdef HAVE_WEBKIT2
@@ -809,7 +814,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);
#ifdef HAVE_WEBKIT2
webkit_web_view_execute_editing_command (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed), WEBKIT_EDITING_COMMAND_COPY);
@@ -833,7 +839,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);
#ifdef HAVE_WEBKIT2
@@ -858,7 +865,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 */
@@ -883,8 +891,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);
#ifdef HAVE_WEBKIT2
@@ -1190,8 +1198,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));
@@ -1441,13 +1449,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));
@@ -1472,7 +1480,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 ());
}
}
@@ -1484,9 +1492,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]