]> www.fi.muni.cz Git - evince.git/commitdiff
actually remove the job.
authorJonathan Blandford <jrb@redhat.com>
Fri, 22 Apr 2005 03:39:52 +0000 (03:39 +0000)
committerJonathan Blandford <jrb@src.gnome.org>
Fri, 22 Apr 2005 03:39:52 +0000 (03:39 +0000)
Thu Apr 21 23:37:52 2005  Jonathan Blandford  <jrb@redhat.com>

        * shell/ev-pixbuf-cache.c (dispose_cache_job_info): actually
        remove the job.

        * backend/ev-document.h: Remove EV_DOC_MUTEX in favor of a locking
        function.  This helps debugging.

12 files changed:
ChangeLog
backend/ev-document.c
backend/ev-document.h
backend/ev-jobs.c
backend/ev-page-cache.c
djvu/djvu-document.c
pdf/ev-poppler.cc
shell/ev-pixbuf-cache.c
shell/ev-print-job.c
shell/ev-sidebar-thumbnails.c
shell/ev-view.c
shell/ev-window.c

index 828940012274c2a19c0194777e727e8d86ab92aa..11cf2667e21e25ee32392a1a7d57950d7d57e69e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Thu Apr 21 23:37:52 2005  Jonathan Blandford  <jrb@redhat.com>
+
+       * shell/ev-pixbuf-cache.c (dispose_cache_job_info): actually
+       remove the job.
+
+       * backend/ev-document.h: Remove EV_DOC_MUTEX in favor of a locking
+       function.  This helps debugging.
+
 2005-04-21  Nickolay V. Shmyrev  <nshmyrev@yandex.ru>
 
        * djvu/djvu-document.c: (djvu_document_class_init),
index 5df6e69ba7fe7ee6a2ec591f8221e787d73400ef..1b2f778181a070bc4d346b7dfde4fd0165fa05ac 100644 (file)
@@ -96,6 +96,19 @@ ev_document_get_doc_mutex (void)
        return ev_doc_mutex;
 }
 
+void
+ev_document_doc_mutex_lock (void)
+{
+       g_mutex_lock (ev_document_get_doc_mutex ());
+}
+
+void
+ev_document_doc_mutex_unlock (void)
+{
+       g_mutex_unlock (ev_document_get_doc_mutex ());
+}
+
+
 
 gboolean
 ev_document_load (EvDocument  *document,
index 47a91eef79622cbe3f12bd7be4bf3c38620d84bf..da38283263abb8b8a3ee00429037d517c12c7803 100644 (file)
@@ -47,7 +47,8 @@ typedef struct _EvPageCacheClass  EvPageCacheClass;
 
 
 #define EV_DOCUMENT_ERROR ev_document_error_quark ()
-#define EV_DOC_MUTEX (ev_document_get_doc_mutex ())
+#define EV_DOC_MUTEX_LOCK (ev_document_doc_mutex_lock ())
+#define EV_DOC_MUTEX_UNLOCK (ev_document_doc_mutex_unlock ())
 
 typedef enum
 {
@@ -96,6 +97,8 @@ GType         ev_document_get_type       (void);
 GQuark         ev_document_error_quark    (void);
 EvPageCache    *ev_document_get_page_cache (EvDocument     *document);
 GMutex        *ev_document_get_doc_mutex  (void);
+void            ev_document_doc_mutex_lock (void);
+void            ev_document_doc_mutex_unlock (void);
 EvDocumentInfo *ev_document_get_info      (EvDocument     *document);
 gboolean       ev_document_load           (EvDocument     *document,
                                            const char     *uri,
index 0a5f69fe5d220e373252c3368a5fb77530d5bb6a..c4556c95a8f506409e107e1b83860982e2c35953 100644 (file)
@@ -170,10 +170,10 @@ ev_job_links_run (EvJobLinks *job)
 {
        g_return_if_fail (EV_IS_JOB_LINKS (job));
 
-       g_mutex_lock (EV_DOC_MUTEX);
+       ev_document_doc_mutex_lock ();
        job->model = ev_document_links_get_links_model (EV_DOCUMENT_LINKS (EV_JOB (job)->document));
        EV_JOB (job)->finished = TRUE;
-       g_mutex_unlock (EV_DOC_MUTEX);
+       ev_document_doc_mutex_unlock ();
 }
 
 
@@ -204,7 +204,7 @@ ev_job_render_run (EvJobRender *job)
 {
        g_return_if_fail (EV_IS_JOB_RENDER (job));
 
-       g_mutex_lock (EV_DOC_MUTEX);
+       ev_document_doc_mutex_lock ();
 
        job->pixbuf = ev_document_render_pixbuf (EV_JOB (job)->document,
                                                 job->page,
@@ -212,8 +212,7 @@ ev_job_render_run (EvJobRender *job)
        if (job->include_links)
                job->link_mapping = ev_document_get_links (EV_JOB (job)->document, job->page);
        EV_JOB (job)->finished = TRUE;
-
-       g_mutex_unlock (EV_DOC_MUTEX);
+       ev_document_doc_mutex_unlock ();
 }
 
 EvJob *
@@ -237,7 +236,7 @@ ev_job_thumbnail_run (EvJobThumbnail *job)
 {
        g_return_if_fail (EV_IS_JOB_THUMBNAIL (job));
 
-       g_mutex_lock (EV_DOC_MUTEX);
+       ev_document_doc_mutex_lock ();
 
        job->thumbnail =
                ev_document_thumbnails_get_thumbnail (EV_DOCUMENT_THUMBNAILS (EV_JOB (job)->document),
@@ -246,5 +245,5 @@ ev_job_thumbnail_run (EvJobThumbnail *job)
                                                      TRUE);
        EV_JOB (job)->finished = TRUE;
 
-       g_mutex_unlock (EV_DOC_MUTEX);
+       ev_document_doc_mutex_unlock ();
 }
index 935347e19430c9ee4e899ea68c94041a73b37a60..a6d78228b5d82d455cad9de47a1e7cd2470ad822 100644 (file)
@@ -96,7 +96,7 @@ _ev_page_cache_new (EvDocument *document)
 
        page_cache = (EvPageCache *) g_object_new (EV_TYPE_PAGE_CACHE, NULL);
 
-       g_mutex_lock (EV_DOC_MUTEX);
+       ev_document_doc_mutex_lock ();
 
        /* We read page information out of the document */
 
@@ -152,7 +152,7 @@ _ev_page_cache_new (EvDocument *document)
        if (! page_cache->uniform)
                g_assert (page_cache->size_cache != NULL);
 
-       g_mutex_unlock (EV_DOC_MUTEX);
+       ev_document_doc_mutex_unlock ();
 
        if (page_cache->n_pages > 0)
                ev_page_cache_set_current_page (page_cache, 0);
index e6a270f180602b1ef1260ae77a8e236c4844d918..72be474bf3d76e9778b3d478cd312aa2362f618a 100644 (file)
@@ -164,7 +164,7 @@ djvu_document_render_pixbuf (EvDocument  *document,
                           &rrect,
                           djvu_document->d_format,
                          gdk_pixbuf_get_rowstride (pixbuf),
-                          gdk_pixbuf_get_pixels (pixbuf));
+                          (gchar *)gdk_pixbuf_get_pixels (pixbuf));
        
     
        return pixbuf;
@@ -250,7 +250,7 @@ djvu_document_thumbnails_get_thumbnail (EvDocumentThumbnails   *document,
        GdkPixbuf *pixbuf;
        gint thumb_width, thumb_height;
 
-       gchar *pixels;
+       guchar *pixels;
        
        g_return_val_if_fail (djvu_document->d_document, NULL);
        
@@ -273,7 +273,7 @@ djvu_document_thumbnails_get_thumbnail (EvDocumentThumbnails   *document,
                                &thumb_width, &thumb_height,
                                djvu_document->d_format,
                                gdk_pixbuf_get_rowstride (pixbuf), 
-                               pixels);
+                               (gchar *)pixels);
        
        return pixbuf;
 }
index ac70a035d75aeca0f72f3439ed61dbbc9f87fbb6..d20acb04823e5106c12279c45df29846976ddf97 100644 (file)
@@ -192,7 +192,7 @@ pdf_document_get_page_label (EvDocument *document,
        poppler_page = poppler_document_get_page (PDF_DOCUMENT (document)->document,
                                                  page);
 
-       g_object_get (poppler_page,
+       g_object_get (G_OBJECT (poppler_page),
                      "label", &label,
                      NULL);
 
@@ -348,6 +348,8 @@ pdf_document_get_info (EvDocument *document)
                case POPPLER_PAGE_LAYOUT_TWO_PAGE_RIGHT:
                        info->layout = EV_DOCUMENT_LAYOUT_TWO_PAGE_RIGHT;
                        break;
+               default:
+                       break;
        }
 
        switch (mode) {
@@ -365,6 +367,8 @@ pdf_document_get_info (EvDocument *document)
                        break;
                case POPPLER_PAGE_MODE_USE_ATTACHMENTS:
                        info->mode = EV_DOCUMENT_MODE_USE_ATTACHMENTS;
+               default:
+                       break;
        }
 
        info->ui_hints = 0;
@@ -662,9 +666,9 @@ pdf_document_search_idle_callback (void *data)
        page = poppler_document_get_page (search->document->document,
                                          search->search_page);
 
-       g_mutex_lock (EV_DOC_MUTEX);
+       ev_document_doc_mutex_lock ();
        matches = poppler_page_find_text (page, search->text);
-       g_mutex_unlock (EV_DOC_MUTEX);
+       ev_document_doc_mutex_unlock ();
 
        search->pages[search->search_page] = matches;
         n_pages = pdf_document_get_n_pages (EV_DOCUMENT (search->document));
@@ -769,7 +773,6 @@ int
 pdf_document_find_get_n_results (EvDocumentFind *document_find, int page)
 {
        PdfDocumentSearch *search = PDF_DOCUMENT (document_find)->search;
-       int current_page;
 
        if (search) {
                return g_list_length (search->pages[page]);
@@ -788,7 +791,6 @@ pdf_document_find_get_result (EvDocumentFind *document_find,
        PdfDocumentSearch *search = pdf_document->search;
        PopplerPage *poppler_page;
        PopplerRectangle *r;
-       int current_page;
        double height;
 
        if (search == NULL)
index 91bd314588c2be029e837809fff8b59e7732bbd6..b5227eef8d8c95be9eff947b3aea789d8f2bfdbd 100644 (file)
@@ -119,6 +119,7 @@ dispose_cache_job_info (CacheJobInfo *job_info,
                g_signal_handlers_disconnect_by_func (job_info->job,
                                                      G_CALLBACK (job_finished_cb),
                                                      data);
+               ev_job_queue_remove_job (job_info->job);
                g_object_unref (G_OBJECT (job_info->job));
                job_info->job = NULL;
        }
index ccc07e38541bc1d448146830b810a3b619095190..70f92fd53bfa9e6d859d8510fa20209637595bdf 100644 (file)
@@ -234,10 +234,10 @@ idle_print_handler (EvPrintJob *job)
        EvPageCache *page_cache;
 
        if (!job->printing) {
-               g_mutex_lock (EV_DOC_MUTEX);
+               ev_document_doc_mutex_lock ();
                ev_ps_exporter_begin (EV_PS_EXPORTER (job->document),
                                      job->temp_file);
-               g_mutex_unlock (EV_DOC_MUTEX);
+               ev_document_doc_mutex_unlock ();
                job->next_page = 0;
                job->printing = TRUE;
                return TRUE;
@@ -248,16 +248,16 @@ idle_print_handler (EvPrintJob *job)
 #if 0
                g_printerr ("Printing page %d\n", job->next_page);
 #endif
-               g_mutex_lock (EV_DOC_MUTEX);
+               ev_document_doc_mutex_lock ();
                ev_ps_exporter_do_page (EV_PS_EXPORTER (job->document),
                                        job->next_page);
-               g_mutex_unlock (EV_DOC_MUTEX);
+               ev_document_doc_mutex_unlock ();
                job->next_page++;
                return TRUE;
        } else { /* no more pages */
-               g_mutex_lock (EV_DOC_MUTEX);
+               ev_document_doc_mutex_lock ();
                ev_ps_exporter_end (EV_PS_EXPORTER (job->document));
-               g_mutex_unlock (EV_DOC_MUTEX);
+               ev_document_doc_mutex_unlock ();
 
                close (job->fd);
                job->fd = 0;
index a22d70ebd70dd8717a91462e45eec03f66f88862..7945874b28cb1c761d66b2cc6f784f66836e244d 100644 (file)
@@ -267,10 +267,10 @@ ev_sidebar_thumbnails_set_document (EvSidebarPage *sidebar_page,
 
        /* We get the dimensions of the first doc so that we can make a blank
         * icon.  */
-       g_mutex_lock (EV_DOC_MUTEX);
+       ev_document_doc_mutex_lock ();
        ev_document_thumbnails_get_dimensions (EV_DOCUMENT_THUMBNAILS (priv->document),
                                               0, THUMBNAIL_WIDTH, &width, &height);
-       g_mutex_unlock (EV_DOC_MUTEX);
+       ev_document_doc_mutex_unlock ();
 
        loading_icon = ev_document_misc_get_thumbnail_frame (width, height, NULL);
 
index b51082f24dfde8aada92f9c383fe296bb24cfd49..cca39477c4fdb6fdce5460d7ba5bd5cad6c0ce4f 100644 (file)
@@ -537,21 +537,21 @@ highlight_find_results (EvView *view)
        g_return_if_fail (EV_IS_DOCUMENT_FIND (view->document));
 
        find = EV_DOCUMENT_FIND (view->document);
-
-       g_mutex_lock (EV_DOC_MUTEX);
+#if 0
+       ev_document_doc_mutex_lock ();
        results = ev_document_find_get_n_results (find, view->current_page);
-       g_mutex_unlock (EV_DOC_MUTEX);
-
+       ev_document_doc_mutex_unlock ();
+#endif
        for (i = 0; i < results; i++) {
                EvRectangle rectangle;
                GdkRectangle view_rectangle;
                guchar alpha;
 
                alpha = (i == view->find_result) ? 0x90 : 0x20;
-               g_mutex_lock (EV_DOC_MUTEX);
+               ev_document_doc_mutex_lock ();
                ev_document_find_get_result (find, view->current_page,
                                             i, &rectangle);
-               g_mutex_unlock (EV_DOC_MUTEX);
+               ev_document_doc_mutex_unlock ();
                doc_rect_to_view_rect (view, &rectangle, &view_rectangle);
                draw_rubberband (GTK_WIDGET (view), view->bin_window,
                                 &view_rectangle, alpha);
@@ -686,11 +686,11 @@ ev_view_copy (EvView *ev_view)
                return;
        }
 
-       g_mutex_lock (EV_DOC_MUTEX);
+       ev_document_doc_mutex_lock ();
        text = ev_document_get_text (ev_view->document,
                                     ev_view->current_page,
                                     &ev_view->selection);
-       g_mutex_unlock (EV_DOC_MUTEX);
+       ev_document_doc_mutex_unlock ();
 
        clipboard = gtk_widget_get_clipboard (GTK_WIDGET (ev_view),
                                              GDK_SELECTION_CLIPBOARD);
@@ -721,11 +721,11 @@ ev_view_primary_get_cb (GtkClipboard     *clipboard,
                return;
        }
 
-       g_mutex_lock (EV_DOC_MUTEX);
+       ev_document_doc_mutex_lock ();
        text = ev_document_get_text (ev_view->document,
                                     ev_view->current_page,
                                     &ev_view->selection);
-       g_mutex_unlock (EV_DOC_MUTEX);
+       ev_document_doc_mutex_unlock ();
        gtk_selection_data_set_text (selection_data, text, -1);
 }
 
@@ -1341,15 +1341,15 @@ update_find_status_message (EvView *view)
 {
        char *message;
 
-//     g_mutex_lock (EV_DOC_MUTEX);
+//     ev_document_doc_mutex_lock ();
        if (view->current_page == view->find_page) {
                int results;
 
-//             g_mutex_lock (EV_DOC_MUTEX);
+//             ev_document_doc_mutex_lock ();
                results = ev_document_find_get_n_results
                                (EV_DOCUMENT_FIND (view->document),
                                 view->current_page);
-//             g_mutex_unlock (EV_DOC_MUTEX);
+//             ev_document_doc_mutex_unlock ();
                /* TRANS: Sometimes this could be better translated as
                   "%d hit(s) on this page".  Therefore this string
                   contains plural cases. */
@@ -1360,10 +1360,10 @@ update_find_status_message (EvView *view)
        } else {
                double percent;
 
-               g_mutex_lock (EV_DOC_MUTEX);
+               ev_document_doc_mutex_lock ();
                percent = ev_document_find_get_progress
                                (EV_DOCUMENT_FIND (view->document));
-               g_mutex_unlock (EV_DOC_MUTEX);
+               ev_document_doc_mutex_unlock ();
                if (percent >= (1.0 - 1e-10)) {
                        message = g_strdup (_("Not found"));
                } else {
@@ -1372,7 +1372,7 @@ update_find_status_message (EvView *view)
                }
 
        }
-//     g_mutex_unlock (EV_DOC_MUTEX);
+//     ev_document_doc_mutex_unlock ();
 
        ev_view_set_find_status (view, message);
 //     g_free (message);
@@ -1420,15 +1420,15 @@ jump_to_find_result (EvView *view)
        GdkRectangle view_rect;
        int n_results;
 
-       g_mutex_lock (EV_DOC_MUTEX);
+       ev_document_doc_mutex_lock ();
        n_results = ev_document_find_get_n_results (find, view->current_page);
-       g_mutex_unlock (EV_DOC_MUTEX);
+       ev_document_doc_mutex_unlock ();
 
        if (n_results > view->find_result) {
-               g_mutex_lock (EV_DOC_MUTEX);
+               ev_document_doc_mutex_lock ();
                ev_document_find_get_result
                        (find, view->current_page, view->find_result, &rect);
-               g_mutex_unlock (EV_DOC_MUTEX);
+               ev_document_doc_mutex_unlock ();
 
                doc_rect_to_view_rect (view, &rect, &view_rect);
                ensure_rectangle_is_visible (view, &view_rect);
@@ -1451,7 +1451,7 @@ jump_to_find_page (EvView *view)
                        page = page - n_pages;
                }
 
-               //              g_mutex_lock (EV_DOC_MUTEX);
+               //              ev_document_doc_mutex_lock ();
                has_results = ev_document_find_page_has_results
                                (EV_DOCUMENT_FIND (view->document), page);
                if (has_results == -1) {
@@ -1649,9 +1649,9 @@ ev_view_can_find_next (EvView *view)
        if (EV_IS_DOCUMENT_FIND (view->document)) {
                EvDocumentFind *find = EV_DOCUMENT_FIND (view->document);
 
-               g_mutex_lock (EV_DOC_MUTEX);
+               ev_document_doc_mutex_lock ();
                n_results = ev_document_find_get_n_results (find, view->current_page);
-               g_mutex_unlock (EV_DOC_MUTEX);
+               ev_document_doc_mutex_unlock ();
        }
 
        return n_results > 0;
@@ -1665,9 +1665,9 @@ ev_view_find_next (EvView *view)
        EvDocumentFind *find = EV_DOCUMENT_FIND (view->document);
 
        page_cache = ev_document_get_page_cache (view->document);
-       g_mutex_lock (EV_DOC_MUTEX);
+       ev_document_doc_mutex_lock ();
        n_results = ev_document_find_get_n_results (find, view->current_page);
-       g_mutex_unlock (EV_DOC_MUTEX);
+       ev_document_doc_mutex_unlock ();
 
        n_pages = ev_page_cache_get_n_pages (page_cache);
 
@@ -1697,9 +1697,9 @@ ev_view_find_previous (EvView *view)
 
        page_cache = ev_document_get_page_cache (view->document);
 
-       g_mutex_lock (EV_DOC_MUTEX);
+       ev_document_doc_mutex_lock ();
        n_results = ev_document_find_get_n_results (find, view->current_page);
-       g_mutex_unlock (EV_DOC_MUTEX);
+       ev_document_doc_mutex_unlock ();
 
        n_pages = ev_page_cache_get_n_pages (page_cache);
 
index 749242d89a4abca2007c728c1e20315d570fe1bc..e45d485608e509ddd3612280ab0dad8d41f13237 100644 (file)
@@ -525,10 +525,10 @@ password_dialog_response (GtkWidget *password_dialog,
 
                password = ev_password_dialog_get_password (password_dialog);
                if (password) {
-                       g_mutex_lock (EV_DOC_MUTEX);
+                       ev_document_doc_mutex_lock ();
                        ev_document_security_set_password (EV_DOCUMENT_SECURITY (ev_window->priv->password_document),
                                                           password);
-                       g_mutex_unlock (EV_DOC_MUTEX);
+                       ev_document_doc_mutex_unlock ();
                }
                g_free (password);
 
@@ -906,9 +906,9 @@ ev_window_cmd_save_as (GtkAction *action, EvWindow *ev_window)
                                continue;
 */
                
-               g_mutex_lock (EV_DOC_MUTEX);
+               ev_document_doc_mutex_lock ();
                success = ev_document_save (ev_window->priv->document, uri, NULL);
-               g_mutex_unlock (EV_DOC_MUTEX);
+               ev_document_doc_mutex_unlock ();
 
                if (success)
                        break;
@@ -1925,16 +1925,16 @@ find_bar_search_changed_cb (EggFindBar *find_bar,
        if (ev_window->priv->document &&
            EV_IS_DOCUMENT_FIND (ev_window->priv->document)) {
                if (visible && search_string && search_string[0]) {
-                       g_mutex_lock (EV_DOC_MUTEX);
+                       ev_document_doc_mutex_lock ();
                        ev_document_find_begin (EV_DOCUMENT_FIND (ev_window->priv->document), 
                                                ev_page_cache_get_current_page (ev_window->priv->page_cache),
                                                search_string,
                                                case_sensitive);
-                       g_mutex_unlock (EV_DOC_MUTEX);
+                       ev_document_doc_mutex_unlock ();
                } else {
-                       g_mutex_lock (EV_DOC_MUTEX);
+                       ev_document_doc_mutex_lock ();
                        ev_document_find_cancel (EV_DOCUMENT_FIND (ev_window->priv->document));
-                       g_mutex_unlock (EV_DOC_MUTEX);
+                       ev_document_doc_mutex_unlock ();
 
                        egg_find_bar_set_status_text (EGG_FIND_BAR (ev_window->priv->find_bar),
                                                      NULL);