aboutsummaryrefslogtreecommitdiffstats
path: root/src/ephy-shell.c
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@gnome.org>2003-11-10 03:16:35 +0800
committerMarco Pesenti Gritti <marco@src.gnome.org>2003-11-10 03:16:35 +0800
commitd68d147c784bde6f5d13c200eb2d92a40141a5a3 (patch)
tree8d9d57cc6cf037c32acc56aecac0fa99be7169bd /src/ephy-shell.c
parentc135299f16ff6d9669ccc12a7f670d9e574bbaa0 (diff)
downloadgsoc2013-epiphany-d68d147c784bde6f5d13c200eb2d92a40141a5a3.tar
gsoc2013-epiphany-d68d147c784bde6f5d13c200eb2d92a40141a5a3.tar.gz
gsoc2013-epiphany-d68d147c784bde6f5d13c200eb2d92a40141a5a3.tar.bz2
gsoc2013-epiphany-d68d147c784bde6f5d13c200eb2d92a40141a5a3.tar.lz
gsoc2013-epiphany-d68d147c784bde6f5d13c200eb2d92a40141a5a3.tar.xz
gsoc2013-epiphany-d68d147c784bde6f5d13c200eb2d92a40141a5a3.tar.zst
gsoc2013-epiphany-d68d147c784bde6f5d13c200eb2d92a40141a5a3.zip
Cleanup session. Persist also history and bookmarks.
2003-11-09 Marco Pesenti Gritti <marco@gnome.org> * embed/ephy-embed.h: * idl/EphyAutomation.idl: * src/ephy-automation.c: (impl_ephy_automation_loadurl), (impl_ephy_automation_open_bookmarks_editor), (ephy_automation_init), (ephy_automation_object_finalize), (ephy_automation_class_init): * src/ephy-completion-model.c: (root_child_removed_cb): * src/ephy-main.c: (ephy_main_start): * src/ephy-shell.c: (ephy_shell_get_active_window), (toolwindow_show_cb), (toolwindow_hide_cb), (ephy_shell_get_bookmarks_editor), (ephy_shell_get_history_window): * src/ephy-shell.h: * src/ephy-tab.c: (ephy_tab_net_state_cb), (ephy_tab_size_to_cb): * src/ephy-window.c: (remove_from_session), (ephy_window_init): * src/session.c: (session_autoresume), (session_close), (session_dispose), (save_window_geometry), (save_tool_window), (save_ephy_window), (session_save), (session_load), (session_get_windows), (net_stop_cb), (tab_added_cb), (tab_removed_cb), (tabs_reordered_cb), (session_add_window), (session_remove_window), (save_yourself_cb), (session_die_cb), (gnome_session_init), (session_init): * src/session.h: * src/window-commands.c: (window_cmd_go_bookmarks), (window_cmd_go_history): Cleanup session. Persist also history and bookmarks.
Diffstat (limited to 'src/ephy-shell.c')
-rw-r--r--src/ephy-shell.c85
1 files changed, 39 insertions, 46 deletions
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index a2e825372..806b8ca47 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -412,14 +412,25 @@ EphyWindow *
ephy_shell_get_active_window (EphyShell *gs)
{
Session *session;
- const GList *windows;
+ GList *windows, *l;
+ EphyWindow *window = NULL;
session = EPHY_SESSION (ephy_shell_get_session (gs));
+
windows = session_get_windows (session);
- if (windows == NULL) return NULL;
+ for (l = windows; l != NULL; l = l->next)
+ {
+ if (EPHY_IS_WINDOW (l->data))
+ {
+ window = EPHY_WINDOW (l->data);
+ break;
+ }
+ }
+
+ g_list_free (windows);
- return EPHY_WINDOW(windows->data);
+ return window;
}
/**
@@ -628,15 +639,23 @@ ephy_shell_get_toolbars_model (EphyShell *gs, gboolean fullscreen)
}
static void
-bookmarks_hide_cb (GtkWidget *widget, gpointer data)
+toolwindow_show_cb (GtkWidget *widget)
+{
+ LOG ("Ref shell for %s", G_OBJECT_TYPE_NAME (widget))
+ session_add_window (ephy_shell->priv->session, GTK_WINDOW (widget));
+ g_object_ref (ephy_shell);
+}
+
+static void
+toolwindow_hide_cb (GtkWidget *widget)
{
- LOG ("Unref shell for bookmarks editor")
+ LOG ("Unref shell for %s", G_OBJECT_TYPE_NAME (widget))
+ session_remove_window (ephy_shell->priv->session, GTK_WINDOW (widget));
g_object_unref (ephy_shell);
}
-void
-ephy_shell_show_bookmarks_editor (EphyShell *gs,
- GtkWidget *parent)
+GtkWidget *
+ephy_shell_get_bookmarks_editor (EphyShell *gs)
{
EphyBookmarks *bookmarks;
@@ -645,35 +664,18 @@ ephy_shell_show_bookmarks_editor (EphyShell *gs,
bookmarks = ephy_shell_get_bookmarks (ephy_shell);
g_assert (bookmarks != NULL);
gs->priv->bme = ephy_bookmarks_editor_new (bookmarks);
- g_signal_connect (gs->priv->bme, "hide",
- G_CALLBACK (bookmarks_hide_cb), NULL);
- }
-
- if (!GTK_WIDGET_VISIBLE (gs->priv->bme))
- {
- LOG ("Ref shell for bookmarks editor")
- g_object_ref (ephy_shell);
- }
- if (parent)
- {
- ephy_bookmarks_editor_set_parent
- (EPHY_BOOKMARKS_EDITOR (gs->priv->bme), parent);
+ g_signal_connect (gs->priv->bme, "show",
+ G_CALLBACK (toolwindow_show_cb), NULL);
+ g_signal_connect (gs->priv->bme, "hide",
+ G_CALLBACK (toolwindow_hide_cb), NULL);
}
- gtk_window_present (GTK_WINDOW (gs->priv->bme));
-}
-
-static void
-history_window_hide_cb (GtkWidget *widget, gpointer data)
-{
- LOG ("Unref shell for history window")
- g_object_unref (ephy_shell);
+ return gs->priv->bme;
}
-void
-ephy_shell_show_history_window (EphyShell *gs,
- GtkWidget *parent)
+GtkWidget *
+ephy_shell_get_history_window (EphyShell *gs)
{
EphyHistory *history;
@@ -683,23 +685,14 @@ ephy_shell_show_history_window (EphyShell *gs,
(EPHY_EMBED_SHELL (ephy_shell));
g_assert (history != NULL);
gs->priv->history_window = ephy_history_window_new (history);
- g_signal_connect (gs->priv->history_window, "hide",
- G_CALLBACK (history_window_hide_cb), NULL);
- }
- if (!GTK_WIDGET_VISIBLE (gs->priv->history_window))
- {
- LOG ("Ref shell for history window")
- g_object_ref (ephy_shell);
- }
-
- if (parent)
- {
- ephy_history_window_set_parent
- (EPHY_HISTORY_WINDOW (gs->priv->history_window), parent);
+ g_signal_connect (gs->priv->history_window, "show",
+ G_CALLBACK (toolwindow_show_cb), NULL);
+ g_signal_connect (gs->priv->history_window, "hide",
+ G_CALLBACK (toolwindow_hide_cb), NULL);
}
- gtk_window_present (GTK_WINDOW (gs->priv->history_window));
+ return gs->priv->history_window;
}
void