diff options
author | Lucian Branescu Mihaila <lucian.branescu@gmail.com> | 2010-06-19 17:33:04 (GMT) |
---|---|---|
committer | Lucian Branescu Mihaila <lucian.branescu@gmail.com> | 2010-06-19 17:33:04 (GMT) |
commit | d1aa885e319c2c14d41fac8d39e958154e0ca329 (patch) | |
tree | 1e4b713675f9e6ac1edcf30c43997d683641de45 /sessionstore.py | |
parent | 0a3d8753901589b3d1f90910f121ca7694d70320 (diff) |
Implement sessions, homepage and various fixes.
Diffstat (limited to 'sessionstore.py')
-rw-r--r-- | sessionstore.py | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/sessionstore.py b/sessionstore.py deleted file mode 100644 index 11fe135..0000000 --- a/sessionstore.py +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright (C) 2007, One Laptop Per Child -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -# Based on -# http://lxr.mozilla.org/seamonkey/source/browser/components/sessionstore - -import logging - - -def get_session(browser): - session_history = browser.get_back_forward_list() - - if len(session_history) == 0: - return '' - return _get_history(session_history) - - -def set_session(browser, data): - session_history = browser.get_back_forward_list() - - _set_history(session_history, data) - - if data: - session_history.go_to_item(len(data) - 1) - else: - browser.load_uri('about:blank') - - -def _get_history(history): - entries_dest = [] - for i in range(0, len(history)): - entry_orig = history.get_nth_item(i) - entry_dest = {'url': entry_orig.props.uri, - 'title': entry_orig.props.title} - - entries_dest.append(entry_dest) - - return entries_dest - - -def _set_history(history, history_data): - history.clear() - - for entry_dict in history_data: - logging.debug('entry_dict: %r' % entry_dict) - - entry = webkit.WebHistoryItem(entry_dict['url'], entry_dict['title']) - - history.add_item(entry) |