From 7072ec5913ff6e1447666adf825c46edb0074a93 Mon Sep 17 00:00:00 2001 From: Gonzalo Odiard Date: Wed, 08 Jun 2011 20:09:14 +0000 Subject: Set and restore index in the history (OLPC #10779 / SL #2499) Restoring the history index instead of (re)loading the active URL will "distribute" the history over the Back and Forward buttons exactly the same as before Stop + Resume instead of putting it all on the Back button. [tweaked description] Signed-off-by: Sascha Silbe Acked-By: Sascha Silbe --- (limited to 'browser.py') diff --git a/browser.py b/browser.py index 649a71e..e93bac5 100644 --- a/browser.py +++ b/browser.py @@ -287,7 +287,6 @@ class Browser(WebView): def do_setup(self): WebView.do_setup(self) - listener = xpcom.server.WrapObject(ContentInvoker(self), interfaces.nsIDOMEventListener) self.window_root.addEventListener('click', listener, False) @@ -357,6 +356,12 @@ class Browser(WebView): interfaces.nsIMarkupDocumentViewer) markupDocumentViewer.fullZoom -= _ZOOM_AMOUNT + def get_history_index(self): + return self.web_navigation.sessionHistory.index + + def set_history_index(self, index): + self.web_navigation.gotoIndex(index) + class PopupDialog(gtk.Window): def __init__(self): -- cgit v0.9.1