Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/pdf
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <mpg@redhat.com>2005-06-11 14:15:42 (GMT)
committer Marco Pesenti Gritti <marco@src.gnome.org>2005-06-11 14:15:42 (GMT)
commitcbdeaed3897f8fdd01995a356c1e3a829fffbf7e (patch)
treecdecbff828fe40a30bb201cf6e883f3674b5aafc /pdf
parente1dd38e5d83e54780cdc37a02f2e3e44eee6400a (diff)
Make fonts model fill incrementally.
2005-06-11 Marco Pesenti Gritti <mpg@redhat.com> * backend/ev-document-fonts.c: (ev_document_fonts_fill_model): * backend/ev-document-fonts.h: * pdf/ev-poppler.cc: Make fonts model fill incrementally. * shell/ev-job-queue.c: (handle_job), (search_for_jobs_unlocked), (no_jobs_available_unlocked), (ev_job_queue_init), (find_queue), (ev_job_queue_remove_job): * shell/ev-jobs.c: (ev_job_fonts_init), (ev_job_fonts_class_init), (ev_job_fonts_new), (ev_job_fonts_run): * shell/ev-jobs.h: New job for fonts scanning * shell/ev-properties.c: (job_fonts_finished_cb), (fill_fonts_treeview), (setup_fonts_view), (ev_properties_new): * shell/ev-properties.h: * shell/ev-window.c: (ev_window_cmd_file_properties): Incrementally feel the treeview using the new job. Show Loading... message until scanning is completed. Hopefully I didnt break the build without the poppler patch.
Diffstat (limited to 'pdf')
-rw-r--r--pdf/ev-poppler.cc74
1 files changed, 35 insertions, 39 deletions
diff --git a/pdf/ev-poppler.cc b/pdf/ev-poppler.cc
index c65f1df..8d555af 100644
--- a/pdf/ev-poppler.cc
+++ b/pdf/ev-poppler.cc
@@ -495,58 +495,54 @@ pdf_document_security_iface_init (EvDocumentSecurityIface *iface)
iface->set_password = pdf_document_set_password;
}
-#ifdef POPPLER_FONT_INFO
-static void
-build_fonts_list (PdfDocument *pdf_document,
- GtkTreeModel *model,
- GtkTreeIter *parent,
- PopplerFontsIter *iter)
-{
- do {
- GtkTreeIter list_iter;
- PopplerIndexIter *child;
- const char *name;
-
- name = poppler_fonts_iter_get_name (iter);
- gtk_list_store_append (GTK_LIST_STORE (model), &list_iter);
- gtk_list_store_set (GTK_LIST_STORE (model), &list_iter,
- EV_DOCUMENT_FONTS_COLUMN_NAME, name,
- -1);
- } while (poppler_fonts_iter_next (iter));
-}
-#endif
-
-static GtkTreeModel *
-pdf_document_fonts_get_fonts_model (EvDocumentFonts *document_fonts)
+static gboolean
+pdf_document_fonts_fill_model (EvDocumentFonts *document_fonts,
+ GtkTreeModel *model,
+ int n_pages)
{
- PdfDocument *pdf_document = PDF_DOCUMENT (document_fonts);
- GtkTreeModel *model = NULL;
#ifdef POPPLER_FONT_INFO
+ PdfDocument *pdf_document = PDF_DOCUMENT (document_fonts);
+ PopplerFontInfo *info;
PopplerFontsIter *iter;
-#endif
+ gboolean result;
- g_return_val_if_fail (PDF_IS_DOCUMENT (document_fonts), NULL);
+ g_return_val_if_fail (PDF_IS_DOCUMENT (document_fonts), FALSE);
-#ifdef POPPLER_FONT_INFO
- iter = poppler_fonts_iter_new (pdf_document->document);
- /* Create the model iff we have items*/
- if (iter != NULL) {
-#endif
- model = (GtkTreeModel *) gtk_list_store_new (EV_DOCUMENT_FONTS_COLUMN_NUM_COLUMNS,
- G_TYPE_STRING);
-#ifdef POPPLER_FONT_INFO
- build_fonts_list (pdf_document, model, NULL, iter);
+ info = (PopplerFontInfo *)g_object_get_data (G_OBJECT (model), "font_info");
+ if (info == NULL) {
+ info = poppler_font_info_new (pdf_document->document);
+ g_object_set_data_full (G_OBJECT (model), "font_info",
+ (PopplerFontInfo *)info,
+ (GDestroyNotify)poppler_font_info_free);
+ }
+
+ result = poppler_font_info_scan (info, n_pages, &iter);
+
+ if (iter) {
+ do {
+ GtkTreeIter list_iter;
+ PopplerIndexIter *child;
+ const char *name;
+
+ name = poppler_fonts_iter_get_name (iter);
+ gtk_list_store_append (GTK_LIST_STORE (model), &list_iter);
+ gtk_list_store_set (GTK_LIST_STORE (model), &list_iter,
+ EV_DOCUMENT_FONTS_COLUMN_NAME, name,
+ -1);
+ } while (poppler_fonts_iter_next (iter));
poppler_fonts_iter_free (iter);
}
-#endif
- return model;
+ return result;
+#else
+ return FALSE;
+#endif
}
static void
pdf_document_document_fonts_iface_init (EvDocumentFontsIface *iface)
{
- iface->get_fonts_model = pdf_document_fonts_get_fonts_model;
+ iface->fill_model = pdf_document_fonts_fill_model;
}
static gboolean