[poppler] 2 commits - CMakeLists.txt configure.ac glib/CMakeLists.txt glib/Makefile.am glib/poppler-features.h.in glib/poppler-page.cc glib/poppler-page.h glib/test-poppler-glib.cc

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Sun Feb 13 02:56:00 PST 2011


 CMakeLists.txt             |    9 
 configure.ac               |   44 ---
 glib/CMakeLists.txt        |   22 -
 glib/Makefile.am           |   22 -
 glib/poppler-features.h.in |    6 
 glib/poppler-page.cc       |  296 --------------------
 glib/poppler-page.h        |   34 --
 glib/test-poppler-glib.cc  |  657 ---------------------------------------------
 8 files changed, 4 insertions(+), 1086 deletions(-)

New commits:
commit 149b7fec472beda9d1538e0f26607c9498d504c2
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Sun Feb 13 11:51:57 2011 +0100

    glib: Remove deprecated GDK API
    
    It removes the GDK dependency so that poppler-glib now only depends on
    glib and cairo.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ee65cee..1c83370 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -97,15 +97,7 @@ if(CAIRO_FOUND)
     set(GLIB_REQ "glib-2.0 >= ${GLIB_REQUIRED} gobject-2.0 >= ${GLIB_REQUIRED} cairo >= ${CAIRO_VERSION}")
     set(POPPLER_GLIB_DISABLE_DEPRECATED "${POPPLER_GLIB_DISABLE_DEPRECATED} -DG_DISABLE_DEPRECATED")
     set(POPPLER_GLIB_DISABLE_SINGLE_INCLUDES "${POPPLER_GLIB_DISABLE_SINGLE_INCLUDES} -DG_DISABLE_SINGLE_INCLUDES")
-    macro_optional_find_package(GDK)
     macro_optional_find_package(GTK)
-    if(GDK_FOUND)
-      set(GDK_REQ "gdk-2.0 gdk-pixbuf-2.0")
-      set(POPPLER_WITH_GDK ${GDK_FOUND})
-      set(GDK_FEATURE "#define POPPLER_WITH_GDK 1")
-      set(POPPLER_GLIB_DISABLE_DEPRECATED "${POPPLER_GLIB_DISABLE_DEPRECATED} -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED")
-      set(POPPLER_GLIB_DISABLE_SINGLE_INCLUDES "${POPPLER_GLIB_DISABLE_SINGLE_INCLUDES} -DGTK_DISABLE_SINGLE_INCLUDES")
-    endif(GDK_FOUND)
   endif(GLIB_FOUND)
 else(CAIRO_FOUND)
   set(CAIRO_FEATURE "#undef POPPLER_HAS_CAIRO")
@@ -585,7 +577,6 @@ show_end_message_yesno("cairo output" CAIRO_FOUND)
 show_end_message_yesno("abiword output" ENABLE_ABIWORD)
 show_end_message_yesno("qt4 wrapper" QT4_FOUND)
 show_end_message_yesno("glib wrapper" ENABLE_GLIB)
-show_end_message_yesno("  use GDK" POPPLER_WITH_GDK)
 show_end_message_yesno("  introspection" INTROSPECTION_FOUND)
 show_end_message_yesno("cpp wrapper" ENABLE_CPP)
 show_end_message("use gtk-doc" "not supported with this CMake build system")
diff --git a/configure.ac b/configure.ac
index 6041010..63a4dfb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -439,50 +439,11 @@ fi
 AM_CONDITIONAL(BUILD_POPPLER_GLIB, test x$enable_poppler_glib = xyes)
 AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = "xyes")
 AC_SUBST(GLIB_REQ)
-
-GTK_DOC_CHECK([1.14],[--flavour no-tmpl])
-
-dnl
-dnl GDK
-dnl
-AC_ARG_ENABLE(gdk,
-              AC_HELP_STRING([--disable-gdk],
-	                     [Compile without gdk.]),
-              enable_gdk=$enableval,
-	      enable_gdk="try")
-
-if test x$enable_poppler_glib = xyes; then
-  if test x$enable_gdk = xyes; then
-    PKG_CHECK_MODULES(GDK, gdk-2.0)
-  elif test x$enable_gdk = xtry; then
-    PKG_CHECK_MODULES(GDK, gdk-2.0,
-                      [enable_gdk="yes"],
-                      [enable_gdk="no"])
-  fi
-  if test x$enable_gdk = xyes; then
-    GDK_REQ="gdk-2.0 gdk-pixbuf-2.0"
-    AC_DEFINE(POPPLER_WITH_GDK,[1], [Have GDK])
-    GDK_FEATURE="#define POPPLER_WITH_GDK 1"
-    POPPLER_GLIB_DISABLE_DEPRECATED="$POPPLER_GLIB_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED"
-    POPPLER_GLIB_DISABLE_SINGLE_INCLUDES="$POPPLER_GLIB_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_SINGLE_INCLUDES"
-  else
-    enable_gdk="no"
-    GDK_FEATURE=""
-    GDK_REQ=""
-  fi
-else
-  enable_gdk="no"
-  GDK_REQ=""
-fi
-AM_CONDITIONAL(BUILD_WITH_GDK, test x$enable_gdk = xyes)
-AC_SUBST(GDK_CFLAGS)
-AC_SUBST(GDK_LIBS)
-AC_SUBST(GDK_FEATURE)
-AC_SUBST(GDK_REQ)
-
 AC_SUBST(POPPLER_GLIB_DISABLE_DEPRECATED)
 AC_SUBST(POPPLER_GLIB_DISABLE_SINGLE_INCLUDES)
 
+GTK_DOC_CHECK([1.14],[--flavour no-tmpl])
+
 dnl 
 dnl Try Qt4
 dnl
@@ -689,7 +650,6 @@ echo "  cairo output:       $enable_cairo_output"
 echo "  abiword output:     $enable_abiword_output"
 echo "  qt4 wrapper:        $enable_poppler_qt4"
 echo "  glib wrapper:       $enable_poppler_glib"
-echo "    use GDK:          $enable_gdk"
 echo "    introspection:    $found_introspection"
 echo "  cpp wrapper:        $enable_poppler_cpp"
 echo "  use gtk-doc:        $enable_gtk_doc"
diff --git a/glib/CMakeLists.txt b/glib/CMakeLists.txt
index cf43129..d42379f 100644
--- a/glib/CMakeLists.txt
+++ b/glib/CMakeLists.txt
@@ -12,11 +12,6 @@ add_definitions(
   ${POPPLER_GLIB_DISABLE_SINGLE_INCLUDES}
 )
 
-if (GDK_FOUND)
-  include_directories(${GDK2_INCLUDE_DIRS})
-  add_definitions(${GDK2_CFLAGS_OTHER})
-endif (GDK_FOUND)
-
 configure_file(poppler-features.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/poppler-features.h @ONLY)
 
 if (GTK_FOUND AND BUILD_GTK_TESTS)
@@ -82,11 +77,8 @@ set(poppler_glib_generated_SRCS
   ${CMAKE_SOURCE_DIR}/poppler/CairoRescaleBox.cc
 )
 add_library(poppler-glib SHARED ${poppler_glib_SRCS} ${poppler_glib_generated_SRCS})
-set_target_properties(poppler-glib PROPERTIES VERSION 6.0.0 SOVERSION 6)
+set_target_properties(poppler-glib PROPERTIES VERSION 7.0.0 SOVERSION 7)
 target_link_libraries(poppler-glib poppler ${GLIB2_LIBRARIES} ${CAIRO_LIBRARIES} ${FREETYPE_LIBRARIES})
-if (GDK_FOUND)
-  target_link_libraries(poppler-glib ${GDK2_LIBRARIES})
-endif (GDK_FOUND)
 install(TARGETS poppler-glib RUNTIME DESTINATION bin LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX})
 
 install(FILES
@@ -128,10 +120,6 @@ if (HAVE_INTROSPECTION)
   )
   set(Poppler_0_16_gir_FILES ${_abs_introspection_files})
 
-  if (GDK_FOUND)
-    list(APPEND Poppler_0_16_gir_INCLUDES Gdk-2.0)
-  endif ()
-
   list(APPEND INTROSPECTION_GIRS Poppler-0.16.gir)
 
   gir_add_introspections(INTROSPECTION_GIRS)
diff --git a/glib/Makefile.am b/glib/Makefile.am
index c7de40f..a5547b8 100644
--- a/glib/Makefile.am
+++ b/glib/Makefile.am
@@ -6,7 +6,6 @@ INCLUDES =					\
 	-I$(top_srcdir)				\
 	-I$(top_srcdir)/poppler			\
 	$(POPPLER_GLIB_CFLAGS)			\
-	$(GDK_CFLAGS)				\
 	$(FREETYPE_CFLAGS)			\
 	$(FONTCONFIG_CFLAGS)                    \
 	$(POPPLER_GLIB_DISABLE_DEPRECATED)	\
@@ -72,11 +71,10 @@ libpoppler_glib_la_LIBADD =				\
 	$(top_builddir)/poppler/libpoppler.la		\
 	$(top_builddir)/poppler/libpoppler-cairo.la	\
 	$(POPPLER_GLIB_LIBS)				\
-	$(GDK_LIBS)					\
 	$(FREETYPE_LIBS)				\
 	$(FONTCONFIG_LIBS)
 
-libpoppler_glib_la_LDFLAGS = -version-info 6:0:0 @create_shared_lib@ @auto_import_flags@
+libpoppler_glib_la_LDFLAGS = -version-info 7:0:0 @create_shared_lib@ @auto_import_flags@
 
 BUILT_SOURCES =					\
 	poppler-enums.c				\
@@ -100,10 +98,6 @@ Poppler_0_16_gir_CFLAGS = $(INCLUDES) -I$(top_builddir)
 Poppler_0_16_gir_LIBS = libpoppler-glib.la
 Poppler_0_16_gir_FILES = $(addprefix $(srcdir)/, $(introspection_files))
 
-if BUILD_WITH_GDK
-Poppler_0_16_gir_INCLUDES += Gdk-2.0
-endif
-
 INTROSPECTION_GIRS += Poppler-0.16.gir
 
 girdir = $(datadir)/gir-1.0
diff --git a/glib/poppler-features.h.in b/glib/poppler-features.h.in
index 4cd37cd..e6b3a8e 100644
--- a/glib/poppler-features.h.in
+++ b/glib/poppler-features.h.in
@@ -36,12 +36,6 @@
  * Defined if poppler was compiled with cairo support.
  */
 @CAIRO_FEATURE@
-/**
- * POPPLER_WITH_GDK:
- *
- * Defined if poppler was compiled with GDK support.
- */
- at GDK_FEATURE@
 
 /**
  * POPPLER_MAJOR_VERSION:
diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc
index 064e4af..613b0cb 100644
--- a/glib/poppler-page.cc
+++ b/glib/poppler-page.cc
@@ -285,48 +285,6 @@ poppler_page_get_text_page (PopplerPage *page)
   return page->text;
 }
 
-#ifdef POPPLER_WITH_GDK
-static void
-copy_cairo_surface_to_pixbuf (cairo_surface_t *surface,
-			      GdkPixbuf       *pixbuf)
-{
-  int cairo_width, cairo_height, cairo_rowstride;
-  unsigned char *pixbuf_data, *dst, *cairo_data;
-  int pixbuf_rowstride, pixbuf_n_channels;
-  unsigned int *src;
-  int x, y;
-
-  cairo_width = cairo_image_surface_get_width (surface);
-  cairo_height = cairo_image_surface_get_height (surface);
-  cairo_rowstride = cairo_image_surface_get_stride (surface);
-  cairo_data = cairo_image_surface_get_data (surface);
-
-  pixbuf_data = gdk_pixbuf_get_pixels (pixbuf);
-  pixbuf_rowstride = gdk_pixbuf_get_rowstride (pixbuf);
-  pixbuf_n_channels = gdk_pixbuf_get_n_channels (pixbuf);
-
-  if (cairo_width > gdk_pixbuf_get_width (pixbuf))
-    cairo_width = gdk_pixbuf_get_width (pixbuf);
-  if (cairo_height > gdk_pixbuf_get_height (pixbuf))
-    cairo_height = gdk_pixbuf_get_height (pixbuf);
-  for (y = 0; y < cairo_height; y++)
-    {
-      src = (unsigned int *) (cairo_data + y * cairo_rowstride);
-      dst = pixbuf_data + y * pixbuf_rowstride;
-      for (x = 0; x < cairo_width; x++) 
-	{
-	  dst[0] = (*src >> 16) & 0xff;
-	  dst[1] = (*src >> 8) & 0xff; 
-	  dst[2] = (*src >> 0) & 0xff;
-	  if (pixbuf_n_channels == 4)
-	      dst[3] = (*src >> 24) & 0xff;
-	  dst += pixbuf_n_channels;
-	  src++;
-	}
-    }
-}	
-#endif /* POPPLER_WITH_GDK */
-
 static gboolean
 annot_is_markup (Annot *annot)
 {
@@ -614,260 +572,6 @@ poppler_page_render_selection (PopplerPage           *page,
   output_dev->setCairo (NULL);
 }
 
-#ifdef POPPLER_WITH_GDK
-static void
-_poppler_page_render_to_pixbuf (PopplerPage *page,
-				int src_x, int src_y,
-				int src_width, int src_height,
-				double scale,
-				int rotation,
-				GBool printing,
-				GdkPixbuf *pixbuf)
-{
-  cairo_t *cr;
-  cairo_surface_t *surface;
-
-  surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
-					src_width, src_height);
-  cr = cairo_create (surface);
-  cairo_save (cr);
-  switch (rotation) {
-  case 90:
-	  cairo_translate (cr, src_x + src_width, -src_y);
-	  break;
-  case 180:
-	  cairo_translate (cr, src_x + src_width, src_y + src_height);
-	  break;
-  case 270:
-	  cairo_translate (cr, -src_x, src_y + src_height);
-	  break;
-  default:
-	  cairo_translate (cr, -src_x, -src_y);
-  }
-
-  if (scale != 1.0)
-	  cairo_scale (cr, scale, scale);
-
-  if (rotation != 0)
-	  cairo_rotate (cr, rotation * G_PI / 180.0);
-
-  if (printing)
-	  poppler_page_render_for_printing (page, cr);
-  else
-	  poppler_page_render (page, cr);
-  cairo_restore (cr);
-
-  cairo_set_operator (cr, CAIRO_OPERATOR_DEST_OVER);
-  cairo_set_source_rgb (cr, 1., 1., 1.);
-  cairo_paint (cr);
-
-  cairo_destroy (cr);
-
-  copy_cairo_surface_to_pixbuf (surface, pixbuf);
-  cairo_surface_destroy (surface);
-}
-
-/**
- * poppler_page_render_to_pixbuf:
- * @page: the page to render from
- * @src_x: x coordinate of upper left corner  
- * @src_y: y coordinate of upper left corner  
- * @src_width: width of rectangle to render  
- * @src_height: height of rectangle to render
- * @scale: scale specified as pixels per point
- * @rotation: rotate the document by the specified degree
- * @pixbuf: pixbuf to render into
- *
- * First scale the document to match the specified pixels per point,
- * then render the rectangle given by the upper left corner at
- * (src_x, src_y) and src_width and src_height.
- * This function is for rendering a page that will be displayed.
- * If you want to render a page that will be printed use
- * poppler_page_render_to_pixbuf_for_printing() instead
- *
- * Deprecated: 0.16
- **/
-void
-poppler_page_render_to_pixbuf (PopplerPage *page,
-			       int src_x, int src_y,
-			       int src_width, int src_height,
-			       double scale,
-			       int rotation,
-			       GdkPixbuf *pixbuf)
-{
-  g_return_if_fail (POPPLER_IS_PAGE (page));
-  g_return_if_fail (scale > 0.0);
-  g_return_if_fail (pixbuf != NULL);
-
-  _poppler_page_render_to_pixbuf (page, src_x, src_y,
-				  src_width, src_height,
-				  scale, rotation,
-				  gFalse,
-				  pixbuf);
-}
-
-/**
- * poppler_page_render_to_pixbuf_for_printing:
- * @page: the page to render from
- * @src_x: x coordinate of upper left corner  
- * @src_y: y coordinate of upper left corner  
- * @src_width: width of rectangle to render  
- * @src_height: height of rectangle to render
- * @scale: scale specified as pixels per point
- * @rotation: rotate the document by the specified degree
- * @pixbuf: pixbuf to render into
- *
- * First scale the document to match the specified pixels per point,
- * then render the rectangle given by the upper left corner at
- * (src_x, src_y) and src_width and src_height.
- * This function is for rendering a page that will be printed.
- *
- * Deprecated: 0.16
- **/
-void
-poppler_page_render_to_pixbuf_for_printing (PopplerPage *page,
-					    int src_x, int src_y,
-					    int src_width, int src_height,
-					    double scale,
-					    int rotation,
-					    GdkPixbuf *pixbuf)
-{
-  g_return_if_fail (POPPLER_IS_PAGE (page));
-  g_return_if_fail (scale > 0.0);
-  g_return_if_fail (pixbuf != NULL);
-
-  _poppler_page_render_to_pixbuf (page, src_x, src_y,
-				  src_width, src_height,
-				  scale, rotation,
-				  gTrue,
-				  pixbuf);
-}
-
-/**
- * poppler_page_get_thumbnail_pixbuf:
- * @page: the #PopperPage to get the thumbnail for
- * 
- * Get the embedded thumbnail for the specified page.  If the document
- * doesn't have an embedded thumbnail for the page, this function
- * returns %NULL.
- * 
- * Return value: the tumbnail as a #GdkPixbuf or %NULL if the document
- * doesn't have a thumbnail for this page.
- *
- * Deprecated: 0.16
- **/
-GdkPixbuf *
-poppler_page_get_thumbnail_pixbuf (PopplerPage *page)
-{
-  unsigned char *data;
-  int width, height, rowstride;
-
-  g_return_val_if_fail (POPPLER_IS_PAGE (page), NULL);
-
-  if (!page->page->loadThumb (&data, &width, &height, &rowstride))
-    return NULL;
-
-  return gdk_pixbuf_new_from_data (data, GDK_COLORSPACE_RGB,
-				   FALSE, 8, width, height, rowstride,
-				   (GdkPixbufDestroyNotify)gfree, NULL);
-}
-
-/**
- * poppler_page_render_selection_to_pixbuf:
- * @page: the #PopplerPage for which to render selection
- * @scale: scale specified as pixels per point
- * @rotation: rotate the document by the specified degree
- * @pixbuf: pixbuf to render to
- * @selection: start and end point of selection as a rectangle
- * @old_selection: previous selection
- * @style: a #PopplerSelectionStyle
- * @glyph_color: color to use for drawing glyphs
- * @background_color: color to use for the selection background
- * 
- * Render the selection specified by @selection for @page into
- * @pixbuf.  The selection will be rendered at @scale, using
- * @glyph_color for the glyphs and @background_color for the selection
- * background.
- *
- * If non-NULL, @old_selection specifies the selection that is already
- * rendered in @pixbuf, in which case this function will (some day)
- * only render the changed part of the selection.
- *
- * Deprecated: 0.16
- **/
-void
-poppler_page_render_selection_to_pixbuf (PopplerPage           *page,
-                                         gdouble                scale,
-                                         int                    rotation,
-                                         GdkPixbuf             *pixbuf,
-                                         PopplerRectangle      *selection,
-                                         PopplerRectangle      *old_selection,
-					 PopplerSelectionStyle  style,
-                                         GdkColor              *glyph_color,
-                                         GdkColor              *background_color)
-{
-  cairo_t *cr;
-  cairo_surface_t *surface;
-  double width, height;
-  int cairo_width, cairo_height, rotate;
-  PopplerColor poppler_background_color;
-  PopplerColor poppler_glyph_color;
-
-  poppler_background_color.red = background_color->red;
-  poppler_background_color.green = background_color->green;
-  poppler_background_color.blue = background_color->blue;
-  poppler_glyph_color.red = glyph_color->red;
-  poppler_glyph_color.green = glyph_color->green;
-  poppler_glyph_color.blue = glyph_color->blue;
-
-  rotate = rotation + page->page->getRotate ();
-  if (rotate == 90 || rotate == 270) {
-    height = page->page->getCropWidth ();
-    width = page->page->getCropHeight ();
-  } else {
-    width = page->page->getCropWidth ();
-    height = page->page->getCropHeight ();
-  }
-
-  cairo_width = (int) ceil(width * scale);
-  cairo_height = (int) ceil(height * scale);
-
-  surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
-					cairo_width, cairo_height);
-  cr = cairo_create (surface);
-  cairo_set_source_rgba (cr, 0, 0, 0, 0);
-  cairo_paint (cr);
-
-  switch (rotate) {
-  case 90:
-	  cairo_translate (cr, cairo_width, 0);
-	  break;
-  case 180:
-	  cairo_translate (cr, cairo_width, cairo_height);
-	  break;
-  case 270:
-	  cairo_translate (cr, 0, cairo_height);
-	  break;
-  default:
-	  cairo_translate (cr, 0, 0);
-  }
-  if (scale != 1.0)
-	  cairo_scale (cr, scale, scale);
-
-  if (rotate != 0)
-	  cairo_rotate (cr, rotation * G_PI / 180.0);
-
-  poppler_page_render_selection (page, cr, selection, old_selection, style,
-				 &poppler_glyph_color, &poppler_background_color);
-
-  cairo_destroy (cr);
-
-  copy_cairo_surface_to_pixbuf (surface, pixbuf);
-  cairo_surface_destroy (surface);
-}
-
-#endif /* POPPLER_WITH_GDK */
-
 /**
  * poppler_page_get_thumbnail_size:
  * @page: A #PopplerPage
diff --git a/glib/poppler-page.h b/glib/poppler-page.h
index d40c0ee..03e22ec 100644
--- a/glib/poppler-page.h
+++ b/glib/poppler-page.h
@@ -23,10 +23,6 @@
 
 #include "poppler.h"
 
-#ifdef POPPLER_WITH_GDK
-#include <gdk/gdk.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#endif
 #include <cairo.h>
 
 G_BEGIN_DECLS
@@ -38,36 +34,6 @@ G_BEGIN_DECLS
 
 GType      	       poppler_page_get_type             (void) G_GNUC_CONST;
 
-#ifdef POPPLER_WITH_GDK
-void                   poppler_page_render_to_pixbuf     (PopplerPage        *page,
-							  int                 src_x,
-							  int                 src_y,
-							  int                 src_width,
-							  int                 src_height,
-							  double              scale,
-							  int                 rotation,
-							  GdkPixbuf          *pixbuf);
-void          poppler_page_render_to_pixbuf_for_printing (PopplerPage        *page,
-							  int                 src_x,
-							  int                 src_y,
-							  int                 src_width,
-							  int                 src_height,
-							  double              scale,
-							  int                 rotation,
-							  GdkPixbuf          *pixbuf);
-GdkPixbuf             *poppler_page_get_thumbnail_pixbuf (PopplerPage        *page);
-void                poppler_page_render_selection_to_pixbuf (
-							  PopplerPage        *page,
-							  gdouble             scale,
-							  int		      rotation,
-							  GdkPixbuf          *pixbuf,
-							  PopplerRectangle   *selection,
-							  PopplerRectangle   *old_selection,
-							  PopplerSelectionStyle style,
-							  GdkColor           *glyph_color,
-							  GdkColor           *background_color);
-#endif /* POPPLER_WITH_GDK */
-
 void                   poppler_page_render               (PopplerPage        *page,
 							  cairo_t            *cairo);
 void                   poppler_page_render_for_printing  (PopplerPage        *page,
commit a5482d64472a81206dd8d0c5bb80007f6d5bb893
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Sun Feb 13 11:40:23 2011 +0100

    glib: Remove test-poppler-glib, poppler-glib-demo does the same and more

diff --git a/glib/CMakeLists.txt b/glib/CMakeLists.txt
index b59935e..cf43129 100644
--- a/glib/CMakeLists.txt
+++ b/glib/CMakeLists.txt
@@ -100,14 +100,6 @@ set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES
 )
 
 
-if (GDK_FOUND)
-  set(test_poppler_glib_SRCS
-    test-poppler-glib.cc
-  )
-  poppler_add_test(test-poppler-glib BUILD_GTK_TESTS ${test_poppler_glib_SRCS})
-  target_link_libraries(test-poppler-glib poppler-glib ${GDK2_LIBRARIES})
-endif (GDK_FOUND)
-
 macro(_list_prefix _outvar _listvar _prefix)
   set(${_outvar})
   foreach(_item IN LISTS ${_listvar})
diff --git a/glib/Makefile.am b/glib/Makefile.am
index 76818ca..c7de40f 100644
--- a/glib/Makefile.am
+++ b/glib/Makefile.am
@@ -78,20 +78,6 @@ libpoppler_glib_la_LIBADD =				\
 
 libpoppler_glib_la_LDFLAGS = -version-info 6:0:0 @create_shared_lib@ @auto_import_flags@
 
-if BUILD_WITH_GDK
-noinst_PROGRAMS = test-poppler-glib
-
-test_poppler_glib_SOURCES =			\
-       test-poppler-glib.cc
-
-test_poppler_glib_LDADD =			\
-	$(top_builddir)/poppler/libpoppler.la	\
-	libpoppler-glib.la			\
-	$(POPPLER_GLIB_LIBS)			\
-	$(GDK_LIBS)				\
-	$(FREETYPE_LIBS)
-endif
-
 BUILT_SOURCES =					\
 	poppler-enums.c				\
 	poppler-enums.h
diff --git a/glib/test-poppler-glib.cc b/glib/test-poppler-glib.cc
deleted file mode 100644
index 32b2d21..0000000
--- a/glib/test-poppler-glib.cc
+++ /dev/null
@@ -1,657 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include "config.h"
-#include "poppler.h"
-
-#define FAIL(msg) \
-	do { fprintf (stderr, "FAIL: %s\n", msg); exit (-1); } while (0)
-
-static gchar *
-poppler_format_date (GTime utime)
-{
-	time_t time = (time_t) utime;
-	char s[256];
-	const char *fmt_hack = "%c";
-	size_t len;
-#ifdef HAVE_LOCALTIME_R
-	struct tm t;
-	if (time == 0 || !localtime_r (&time, &t)) return NULL;
-	len = strftime (s, sizeof (s), fmt_hack, &t);
-#else
-	struct tm *t;
-	if (time == 0 || !(t = localtime (&time)) ) return NULL;
-	len = strftime (s, sizeof (s), fmt_hack, t);
-#endif
-
-	if (len == 0 || s[0] == '\0') return NULL;
-
-	return g_locale_to_utf8 (s, -1, NULL, NULL, NULL);
-}
-
-static void
-print_index (PopplerIndexIter *iter, gint deph)
-{
-  do
-    {
-      PopplerAction    *action;
-      PopplerIndexIter *child;
-      int               i;
-
-      action = poppler_index_iter_get_action (iter);
-      for (i = 0; i < deph; i++)
-        g_print (" ");
-      g_print ("+ %s\n", action->any.title);
-      poppler_action_free (action);
-      child = poppler_index_iter_get_child (iter);
-      if (child)
-        print_index (child, deph + 1);
-      poppler_index_iter_free (child);
-    }
-  while (poppler_index_iter_next (iter));
-}
-
-static void
-print_layers (PopplerLayersIter *iter, gint deph)
-{
-  do
-    {
-      PopplerLayersIter *child;
-      PopplerLayer      *layer;
-      gint               i;
-
-      for (i = 0; i < deph; i++)
-        g_print (" ");
-
-      layer = poppler_layers_iter_get_layer (iter);
-      if (layer)
-        {
-	  g_print ("+ %s (%s)\n", poppler_layer_get_title (layer),
-		   poppler_layer_is_visible (layer) ?
-		   "Visible" : "Hidden");
-	  g_object_unref (layer);
-	}
-      
-      child = poppler_layers_iter_get_child (iter);
-      if (child)
-        {
-	  gchar *title;
-
-	  title = poppler_layers_iter_get_title (iter);
-	  if (title)
-	    {
-	      g_print ("+ %s\n", title);
-	      g_free (title);
-	    }
-	  print_layers (child, deph + 1);
-	}
-      poppler_layers_iter_free (child);
-    }
-  while (poppler_layers_iter_next (iter));
-}
- 
-static void
-print_document_info (PopplerDocument *document)
-{
-  gchar *title, *format, *author, *subject, *keywords, *creator, *producer, *linearized;
-  GTime creation_date, mod_date;
-  gchar *strdate;
-  PopplerPageLayout layout;
-  PopplerPageMode mode;
-  PopplerViewerPreferences view_prefs;
-  PopplerPermissions permissions;
-  PopplerFontInfo *font_info;
-  PopplerFontsIter *fonts_iter;
-  PopplerIndexIter *index_iter;
-  GEnumValue *enum_value;
-
-  g_object_get (document,
-		"title", &title,
-		"format", &format,
-		"author", &author,
-		"subject", &subject,
-		"keywords", &keywords,
-		"creation-date", &creation_date,
-		"mod-date", &mod_date,
-		"creator", &creator,
-		"producer", &producer,	
-		"linearized", &linearized,
-		"page-mode", &mode,
-		"page-layout", &layout,
-		"viewer-preferences", &view_prefs,
-		"permissions", &permissions,
-		NULL);
-
-  printf ("\t---------------------------------------------------------\n");
-  printf ("\tDocument Metadata\n");
-  printf ("\t---------------------------------------------------------\n");
-  if (title)  printf   ("\ttitle:\t\t%s\n", title);
-  if (format) printf   ("\tformat:\t\t%s\n", format);
-  if (author) printf   ("\tauthor:\t\t%s\n", author);
-  if (subject) printf  ("\tsubject:\t%s\n", subject);
-  if (keywords) printf ("\tkeywords:\t%s\n", keywords);
-  if (creator) printf ("\tcreator:\t%s\n", creator);
-  if (producer) printf ("\tproducer:\t%s\n", producer);
-  if (linearized) printf ("\tlinearized:\t%s\n", linearized);
-  
-  enum_value = g_enum_get_value ((GEnumClass *) g_type_class_peek (POPPLER_TYPE_PAGE_MODE), mode);
-  g_print ("\tpage mode:\t%s\n", enum_value->value_name);
-  enum_value = g_enum_get_value ((GEnumClass *) g_type_class_peek (POPPLER_TYPE_PAGE_LAYOUT), layout);
-  g_print ("\tpage layout:\t%s\n", enum_value->value_name);
-
-  strdate = poppler_format_date (creation_date);
-  if (strdate)
-    {
-      g_print ("\tcreation date:\t%s\n", strdate);
-      g_free (strdate);
-    }
-  strdate = poppler_format_date (mod_date);
-  if (strdate)
-    {
-      g_print ("\tmodified date:\t%s\n", strdate);
-      g_free (strdate);
-    }
-
-  g_print ("\tfonts:\n");
-  font_info = poppler_font_info_new (document);
-  while (poppler_font_info_scan (font_info, 20, &fonts_iter)) {
-    if (fonts_iter) {
-      do {
-        g_print ("\t\t\t%s\n", poppler_fonts_iter_get_name (fonts_iter));
-      } while (poppler_fonts_iter_next (fonts_iter));
-      poppler_fonts_iter_free (fonts_iter);
-    }
-  }
-  g_object_unref (font_info);
-
-  index_iter = poppler_index_iter_new (document);
-  if (index_iter)
-    {
-      g_print ("\tindex:\n");
-      print_index (index_iter, 0);
-      poppler_index_iter_free (index_iter);
-    }
-
-  printf ("\t---------------------------------------------------------\n");
-  printf ("\tDocument Permissions\n");
-  printf ("\t---------------------------------------------------------\n");
-
-  printf ("\tOk to Print: %s\n",
-	  permissions & POPPLER_PERMISSIONS_OK_TO_PRINT ? "Yes" : "No");
-  printf ("\tOk to Modify: %s\n",
-	  permissions & POPPLER_PERMISSIONS_OK_TO_MODIFY ? "Yes" : "No");
-  printf ("\tOk to Copy: %s\n",
-	  permissions & POPPLER_PERMISSIONS_OK_TO_COPY ? "Yes" : "No");
-  printf ("\tOk to Add Notes: %s\n",
-	  permissions & POPPLER_PERMISSIONS_OK_TO_ADD_NOTES ? "Yes" : "No");
-  printf ("\tOk to Fill Forms: %s\n",
-	  permissions & POPPLER_PERMISSIONS_OK_TO_FILL_FORM ? "Yes" : "No");
-
-  printf ("\n");
-  
-  /* FIXME: print out the view prefs when we support it */
-
-  g_free (title);
-  g_free (format);
-  g_free (author);
-  g_free (subject);
-  g_free (keywords);
-  g_free (creator);
-  g_free (producer); 
-  g_free (linearized);
-}
-
-static const gchar *
-transition_effect_name (PopplerPageTransitionType type)
-{
-  switch (type)
-    {
-      case POPPLER_PAGE_TRANSITION_REPLACE:
-	return "Replace";
-      case POPPLER_PAGE_TRANSITION_SPLIT:
-	return "Split";
-      case POPPLER_PAGE_TRANSITION_BLINDS:
-	return "Blinds";
-      case POPPLER_PAGE_TRANSITION_BOX:
-	return "Box";
-      case POPPLER_PAGE_TRANSITION_WIPE:
-	return "Wipe";
-      case POPPLER_PAGE_TRANSITION_DISSOLVE:
-	return "Dissolve";
-      case POPPLER_PAGE_TRANSITION_GLITTER:
-	return "Glitter";
-      case POPPLER_PAGE_TRANSITION_FLY:
-	return "Fly";
-      case POPPLER_PAGE_TRANSITION_PUSH:
-	return "Push";
-      case POPPLER_PAGE_TRANSITION_COVER:
-	return "Cover";
-      case POPPLER_PAGE_TRANSITION_UNCOVER:
-	return "Uncover";
-      case POPPLER_PAGE_TRANSITION_FADE:
-	return "Fade";
-    }
-
-  return "Unknown";
-}
-
-static void
-print_page_transition (PopplerPageTransition *transition)
-{
-  printf ("\t\tEffect: %s\n", transition_effect_name (transition->type));
-  printf ("\t\tAlignment: %s\n",
-	  transition->alignment == POPPLER_PAGE_TRANSITION_HORIZONTAL ?
-	  "Horizontal" : "Vertical");
-  printf ("\t\tDirection: %s\n",
-	  transition->direction == POPPLER_PAGE_TRANSITION_INWARD ?
-	  "Inward" : "Outward");
-  printf ("\t\tDuration: %d\n", transition->duration);
-  printf ("\t\tAngle: %d\n", transition->angle);
-  printf ("\t\tScale: %.2f\n", transition->scale);
-  printf ("\t\tRectangular: %s\n", transition->rectangular ? "Yes" : "No");
-}
-
-static void
-form_field_text_print (PopplerFormField *field)
-{
-  PopplerFormTextType type;
-  gchar *text;
-
-  type = poppler_form_field_text_get_text_type (field);
-  printf ("\t\tType:\t\tText\n");
-  printf ("\t\tMultiline:\t%s\n",
-	  type == POPPLER_FORM_TEXT_MULTILINE ? "Yes" : "No");
-  printf ("\t\tFileSelect:\t%s\n",
-	  type == POPPLER_FORM_TEXT_FILE_SELECT ? "Yes" : "No");
-  printf ("\t\tDoSpellCheck:\t%s\n",
-	  poppler_form_field_text_do_spell_check (field) ? "Yes" : "No");
-  printf ("\t\tDoScroll:\t%s\n",
-	  poppler_form_field_text_do_scroll (field) ? "Yes" : "No");
-  printf ("\t\tIsRichText:\t%s\n",
-	  poppler_form_field_text_is_rich_text (field) ? "Yes" : "No");
-  printf ("\t\tPassword:\t%s\n",
-	  poppler_form_field_text_is_password (field) ? "Yes" : "No");
-  printf ("\t\tMaxLen:\t\t%d\n", poppler_form_field_text_get_max_len (field));
-  text = poppler_form_field_text_get_text (field);
-  printf ("\t\tContent:\t%s\n", text ? text : "");
-  g_free (text);
-}
-
-static void
-form_field_button_print (PopplerFormField *field)
-{
-  PopplerFormButtonType button_type;
-  const gchar *button_type_str;
-
-  button_type = poppler_form_field_button_get_button_type (field);
-
-  switch (button_type)
-    {
-      case POPPLER_FORM_BUTTON_PUSH:
-        button_type_str = "Push";
-	break;
-      case POPPLER_FORM_BUTTON_CHECK:
-        button_type_str = "Check box";
-	break;
-      case POPPLER_FORM_BUTTON_RADIO:
-        button_type_str = "Radio Button";
-	break;
-      default:
-        g_assert_not_reached ();
-    }
-  
-  printf ("\t\tType:\t\tButton\n");
-  printf ("\t\tButton type:\t%s\n", button_type_str);
-  if (button_type != POPPLER_FORM_BUTTON_PUSH)
-    printf ("\t\tState:\t\t%s\n",
-	    poppler_form_field_button_get_state (field) ? "Active" : "Inactive");
-}
-
-static void
-form_field_choice_print (PopplerFormField *field)
-{
-  gint i, n_items;
-  
-  printf ("\t\tType:\t\tChoice\n");
-  printf ("\t\tSubType:\t%s\n",
-	  poppler_form_field_choice_get_choice_type (field) == POPPLER_FORM_CHOICE_COMBO ?
-	  "Combo" : "List");
-  printf ("\t\tEditable:\t%s\n",
-	  poppler_form_field_choice_is_editable (field) ? "Yes" : "No");
-  printf ("\t\tCan select multiple: %s\n",
-	  poppler_form_field_choice_can_select_multiple (field) ? "Yes" : "No");
-  printf ("\t\tDoSpellCheck:\t%s\n",
-	  poppler_form_field_choice_do_spell_check (field) ? "Yes" : "No");
-  printf ("\t\tCommit on change: %s\n",
-	  poppler_form_field_choice_commit_on_change (field) ? "Yes" : "No");
-  
-  n_items = poppler_form_field_choice_get_n_items (field);
-  for (i = 0; i < n_items; i++)
-    {
-      gchar *item;
-
-      item = poppler_form_field_choice_get_item (field, i);
-      printf ("\t\t\tItem %d: %s %s\n", i, item ? item : "",
-	      poppler_form_field_choice_is_item_selected (field, i) ?
-	      "(selected)" : "");
-      g_free (item);
-    }
-}
-
-static void
-form_field_print (PopplerFormField *field)
-{
-  printf ("\t\tFont Size:\t%.2f\n",
-	  poppler_form_field_get_font_size (field));
-  printf ("\t\tReadOnly:\t%s\n",
-	  poppler_form_field_is_read_only (field) ? "Yes" : "No");
-  
-  switch (poppler_form_field_get_field_type (field))
-    {
-    case POPPLER_FORM_FIELD_TEXT:
-      form_field_text_print (field);
-      break;
-    case POPPLER_FORM_FIELD_BUTTON:
-      form_field_button_print (field);
-      break;
-    case POPPLER_FORM_FIELD_CHOICE:
-      form_field_choice_print (field);
-      break;
-    default:
-      printf ("\t\tUnknown form field\n");
-    }
-  printf ("\n");
-}
-
-static void
-annot_print (PopplerAnnot *annot)
-{
-  GEnumValue *enum_value;
-  gchar *text;
-  
-  enum_value = g_enum_get_value ((GEnumClass *) g_type_class_ref (POPPLER_TYPE_ANNOT_TYPE),
-				 poppler_annot_get_annot_type (annot));
-  g_print ("\t\tType: %s\n", enum_value->value_name);
-  text = poppler_annot_get_contents (annot);
-  g_print ("\t\tContents: %s\n", text);
-  g_free (text);
-  printf ("\n");
-}
-
-int main (int argc, char *argv[])
-{
-  PopplerDocument *document;
-  PopplerBackend backend;
-  PopplerPage *page;
-  PopplerPageTransition *transition;
-  PopplerFormField *field;
-  GEnumValue *enum_value;
-  char *label;
-  GError *error;
-  GdkPixbuf *pixbuf, *thumb;
-  double width, height;
-  GList *list, *l;
-  char *text;
-  double duration;
-  gint num_images;
-  gint num_forms;
-  gint num_links;
-  gint num_annots;
-  gint form_id = 0;
-  PopplerLayersIter *layers_iter;
-
-  if (argc != 3)
-    FAIL ("usage: test-poppler-glib file://FILE PAGE");
-
-  g_type_init ();
-
-  g_print ("Poppler version %s\n", poppler_get_version ());
-  backend = poppler_get_backend ();
-  enum_value = g_enum_get_value ((GEnumClass *) g_type_class_ref (POPPLER_TYPE_BACKEND), backend);
-  g_print ("Backend is %s\n", enum_value->value_name);
-
-  error = NULL;
-  document = poppler_document_new_from_file (argv[1], NULL, &error);
-  if (document == NULL)
-    FAIL (error->message);
-
-  print_document_info (document); 
-
-  page = poppler_document_get_page_by_label (document, argv[2]);
-  if (page == NULL)
-    FAIL ("page not found");
-
-  poppler_page_get_size (page, &width, &height);
-  printf ("\tpage size:\t%f inches by %f inches\n", width / 72, height / 72);
-
-  duration = poppler_page_get_duration (page);
-  if (duration > 0)
-    printf ("\tpage duration:\t%f second(s)\n", duration);
-  else
-    printf ("\tpage duration:\tno duration for page\n");
-
-  transition = poppler_page_get_transition (page);
-  if (transition) {
-    printf ("\tpage transition:\n");
-    print_page_transition (transition);
-    poppler_page_transition_free (transition);
-  } else {
-    printf ("\tpage transition:no transition effect for page\n");
-  }
-
-  thumb = poppler_page_get_thumbnail_pixbuf (page);
-  if (thumb != NULL) {
-    gdk_pixbuf_save (thumb, "thumb.png", "png", &error, NULL);
-    if (error != NULL)
-      FAIL (error->message);
-    else
-      printf ("\tthumbnail:\tsaved as thumb.png\n");
-    g_object_unref (G_OBJECT (thumb));
-  }
-  else
-    printf ("\tthumbnail:\tno thumbnail for page\n");
-
-  g_object_get (page, "label", &label, NULL);
-  printf ("\tpage label:\t%s\n", label);
-  g_free (label);
-
-  pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, 220, 220);
-  gdk_pixbuf_fill (pixbuf, 0x00106000);
-  poppler_page_render_to_pixbuf (page, 100, 100, 200, 200, 1, 0, pixbuf);
-
-  gdk_pixbuf_save (pixbuf, "slice.png", "png", &error, NULL);
-  printf ("\tslice:\t\tsaved 200x200 slice at (100, 100) as slice.png\n");
-  if (error != NULL) {
-    FAIL (error->message);
-    g_error_free (error);
-  }
-
-  g_object_unref (G_OBJECT (pixbuf));
-
-  list = poppler_page_get_link_mapping (page);
-  num_links = g_list_length (list);
-  if (num_links > 0)
-    printf ("\tFound %d links at positions:\n", num_links);
-  else
-    printf ("\tNo links found\n");
-  
-  for (l = list; l != NULL; l = l->next)
-    {
-      PopplerLinkMapping *mapping = (PopplerLinkMapping *)l->data;
-      
-      printf ("\t\t(%f, %f) - (%f, %f)\n",
-	      mapping->area.x1,
-	      mapping->area.y1,
-	      mapping->area.x2,
-	      mapping->area.y2);
-      enum_value = g_enum_get_value ((GEnumClass *) g_type_class_ref (POPPLER_TYPE_ACTION_TYPE),
-				     mapping->action->type);
-      g_print ("\t\t\tAction: %s (%d)\n", enum_value->value_name, mapping->action->type);
-      switch (mapping->action->type)
-        {
-	  case POPPLER_ACTION_GOTO_DEST:
-	    printf("\t\t\tDest title: %s\n", mapping->action->goto_dest.title);
-	    printf("\t\t\tNamed dest: %s\n", mapping->action->goto_dest.dest->named_dest);
-	    break;
-	  default:
-	    printf("\t\t\tDetails unimplemented for this action type\n");
-	}
-    }
-  poppler_page_free_link_mapping (list); 
-  
-  text = poppler_page_get_text (page);
-  if (text)
-    {
-      FILE *file = fopen ("dump.txt", "w");
-      if (file)
-	{
-	  fwrite (text, strlen (text), 1, file);
-	  fclose (file);
-	}
-      g_free (text);
-    }
-
-  list = poppler_page_find_text (page, "Bitwise");
-  printf ("\n");  
-  printf ("\tFound text \"Bitwise\" at positions:\n");
-  for (l = list; l != NULL; l = l->next)
-    {
-      PopplerRectangle *rect = (PopplerRectangle *)l->data;
-
-      printf ("  (%f,%f)-(%f,%f)\n", rect->x1, rect->y1, rect->x2, rect->y2);
-    }
-
-  list = poppler_page_get_image_mapping (page);
-  num_images = g_list_length (list);
-  printf ("\n");
-  if (num_images > 0)
-    printf ("\tFound %d images at positions:\n", num_images);
-  else
-    printf ("\tNo images found\n");
-  for (l = list; l != NULL; l = l->next)
-    {
-      PopplerImageMapping *mapping;
-      cairo_surface_t     *image;
-
-      mapping = (PopplerImageMapping *)l->data;
-      printf ("\t\t(%f, %f) - (%f, %f)\n",
-	      mapping->area.x1,
-	      mapping->area.y1,
-	      mapping->area.x2,
-	      mapping->area.y2);
-
-      image = poppler_page_get_image (page, mapping->image_id);
-      printf ("\t\tImage: %p\n", image);
-      cairo_surface_destroy (image);
-    }
-  poppler_page_free_image_mapping (list);
-
-  list = poppler_page_get_form_field_mapping (page);
-  num_forms = g_list_length (list);
-  printf ("\n");
-  if (num_forms > 0)
-    printf ("\tFound %d form fields at positions:\n", num_forms);
-  else
-    printf ("\tNo forms fields found\n");
-  for (l = list; l != NULL; l = l->next)
-    {
-      PopplerFormFieldMapping *mapping;
-
-      mapping = (PopplerFormFieldMapping *)l->data;
-
-      form_id = poppler_form_field_get_id (mapping->field);
-      
-      printf ("\t\tId: %d: (%f, %f) - (%f, %f)\n",
-	      form_id,
-	      mapping->area.x1,
-	      mapping->area.y1,
-	      mapping->area.x2,
-	      mapping->area.y2);
-      form_field_print (mapping->field);
-    }
-  poppler_page_free_form_field_mapping (list);
-
-  if (num_forms > 0)
-    {
-      field = poppler_document_get_form_field (document, form_id);
-      printf ("\tForm field for id %d\n", form_id);
-      form_field_print (field);
-      g_object_unref (field);
-    }  
-
-  list = poppler_page_get_annot_mapping (page);
-  num_annots = g_list_length (list);
-  if (num_annots > 0)
-    printf ("\tFound %d annotations at positions:\n", num_annots);
-  else
-    printf ("\tNo annotations found\n");
-  for (l = list; l != NULL; l = l->next)
-    {
-      PopplerAnnotMapping *mapping = (PopplerAnnotMapping *)l->data;
-	    
-      printf ("\t\t(%f, %f) - (%f, %f)\n",
-	      mapping->area.x1,
-	      mapping->area.y1,
-	      mapping->area.x2,
-	      mapping->area.y2);
-
-      annot_print (mapping->annot);
-    }
-  poppler_page_free_annot_mapping (list);
-  
-  if (poppler_document_has_attachments (document))
-    {
-      int i = 0;
-
-      g_print ("Attachments found:\n\n");
-
-      list = poppler_document_get_attachments (document);
-      for (l = list; l; l = l->next)
-	{
-	  PopplerAttachment *attachment;
-	  char *filename, *strdate;
-
-	  filename = g_strdup_printf ("/tmp/attach%d", i);
-	  attachment = (PopplerAttachment *)l->data;
-	  g_print ("\tname: %s\n", attachment->name);
-	  g_print ("\tdescription: %s\n", attachment->description);
-	  g_print ("\tsize: %" G_GSIZE_FORMAT "\n", attachment->size);
-	  strdate = poppler_format_date (attachment->ctime);
-	  if (strdate)
-	    {
-	      g_print ("\tcreation date: %s\n", strdate);
-	      g_free (strdate);
-	    }
-	  strdate = poppler_format_date (attachment->mtime);
-	  if (strdate)
-	    {
-	      g_print ("\tmodification date: %s\n", strdate);
-	      g_free (strdate);
-	    }
-	  poppler_attachment_save (attachment, filename, NULL);
-	  g_free (filename);
-	  g_print ("\n");
-	  i++;
-	}
-      g_list_foreach (list, (GFunc) g_object_unref, NULL);
-      g_list_free (list);
-    }
-  else
-    g_print ("\tNo attachments found\n");
-
-  layers_iter = poppler_layers_iter_new (document);
-  if (layers_iter)
-    {
-      g_print ("\tLayers:\n");
-      print_layers (layers_iter, 0);
-      poppler_layers_iter_free (layers_iter);
-    }
-  else
-    g_print ("\tNo layers found\n");
-
-  g_object_unref (G_OBJECT (page));
-  g_object_unref (G_OBJECT (document));
-
-  return 0;
-}


More information about the poppler mailing list