+2008-04-27 Carlos Garcia Campos <carlosgc@gnome.org>
+
+ * configure.ac:
+ * libdocument/Makefile.am:
+ * libdocument/ev-debug.[ch]:
+ * libdocument/ev-document.c:
+ * shell/ev-jobs.c: (ev_job_links_dispose),
+ (ev_job_render_dispose), (ev_job_thumbnail_dispose),
+ (ev_job_print_dispose), (ev_job_finished), (ev_job_links_new),
+ (ev_job_links_run), (ev_job_render_new), (notify_page_ready),
+ (ev_job_render_page_ready), (ev_job_render_run),
+ (ev_job_thumbnail_new), (ev_job_thumbnail_run),
+ (ev_job_fonts_new), (ev_job_fonts_run), (ev_job_load_dispose),
+ (ev_job_load_new), (ev_job_load_set_uri), (ev_job_load_run),
+ (ev_job_save_dispose), (ev_job_save_new), (ev_job_save_run),
+ (ev_job_print_new), (ev_job_print_run):
+ * shell/main.c: (main):
+
+ Add debug mode based on gedit code. Add debug messages in
+ ev-jobs.
+
2008-04-24 Carlos Garcia Campos <carlosgc@gnome.org>
* libdocument/ev-document-factory.c: (get_document_from_uri):
GNOME_MAINTAINER_MODE_DEFINES
GNOME_COMPILE_WARNINGS
GNOME_CXX_WARNINGS
-GNOME_DEBUG_CHECK
GTK_DOC_CHECK(1.0)
AC_SUBST([DBUS_CFLAGS])
AC_SUBST([DBUS_LIBS])
-LIB_CFLAGS="$LIB_CFLAGS $GNOME_CFLAGS"
+AM_CONDITIONAL([ENABLE_DBUS], [test "x$enable_dbus" = "xyes"])
+AM_CONDITIONAL([DBUS_TOOL_NO_PREFIX], [test "x$DBUS_VERSION" = "x33"])
+
+dnl Debug mode
+AC_ARG_ENABLE([debug],
+ AC_HELP_STRING([--enable-debug],
+ [Turn on evince debug mode]),,
+ [enable_debug=no])
+
+if test "x$enable_debug" = "xyes"; then
+ DEBUG_FLAGS="-DEV_ENABLE_DEBUG"
+fi
+
+
+LIB_CFLAGS="$LIB_CFLAGS $GNOME_CFLAGS $DEBUG_FLAGS"
LIB_LIBS="$LIB_LIBS $GNOME_LIBS"
AC_SUBST(LIB_CFLAGS)
AC_SUBST(LIB_LIBS)
-BACKEND_CFLAGS="$BACKEND_CFLAGS -DGDK_MULTIHEAD_SAFE -DGTK_MULTIHEAD_SAFE"
+BACKEND_CFLAGS="$BACKEND_CFLAGS -DGDK_MULTIHEAD_SAFE -DGTK_MULTIHEAD_SAFE $DEBUG_FLAGS"
AC_SUBST(BACKEND_CFLAGS)
AC_SUBST(BACKEND_LIBS)
-SHELL_CFLAGS="$SHELL_CORE_CFLAGS $DBUS_CFLAGS $GNOMEUI_CFLAGS $KEYRING_CFLAGS -DGDK_MULTIHEAD_SAFE -DGTK_MULTIHEAD_SAFE"
+SHELL_CFLAGS="$SHELL_CORE_CFLAGS $DBUS_CFLAGS $GNOMEUI_CFLAGS $KEYRING_CFLAGS -DGDK_MULTIHEAD_SAFE -DGTK_MULTIHEAD_SAFE $DEBUG_FLAGS"
SHELL_LIBS="$SHELL_CORE_LIBS $DBUS_LIBS $GNOMEUI_LIBS $KEYRING_LIBS -lz"
AC_SUBST(SHELL_CFLAGS)
AC_SUBST(SHELL_LIBS)
-FRONTEND_CFLAGS="$FRONTEND_CORE_CFLAGS $GNOME_CFLAGS"
+FRONTEND_CFLAGS="$FRONTEND_CORE_CFLAGS $GNOME_CFLAGS $DEBUG_FLAGS"
FRONTEND_LIBS="$FRONTEND_CORE_LIBS $GNOME_LIBS -lz"
AC_SUBST(FRONTEND_CFLAGS)
AC_SUBST(FRONTEND_LIBS)
-AM_CONDITIONAL([ENABLE_DBUS], [test "x$enable_dbus" = "xyes"])
-AM_CONDITIONAL([DBUS_TOOL_NO_PREFIX], [test "x$DBUS_VERSION" = "x33"])
-
dnl Check for Nautilus property page build
AC_ARG_ENABLE(nautilus,
AC_HELP_STRING([--enable-nautilus],[compile the nautilus plugin]),
Nautilus Plugin....: $HAVE_NAUTILUS
Thumbnailer........: $ENABLE_THUMBNAILER
Gtk-Doc Support....: $enable_gtk_doc
+ Debug mode.........: $enable_debug
PDF Backend........: $enable_pdf
PostScript Backend.: $enable_ps
NOINST_H_FILES = \
ev-backend-marshalers.h \
ev-backends-manager.h \
+ ev_debug.h \
ev-document-factory.h \
ev-module.h
ev-document-transition.c \
ev-document-forms.c \
ev-form-field.c \
+ ev-debug.c \
ev-file-exporter.c \
ev-file-helpers.c \
ev-module.c \
--- /dev/null
+/*
+ * ev-debug.c
+ * This file is part of Evince
+ *
+ * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
+ * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi
+ * Copyright (C) 2002 - 2005 Paolo Maggi
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the gedit Team, 1998-2005. See the AUTHORS file for a
+ * list of people on the gedit Team.
+ * See the ChangeLog files for a list of changes.
+ *
+ * $Id: gedit-debug.c 4809 2006-04-08 14:46:31Z pborelli $
+ */
+
+/* Modified by Evince Team */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+
+#include "ev-debug.h"
+
+#ifdef EV_ENABLE_DEBUG
+static EvDebugSection ev_debug = EV_NO_DEBUG;
+
+void
+ev_debug_init ()
+{
+ if (g_getenv ("EV_DEBUG") != NULL) {
+ /* enable all debugging */
+ ev_debug = ~EV_NO_DEBUG;
+ return;
+ }
+
+ if (g_getenv ("EV_DEBUG_JOBS") != NULL)
+ ev_debug |= EV_DEBUG_JOBS;
+}
+
+void
+ev_debug_message (EvDebugSection section,
+ const gchar *file,
+ gint line,
+ const gchar *function,
+ const gchar *format, ...)
+{
+ if (G_UNLIKELY (ev_debug & section)) {
+ gchar *msg = NULL;
+
+ if (format) {
+ va_list args;
+
+ va_start (args, format);
+ msg = g_strdup_vprintf (format, args);
+ va_end (args);
+ }
+
+ g_print ("%s:%d (%s) %s\n", file, line, function, msg ? msg : "");
+
+ fflush (stdout);
+
+ g_free (msg);
+ }
+}
+
+#endif /* EV_ENABLE_DEBUG */
--- /dev/null
+/*
+ * ev-debug.h
+ * This file is part of Evince
+ *
+ * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
+ * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi
+ * Copyright (C) 2002 - 2005 Paolo Maggi
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the gedit Team, 1998-2005. See the AUTHORS file for a
+ * list of people on the gedit Team.
+ * See the ChangeLog files for a list of changes.
+ *
+ * $Id: gedit-debug.h 4809 2006-04-08 14:46:31Z pborelli $
+ */
+
+/* Modified by Evince Team */
+
+#ifndef __EV_DEBUG_H__
+#define __EV_DEBUG_H__
+
+#include <glib.h>
+
+#ifndef EV_ENABLE_DEBUG
+#define ev_debug_init()
+#define ev_debug_message(...)
+#else
+
+G_BEGIN_DECLS
+
+/*
+ * Set an environmental var of the same name to turn on
+ * debugging output. Setting EV_DEBUG will turn on all
+ * sections.
+ */
+typedef enum {
+ EV_NO_DEBUG = 0,
+ EV_DEBUG_JOBS = 1 << 0
+} EvDebugSection;
+
+
+#define DEBUG_JOBS EV_DEBUG_JOBS, __FILE__, __LINE__, G_STRFUNC
+
+void ev_debug_init (void);
+
+void ev_debug_message (EvDebugSection section,
+ const gchar *file,
+ gint line,
+ const gchar *function,
+ const gchar *format, ...) G_GNUC_PRINTF(5, 6);
+
+
+G_END_DECLS
+
+#endif /* EV_ENABLE_DEBUG */
+#endif /* __EV_DEBUG_H__ */
GMutex *ev_doc_mutex = NULL;
GMutex *ev_fc_mutex = NULL;
-#define LOG(x)
GType
ev_document_get_type (void)
{
{
EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
gboolean retval;
- LOG ("ev_document_load");
+
retval = iface->load (document, uri, error);
return retval;
EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
gboolean retval;
- LOG ("ev_document_save");
retval = iface->save (document, uri, error);
return retval;
EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
gint retval;
- LOG ("ev_document_get_n_pages");
retval = iface->get_n_pages (document);
return retval;
{
EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
- LOG ("ev_document_get_page_size");
iface->get_page_size (document, page, width, height);
}
{
EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
- LOG ("ev_document_get_page_label");
if (iface->get_page_label == NULL)
return NULL;
EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
GList *retval;
- LOG ("ev_document_get_attachments");
if (iface->get_attachments == NULL)
return NULL;
retval = iface->get_attachments (document);
EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
cairo_surface_t *retval;
- LOG ("ev_document_render_pixbuf");
g_assert (iface->render);
retval = iface->render (document, rc);
#include "ev-file-helpers.h"
#include "ev-document-fonts.h"
#include "ev-async-renderer.h"
+#include "ev-debug.h"
#include <errno.h>
#include <glib/gstdio.h>
{
EvJobLinks *job;
+ ev_debug_message (DEBUG_JOBS, NULL);
+
job = EV_JOB_LINKS (object);
if (job->model) {
job = EV_JOB_RENDER (object);
+ ev_debug_message (DEBUG_JOBS, "page: %d", job->ev_page->index);
+
if (job->ev_page) {
g_object_unref (job->ev_page);
job->ev_page = NULL;
job = EV_JOB_THUMBNAIL (object);
+ ev_debug_message (DEBUG_JOBS, "%d", job->page);
+
if (job->thumbnail) {
g_object_unref (job->thumbnail);
job->thumbnail = NULL;
job = EV_JOB_PRINT (object);
+ ev_debug_message (DEBUG_JOBS, NULL);
+
if (job->temp_file) {
g_unlink (job->temp_file);
g_free (job->temp_file);
void
ev_job_finished (EvJob *job)
{
+ ev_debug_message (DEBUG_JOBS, NULL);
+
g_return_if_fail (EV_IS_JOB (job));
g_signal_emit (job, job_signals[FINISHED], 0);
{
EvJob *job;
+ ev_debug_message (DEBUG_JOBS, NULL);
+
job = g_object_new (EV_TYPE_JOB_LINKS, NULL);
job->document = g_object_ref (document);
void
ev_job_links_run (EvJobLinks *job)
{
+ ev_debug_message (DEBUG_JOBS, NULL);
+
g_return_if_fail (EV_IS_JOB_LINKS (job));
ev_document_doc_mutex_lock ();
{
EvJobRender *job;
+ ev_debug_message (DEBUG_JOBS, "page: %d", page);
+
job = g_object_new (EV_TYPE_JOB_RENDER, NULL);
EV_JOB (job)->document = g_object_ref (document);
static gboolean
notify_page_ready (EvJobRender *job)
{
+ ev_debug_message (DEBUG_JOBS, "%d", job->ev_page->index);
+
g_signal_emit (job, job_render_signals[PAGE_READY], 0);
return FALSE;
static void
ev_job_render_page_ready (EvJobRender *job)
{
+ ev_debug_message (DEBUG_JOBS, "%d", job->ev_page->index);
+
job->page_ready = TRUE;
g_idle_add_full (G_PRIORITY_HIGH_IDLE,
(GSourceFunc)notify_page_ready,
{
g_return_if_fail (EV_IS_JOB_RENDER (job));
+ ev_debug_message (DEBUG_JOBS, "page: %d", job->page);
+
ev_document_doc_mutex_lock ();
if (EV_JOB (job)->async) {
{
EvJobThumbnail *job;
+ ev_debug_message (DEBUG_JOBS, "%d", page);
+
job = g_object_new (EV_TYPE_JOB_THUMBNAIL, NULL);
EV_JOB (job)->document = g_object_ref (document);
{
EvRenderContext *rc;
EvPage *page;
+
+ ev_debug_message (DEBUG_JOBS, "%d", job->page);
g_return_if_fail (EV_IS_JOB_THUMBNAIL (job));
{
EvJobFonts *job;
+ ev_debug_message (DEBUG_JOBS, NULL);
+
job = g_object_new (EV_TYPE_JOB_FONTS, NULL);
EV_JOB (job)->document = g_object_ref (document);
{
EvDocumentFonts *fonts;
+ ev_debug_message (DEBUG_JOBS, NULL);
+
g_return_if_fail (EV_IS_JOB_FONTS (job));
ev_document_doc_mutex_lock ();
{
EvJobLoad *job = EV_JOB_LOAD (object);
+ ev_debug_message (DEBUG_JOBS, "%s", job->uri);
+
if (job->uri) {
g_free (job->uri);
job->uri = NULL;
{
EvJobLoad *job;
+ ev_debug_message (DEBUG_JOBS, "%s", uri);
+
job = g_object_new (EV_TYPE_JOB_LOAD, NULL);
job->uri = g_strdup (uri);
void
ev_job_load_set_uri (EvJobLoad *job, const gchar *uri)
{
+ ev_debug_message (DEBUG_JOBS, "%s", uri);
+
if (job->uri)
g_free (job->uri);
job->uri = g_strdup (uri);
ev_job_load_run (EvJobLoad *job)
{
g_return_if_fail (EV_IS_JOB_LOAD (job));
+
+ ev_debug_message (DEBUG_JOBS, "%s", job->uri);
if (job->error) {
g_error_free (job->error);
{
EvJobSave *job = EV_JOB_SAVE (object);
+ ev_debug_message (DEBUG_JOBS, "%s", job->uri);
+
if (job->uri) {
g_free (job->uri);
job->uri = NULL;
{
EvJobSave *job;
+ ev_debug_message (DEBUG_JOBS, "uri: %s, document_uri: %s", uri, document_uri);
+
job = g_object_new (EV_TYPE_JOB_SAVE, NULL);
EV_JOB (job)->document = g_object_ref (document);
gchar *filename;
gchar *tmp_filename;
gchar *local_uri;
+
+ ev_debug_message (DEBUG_JOBS, "uri: %s, document_uri: %s", job->uri, job->document_uri);
filename = ev_tmp_filename ("saveacopy");
tmp_filename = g_strdup_printf ("%s.XXXXXX", filename);
{
EvJobPrint *job;
+ ev_debug_message (DEBUG_JOBS, "format: %s, width: %f, height:%f,"
+ "n_ranges: %d, pages_per_sheet: %d, copies: %d,"
+ "collate: %s, reverse: %s",
+ format, width, height, n_ranges, pages_per_sheet, copies,
+ collate ? "True" : "False", reverse ? "True" : "False");
+
job = g_object_new (EV_TYPE_JOB_PRINT, NULL);
EV_JOB (job)->document = g_object_ref (document);
g_return_if_fail (EV_IS_JOB_PRINT (job));
+ ev_debug_message (DEBUG_JOBS, NULL);
+
if (job->temp_file)
g_free (job->temp_file);
job->temp_file = NULL;
#include "ev-application.h"
#include "ev-metadata-manager.h"
+#include "ev-debug.h"
#include <glib/gi18n.h>
#include <gdk/gdkx.h>
}
#endif
+ ev_debug_init ();
+
#if WITH_GNOME
gnome_authentication_manager_init ();
#endif