diff options
author | Gonzalo Odiard <godiard@gmail.com> | 2012-09-27 15:07:53 (GMT) |
---|---|---|
committer | Gonzalo Odiard <godiard@gmail.com> | 2012-09-27 15:07:53 (GMT) |
commit | 502990fcb8c319deca057e545b8db50d45874d5b (patch) | |
tree | 49e452b066c5c06722741a4aeb0480e3d4541467 /epubview | |
parent | d65364368002663ad89a7c6a02e51afa16cbf01b (diff) |
Fix crash in search with epub files - part of SL #3924
This patch also highligth the results as in Browse.
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Diffstat (limited to 'epubview')
-rw-r--r-- | epubview/epubview.py | 11 | ||||
-rw-r--r-- | epubview/jobs.py | 7 |
2 files changed, 9 insertions, 9 deletions
diff --git a/epubview/epubview.py b/epubview/epubview.py index a441d55..a3c2bc7 100644 --- a/epubview/epubview.py +++ b/epubview/epubview.py @@ -338,7 +338,6 @@ class _View(Gtk.HBox): Highlights the next matching item for current search ''' self._view.grab_focus() - self._view.grab_default() if self._view.search_text(self._findjob.get_search_text(), self._findjob.get_case_sensitive(), @@ -356,7 +355,6 @@ class _View(Gtk.HBox): Highlights the previous matching item for current search ''' self._view.grab_focus() - self._view.grab_default() if self._view.search_text(self._findjob.get_search_text(), self._findjob.get_case_sensitive(), @@ -371,10 +369,16 @@ class _View(Gtk.HBox): def _find_changed(self, job): self._view.grab_focus() - self._view.grab_default() self._findjob = job + self._mark_found_text() self.find_next() + def _mark_found_text(self): + self._view.unmark_text_matches() + self._view.mark_text_matches(self._findjob.get_search_text(), + case_sensitive=self._findjob.get_case_sensitive(), limit=0) + self._view.set_highlight_text_matches(True) + def __set_zoom(self, value): self._view.set_zoom_level(value) self.scale = value @@ -445,6 +449,7 @@ class _View(Gtk.HBox): self._view.add_bottom_padding(extra) if self.__in_search: + self._mark_found_text() self._view.search_text(self._findjob.get_search_text(), \ self._findjob.get_case_sensitive(), \ self.__search_fwd, False) diff --git a/epubview/jobs.py b/epubview/jobs.py index 96a7e22..cf99f90 100644 --- a/epubview/jobs.py +++ b/epubview/jobs.py @@ -18,10 +18,8 @@ from gi.repository import GObject from gi.repository import Gtk -from gi.repository import Gdk import widgets import cairo - import math import os.path import BeautifulSoup @@ -61,10 +59,8 @@ class SearchThread(threading.Thread): self.obj._matchfilelist.append(entry) f.close() - Gdk.threads_enter() self.obj._finished = True - self.obj.emit('updated') - Gdk.threads_leave() + GObject.idle_add(self.obj.emit, 'updated') return False @@ -255,7 +251,6 @@ class _JobFind(GObject.GObject): def __init__(self, document, start_page, n_pages, text, case_sensitive=False): GObject.GObject.__init__(self) - Gdk.threads_init() self._finished = False self._document = document |