[epiphany] ephy-session.c: add ephy_session_clear()



commit 65f5514fc4df4d6d7c88319d08b12820546e4d1b
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Thu Feb 7 10:23:17 2013 +0200

    ephy-session.c: add ephy_session_clear()
    
    https://bugzilla.gnome.org/show_bug.cgi?id=693297

 src/ephy-private.h |    5 +++++
 src/ephy-session.c |   20 ++++++++++++++++++++
 2 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/src/ephy-private.h b/src/ephy-private.h
index 8a7757b..5e7b77a 100644
--- a/src/ephy-private.h
+++ b/src/ephy-private.h
@@ -29,6 +29,7 @@
 #include "ephy-embed-event.h"
 #include "ephy-embed-private.h"
 #include "ephy-location-controller.h"
+#include "ephy-session.h"
 #include "ephy-shell.h"
 #include "ephy-window.h"
 
@@ -62,5 +63,9 @@ EphyShellStartupContext *ephy_shell_startup_context_new       (EphyStartupFlags
 
 void                     _ephy_shell_create_instance          (EphyEmbedShellMode        mode);
 
+/* EphySession */
+
+void                     ephy_session_clear                   (EphySession *session);
+
 #endif
 
diff --git a/src/ephy-session.c b/src/ephy-session.c
index 3ad9dbb..9fa15be 100644
--- a/src/ephy-session.c
+++ b/src/ephy-session.c
@@ -32,6 +32,7 @@
 #include "ephy-gui.h"
 #include "ephy-notebook.h"
 #include "ephy-prefs.h"
+#include "ephy-private.h"
 #include "ephy-settings.h"
 #include "ephy-shell.h"
 #include "ephy-string.h"
@@ -1621,3 +1622,22 @@ ephy_session_resume_finish (EphySession *session,
 	return !g_simple_async_result_propagate_error (simple, error);
 }
 
+
+void
+ephy_session_clear (EphySession *session)
+{
+	EphyShell *shell;
+	GList *windows, *p;
+
+	g_return_if_fail (EPHY_IS_SESSION (session));
+
+	shell = ephy_shell_get_default ();
+	windows = ephy_shell_get_windows (shell);
+	for (p = windows; p; p = p->next)
+		gtk_widget_destroy (GTK_WIDGET (p->data));
+	g_queue_foreach (session->priv->closed_tabs,
+			 (GFunc)closed_tab_free, NULL);
+	g_queue_clear (session->priv->closed_tabs);
+
+	ephy_session_save (session, SESSION_STATE);
+}


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