]> www.fi.muni.cz Git - evince.git/commitdiff
Separate scan and fill so that we can incrementally fill from the main
authorMarco Pesenti Gritti <mpg@redhat.com>
Mon, 13 Jun 2005 18:45:06 +0000 (18:45 +0000)
committerMarco Pesenti Gritti <marco@src.gnome.org>
Mon, 13 Jun 2005 18:45:06 +0000 (18:45 +0000)
2005-06-13  Marco Pesenti Gritti <mpg@redhat.com>

        * backend/ev-document-fonts.c: (ev_document_fonts_get_progress),
        (ev_document_fonts_scan), (ev_document_fonts_fill_model):
        * backend/ev-document-fonts.h:

        Separate scan and fill so that we can incrementally fill from
        the main thread. Add a progress api.

        * data/evince-properties.glade:
        * pdf/ev-poppler.cc:
        * shell/ev-jobs.c: (ev_job_fonts_new), (ev_job_fonts_run):
        * shell/ev-jobs.h:
        * shell/ev-properties.c: (update_progress_label),
        (job_fonts_finished_cb), (setup_fonts_view):

        Incrementally feel the list and show the progress
        percentage in a label like acrobat does.

ChangeLog
backend/ev-document-fonts.c
backend/ev-document-fonts.h
data/evince-properties.glade
pdf/ev-poppler.cc
shell/ev-jobs.c
shell/ev-jobs.h
shell/ev-properties.c

index b446f7869546231c40b09fe1e9d0821bf274a09e..f2a3b7d8878d874b1ca78051af9d8fc65de0b75b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2005-06-13  Marco Pesenti Gritti <mpg@redhat.com>
+
+       * backend/ev-document-fonts.c: (ev_document_fonts_get_progress),
+       (ev_document_fonts_scan), (ev_document_fonts_fill_model):
+       * backend/ev-document-fonts.h:
+
+       Separate scan and fill so that we can incrementally fill from
+       the main thread. Add a progress api.
+
+       * data/evince-properties.glade:
+       * pdf/ev-poppler.cc:
+       * shell/ev-jobs.c: (ev_job_fonts_new), (ev_job_fonts_run):
+       * shell/ev-jobs.h:
+       * shell/ev-properties.c: (update_progress_label),
+       (job_fonts_finished_cb), (setup_fonts_view):
+
+       Incrementally feel the list and show the progress
+       percentage in a label like acrobat does.
+
+       You are going to need poppler cvs
+
 2005-06-11  Marco Pesenti Gritti <mpg@redhat.com>
 
        * backend/ev-document-fonts.c: (ev_document_fonts_fill_model):
index cd53d1e9a538696f24d0a951277957c78d2fb4d9..854383dd9ef31600f90ae1a3f9289523f946cfa7 100644 (file)
@@ -47,12 +47,28 @@ ev_document_fonts_get_type (void)
        return type;
 }
 
+double
+ev_document_fonts_get_progress (EvDocumentFonts *document_fonts)
+{
+       EvDocumentFontsIface *iface = EV_DOCUMENT_FONTS_GET_IFACE (document_fonts);
+
+       return iface->get_progress (document_fonts);
+}
+
 gboolean
+ev_document_fonts_scan (EvDocumentFonts *document_fonts,
+                       int              n_pages)
+{
+       EvDocumentFontsIface *iface = EV_DOCUMENT_FONTS_GET_IFACE (document_fonts);
+
+       return iface->scan (document_fonts, n_pages);
+}
+
+void
 ev_document_fonts_fill_model (EvDocumentFonts *document_fonts,
-                             GtkTreeModel    *model,
-                             int              n_pages)
+                             GtkTreeModel    *model)
 {
        EvDocumentFontsIface *iface = EV_DOCUMENT_FONTS_GET_IFACE (document_fonts);
 
-       return iface->fill_model (document_fonts, model, n_pages);
+       iface->fill_model (document_fonts, model);
 }
index 2a05e7eea15f734797a9311145dbcc70cb1a9b6b..d069b9d83519bdf9445b8bca9c3ecf2022a23666 100644 (file)
@@ -53,16 +53,20 @@ struct _EvDocumentFontsIface
 {
        GTypeInterface base_iface;
 
-       /* Methods  */
-       gboolean (* fill_model) (EvDocumentFonts *document_fonts,
-                                GtkTreeModel    *model,
-                                int              n_pages);
+       /* Methods */
+       gboolean (* scan)         (EvDocumentFonts *document_fonts,
+                                  int              n_pages);
+       double   (* get_progress) (EvDocumentFonts *document_fonts);
+       void     (* fill_model)   (EvDocumentFonts *document_fonts,
+                                  GtkTreeModel    *model);
 };
 
-GType     ev_document_fonts_get_type   (void);
-gboolean  ev_document_fonts_fill_model (EvDocumentFonts *document_fonts,
-                                       GtkTreeModel    *model,
-                                       int              n_pages);
+GType     ev_document_fonts_get_type     (void);
+gboolean  ev_document_fonts_scan         (EvDocumentFonts *document_fonts,
+                                         int              n_pages);
+double   ev_document_fonts_get_progress (EvDocumentFonts *document_fonts);
+void      ev_document_fonts_fill_model   (EvDocumentFonts *document_fonts,
+                                         GtkTreeModel    *model);
 
 G_END_DECLS
 
index a6727163deb58667933b605757bb8ab5d99ef753..837ecd5a7e45b59fb2e62034ff0779a3dcd2f899 100644 (file)
@@ -16,7 +16,6 @@
   <property name="skip_pager_hint">False</property>
   <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
   <property name="gravity">GDK_GRAVITY_CENTER</property>
-  <property name="focus_on_map">True</property>
   <property name="has_separator">False</property>
 
   <child internal-child="vbox">
                  <property name="yalign">0.5</property>
                  <property name="xpad">0</property>
                  <property name="ypad">0</property>
-                 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-                 <property name="width_chars">-1</property>
-                 <property name="single_line_mode">False</property>
-                 <property name="angle">0</property>
                </widget>
                <packing>
                  <property name="left_attach">0</property>
                  <property name="yalign">0.5</property>
                  <property name="xpad">0</property>
                  <property name="ypad">0</property>
-                 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-                 <property name="width_chars">-1</property>
-                 <property name="single_line_mode">False</property>
-                 <property name="angle">0</property>
                </widget>
                <packing>
                  <property name="left_attach">0</property>
                  <property name="yalign">0.5</property>
                  <property name="xpad">0</property>
                  <property name="ypad">0</property>
-                 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-                 <property name="width_chars">-1</property>
-                 <property name="single_line_mode">False</property>
-                 <property name="angle">0</property>
                </widget>
                <packing>
                  <property name="left_attach">0</property>
                  <property name="yalign">0.5</property>
                  <property name="xpad">0</property>
                  <property name="ypad">0</property>
-                 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-                 <property name="width_chars">-1</property>
-                 <property name="single_line_mode">False</property>
-                 <property name="angle">0</property>
                </widget>
                <packing>
                  <property name="left_attach">0</property>
                  <property name="yalign">0.5</property>
                  <property name="xpad">0</property>
                  <property name="ypad">0</property>
-                 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-                 <property name="width_chars">-1</property>
-                 <property name="single_line_mode">False</property>
-                 <property name="angle">0</property>
                </widget>
                <packing>
                  <property name="left_attach">0</property>
                  <property name="yalign">0.5</property>
                  <property name="xpad">0</property>
                  <property name="ypad">0</property>
-                 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-                 <property name="width_chars">-1</property>
-                 <property name="single_line_mode">False</property>
-                 <property name="angle">0</property>
                </widget>
                <packing>
                  <property name="left_attach">0</property>
                  <property name="yalign">0.5</property>
                  <property name="xpad">0</property>
                  <property name="ypad">0</property>
-                 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-                 <property name="width_chars">-1</property>
-                 <property name="single_line_mode">False</property>
-                 <property name="angle">0</property>
                </widget>
                <packing>
                  <property name="left_attach">0</property>
                  <property name="yalign">0.5</property>
                  <property name="xpad">0</property>
                  <property name="ypad">0</property>
-                 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-                 <property name="width_chars">-1</property>
-                 <property name="single_line_mode">False</property>
-                 <property name="angle">0</property>
                </widget>
                <packing>
                  <property name="left_attach">0</property>
                  <property name="yalign">0.5</property>
                  <property name="xpad">0</property>
                  <property name="ypad">0</property>
-                 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-                 <property name="width_chars">-1</property>
-                 <property name="single_line_mode">False</property>
-                 <property name="angle">0</property>
                </widget>
                <packing>
                  <property name="left_attach">0</property>
                  <property name="yalign">0.5</property>
                  <property name="xpad">0</property>
                  <property name="ypad">0</property>
-                 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-                 <property name="width_chars">-1</property>
-                 <property name="single_line_mode">False</property>
-                 <property name="angle">0</property>
                </widget>
                <packing>
                  <property name="left_attach">0</property>
                  <property name="yalign">0.5</property>
                  <property name="xpad">0</property>
                  <property name="ypad">0</property>
-                 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-                 <property name="width_chars">-1</property>
-                 <property name="single_line_mode">False</property>
-                 <property name="angle">0</property>
                </widget>
                <packing>
                  <property name="left_attach">0</property>
                  <property name="yalign">0.5</property>
                  <property name="xpad">0</property>
                  <property name="ypad">0</property>
-                 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-                 <property name="width_chars">-1</property>
-                 <property name="single_line_mode">False</property>
-                 <property name="angle">0</property>
                </widget>
                <packing>
                  <property name="left_attach">0</property>
                  <property name="yalign">0.5</property>
                  <property name="xpad">0</property>
                  <property name="ypad">0</property>
-                 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-                 <property name="width_chars">-1</property>
-                 <property name="single_line_mode">False</property>
-                 <property name="angle">0</property>
                </widget>
                <packing>
                  <property name="left_attach">1</property>
                  <property name="yalign">0.5</property>
                  <property name="xpad">0</property>
                  <property name="ypad">0</property>
-                 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-                 <property name="width_chars">-1</property>
-                 <property name="single_line_mode">False</property>
-                 <property name="angle">0</property>
                </widget>
                <packing>
                  <property name="left_attach">1</property>
                  <property name="yalign">0.5</property>
                  <property name="xpad">0</property>
                  <property name="ypad">0</property>
-                 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-                 <property name="width_chars">-1</property>
-                 <property name="single_line_mode">False</property>
-                 <property name="angle">0</property>
                </widget>
                <packing>
                  <property name="left_attach">1</property>
                  <property name="yalign">0.5</property>
                  <property name="xpad">0</property>
                  <property name="ypad">0</property>
-                 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-                 <property name="width_chars">-1</property>
-                 <property name="single_line_mode">False</property>
-                 <property name="angle">0</property>
                </widget>
                <packing>
                  <property name="left_attach">1</property>
                  <property name="yalign">0.5</property>
                  <property name="xpad">0</property>
                  <property name="ypad">0</property>
-                 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-                 <property name="width_chars">-1</property>
-                 <property name="single_line_mode">False</property>
-                 <property name="angle">0</property>
                </widget>
                <packing>
                  <property name="left_attach">1</property>
                  <property name="yalign">0.5</property>
                  <property name="xpad">0</property>
                  <property name="ypad">0</property>
-                 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-                 <property name="width_chars">-1</property>
-                 <property name="single_line_mode">False</property>
-                 <property name="angle">0</property>
                </widget>
                <packing>
                  <property name="left_attach">1</property>
                  <property name="yalign">0.5</property>
                  <property name="xpad">0</property>
                  <property name="ypad">0</property>
-                 <property name="ellipsize">PANGO_ELLIPSIZE_END</property>
-                 <property name="width_chars">-1</property>
-                 <property name="single_line_mode">False</property>
-                 <property name="angle">0</property>
                </widget>
                <packing>
                  <property name="left_attach">1</property>
                  <property name="yalign">0.5</property>
                  <property name="xpad">0</property>
                  <property name="ypad">0</property>
-                 <property name="ellipsize">PANGO_ELLIPSIZE_END</property>
-                 <property name="width_chars">-1</property>
-                 <property name="single_line_mode">False</property>
-                 <property name="angle">0</property>
                </widget>
                <packing>
                  <property name="left_attach">1</property>
                  <property name="yalign">0.5</property>
                  <property name="xpad">0</property>
                  <property name="ypad">0</property>
-                 <property name="ellipsize">PANGO_ELLIPSIZE_END</property>
-                 <property name="width_chars">-1</property>
-                 <property name="single_line_mode">False</property>
-                 <property name="angle">0</property>
                </widget>
                <packing>
                  <property name="left_attach">1</property>
                  <property name="yalign">0.5</property>
                  <property name="xpad">0</property>
                  <property name="ypad">0</property>
-                 <property name="ellipsize">PANGO_ELLIPSIZE_END</property>
-                 <property name="width_chars">-1</property>
-                 <property name="single_line_mode">False</property>
-                 <property name="angle">0</property>
                </widget>
                <packing>
                  <property name="left_attach">1</property>
                  <property name="yalign">0.5</property>
                  <property name="xpad">0</property>
                  <property name="ypad">0</property>
-                 <property name="ellipsize">PANGO_ELLIPSIZE_END</property>
-                 <property name="width_chars">-1</property>
-                 <property name="single_line_mode">False</property>
-                 <property name="angle">0</property>
                </widget>
                <packing>
                  <property name="left_attach">1</property>
                  <property name="yalign">0.5</property>
                  <property name="xpad">0</property>
                  <property name="ypad">0</property>
-                 <property name="ellipsize">PANGO_ELLIPSIZE_END</property>
-                 <property name="width_chars">-1</property>
-                 <property name="single_line_mode">False</property>
-                 <property name="angle">0</property>
                </widget>
                <packing>
                  <property name="left_attach">1</property>
              <property name="yalign">0.5</property>
              <property name="xpad">0</property>
              <property name="ypad">0</property>
-             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-             <property name="width_chars">-1</property>
-             <property name="single_line_mode">False</property>
-             <property name="angle">0</property>
            </widget>
            <packing>
              <property name="type">tab</property>
              <property name="border_width">12</property>
              <property name="visible">True</property>
              <property name="homogeneous">False</property>
-             <property name="spacing">0</property>
+             <property name="spacing">6</property>
 
              <child>
                <widget class="GtkScrolledWindow" id="scrolledwindow1">
                    <widget class="GtkTreeView" id="fonts_treeview">
                      <property name="visible">True</property>
                      <property name="can_focus">True</property>
-                     <property name="headers_visible">True</property>
+                     <property name="headers_visible">False</property>
                      <property name="rules_hint">False</property>
                      <property name="reorderable">False</property>
                      <property name="enable_search">True</property>
-                     <property name="fixed_height_mode">False</property>
-                     <property name="hover_selection">False</property>
-                     <property name="hover_expand">False</property>
                    </widget>
                  </child>
                </widget>
                  <property name="fill">True</property>
                </packing>
              </child>
+
+             <child>
+               <widget class="GtkLabel" id="font_progress_label">
+                 <property name="visible">True</property>
+                 <property name="label" translatable="yes"></property>
+                 <property name="use_underline">False</property>
+                 <property name="use_markup">False</property>
+                 <property name="justify">GTK_JUSTIFY_LEFT</property>
+                 <property name="wrap">False</property>
+                 <property name="selectable">False</property>
+                 <property name="xalign">0</property>
+                 <property name="yalign">0.5</property>
+                 <property name="xpad">0</property>
+                 <property name="ypad">0</property>
+               </widget>
+               <packing>
+                 <property name="padding">0</property>
+                 <property name="expand">False</property>
+                 <property name="fill">False</property>
+               </packing>
+             </child>
            </widget>
            <packing>
              <property name="tab_expand">False</property>
              <property name="yalign">0.5</property>
              <property name="xpad">0</property>
              <property name="ypad">0</property>
-             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-             <property name="width_chars">-1</property>
-             <property name="single_line_mode">False</property>
-             <property name="angle">0</property>
            </widget>
            <packing>
              <property name="type">tab</property>
index 8d555affd66d56f27d53c7a364fd5059942ce17a..7c60d9cff351c7350f922903436d1d744e6d0e34 100644 (file)
@@ -56,6 +56,10 @@ struct _PdfDocument
        PopplerPSFile *ps_file;
        gchar *password;
 
+       PopplerFontInfo *font_info;
+       PopplerFontsIter *fonts_iter;
+       int fonts_scanned_pages;
+
        PdfDocumentSearch *search;
 };
 
@@ -100,6 +104,14 @@ pdf_document_dispose (GObject *object)
        if (pdf_document->document) {
                g_object_unref (pdf_document->document);
        }
+
+       if (pdf_document->font_info) { 
+               poppler_font_info_free (pdf_document->font_info);
+       }
+
+       if (pdf_document->fonts_iter) {
+               poppler_fonts_iter_free (pdf_document->fonts_iter);
+       }
 }
 
 static void
@@ -495,28 +507,55 @@ pdf_document_security_iface_init (EvDocumentSecurityIface *iface)
        iface->set_password = pdf_document_set_password;
 }
 
+static gdouble
+pdf_document_fonts_get_progress (EvDocumentFonts *document_fonts)
+{
+       PdfDocument *pdf_document = PDF_DOCUMENT (document_fonts);
+       int n_pages;
+
+        n_pages = pdf_document_get_n_pages (EV_DOCUMENT (pdf_document));
+
+       return (double)pdf_document->fonts_scanned_pages / (double)n_pages;
+}
+
 static gboolean
-pdf_document_fonts_fill_model (EvDocumentFonts *document_fonts,
-                              GtkTreeModel    *model,
-                              int              n_pages)
+pdf_document_fonts_scan (EvDocumentFonts *document_fonts,
+                        int              n_pages)
 {
-#ifdef POPPLER_FONT_INFO
        PdfDocument *pdf_document = PDF_DOCUMENT (document_fonts);
-       PopplerFontInfo *info;
-       PopplerFontsIter *iter;
        gboolean result;
 
        g_return_val_if_fail (PDF_IS_DOCUMENT (document_fonts), FALSE);
 
-       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);
+       if (pdf_document->font_info == NULL) { 
+               pdf_document->font_info = poppler_font_info_new (pdf_document->document);
+       }
+
+       if (pdf_document->fonts_iter) {
+               poppler_fonts_iter_free (pdf_document->fonts_iter);
        }
 
-       result = poppler_font_info_scan (info, n_pages, &iter);
+       pdf_document->fonts_scanned_pages += n_pages;
+
+       result = poppler_font_info_scan (pdf_document->font_info, n_pages,
+                                        &pdf_document->fonts_iter);
+       if (!result) {
+               pdf_document->fonts_scanned_pages = 0;
+               poppler_font_info_free (pdf_document->font_info);
+               pdf_document->font_info = NULL; 
+       }
+
+       return result;
+}
+
+static void
+pdf_document_fonts_fill_model (EvDocumentFonts *document_fonts,
+                              GtkTreeModel    *model)
+{
+       PdfDocument *pdf_document = PDF_DOCUMENT (document_fonts);
+       PopplerFontsIter *iter = pdf_document->fonts_iter;
+
+       g_return_if_fail (PDF_IS_DOCUMENT (document_fonts));
 
        if (iter) {
                do {
@@ -530,19 +569,15 @@ pdf_document_fonts_fill_model (EvDocumentFonts *document_fonts,
                                            EV_DOCUMENT_FONTS_COLUMN_NAME, name,
                                            -1);
                } while (poppler_fonts_iter_next (iter));
-               poppler_fonts_iter_free (iter);
        }
-
-       return result;
-#else
-       return FALSE;
-#endif
 }
 
 static void
 pdf_document_document_fonts_iface_init (EvDocumentFontsIface *iface)
 {
        iface->fill_model = pdf_document_fonts_fill_model;
+       iface->scan = pdf_document_fonts_scan;
+       iface->get_progress = pdf_document_fonts_get_progress;
 }
 
 static gboolean
index 82f310f407acfb9f54d9c237e19bc1e670a1cd3a..20ebf856c33285a4b12f76f676ff9fbf8ee3addf 100644 (file)
@@ -347,15 +347,13 @@ static void ev_job_fonts_init (EvJobFonts *job) { /* Do Nothing */ }
 static void ev_job_fonts_class_init (EvJobFontsClass *class) { /* Do Nothing */ }
 
 EvJob *
-ev_job_fonts_new (EvDocument   *document,
-                 GtkTreeModel *model)
+ev_job_fonts_new (EvDocument *document)
 {
        EvJobFonts *job;
 
        job = g_object_new (EV_TYPE_JOB_FONTS, NULL);
 
        EV_JOB (job)->document = g_object_ref (document);
-       job->model = g_object_ref (model);
 
        return EV_JOB (job);
 }
@@ -370,7 +368,7 @@ ev_job_fonts_run (EvJobFonts *job)
        ev_document_doc_mutex_lock ();
        
        fonts = EV_DOCUMENT_FONTS (EV_JOB (job)->document);
-       job->scan_completed = !ev_document_fonts_fill_model (fonts, job->model, 20);
+       job->scan_completed = !ev_document_fonts_scan (fonts, 20);
        
        EV_JOB (job)->finished = TRUE;
 
index d585d86776b19f4d4182aeee3f78b7df63618f81..900d040566cf398efec8094a3795dd6843153145 100644 (file)
@@ -152,7 +152,6 @@ struct _EvJobLoadClass
 struct _EvJobFonts
 {
        EvJob parent;
-       GtkTreeModel *model;
        gboolean scan_completed;
 };
 
@@ -195,8 +194,7 @@ void                ev_job_load_run           (EvJobLoad       *load);
 
 /* EvJobFonts */
 GType          ev_job_fonts_get_type     (void);
-EvJob         *ev_job_fonts_new          (EvDocument      *document,
-                                          GtkTreeModel    *model);
+EvJob         *ev_job_fonts_new          (EvDocument      *document);
 void           ev_job_fonts_run          (EvJobFonts      *fonts);
 
 G_END_DECLS
index 6007f134c671e39f06d191a762e9733d09958885..e8eca8f48d5539e610afe52a295073ce16e256e0 100644 (file)
@@ -105,62 +105,61 @@ set_property (GladeXML *xml, Property property, const char *text)
        gtk_label_set_text (GTK_LABEL (widget), text ? text : "");
 }
 
+static void
+update_progress_label (GtkWidget *label, double progress)
+{
+       if (progress > 0) {
+               char *progress_text;
+               progress_text = g_strdup_printf (_("Gathering font information... %3d%%"),
+                                                (int) (progress * 100));
+               gtk_label_set_text (GTK_LABEL (label), progress_text);
+               g_free (progress_text);
+       } else {
+               gtk_label_set_text (GTK_LABEL (label), "");
+       }
+}
+
 static void
 job_fonts_finished_cb (EvJob *job, GtkTreeView *tree_view)
 {
-       GtkTreeModel *model = EV_JOB_FONTS (job)->model;
+       EvDocumentFonts *document_fonts = EV_DOCUMENT_FONTS (job->document);
+       GtkWidget *progress_label;
+       double progress;
+
+       progress_label = g_object_get_data (G_OBJECT (tree_view), "progress_label");
+       progress = ev_document_fonts_get_progress (document_fonts);
+       update_progress_label (progress_label, progress);
 
        if (EV_JOB_FONTS (job)->scan_completed) {
                g_signal_handlers_disconnect_by_func
                                (job, job_fonts_finished_cb, tree_view);
-               gtk_tree_view_set_model (tree_view, model);
        } else {
-               EvJob *new_job = ev_job_fonts_new (job->document, model);
+               EvJob *new_job;
+
+               ev_document_fonts_fill_model (document_fonts,
+                                             gtk_tree_view_get_model (tree_view));
+               new_job = ev_job_fonts_new (job->document);
                ev_job_queue_add_job (job, EV_JOB_PRIORITY_LOW);
                g_object_unref (new_job);
        }
 }
 
-static void
-fill_fonts_treeview (GtkTreeView  *tree_view,
-                    EvDocument   *document)
-{
-       GtkListStore *list_store;
-       EvJob *job;
-
-       list_store = gtk_list_store_new (NUM_COLS, G_TYPE_STRING);
-       g_object_set_data_full (G_OBJECT (tree_view), "list_store",
-                               list_store, g_object_unref);
-
-       job = ev_job_fonts_new (document, GTK_TREE_MODEL (list_store));
-       g_signal_connect_object (job, "finished",
-                                G_CALLBACK (job_fonts_finished_cb),
-                                tree_view, 0);
-       ev_job_queue_add_job (job, EV_JOB_PRIORITY_LOW);
-       g_object_unref (job);
-}
-
 static void
 setup_fonts_view (GladeXML *xml, EvDocument *document)
 {
-       GtkWidget *widget;
        GtkCellRenderer *renderer;
        GtkTreeViewColumn *column;
        GtkListStore *list_store;
-       GtkTreeIter iter;
-
-       widget = glade_xml_get_widget (xml, "fonts_treeview");
-
-       list_store = gtk_list_store_new (NUM_COLS, G_TYPE_STRING);
-       gtk_list_store_append (list_store, &iter);
-       gtk_list_store_set (list_store, &iter, FONT_NAME_COL,  _("Loading..."), -1);
+       EvJob *job;
+       GtkWidget *tree_view;
+       GtkWidget *progress_label;
 
-       gtk_tree_view_set_model (GTK_TREE_VIEW (widget), GTK_TREE_MODEL (list_store));
-       g_object_unref (list_store);
+       tree_view = glade_xml_get_widget (xml, "fonts_treeview");
+       progress_label = glade_xml_get_widget (xml, "font_progress_label");
 
        column = gtk_tree_view_column_new ();
        gtk_tree_view_column_set_expand (GTK_TREE_VIEW_COLUMN (column), TRUE);
-       gtk_tree_view_append_column (GTK_TREE_VIEW (widget), column);
+       gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
 
        renderer = gtk_cell_renderer_text_new ();
        gtk_tree_view_column_pack_start (GTK_TREE_VIEW_COLUMN (column), renderer, FALSE);
@@ -169,7 +168,18 @@ setup_fonts_view (GladeXML *xml, EvDocument *document)
                                             "text", EV_DOCUMENT_FONTS_COLUMN_NAME,
                                             NULL);
 
-       fill_fonts_treeview (GTK_TREE_VIEW (widget), document);
+       list_store = gtk_list_store_new (NUM_COLS, G_TYPE_STRING);
+       gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view),
+                                GTK_TREE_MODEL (list_store));
+
+       job = ev_job_fonts_new (document);
+       g_object_set_data (G_OBJECT (tree_view), "progress_label",
+                          progress_label);
+       g_signal_connect_object (job, "finished",
+                                G_CALLBACK (job_fonts_finished_cb),
+                                tree_view, 0);
+       ev_job_queue_add_job (job, EV_JOB_PRIORITY_LOW);
+       g_object_unref (job);
 }
 
 GtkDialog *