evince r3025 - in trunk: . libdocument shell
- From: carlosgc svn gnome org
- To: svn-commits-list gnome org
- Subject: evince r3025 - in trunk: . libdocument shell
- Date: Sun, 27 Apr 2008 16:52:51 +0100 (BST)
Author: carlosgc
Date: Sun Apr 27 15:52:51 2008
New Revision: 3025
URL: http://svn.gnome.org/viewvc/evince?rev=3025&view=rev
Log:
Merge branch 'ev-debug' into work
Added:
trunk/libdocument/ev-debug.c
trunk/libdocument/ev-debug.h
Modified:
trunk/ChangeLog
trunk/configure.ac
trunk/libdocument/Makefile.am
trunk/libdocument/ev-document.c
trunk/shell/ev-jobs.c
trunk/shell/main.c
Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Sun Apr 27 15:52:51 2008
@@ -27,7 +27,6 @@
GNOME_MAINTAINER_MODE_DEFINES
GNOME_COMPILE_WARNINGS
GNOME_CXX_WARNINGS
-GNOME_DEBUG_CHECK
GTK_DOC_CHECK(1.0)
@@ -129,28 +128,39 @@
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]),
@@ -466,6 +476,7 @@
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
Modified: trunk/libdocument/Makefile.am
==============================================================================
--- trunk/libdocument/Makefile.am (original)
+++ trunk/libdocument/Makefile.am Sun Apr 27 15:52:51 2008
@@ -14,6 +14,7 @@
NOINST_H_FILES = \
ev-backend-marshalers.h \
ev-backends-manager.h \
+ ev_debug.h \
ev-document-factory.h \
ev-module.h
@@ -66,6 +67,7 @@
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 \
Added: trunk/libdocument/ev-debug.c
==============================================================================
--- (empty file)
+++ trunk/libdocument/ev-debug.c Sun Apr 27 15:52:51 2008
@@ -0,0 +1,85 @@
+/*
+ * 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 */
Added: trunk/libdocument/ev-debug.h
==============================================================================
--- (empty file)
+++ trunk/libdocument/ev-debug.h Sun Apr 27 15:52:51 2008
@@ -0,0 +1,72 @@
+/*
+ * 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__ */
Modified: trunk/libdocument/ev-document.c
==============================================================================
--- trunk/libdocument/ev-document.c (original)
+++ trunk/libdocument/ev-document.c Sun Apr 27 15:52:51 2008
@@ -30,7 +30,6 @@
GMutex *ev_doc_mutex = NULL;
GMutex *ev_fc_mutex = NULL;
-#define LOG(x)
GType
ev_document_get_type (void)
{
@@ -118,7 +117,7 @@
{
EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
gboolean retval;
- LOG ("ev_document_load");
+
retval = iface->load (document, uri, error);
return retval;
@@ -132,7 +131,6 @@
EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
gboolean retval;
- LOG ("ev_document_save");
retval = iface->save (document, uri, error);
return retval;
@@ -144,7 +142,6 @@
EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
gint retval;
- LOG ("ev_document_get_n_pages");
retval = iface->get_n_pages (document);
return retval;
@@ -173,7 +170,6 @@
{
EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
- LOG ("ev_document_get_page_size");
iface->get_page_size (document, page, width, height);
}
@@ -183,7 +179,6 @@
{
EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
- LOG ("ev_document_get_page_label");
if (iface->get_page_label == NULL)
return NULL;
@@ -215,7 +210,6 @@
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);
@@ -230,7 +224,6 @@
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);
Modified: trunk/shell/ev-jobs.c
==============================================================================
--- trunk/shell/ev-jobs.c (original)
+++ trunk/shell/ev-jobs.c Sun Apr 27 15:52:51 2008
@@ -11,6 +11,7 @@
#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>
@@ -98,6 +99,8 @@
{
EvJobLinks *job;
+ ev_debug_message (DEBUG_JOBS, NULL);
+
job = EV_JOB_LINKS (object);
if (job->model) {
@@ -128,6 +131,8 @@
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;
@@ -179,6 +184,8 @@
job = EV_JOB_THUMBNAIL (object);
+ ev_debug_message (DEBUG_JOBS, "%d", job->page);
+
if (job->thumbnail) {
g_object_unref (job->thumbnail);
job->thumbnail = NULL;
@@ -206,6 +213,8 @@
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);
@@ -240,6 +249,8 @@
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);
@@ -250,6 +261,8 @@
{
EvJob *job;
+ ev_debug_message (DEBUG_JOBS, NULL);
+
job = g_object_new (EV_TYPE_JOB_LINKS, NULL);
job->document = g_object_ref (document);
@@ -259,6 +272,8 @@
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 ();
@@ -278,6 +293,8 @@
{
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);
@@ -328,6 +345,8 @@
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;
@@ -336,6 +355,8 @@
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,
@@ -348,6 +369,8 @@
{
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) {
@@ -415,6 +438,8 @@
{
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);
@@ -430,6 +455,8 @@
{
EvRenderContext *rc;
EvPage *page;
+
+ ev_debug_message (DEBUG_JOBS, "%d", job->page);
g_return_if_fail (EV_IS_JOB_THUMBNAIL (job));
@@ -457,6 +484,8 @@
{
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);
@@ -469,6 +498,8 @@
{
EvDocumentFonts *fonts;
+ ev_debug_message (DEBUG_JOBS, NULL);
+
g_return_if_fail (EV_IS_JOB_FONTS (job));
ev_document_doc_mutex_lock ();
@@ -490,6 +521,8 @@
{
EvJobLoad *job = EV_JOB_LOAD (object);
+ ev_debug_message (DEBUG_JOBS, "%s", job->uri);
+
if (job->uri) {
g_free (job->uri);
job->uri = NULL;
@@ -532,6 +565,8 @@
{
EvJobLoad *job;
+ ev_debug_message (DEBUG_JOBS, "%s", uri);
+
job = g_object_new (EV_TYPE_JOB_LOAD, NULL);
job->uri = g_strdup (uri);
@@ -548,6 +583,8 @@
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);
@@ -557,6 +594,8 @@
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);
@@ -589,6 +628,8 @@
{
EvJobSave *job = EV_JOB_SAVE (object);
+ ev_debug_message (DEBUG_JOBS, "%s", job->uri);
+
if (job->uri) {
g_free (job->uri);
job->uri = NULL;
@@ -624,6 +665,8 @@
{
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);
@@ -641,6 +684,8 @@
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);
@@ -734,6 +779,12 @@
{
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);
@@ -889,6 +940,8 @@
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;
Modified: trunk/shell/main.c
==============================================================================
--- trunk/shell/main.c (original)
+++ trunk/shell/main.c Sun Apr 27 15:52:51 2008
@@ -21,6 +21,7 @@
#include "ev-application.h"
#include "ev-metadata-manager.h"
+#include "ev-debug.h"
#include <glib/gi18n.h>
#include <gdk/gdkx.h>
@@ -378,6 +379,8 @@
}
#endif
+ ev_debug_init ();
+
#if WITH_GNOME
gnome_authentication_manager_init ();
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]