diff options
-rw-r--r-- | readdb.py | 12 | ||||
-rw-r--r-- | readtoolbar.py | 4 |
2 files changed, 8 insertions, 8 deletions
@@ -10,8 +10,8 @@ from readbookmark import Bookmark _logger = logging.getLogger('read-activity') class BookmarkManager: - def __init__(self, hash, dbpath='read.db'): - self._hash = hash + def __init__(self, filehash, dbpath='read.db'): + self._filehash = filehash self._conn = sqlite3.connect(dbpath) self._cur = self._conn.cursor() @@ -26,7 +26,7 @@ class BookmarkManager: user = client.get_string("/desktop/sugar/user/nick") color = client.get_string("/desktop/sugar/user/color") - t = (self._hash, page, title, timestamp, user, color, local) + t = (self._filehash, page, title, timestamp, user, color, local) self._cur.execute('insert into bookmarks values (?, ?, ?, ?, ?, ?, ?)', t) self._conn.commit() @@ -38,7 +38,7 @@ class BookmarkManager: # We delete only the locally made bookmark - t = (self._hash, page, user) + t = (self._filehash, page, user) self._cur.execute('delete from bookmarks where md5=? and page=? and user=?', t) self._conn.commit() @@ -46,7 +46,7 @@ class BookmarkManager: def _populate_bookmarks(self): # TODO: Figure out if caching the entire set of bookmarks is a good idea or not - self._cur.execute('select * from bookmarks where md5=?', (self._hash,)) + self._cur.execute('select * from bookmarks where md5=?', (self._filehash,)) for row in self._cur: self._bookmarks.append(Bookmark(row)) @@ -62,4 +62,4 @@ class BookmarkManager: def _resync_bookmark_cache(self): # To be called when a new bookmark has been added/removed self._bookmarks = [] - self._populate_bookmarks()
\ No newline at end of file + self._populate_bookmarks() diff --git a/readtoolbar.py b/readtoolbar.py index 5baf310..07a60c9 100644 --- a/readtoolbar.py +++ b/readtoolbar.py @@ -270,13 +270,13 @@ class ReadToolbar(gtk.Toolbar): bookmarkitem.show_all() def set_document(self, document, filepath): - hash = get_md5(filepath) + filehash = get_md5(filepath) self._document = document page_cache = self._document.get_page_cache() page_cache.connect('page-changed', self._page_changed_cb) self._update_nav_buttons() self._update_toc() - self._sidebar.set_bookmarkmanager(hash) + self._sidebar.set_bookmarkmanager(filehash) def _num_page_entry_insert_text_cb(self, entry, text, length, position): if not re.match('[0-9]', text): |