Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Quiñones <manuq@laptop.org>2013-01-03 18:52:12 (GMT)
committer Manuel Quiñones <manuq@laptop.org>2013-01-25 14:01:22 (GMT)
commitca6b1c7bd30cfefb008fcbf4b053e8092d3f9005 (patch)
tree605ddef1d23d633b5207b9e3cdde3cb543748a5f
parentde545fc97273db57453d3cc212ce80bb784aa9de (diff)
Persist zoom level of tabs between sessions - SL #4368
- Read the zoom level using Dictionary.get() to make it backwards compatible. - Add getter and setter to DummyBrowser for the duck typing. Initial patch from Ariel Calzada <ariel@acivitycentral.com> Signed-off-by: Ariel Calzada <ariel@acivitycentral.com> Signed-off-by: Manuel Quiñones <manuq@laptop.org>
-rw-r--r--pdfviewer.py6
-rw-r--r--webactivity.py7
2 files changed, 12 insertions, 1 deletions
diff --git a/pdfviewer.py b/pdfviewer.py
index e539a32..e0030ef 100644
--- a/pdfviewer.py
+++ b/pdfviewer.py
@@ -282,6 +282,12 @@ class DummyBrowser(GObject.GObject):
def get_history_index(self):
return 0
+ def set_zoom_level(self, zoom_level):
+ pass
+
+ def get_zoom_level(self):
+ return 0
+
def stop_loading(self):
self._tab.cancel_download()
diff --git a/webactivity.py b/webactivity.py
index 3c0d337..ecf84b6 100644
--- a/webactivity.py
+++ b/webactivity.py
@@ -411,9 +411,13 @@ class WebActivity(activity.Activity):
for number, tab in enumerate(self.model.data['currents']):
tab_page = self._tabbed_view.get_nth_page(number)
tab_page.browser.set_history_index(tab['history_index'])
+ zoom_level = tab.get('zoom_level')
+ if zoom_level is not None:
+ tab_page.browser.set_zoom_level(zoom_level)
tab_page.browser.grab_focus()
self._tabbed_view.set_current_page(self.model.data['current_tab'])
+
elif self.metadata['mime_type'] == 'text/uri-list':
data = self._get_data_from_file_path(file_path)
uris = mime.split_uri_list(data)
@@ -453,7 +457,8 @@ class WebActivity(activity.Activity):
uri = n_browser.get_uri()
history_index = n_browser.get_history_index()
info = {'title': n_browser.props.title, 'url': uri,
- 'history_index': history_index}
+ 'history_index': history_index,
+ 'zoom_level': n_browser.get_zoom_level()}
self.model.data['currents'].append(info)