[evince] libview: Keep a reference of the job find instead of a pointer to the results
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince] libview: Keep a reference of the job find instead of a pointer to the results
- Date: Sun, 9 Sep 2012 09:23:53 +0000 (UTC)
commit df5c5234098ff10cfb762fd538e626a16568dfe1
Author: Carlos Garcia Campos <carlosgc gnome org>
Date: Sun Sep 9 11:20:42 2012 +0200
libview: Keep a reference of the job find instead of a pointer to the results
We still use a pointer to the results internally for backwards compatibility.
libview/ev-view-private.h | 3 ++-
libview/ev-view.c | 17 ++++++++++++++++-
2 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/libview/ev-view-private.h b/libview/ev-view-private.h
index 47c397c..e7ac522 100644
--- a/libview/ev-view-private.h
+++ b/libview/ev-view-private.h
@@ -117,7 +117,8 @@ struct _EvView {
EvDocument *document;
/* Find */
- GList **find_pages;
+ EvJobFind *find_job;
+ GList **find_pages; /* Backwards compatibility */
gint find_result;
gboolean jump_to_find_result;
gboolean highlight_find_results;
diff --git a/libview/ev-view.c b/libview/ev-view.c
index 9c9adc5..3491824 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -4588,6 +4588,8 @@ ev_view_dispose (GObject *object)
view->page_cache = NULL;
}
+ ev_view_find_cancel (view);
+
ev_view_window_children_free (view);
if (view->selection_scroll_id) {
@@ -5775,6 +5777,12 @@ find_job_updated_cb (EvJobFind *job, gint page, EvView *view)
void
ev_view_find_started (EvView *view, EvJobFind *job)
{
+ if (view->find_job == job)
+ return;
+
+ ev_view_find_cancel (view);
+ view->find_job = g_object_ref (job);
+
g_signal_connect (job, "updated", G_CALLBACK (find_job_updated_cb), view);
}
@@ -5830,7 +5838,7 @@ ev_view_find_search_changed (EvView *view)
{
/* search string has changed, focus on new search result */
view->jump_to_find_result = TRUE;
- view->find_pages = NULL;
+ ev_view_find_cancel (view);
}
void
@@ -5844,6 +5852,13 @@ void
ev_view_find_cancel (EvView *view)
{
view->find_pages = NULL;
+
+ if (!view->find_job)
+ return;
+
+ g_signal_handlers_disconnect_by_func (view->find_job, find_job_updated_cb, view);
+ g_object_unref (view->find_job);
+ view->find_job = NULL;
}
/*** Synctex ***/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]