+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),
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,
#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
{
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,
{
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 ();
}
{
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,
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 *
{
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),
TRUE);
EV_JOB (job)->finished = TRUE;
- g_mutex_unlock (EV_DOC_MUTEX);
+ ev_document_doc_mutex_unlock ();
}
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 */
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);
&rrect,
djvu_document->d_format,
gdk_pixbuf_get_rowstride (pixbuf),
- gdk_pixbuf_get_pixels (pixbuf));
+ (gchar *)gdk_pixbuf_get_pixels (pixbuf));
return pixbuf;
GdkPixbuf *pixbuf;
gint thumb_width, thumb_height;
- gchar *pixels;
+ guchar *pixels;
g_return_val_if_fail (djvu_document->d_document, NULL);
&thumb_width, &thumb_height,
djvu_document->d_format,
gdk_pixbuf_get_rowstride (pixbuf),
- pixels);
+ (gchar *)pixels);
return pixbuf;
}
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);
case POPPLER_PAGE_LAYOUT_TWO_PAGE_RIGHT:
info->layout = EV_DOCUMENT_LAYOUT_TWO_PAGE_RIGHT;
break;
+ default:
+ break;
}
switch (mode) {
break;
case POPPLER_PAGE_MODE_USE_ATTACHMENTS:
info->mode = EV_DOCUMENT_MODE_USE_ATTACHMENTS;
+ default:
+ break;
}
info->ui_hints = 0;
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));
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]);
PdfDocumentSearch *search = pdf_document->search;
PopplerPage *poppler_page;
PopplerRectangle *r;
- int current_page;
double height;
if (search == NULL)
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;
}
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;
#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;
/* 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);
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);
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);
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);
}
{
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. */
} 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 {
}
}
-// g_mutex_unlock (EV_DOC_MUTEX);
+// ev_document_doc_mutex_unlock ();
ev_view_set_find_status (view, message);
// g_free (message);
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);
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) {
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;
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);
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);
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);
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;
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);