[evince] Fill links page labels for the index in the links thread
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince] Fill links page labels for the index in the links thread
- Date: Sun, 5 Sep 2010 09:42:25 +0000 (UTC)
commit b6f2f6c391fa83cb9532e98f561057f022522147
Author: Carlos Garcia Campos <carlosgc gnome org>
Date: Sun Sep 5 11:39:16 2010 +0200
Fill links page labels for the index in the links thread
Getting the page of a named destination requires to take the doc lock,
so it might block the main thread.
libview/ev-jobs.c | 36 +++++++++++++++++++++++++++++++++++-
shell/ev-sidebar-links.c | 34 ----------------------------------
2 files changed, 35 insertions(+), 35 deletions(-)
---
diff --git a/libview/ev-jobs.c b/libview/ev-jobs.c
index 3e33886..561a0f9 100644
--- a/libview/ev-jobs.c
+++ b/libview/ev-jobs.c
@@ -332,6 +332,38 @@ ev_job_links_dispose (GObject *object)
}
static gboolean
+fill_page_labels (GtkTreeModel *tree_model,
+ GtkTreePath *path,
+ GtkTreeIter *iter,
+ EvJob *job)
+{
+ EvDocumentLinks *document_links;
+ EvLink *link;
+ gchar *page_label;
+
+ gtk_tree_model_get (tree_model, iter,
+ EV_DOCUMENT_LINKS_COLUMN_LINK, &link,
+ -1);
+
+ if (!link)
+ return FALSE;
+
+ document_links = EV_DOCUMENT_LINKS (job->document);
+ page_label = ev_document_links_get_link_page_label (document_links, link);
+ if (!page_label)
+ return FALSE;
+
+ gtk_tree_store_set (GTK_TREE_STORE (tree_model), iter,
+ EV_DOCUMENT_LINKS_COLUMN_PAGE_LABEL, page_label,
+ -1);
+
+ g_free (page_label);
+ g_object_unref (link);
+
+ return FALSE;
+}
+
+static gboolean
ev_job_links_run (EvJob *job)
{
EvJobLinks *job_links = EV_JOB_LINKS (job);
@@ -342,7 +374,9 @@ ev_job_links_run (EvJob *job)
ev_document_doc_mutex_lock ();
job_links->model = ev_document_links_get_links_model (EV_DOCUMENT_LINKS (job->document));
ev_document_doc_mutex_unlock ();
-
+
+ gtk_tree_model_foreach (job_links->model, (GtkTreeModelForeachFunc)fill_page_labels, job);
+
ev_job_succeeded (job);
return FALSE;
diff --git a/shell/ev-sidebar-links.c b/shell/ev-sidebar-links.c
index 3d6885d..6985608 100644
--- a/shell/ev-sidebar-links.c
+++ b/shell/ev-sidebar-links.c
@@ -455,38 +455,6 @@ ev_sidebar_links_init (EvSidebarLinks *ev_sidebar_links)
ev_sidebar_links_construct (ev_sidebar_links);
}
-static gboolean
-fill_page_labels (GtkTreeModel *tree_model,
- GtkTreePath *path,
- GtkTreeIter *iter,
- EvSidebarLinks *sidebar_links)
-{
- EvDocumentLinks *document_links;
- EvLink *link;
- gchar *page_label;
-
- gtk_tree_model_get (tree_model, iter,
- EV_DOCUMENT_LINKS_COLUMN_LINK, &link,
- -1);
-
- if (!link)
- return FALSE;
-
- document_links = EV_DOCUMENT_LINKS (sidebar_links->priv->document);
- page_label = ev_document_links_get_link_page_label (document_links, link);
- if (!page_label)
- return FALSE;
-
- gtk_tree_store_set (GTK_TREE_STORE (tree_model), iter,
- EV_DOCUMENT_LINKS_COLUMN_PAGE_LABEL, page_label,
- -1);
-
- g_free (page_label);
- g_object_unref (link);
-
- return FALSE;
-}
-
/* Public Functions */
GtkWidget *
@@ -653,8 +621,6 @@ job_finished_callback (EvJobLinks *job,
ev_sidebar_links_set_links_model (sidebar_links, job->model);
- gtk_tree_model_foreach (priv->model, (GtkTreeModelForeachFunc)fill_page_labels, sidebar_links);
-
gtk_tree_view_set_model (GTK_TREE_VIEW (priv->tree_view), job->model);
g_object_unref (job);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]