Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Blandford <jrb@redhat.com>2005-04-22 03:39:52 (GMT)
committer Jonathan Blandford <jrb@src.gnome.org>2005-04-22 03:39:52 (GMT)
commitbf325e9279324f02bcadc0145cd553ed94c23d2d (patch)
tree6129bb1466dcf874d07205630db3575761b90874
parent4a63e33ac6be1387403071dbd9aed30b4e440242 (diff)
actually remove the job.
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.
-rw-r--r--ChangeLog8
-rw-r--r--backend/ev-document.c13
-rw-r--r--backend/ev-document.h5
-rw-r--r--backend/ev-jobs.c13
-rw-r--r--backend/ev-page-cache.c4
-rw-r--r--djvu/djvu-document.c6
-rw-r--r--pdf/ev-poppler.cc12
-rw-r--r--shell/ev-pixbuf-cache.c1
-rw-r--r--shell/ev-print-job.c12
-rw-r--r--shell/ev-sidebar-thumbnails.c4
-rw-r--r--shell/ev-view.c54
-rw-r--r--shell/ev-window.c16
12 files changed, 87 insertions, 61 deletions
diff --git a/ChangeLog b/ChangeLog
index 8289400..11cf266 100644
--- 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),
diff --git a/backend/ev-document.c b/backend/ev-document.c
index 5df6e69..1b2f778 100644
--- a/backend/ev-document.c
+++ b/backend/ev-document.c
@@ -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,
diff --git a/backend/ev-document.h b/backend/ev-document.h
index 47a91ee..da38283 100644
--- a/backend/ev-document.h
+++ b/backend/ev-document.h
@@ -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,
diff --git a/backend/ev-jobs.c b/backend/ev-jobs.c
index 0a5f69f..c4556c9 100644
--- a/backend/ev-jobs.c
+++ b/backend/ev-jobs.c
@@ -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 ();
}
diff --git a/backend/ev-page-cache.c b/backend/ev-page-cache.c
index 935347e..a6d7822 100644
--- a/backend/ev-page-cache.c
+++ b/backend/ev-page-cache.c
@@ -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);
diff --git a/djvu/djvu-document.c b/djvu/djvu-document.c
index e6a270f..72be474 100644
--- a/djvu/djvu-document.c
+++ b/djvu/djvu-document.c
@@ -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;
}
diff --git a/pdf/ev-poppler.cc b/pdf/ev-poppler.cc
index ac70a03..d20acb0 100644
--- a/pdf/ev-poppler.cc
+++ b/pdf/ev-poppler.cc
@@ -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)
diff --git a/shell/ev-pixbuf-cache.c b/shell/ev-pixbuf-cache.c
index 91bd314..b5227ee 100644
--- a/shell/ev-pixbuf-cache.c
+++ b/shell/ev-pixbuf-cache.c
@@ -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;
}
diff --git a/shell/ev-print-job.c b/shell/ev-print-job.c
index ccc07e3..70f92fd 100644
--- a/shell/ev-print-job.c
+++ b/shell/ev-print-job.c
@@ -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;
diff --git a/shell/ev-sidebar-thumbnails.c b/shell/ev-sidebar-thumbnails.c
index a22d70e..7945874 100644
--- a/shell/ev-sidebar-thumbnails.c
+++ b/shell/ev-sidebar-thumbnails.c
@@ -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);
diff --git a/shell/ev-view.c b/shell/ev-view.c
index b51082f..cca3947 100644
--- a/shell/ev-view.c
+++ b/shell/ev-view.c
@@ -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);
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 749242d..e45d485 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -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);