Index: embed/ephy-embed.c
===================================================================
RCS file: /cvs/gnome/epiphany/embed/ephy-embed.c,v
retrieving revision 1.13
diff -u -p -r1.13 ephy-embed.c
--- embed/ephy-embed.c	1 Sep 2003 23:20:08 -0000	1.13
+++ embed/ephy-embed.c	6 Oct 2003 15:09:31 -0000
@@ -53,11 +53,6 @@ enum
 static void
 ephy_embed_base_init (gpointer base_class);
 
-struct EphyEmbedPrivate
-{
-	gpointer dummy;
-};
-
 static guint ephy_embed_signals[LAST_SIGNAL] = { 0 };
 
 GType
@@ -501,11 +496,11 @@ gresult
 ephy_embed_shistory_get_nth (EphyEmbed *embed,
                              int nth,
                              gboolean is_relative,
-                             char **url,
-                             char **title)
+                             EmbedSHistoryEntry **entry,
+			     gboolean get_full_info)
 {
 	EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed);
-        return klass->shistory_get_nth (embed, nth, is_relative, url, title);
+        return klass->shistory_get_nth (embed, nth, is_relative, entry, get_full_info);
 }
 
 gresult
@@ -605,3 +600,15 @@ ephy_embed_print_preview_navigate (EphyE
 	return klass->print_preview_navigate (embed, navType, pageNum);
 }
 
+void
+ephy_embed_free_shistory_entry (EmbedSHistoryEntry *entry)
+{
+	if (entry)
+	{
+		g_free (entry->uri);
+		g_free (entry->referrer);
+		g_free (entry->title);
+
+		g_free (entry);
+	}
+}
Index: embed/ephy-embed.h
===================================================================
RCS file: /cvs/gnome/epiphany/embed/ephy-embed.h,v
retrieving revision 1.13
diff -u -p -r1.13 ephy-embed.h
--- embed/ephy-embed.h	1 Sep 2003 23:20:08 -0000	1.13
+++ embed/ephy-embed.h	6 Oct 2003 15:09:32 -0000
@@ -78,6 +78,18 @@ typedef struct
 	GList *stylesheets; /* url, title */
 } EmbedPageInfo;
 
+typedef struct
+{
+	char *uri;
+	char *referrer;
+	char *title;
+	// <type?> cacheKey;
+	gboolean expired;
+	gint scroll_x;
+	gint scroll_y;
+	
+} EmbedSHistoryEntry;
+
 typedef enum
 {
 	EMBED_RELOAD_NORMAL = 1 << 1,
@@ -242,8 +254,8 @@ struct EphyEmbedClass
 	gresult   (* shistory_get_nth)     (EphyEmbed *embed,
 				            int nth,
 				            gboolean is_relative,
-				            char **url,
-				            char **title);
+				            EmbedSHistoryEntry **entry,
+					    gboolean get_full_info);
 	gresult   (* shistory_get_pos)     (EphyEmbed *embed,
 				            int *pos);
 	gresult   (* shistory_go_nth)      (EphyEmbed *embed,
@@ -361,8 +373,8 @@ gresult       ephy_embed_shistory_count 
 gresult       ephy_embed_shistory_get_nth     (EphyEmbed *embed,
 					       int nth,
 					       gboolean is_relative,
-					       char **url,
-					       char **title);
+					       EmbedSHistoryEntry **entry,
+					       gboolean get_full_info);
 
 gresult       ephy_embed_shistory_get_pos     (EphyEmbed *embed,
 					       int *pos);
@@ -405,6 +417,10 @@ gresult       ephy_embed_print_preview_n
 gresult       ephy_embed_print_preview_navigate	 (EphyEmbed *embed,
 						  EmbedPrintPreviewNavType navType,
 						  gint pageNum);
+
+/* auxiliary routines */
+
+void	      ephy_embed_free_shistory_entry  (EmbedSHistoryEntry *entry);
 
 G_END_DECLS
 
Index: embed/mozilla/EphyWrapper.cpp
===================================================================
RCS file: /cvs/gnome/epiphany/embed/mozilla/EphyWrapper.cpp,v
retrieving revision 1.19
diff -u -p -r1.19 EphyWrapper.cpp
--- embed/mozilla/EphyWrapper.cpp	13 Sep 2003 18:45:30 -0000	1.19
+++ embed/mozilla/EphyWrapper.cpp	6 Oct 2003 15:09:33 -0000
@@ -454,26 +454,7 @@ nsresult EphyWrapper::GetSHInfo (PRInt32
 	return NS_OK;
 }
 
-nsresult EphyWrapper::GetSHTitleAtIndex (PRInt32 index, PRUnichar **title)
-{
-	nsresult result;
-
-	nsCOMPtr<nsISHistory> SessionHistory;
-	result = GetSHistory (getter_AddRefs(SessionHistory));
-	if (NS_FAILED(result) || ! SessionHistory) return NS_ERROR_FAILURE;
-
-	nsCOMPtr<nsIHistoryEntry> he;
-	result = SessionHistory->GetEntryAtIndex (index, PR_FALSE,
-						  getter_AddRefs (he));
-	if (!NS_SUCCEEDED(result) || (!he)) return NS_ERROR_FAILURE;
-
-	result = he->GetTitle (title);
-	if (!NS_SUCCEEDED(result) || (!title)) return NS_ERROR_FAILURE;
-
-	return NS_OK;
-}
-
-nsresult EphyWrapper::GetSHUrlAtIndex (PRInt32 index, nsCString &url)
+nsresult EphyWrapper::GetSHEntryAtIndex (PRInt32 index, EmbedSHistoryEntry **_retval, gboolean full_info)
 {
 	nsresult result;
 
@@ -486,12 +467,56 @@ nsresult EphyWrapper::GetSHUrlAtIndex (P
 						  getter_AddRefs (he));
 	if (NS_FAILED(result) || (!he)) return NS_ERROR_FAILURE;
 
+	EmbedSHistoryEntry *entry;
+	entry = g_new0 (EmbedSHistoryEntry, 1);
+	*_retval = entry;
+	entry->referrer = NULL;
+
+	/* get the title */
+	PRUnichar *title;
+	result = he->GetTitle (&title);
+	if (NS_FAILED (result) || (!title)) return NS_ERROR_FAILURE;
+	entry->title = g_strdup (NS_ConvertUCS2toUTF8 (title).get());
+	nsMemory::Free (title);
+
+	/* get the URI */
 	nsCOMPtr<nsIURI> uri;
 	result = he->GetURI (getter_AddRefs(uri));
 	if (NS_FAILED(result) || (!uri)) return NS_ERROR_FAILURE;
 
+	nsCString url;
 	result = uri->GetSpec(url);
 	if (NS_FAILED(result) || url.IsEmpty()) return NS_ERROR_FAILURE;
+	// FIXME: is this in UTF-8 ?
+	entry->uri = !url.IsEmpty() ? g_strdup (url.get()) : NULL;
+
+	/* check if the caller only want the title & uri info */
+	if (!full_info) return NS_OK;
+
+	/* get additional information */
+	nsCOMPtr<nsISHEntry> shEntry(do_QueryInterface(he));
+	if (!shEntry) return NS_ERROR_FAILURE;
+
+	/* get the referrer URI */
+	nsCOMPtr<nsIURI> ruri;
+	result = shEntry->GetReferrerURI (getter_AddRefs(ruri));
+	if (NS_FAILED(result) || (!ruri)) return NS_ERROR_FAILURE;
+
+	nsCString rurl;
+	result = ruri->GetSpec(rurl);
+	if (NS_FAILED(result) || rurl.IsEmpty()) return NS_ERROR_FAILURE;
+	// FIXME: is this in UTF-8 ?
+	entry->referrer = !rurl.IsEmpty() ? g_strdup (rurl.get()) : NULL;
+
+	/* get expiration status */
+	PRBool expired;
+	result = shEntry->GetExpirationStatus (&expired);
+	if (NS_FAILED (result)) return NS_ERROR_FAILURE;
+	entry->expired = (expired == PR_TRUE) ? TRUE : FALSE;
+
+	/* get scroll position */
+	result = shEntry->GetScrollPosition (&(entry->scroll_x), &(entry->scroll_y));
+	if (NS_FAILED (result)) return NS_ERROR_FAILURE;
 
 	return NS_OK;
 }
Index: embed/mozilla/EphyWrapper.h
===================================================================
RCS file: /cvs/gnome/epiphany/embed/mozilla/EphyWrapper.h,v
retrieving revision 1.7
diff -u -p -r1.7 EphyWrapper.h
--- embed/mozilla/EphyWrapper.h	17 Aug 2003 15:29:53 -0000	1.7
+++ embed/mozilla/EphyWrapper.h	6 Oct 2003 15:09:35 -0000
@@ -19,6 +19,8 @@
 #ifndef EPHY_WRAPPER_H
 #define EPHY_WRAPPER_H
 
+#include "ephy-embed.h"
+
 #include "nsIDocShell.h"
 #include "ProgressListener.h"
 #include "nsIWebNavigation.h"
@@ -67,8 +69,7 @@ public:
 	nsresult GetPageDescriptor(nsISupports **aPageDescriptor);
 
 	nsresult GetSHInfo (PRInt32 *count, PRInt32 *index);
-	nsresult GetSHTitleAtIndex (PRInt32 index, PRUnichar **title);
-	nsresult GetSHUrlAtIndex (PRInt32 index, nsCString &url);
+	nsresult GetSHEntryAtIndex (PRInt32 index, EmbedSHistoryEntry **_retval, gboolean full_info);
 
 	nsresult CopyHistoryTo (EphyWrapper *embed);
 
Index: embed/mozilla/mozilla-embed.cpp
===================================================================
RCS file: /cvs/gnome/epiphany/embed/mozilla/mozilla-embed.cpp,v
retrieving revision 1.30
diff -u -p -r1.30 mozilla-embed.cpp
--- embed/mozilla/mozilla-embed.cpp	1 Sep 2003 23:20:09 -0000	1.30
+++ embed/mozilla/mozilla-embed.cpp	6 Oct 2003 15:09:36 -0000
@@ -129,8 +129,8 @@ static gresult
 impl_shistory_get_nth (EphyEmbed *embed, 
                        int nth,
                        gboolean is_relative,
-                       char **url,
-                       char **title);
+                       EmbedSHistoryEntry **entry,
+		       gboolean get_full_info);
 static gresult
 impl_shistory_get_pos (EphyEmbed *embed,
                        int *pos);
@@ -961,15 +961,13 @@ impl_shistory_count  (EphyEmbed *embed,
 {
 	nsresult rv;
 	EphyWrapper *wrapper;
-	int c, index;
+	int dummy;
 	
 	wrapper = MOZILLA_EMBED(embed)->priv->wrapper;
 	g_return_val_if_fail (wrapper != NULL, G_FAILED);
 	
-	rv = wrapper->GetSHInfo (&c, &index);
-
-	*count = c;
-	
+	rv = wrapper->GetSHInfo (count, &dummy);
+g_print ("result is %s\n", rv == NS_OK ? "NS_OK" : "not NS_OK");
 	return NS_SUCCEEDED(rv) ? G_OK : G_FAILED;
 }
 
@@ -977,14 +975,15 @@ static gresult
 impl_shistory_get_nth (EphyEmbed *embed, 
                        int nth,
                        gboolean is_relative,
-                       char **aUrl,
-                       char **aTitle)
+                       EmbedSHistoryEntry **entry,
+		       gboolean get_full_info)
 {
 	nsresult rv;
-        nsCAutoString url;
-	PRUnichar *title;
 	EphyWrapper *wrapper;
 	
+	g_return_val_if_fail (entry != NULL, G_FAILED);
+	*entry = NULL;
+
 	wrapper = MOZILLA_EMBED(embed)->priv->wrapper;
 	g_return_val_if_fail (wrapper != NULL, G_FAILED);
 
@@ -995,25 +994,17 @@ impl_shistory_get_nth (EphyEmbed *embed,
 		if (ephy_embed_shistory_get_pos 
 		    (EPHY_EMBED(embed), &pos) == G_OK)
 		{
-			pos += nth;
+			nth += pos;
 		}
 		else
 		{
 			return G_FAILED;
 		}
 	}
-	
-        rv = wrapper->GetSHUrlAtIndex(nth, url);
-
-        *aUrl = (NS_SUCCEEDED (rv) && !url.IsEmpty()) ? g_strdup(url.get()) : NULL;
-
-	rv = wrapper->GetSHTitleAtIndex(nth, &title);
-
-	*aTitle = g_strdup (NS_ConvertUCS2toUTF8(title).get());
 
-	nsMemory::Free (title);
+        rv = wrapper->GetSHEntryAtIndex(nth, entry, get_full_info);
 
-	return G_OK;
+	return NS_SUCCEEDED (rv) ? G_OK : G_FAILED;
 }
 
 static gresult
@@ -1022,15 +1013,13 @@ impl_shistory_get_pos (EphyEmbed *embed,
 {
 	nsresult rv;
 	EphyWrapper *wrapper;
-	int count, index;
-	
+	int dummy;
+
 	wrapper = MOZILLA_EMBED(embed)->priv->wrapper;
 	g_return_val_if_fail (wrapper != NULL, G_FAILED);
-	
-	rv = wrapper->GetSHInfo (&count, &index);
 
-	*pos = index;
-	
+	rv = wrapper->GetSHInfo (&dummy, pos);
+
 	return NS_SUCCEEDED(rv) ? G_OK : G_FAILED;
 }
 
Index: src/ephy-navigation-action.c
===================================================================
RCS file: /cvs/gnome/epiphany/src/ephy-navigation-action.c,v
retrieving revision 1.11
diff -u -p -r1.11 ephy-navigation-action.c
--- src/ephy-navigation-action.c	1 Sep 2003 23:20:14 -0000	1.11
+++ src/ephy-navigation-action.c	6 Oct 2003 15:09:37 -0000
@@ -161,18 +161,22 @@ setup_back_or_forward_menu (EphyWindow *
 
 	while (start != end)
 	{
+		EmbedSHistoryEntry *entry;
+		gresult rv;
+
 		char *title, *url;
 		GtkWidget *item;
-		ephy_embed_shistory_get_nth (embed, start, FALSE, &url, &title);
-		item = new_history_menu_item (title ? title : url, NULL);
+		rv = ephy_embed_shistory_get_nth (embed, start, FALSE, &entry, FALSE);
+		if (rv != G_OK) continue;
+
+		item = new_history_menu_item (entry-> title ? entry->title : entry->uri, NULL);
 		gtk_menu_shell_append (ms, item);
 		g_object_set_data (G_OBJECT (item), "go_nth", GINT_TO_POINTER (start));
 		g_signal_connect (item, "activate",
                                   G_CALLBACK (activate_back_or_forward_menu_item_cb), window);
 		gtk_widget_show_all (item);
 
-		g_free (url);
-		g_free (title);
+		ephy_embed_free_shistory_entry (entry);
 
 		if (start < end)
 		{
Index: src/session.c
===================================================================
RCS file: /cvs/gnome/epiphany/src/session.c,v
retrieving revision 1.22
diff -u -p -r1.22 session.c
--- src/session.c	24 Sep 2003 18:45:03 -0000	1.22
+++ src/session.c	6 Oct 2003 15:09:40 -0000
@@ -30,6 +30,7 @@
 #include "ephy-string.h"
 #include "ephy-file-helpers.h"
 #include "eel-gconf-extensions.h"
+#include "ephy-debug.h"
 
 #include <bonobo/bonobo-i18n.h>
 #include <string.h>
@@ -47,11 +48,6 @@
 
 enum
 {
-	RESTORE_TYPE_PROP
-};
-
-enum
-{
 	RESTORE_SESSION,
 	RESTORE_AS_BOOKMARKS,
 	DISCARD_SESSION
@@ -81,6 +77,9 @@ enum
 
 static guint session_signals[LAST_SIGNAL] = { 0 };
 
+#define EPHY_SESSION_XML_ROOT		"session"
+#define EPHY_SESSION_XML_VERSION	"1.0"
+
 GType
 session_get_type (void)
 {
@@ -438,26 +437,79 @@ save_tab (EphyWindow *window,
 	  xmlNodePtr window_node)
 {
 	EmbedChromeMask chrome;
-	char *location;
-        xmlNodePtr embed_node;
+	char *address, *position;
+	xmlChar *enc_address;
+	xmlNodePtr tab_node, hnode;
 	EphyEmbed *embed;
+	gresult rv;
+	int num_history, i, pos;
 
 	chrome = ephy_window_get_chrome (window);
 
 	/* skip if it's a XUL dialog */
-        if (chrome & EMBED_CHROME_OPENASCHROME) return;
+	if (chrome & EMBED_CHROME_OPENASCHROME) return;
 
-	/* make a new XML node */
-        embed_node = xmlNewDocNode (doc, NULL, "embed", NULL);
+	tab_node = xmlNewChild (window_node, NULL, "tab", NULL);
 
-        /* otherwise, use the actual location. */
 	embed = ephy_tab_get_embed (tab);
-	ephy_embed_get_location (embed, TRUE, &location);
-        xmlSetProp (embed_node, "url", location);
-	g_free (location);
 
-	/* insert node into the tree */
-	xmlAddChild (window_node, embed_node);
+	ephy_embed_get_location (embed, TRUE, &address);
+	enc_address = xmlEncodeSpecialChars (doc, address);
+	xmlNewChild (tab_node, NULL, "address", enc_address);
+	xmlFree (enc_address);
+	g_free (address);
+
+	/* save tab history */
+	rv = ephy_embed_shistory_count (embed, &num_history);
+	g_return_if_fail (rv == G_OK);
+
+	hnode = xmlNewChild (tab_node, NULL, "history", NULL);
+	rv = ephy_embed_shistory_get_pos (embed, &pos);
+	g_return_if_fail (rv == G_OK);
+
+	position = g_strdup_printf ("%d", pos);
+	xmlNewChild (hnode, NULL, "position", position);
+	g_free (position);
+
+	for (i = 0; i < num_history; i++)
+	{
+		EmbedSHistoryEntry *entry;
+		char *address = NULL, *title = NULL;
+
+		rv = ephy_embed_shistory_get_nth (embed, i,
+						  FALSE /* is_relative */,
+						  &entry,
+						  TRUE /* full info */);
+		if (rv == G_OK)
+		{
+			xmlChar *encoded;
+			xmlNodePtr henode;
+
+			henode = xmlNewChild (hnode, NULL, "entry", NULL);
+
+			encoded = xmlEncodeSpecialChars (doc, entry->title);
+			xmlNewChild (henode, NULL, "title", encoded);
+			xmlFree (encoded);
+
+			encoded = xmlEncodeSpecialChars (doc, entry->uri);
+			xmlNewChild (henode, NULL, "address", encoded);
+			xmlFree (encoded);
+			
+			encoded = xmlEncodeSpecialChars (doc, entry->referrer);
+			xmlNewChild (henode, NULL, "referrer", encoded);
+			xmlFree (encoded);
+
+			encoded = g_strdup_printf ("%d", entry->scroll_x);
+			xmlNewChild (henode, NULL, "scroll_x", encoded);
+			g_free (encoded);
+
+			encoded = g_strdup_printf ("%d", entry->scroll_y);
+			xmlNewChild (henode, NULL, "scroll_y", encoded);
+			g_free (encoded);
+		}
+
+		ephy_embed_free_shistory_entry (entry);
+	}
 }
 
 /*
@@ -473,19 +525,21 @@ session_save (Session *session,
 	      const char *filename)
 {
 	const GList *w;
-        xmlNodePtr root_node;
-        xmlNodePtr window_node;
         xmlDocPtr doc;
-        gchar buffer[32];
+        xmlNodePtr root, window_node;
+        char buffer[32];
 	char *save_to;
 
 	save_to = get_session_filename (filename);
 
+	START_PROFILER ("session_save")
+
         doc = xmlNewDoc ("1.0");
 
         /* create and set the root node for the session */
-        root_node = xmlNewDocNode (doc, NULL, "session", NULL);
-        xmlDocSetRootElement (doc, root_node);
+        root = xmlNewDocNode (doc, NULL, EPHY_SESSION_XML_ROOT, NULL);
+	xmlSetProp (root, "version", EPHY_SESSION_XML_VERSION);
+        xmlDocSetRootElement (doc, root);
 
 	w = session_get_windows (session);
 
@@ -526,35 +580,107 @@ session_save (Session *session,
 		}
 		g_list_free (tabs);
 
-		xmlAddChild (root_node, window_node);
+		xmlAddChild (root, window_node);
         }
 
         /* save it all out to disk */
-        xmlSaveFile (save_to, doc);
+        xmlSaveFormatFile (save_to, doc, 1);
         xmlFreeDoc (doc);
 
 	g_free (save_to);
+
+	STOP_PROFILER ("session_save")
+}
+
+static void
+parse_tab_history (xmlNodePtr child, EphyWindow *window, EphyTab *tab)
+{
+	EphyEmbed *embed;
+	gulong pos = 0;
+
+	g_return_if_fail (tab != NULL);
+	embed = ephy_tab_get_embed (tab);
+
+	while (child != NULL)
+	{
+		if (xmlStrEqual (child->name, "entry"))
+		{
+			xmlChar *address = NULL, *title = NULL;
+			xmlNodePtr node;
+
+			for (node = child->children; node != NULL; node = node->next)
+			{
+				if (xmlStrEqual (node->name, "address"))
+				{
+					address = xmlNodeGetContent (node);
+				}
+				else if (xmlStrEqual (node->name, "title"))
+				{
+					title = xmlNodeGetContent (node);
+				}
+			}
+
+			// FIXME: actually insert it into the tab's session history :)
+
+			xmlFree (address);
+			xmlFree (title);
+		}
+		else if (xmlStrEqual (child->name, "position"))
+		{
+			xmlChar *position;
+
+			position = xmlNodeGetContent (child);
+			ephy_string_to_int (position, &pos);
+			xmlFree (position);
+		}
+
+		child = child->next;
+	}
+
+	// FIXME: set pos as position in tab's session history
 }
 
 static void
-parse_embed (xmlNodePtr child, EphyWindow *window)
+parse_tab (xmlNodePtr child, EphyWindow *window)
 {
+	EphyTab *tab = NULL;
+
+	g_return_if_fail (window != NULL);
+
 	while (child != NULL)
 	{
-		if (strcmp (child->name, "embed") == 0)
+		if (xmlStrEqual (child->name, "address"))
 		{
-			xmlChar *url;
+			xmlChar *address;
 
-			g_return_if_fail (window != NULL);
+			address = xmlNodeGetContent (child);
+			// FIXME: invert xmlEncodeSpecialChars ?
 
-			url = xmlGetProp (child, "url");
+			tab = ephy_shell_new_tab
+				(ephy_shell, window, NULL, address,
+				 EPHY_NEW_TAB_IN_EXISTING_WINDOW |
+				 EPHY_NEW_TAB_OPEN_PAGE |
+				 EPHY_NEW_TAB_APPEND_LAST);
 
-			ephy_shell_new_tab (ephy_shell, window, NULL, url,
-					    EPHY_NEW_TAB_IN_EXISTING_WINDOW |
-					    EPHY_NEW_TAB_OPEN_PAGE |
-					    EPHY_NEW_TAB_APPEND_LAST);
+			xmlFree (address);
+		}
+		else if (xmlStrEqual (child->name, "history"))
+		{
+			parse_tab_history (child->children, window, tab);
+		}
 
-			xmlFree (url);
+		child = child->next;
+	}
+}
+
+static void
+parse_tabs (xmlNodePtr child, EphyWindow *window)
+{
+	while (child != NULL)
+	{
+		if (xmlStrEqual (child->name, "tab"))
+		{
+			parse_tab (child->children, window);
 		}
 
 		child = child->next;
@@ -573,7 +699,8 @@ session_load (Session *session,
 	      const char *filename)
 {
 	xmlDocPtr doc;
-        xmlNodePtr child;
+        xmlNodePtr root, child;
+	xmlChar *version;
 	GtkWidget *wmain;
 	EphyWindow *window;
 	char *save_to;
@@ -582,14 +709,20 @@ session_load (Session *session,
 
 	doc = xmlParseFile (save_to);
 
-	child = xmlDocGetRootElement (doc);
+        root = xmlDocGetRootElement (doc);
+	child = root->children;
+        
+        version = xmlGetProp (root, "version");
+        if (version != NULL || !xmlStrEqual (version, EPHY_SESSION_XML_VERSION))
+        {
+                g_warning ("Old session file format detected, unable to load.\n");
 
-	/* skip the session node */
-	child = child->children;
+		child = NULL;
+        }
 
 	while (child != NULL)
 	{
-		if (strcmp (child->name, "window") == 0)
+		if (xmlStrEqual (child->name, "window"))
 		{
 			gulong x = 0, y = 0, width = 0, height = 0;
 			xmlChar *tmp;
@@ -615,7 +748,7 @@ session_load (Session *session,
 			gtk_window_set_default_size (GTK_WINDOW (wmain),
 				                     width, height);
 
-			parse_embed (child->children, window);
+			parse_tabs (child->children, window);
 		}
 
 		child = child->next;
