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.
This commit is contained in:
Christian Dywan 2009-07-05 00:17:00 +01:00
parent ab6ecc1625
commit 82e0a66de7
2 changed files with 8 additions and 2 deletions

View file

@ -1269,6 +1269,7 @@ midori_load_session (gpointer data)
KatzeArray* session; KatzeArray* session;
KatzeItem* item; KatzeItem* item;
guint i; guint i;
gint64 current;
gchar** command = g_object_get_data (G_OBJECT (app), "execute-command"); gchar** command = g_object_get_data (G_OBJECT (app), "execute-command");
browser = midori_app_create_browser (app); browser = midori_app_create_browser (app);
@ -1305,8 +1306,11 @@ midori_load_session (gpointer data)
i = 0; i = 0;
while ((item = katze_array_get_nth_item (_session, i++))) while ((item = katze_array_get_nth_item (_session, i++)))
midori_browser_add_item (browser, item); midori_browser_add_item (browser, item);
/* FIXME: Switch to the last active page */ current = katze_item_get_meta_integer (KATZE_ITEM (_session), "current");
item = katze_array_get_nth_item (_session, 0); 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), "")) if (!strcmp (katze_item_get_uri (item), ""))
midori_browser_activate_action (browser, "Location"); midori_browser_activate_action (browser, "Location");
g_object_unref (_session); g_object_unref (_session);

View file

@ -3973,6 +3973,8 @@ gtk_notebook_switch_page_cb (GtkWidget* notebook,
gtk_window_set_title (GTK_WINDOW (browser), window_title); gtk_window_set_title (GTK_WINDOW (browser), window_title);
g_free (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"); g_object_notify (G_OBJECT (browser), "uri");
_midori_browser_set_statusbar_text (browser, NULL); _midori_browser_set_statusbar_text (browser, NULL);