From 82e0a66de7211e9b9ff81d526f3e2cce00a2e3c9 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Sun, 5 Jul 2009 00:17:00 +0100 Subject: [PATCH] Use metadata API to store and lookup the current page This effectively doesn't work yet as loading of metadata isn't implemented in XBEL. --- midori/main.c | 8 ++++++-- midori/midori-browser.c | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/midori/main.c b/midori/main.c index 435113e9..203c20b5 100644 --- a/midori/main.c +++ b/midori/main.c @@ -1269,6 +1269,7 @@ midori_load_session (gpointer data) KatzeArray* session; KatzeItem* item; guint i; + gint64 current; gchar** command = g_object_get_data (G_OBJECT (app), "execute-command"); browser = midori_app_create_browser (app); @@ -1305,8 +1306,11 @@ midori_load_session (gpointer data) i = 0; while ((item = katze_array_get_nth_item (_session, i++))) midori_browser_add_item (browser, item); - /* FIXME: Switch to the last active page */ - item = katze_array_get_nth_item (_session, 0); + current = katze_item_get_meta_integer (KATZE_ITEM (_session), "current"); + if (current < 0) + current = 0; + midori_browser_set_current_page (browser, current); + item = katze_array_get_nth_item (_session, current); if (!strcmp (katze_item_get_uri (item), "")) midori_browser_activate_action (browser, "Location"); g_object_unref (_session); diff --git a/midori/midori-browser.c b/midori/midori-browser.c index 09df196d..3ac60cff 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -3973,6 +3973,8 @@ gtk_notebook_switch_page_cb (GtkWidget* notebook, gtk_window_set_title (GTK_WINDOW (browser), window_title); g_free (window_title); + katze_item_set_meta_integer (KATZE_ITEM (browser->proxy_array), "current", + midori_browser_get_current_page (browser)); g_object_notify (G_OBJECT (browser), "uri"); _midori_browser_set_statusbar_text (browser, NULL);