]> www.fi.muni.cz Git - evince.git/commitdiff
Switch from .a to libtool convenience libraries.
authorOwen Taylor <otaylor@redhat.com>
Wed, 22 Dec 2004 00:44:41 +0000 (00:44 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Wed, 22 Dec 2004 00:44:41 +0000 (00:44 +0000)
Tue Dec 21 19:28:55 2004  Owen Taylor  <otaylor@redhat.com>

        * pdf/{goo,fofi,splash,xpdf}/Makefile.am: Switch from
        .a to libtool convenience libraries.

        * shell/ev-window.c (ev_window_open): Hard code loading
        a PDF document.

        * backend/ev-document.h: Add a boolean return to load(),
        fix GError * to GError **.

        * pdf/xpdf/pdf-document.[ch] Makefile.am: Add a stub
        object for a PDF backend EvDocument.

12 files changed:
ChangeLog
backend/Makefile.am
backend/ev-document.c
backend/ev-document.h
pdf/fofi/Makefile.am
pdf/goo/Makefile.am
pdf/splash/Makefile.am
pdf/xpdf/Makefile.am
pdf/xpdf/pdf-document.c [new file with mode: 0644]
pdf/xpdf/pdf-document.h [new file with mode: 0644]
shell/Makefile.am
shell/ev-window.c

index fbeec1a2ebb4a35f44f5fa8d0abc0f048131fe62..acb3997217880cb718a0c306eba70113a1328558 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+Tue Dec 21 19:28:55 2004  Owen Taylor  <otaylor@redhat.com>
+
+       * pdf/{goo,fofi,splash,xpdf}/Makefile.am: Switch from
+       .a to libtool convenience libraries.
+
+       * shell/ev-window.c (ev_window_open): Hard code loading
+       a PDF document.
+       
+       * backend/ev-document.h: Add a boolean return to load(),
+       fix GError * to GError **.
+
+       * pdf/xpdf/pdf-document.[ch] Makefile.am: Add a stub
+       object for a PDF backend EvDocument.
+
 Tue Dec 21 18:55:06 2004  Søren Sandmann  <sandmann@redhat.com>
 
        * dvi/*: New directory with the beginning of a .dvi backend.
index 1a2547e5da846d43a7db3747fa65706f19529257..cc0acf44563e0146a62e0fa46d926a4d263ef8db 100644 (file)
@@ -7,9 +7,9 @@ INCLUDES=                                       \
        $(EVINCE_DISABLE_DEPRECATED)            \
        $(NULL)
 
-noinst_LTLIBRARIES = liblibevbackend.la
+noinst_LTLIBRARIES = libevbackend.la
 
-liblibevbackend_la_SOURCES=                    \
+libevbackend_la_SOURCES=                       \
        ev-document.c                           \
        ev-document.h                           \
        $(NULL)
index 44910032276b36b3dd9facebb7c2b5440226d037..5886e3f622100642e8d96633985befd63b79c8c1 100644 (file)
@@ -50,13 +50,13 @@ ev_document_base_init (gpointer g_class)
 {
 }
 
-void
+gboolean
 ev_document_load (EvDocument  *document,
                  const char  *uri,
-                 GError      *error)
+                 GError     **error)
 {
        EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
-       iface->load (document, uri, error);
+       return iface->load (document, uri, error);
 }
 
 int
index e4ff783305bf65de7e96ae772965968b79378ab3..aa10f9bce3c3dce0546643dd8bce6f4e807fed38 100644 (file)
@@ -42,9 +42,9 @@ struct _EvDocumentIface
        GTypeInterface base_iface;
 
        /* Methods  */
-       void        (* load)            (EvDocument *document,
+       gboolean    (* load)            (EvDocument *document,
                                         const char *uri,
-                                        GError     *error);
+                                        GError    **error);
        int         (* get_n_pages)     (EvDocument *document);
        void        (* set_page)        (EvDocument  *document,
                                         int          page);
@@ -64,24 +64,24 @@ struct _EvDocumentIface
 
 GType ev_document_get_type (void);
 
-void ev_document_load          (EvDocument  *document,
-                               const char  *uri,
-                               GError      *error);
-int  ev_document_get_n_pages   (EvDocument  *document);
-void ev_document_set_page      (EvDocument  *document,
-                               int          page);
-void ev_document_set_target    (EvDocument  *document,
-                               GdkDrawable *target);
-void ev_document_set_page_rect (EvDocument  *document,
-                               int          x,
-                               int          y,
-                               int          width,
-                               int          height);
-void ev_document_render        (EvDocument  *document,
-                               int          clip_x,
-                               int          clip_y,
-                               int          clip_width,
-                               int          clip_height);
+gboolean ev_document_load          (EvDocument  *document,
+                                   const char  *uri,
+                                   GError     **error);
+int      ev_document_get_n_pages   (EvDocument  *document);
+void     ev_document_set_page      (EvDocument  *document,
+                                   int          page);
+void     ev_document_set_target    (EvDocument  *document,
+                                   GdkDrawable *target);
+void     ev_document_set_page_rect (EvDocument  *document,
+                                   int          x,
+                                   int          y,
+                                   int          width,
+                                   int          height);
+void     ev_document_render        (EvDocument  *document,
+                                   int          clip_x,
+                                   int          clip_y,
+                                   int          clip_width,
+                                   int          clip_height);
 
 G_END_DECLS
 
index ad20a885c6f5c11d10717715392befc16f251b11..0c1887ce313156da4f98d6b7d113651cb62dd28a 100644 (file)
@@ -3,9 +3,9 @@ INCLUDES =                      \
        -I$(top_srcdir)/pdf     \
        -I$(top_srcdir)/pdf/goo
 
-noinst_LIBRARIES = libfofi.a
+noinst_LTLIBRARIES = libfofi.la
 
-libfofi_a_SOURCES =            \
+libfofi_la_SOURCES =           \
        FoFiBase.cc             \
        FoFiBase.h              \
        FoFiEncodings.cc        \
index 65502abb57540144fef9ff21f9ecad37a7b0b356..793ee8748763d4cfb5b38f1e63fc8ffc33c6585e 100644 (file)
@@ -2,9 +2,9 @@ INCLUDES =                      \
        -I$(top_srcdir)         \
        -I$(top_srcdir)/pdf
 
-noinst_LIBRARIES = libGoo.a
+noinst_LTLIBRARIES = libGoo.la
 
-libGoo_a_SOURCES =     \
+libGoo_la_SOURCES =    \
        GHash.cc        \
        GHash.h         \
        GList.cc        \
index 180a470f445622634c26e998df9ff1ed46d1ba64..4a4ec2836745084a59497895402015899ecce277 100644 (file)
@@ -5,9 +5,9 @@ INCLUDES =                              \
        -I$(top_srcdir)/pdf/fofi        \
        $(FREETYPE_CFLAGS)
 
-noinst_LIBRARIES = libsplash.a
+noinst_LTLIBRARIES = libsplash.la
 
-libsplash_a_SOURCES = \
+libsplash_la_SOURCES = \
        Splash.cc \
        Splash.h \
        SplashBitmap.cc \
index 5d931401247f3d266751f6cb543c72e793a11fae..2d2216c3f5f33f77fb7d201a729955af33ea7c49 100644 (file)
@@ -1,5 +1,6 @@
 INCLUDES =                                                     \
        -I$(top_srcdir)                                         \
+       -I$(top_srcdir)/backend                                 \
        -I$(top_srcdir)/pdf                                     \
        -I$(top_srcdir)/pdf/goo                                 \
        -I$(top_srcdir)/pdf/fofi                                \
@@ -9,9 +10,9 @@ INCLUDES =                                                     \
 
 noinst_PROGRAMS = test-gdk-output-dev
 
-noinst_LIBRARIES = libxpdf.a
+noinst_LTLIBRARIES = libxpdf.la libpdfdocument.la
 
-libxpdf_a_SOURCES =            \
+libxpdf_la_SOURCES =           \
        Annot.cc                \
        Annot.h                 \
        Array.cc                \
@@ -73,6 +74,8 @@ libxpdf_a_SOURCES =           \
        PDFDocEncoding.h        \
        PSTokenizer.cc          \
        PSTokenizer.h           \
+       SplashOutputDev.cc      \
+       SplashOutputDev.h       \
        Stream-CCITT.h          \
        Stream.cc               \
        Stream.h                \
@@ -82,30 +85,39 @@ libxpdf_a_SOURCES =         \
        UnicodeTypeTable.cc     \
        UnicodeTypeTable.h      \
        XRef.cc                 \
-       XRef.h
-
-common_sources =               \
+       XRef.h                  \
+                               \
        CharTypes.h             \
        CompactFontTables.h     \
        ErrorCodes.h            \
        NameToUnicodeTable.h    \
+       GDKSplashOutputDev.cc   \
+       GDKSplashOutputDev.h    \
        TextOutputDev.cc        \
        TextOutputDev.h         \
        UTF8.h
 
+# The sources at the end are put in libxpdf.a for convenience here, but are 
+# conceptually part of the apps not part of the libs.
+
 test_gdk_output_dev_SOURCES =          \
-       GDKSplashOutputDev.cc           \
-       GDKSplashOutputDev.h            \
-       SplashOutputDev.cc              \
-       SplashOutputDev.h               \
-       $(common_sources)               \
        test-gdk-output-dev.cc
 
-test_gdk_output_dev_LDADD =                                    \
-        libxpdf.a                                               \
-        $(top_builddir)/pdf/goo/libGoo.a                        \
-        $(top_builddir)/pdf/fofi/libfofi.a                      \
-       $(top_builddir)/pdf/splash/libsplash.                 \
+test_gdk_output_dev_LDADD =                                    \
+       libxpdf.la                                              \
+       $(top_builddir)/pdf/goo/libGoo.la                       \
+       $(top_builddir)/pdf/fofi/libfofi.la                     \
+       $(top_builddir)/pdf/splash/libsplash.la                 \
        $(GTK_LIBS)
 
+libpdfdocument_la_SOURCES =    \
+       pdf-document.c          \
+       pdf-document.h
+
+libpdfdocument_la_LIBADD =                                     \
+       libxpdf.la                                              \
+       $(top_builddir)/pdf/goo/libGoo.la                       \
+       $(top_builddir)/pdf/fofi/libfofi.la                     \
+       $(top_builddir)/pdf/splash/libsplash.la
+
 EXTRA_DIST = config.h
diff --git a/pdf/xpdf/pdf-document.c b/pdf/xpdf/pdf-document.c
new file mode 100644 (file)
index 0000000..81ad89c
--- /dev/null
@@ -0,0 +1,142 @@
+/* pdfdocument.h: Implementation of EvDocument for PDF
+ * Copyright (C) 2004, Red Hat, Inc.
+ *
+ * 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, 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.
+ */
+
+#include "pdf-document.h"
+
+typedef struct _PdfDocumentClass PdfDocumentClass;
+
+#define PDF_DOCUMENT_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), PDF_TYPE_DOCUMENT, PdfDocumentClass))
+#define PDF_IS_DOCUMENT_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), PDF_TYPE_DOCUMENT))
+#define PDF_DOCUMENT_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), PDF_TYPE_DOCUMENT, PdfDocumentClass))
+
+struct _PdfDocumentClass
+{
+       GObjectClass parent_class;
+};
+
+struct _PdfDocument
+{
+       GObject parent_instance;
+
+       GdkRectangle page_rect;
+       GdkDrawable *target;
+       
+};
+
+static void pdf_document_document_iface_init (EvDocumentIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (PdfDocument, pdf_document, G_TYPE_OBJECT,
+                         { G_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT,
+                                                 pdf_document_document_iface_init) });
+
+
+static gboolean
+pdf_document_load (EvDocument  *document,
+                  const char  *uri,
+                  GError     **error)
+{
+       return TRUE;
+}
+
+static int
+pdf_document_get_n_pages (EvDocument  *document)
+{
+       return 1;
+}
+
+static void
+pdf_document_set_page (EvDocument  *document,
+                      int          page)
+{
+}
+
+static void
+pdf_document_set_target (EvDocument  *document,
+                        GdkDrawable *target)
+{
+       PdfDocument *pdf_document = PDF_DOCUMENT (document);
+       
+       if (pdf_document->target != target) {
+               if (pdf_document->target)
+                       g_object_unref (pdf_document->target);
+               
+               pdf_document->target = target;
+
+               if (pdf_document->target)
+                       g_object_ref (pdf_document->target);
+       }
+}
+
+static void
+pdf_document_set_page_rect (EvDocument  *document,
+                           int          x,
+                           int          y,
+                           int          width,
+                           int          height)
+{
+       PdfDocument *pdf_document = PDF_DOCUMENT (document);
+       
+       pdf_document->page_rect.x = x;
+       pdf_document->page_rect.y = y;
+       pdf_document->page_rect.width = width;
+       pdf_document->page_rect.height = height;
+}
+
+static void
+pdf_document_render (EvDocument  *document,
+                    int          clip_x,
+                    int          clip_y,
+                    int          clip_width,
+                    int          clip_height)
+{
+}
+
+static void
+pdf_document_finalize (GObject *object)
+{
+       PdfDocument *pdf_document = PDF_DOCUMENT (object);
+
+       if (pdf_document->target)
+               g_object_unref (pdf_document->target);
+
+}
+
+static void
+pdf_document_class_init (PdfDocumentClass *class)
+{
+       GObjectClass *gobject_class = G_OBJECT_CLASS (class);
+  
+       gobject_class->finalize = pdf_document_finalize;
+}
+
+static void
+pdf_document_document_iface_init (EvDocumentIface *iface)
+{
+       iface->load = pdf_document_load;
+       iface->get_n_pages = pdf_document_get_n_pages;
+       iface->set_page = pdf_document_set_page;
+       iface->set_target = pdf_document_set_target;
+       iface->set_page_rect = pdf_document_set_page_rect;
+       iface->render = pdf_document_render;
+}
+
+static void
+pdf_document_init (PdfDocument *document)
+{
+}
+
diff --git a/pdf/xpdf/pdf-document.h b/pdf/xpdf/pdf-document.h
new file mode 100644 (file)
index 0000000..5b119b4
--- /dev/null
@@ -0,0 +1,38 @@
+/* pdfdocument.h: Implementation of EvDocument for PDF
+ * Copyright (C) 2004, Red Hat, Inc.
+ *
+ * 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, 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.
+ */
+
+#ifndef __PDF_DOCUMENT_H__
+#define __PDF_DOCUMENT_H__
+
+#include "ev-document.h"
+
+G_BEGIN_DECLS
+
+#define PDF_TYPE_DOCUMENT             (pdf_document_get_type ())
+#define PDF_DOCUMENT(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDF_TYPE_DOCUMENT, PdfDocument))
+#define PDF_IS_DOCUMENT(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDF_TYPE_DOCUMENT))
+
+typedef struct _PdfDocument PdfDocument;
+
+PdfDocument *pdf_document_new       (void);
+
+GType        pdf_document_get_type  (void) G_GNUC_CONST;
+     
+G_END_DECLS
+
+#endif /* __PDF_DOCUMENT_H__ */
index 7179a7da3f413b0b1394c43f4efba70ccb53752a..891eadb7a8a8625b8783da0049ec1db6e2de6f63 100644 (file)
@@ -3,6 +3,8 @@ NULL=
 INCLUDES=                                      \
        -DDATADIR=\"$(pkgdatadir)\"             \
        -I$(top_srcdir)/lib                     \
+       -I$(top_srcdir)/backend                 \
+       -I$(top_srcdir)/pdf/xpdf                \
        -DGNOMELOCALEDIR=\"$(datadir)/locale\"  \
        $(SHELL_CFLAGS)                         \
        $(EVINCE_DISABLE_DEPRECATED)            \
@@ -22,6 +24,8 @@ evince_SOURCES=                               \
        main.c                          \
        $(NULL)
 
-evince_LDADD=                                  \
-       $(SHELL_LIBS)                           \
+evince_LDADD=                                          \
+       $(SHELL_LIBS)                                   \
+       $(top_builddir)/backend/libevbackend.la         \
+       $(top_builddir)/pdf/xpdf/libpdfdocument.la      \
        $(NULL)
index 14733fe243cb11380c1ac5fdfcd30da604b0ca6d..a6097ce4b19e0e2043594525a1a4b8a2343e56b2 100644 (file)
@@ -30,6 +30,8 @@
 #include "ev-sidebar.h"
 #include "eggfindbar.h"
 
+#include "pdf-document.h"
+
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 #include <libgnomevfs/gnome-vfs-mime-utils.h>
@@ -57,6 +59,8 @@ struct _EvWindowPrivate {
        GtkUIManager *ui_manager;
        GtkWidget *statusbar;
        guint help_message_cid;
+       
+       EvDocument *document;
 };
 
 #if 0
@@ -147,6 +151,31 @@ ev_window_is_empty (const EvWindow *ev_window)
 void
 ev_window_open (EvWindow *ev_window, const char *uri)
 {
+       EvDocument *document = g_object_new (PDF_TYPE_DOCUMENT, NULL);
+       GError *error = NULL;
+
+       if (ev_document_load (document, uri, &error)) {
+               if (ev_window->priv->document)
+                       g_object_unref (ev_window->priv->document);
+               ev_window->priv->document = document;
+               
+       } else {
+               GtkWidget *dialog;
+
+               g_object_unref (document);
+
+               dialog = gtk_message_dialog_new (GTK_WINDOW (ev_window),
+                                                GTK_DIALOG_DESTROY_WITH_PARENT,
+                                                GTK_MESSAGE_ERROR,
+                                                GTK_BUTTONS_CLOSE,
+                                                _("Unable to open document"));
+               gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                                                         "%s", error->message);
+               gtk_dialog_run (GTK_DIALOG (dialog));
+
+               g_error_free (error);
+       }
+       
 #if 0
        char *mime_type;
        BonoboObject *bonobo_control;