Sasha:<br>In this patch I have addressed your comments.<br>To test with multiple tabs, in F14 I needed to replace:<br><br>- self._disable_multiple_tabs = cairo.cairo_version() >= 10810<br>+ self._disable_multiple_tabs = cairo.cairo_version() >= 10810 \<br>
+ and cairo.cairo_version() < 11002<br><br>I don't know if is in your plans restore multiple tabs, functionality in F14,<br>but the cairo bug is gone.<br><br>Gonzalo<br><br><br><br><div class="gmail_quote">
On Wed, Jun 8, 2011 at 12:09 PM, <span dir="ltr"><<a href="mailto:godiard@sugarlabs.org">godiard@sugarlabs.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
From: Gonzalo Odiard <<a href="mailto:godiard@gmail.com">godiard@gmail.com</a>><br>
<br>
If the user go back, or select any page in the history and<br>
close the activity, need restore at the next start, the history,<br>
and the index in the history too.<br>
---<br>
browser.py | 7 ++++++-<br>
webactivity.py | 26 ++++++++++----------------<br>
webtoolbar.py | 1 +<br>
3 files changed, 17 insertions(+), 17 deletions(-)<br>
<br>
diff --git a/browser.py b/browser.py<br>
index b9c1f69..3cef766 100644<br>
--- a/browser.py<br>
+++ b/browser.py<br>
@@ -281,7 +281,6 @@ class Browser(WebView):<br>
<br>
def do_setup(self):<br>
WebView.do_setup(self)<br>
-<br>
listener = xpcom.server.WrapObject(ContentInvoker(self),<br>
interfaces.nsIDOMEventListener)<br>
self.window_root.addEventListener('click', listener, False)<br>
@@ -351,6 +350,12 @@ class Browser(WebView):<br>
interfaces.nsIMarkupDocumentViewer)<br>
markupDocumentViewer.fullZoom -= _ZOOM_AMOUNT<br>
<br>
+ def get_history_index(self):<br>
+ return self.web_navigation.sessionHistory.index<br>
+<br>
+ def set_history_index(self, index):<br>
+ self.web_navigation.gotoIndex(index)<br>
+<br>
<br>
class PopupDialog(gtk.Window):<br>
def __init__(self):<br>
diff --git a/webactivity.py b/webactivity.py<br>
index 48cb3ed..8ad95a6 100644<br>
--- a/webactivity.py<br>
+++ b/webactivity.py<br>
@@ -458,6 +458,10 @@ class WebActivity(activity.Activity):<br>
link['owner'], -1, link['hash'])<br>
logging.debug('########## reading %s', data)<br>
self._tabbed_view.set_session(self.model.data['history'])<br>
+ for number, tab in enumerate(self.model.data['currents']):<br>
+ browser = self._tabbed_view.get_nth_page(number)<br>
+ browser.set_history_index(tab['history_index'])<br>
+<br>
self._tabbed_view.set_current_page(self.model.data['current_tab'])<br>
elif self.metadata['mime_type'] == 'text/uri-list':<br>
data = self._get_data_from_file_path(file_path)<br>
@@ -469,19 +473,6 @@ class WebActivity(activity.Activity):<br>
'list of multiple uris by now.')<br>
else:<br>
self._tabbed_view.props.current_browser.load_uri(file_path)<br>
- self._load_urls()<br>
-<br>
- def _load_urls(self):<br>
- if self.model.data['currents'] != None:<br>
- first = True<br>
- for current_tab in self.model.data['currents']:<br>
- if first:<br>
- browser = self._tabbed_view.current_browser<br>
- first = False<br>
- else:<br>
- browser = Browser()<br>
- self._tabbed_view._append_tab(browser)<br>
- browser.load_uri(current_tab['url'])<br>
<br>
def write_file(self, file_path):<br>
if not self.metadata['mime_type']:<br>
@@ -503,9 +494,12 @@ class WebActivity(activity.Activity):<br>
for n in range(0, self._tabbed_view.get_n_pages()):<br>
n_browser = self._tabbed_view.get_nth_page(n)<br>
if n_browser != None:<br>
- nsiuri = browser.progress.location<br>
- ui_uri = browser.get_url_from_nsiuri(nsiuri)<br>
- info = {'title': browser.props.title, 'url': ui_uri}<br>
+ nsiuri = n_browser.progress.location<br>
+ ui_uri = n_browser.get_url_from_nsiuri(nsiuri)<br>
+ history_index = n_browser.get_history_index()<br>
+ info = {'title': n_browser.props.title, 'url': ui_uri,<br>
+ 'history_index': history_index}<br>
+<br>
self.model.data['currents'].append(info)<br>
<br>
f = open(file_path, 'w')<br>
diff --git a/webtoolbar.py b/webtoolbar.py<br>
index 8b0e108..6cb3ee7 100644<br>
--- a/webtoolbar.py<br>
+++ b/webtoolbar.py<br>
@@ -355,6 +355,7 @@ class PrimaryToolbar(ToolbarBase):<br>
self._history = browser.history<br>
self._session_history_changed_hid = self._history.connect(<br>
'session-history-changed', self._session_history_changed_cb)<br>
+ self._reload_session_history()<br>
<br>
if self._browser is not None:<br>
self._browser.disconnect(self._title_changed_hid)<br>
<font color="#888888">--<br>
1.7.4.4<br>
<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Gonzalo Odiard<br><br><br>