[poppler] 2 commits - configure.ac glib/Makefile.am glib/poppler-annot.cc glib/poppler-document.cc glib/poppler-page.cc glib/reference m4/introspection.m4

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Fri Jul 2 09:19:59 PDT 2010


 configure.ac                     |    5 ++
 glib/Makefile.am                 |   29 ++++++++++++
 glib/poppler-annot.cc            |   45 +++++++++---------
 glib/poppler-document.cc         |    8 +--
 glib/poppler-page.cc             |   23 ++++++---
 glib/reference/poppler-docs.sgml |    2 
 m4/introspection.m4              |   94 +++++++++++++++++++++++++++++++++++++++
 7 files changed, 171 insertions(+), 35 deletions(-)

New commits:
commit f16015303422280eaa21c3144eca0f1a330dce8a
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Fri Jul 2 18:19:13 2010 +0200

    [glib] docs: Add GObject introspection annotations

diff --git a/glib/poppler-annot.cc b/glib/poppler-annot.cc
index 03dfaec..3a49b01 100644
--- a/glib/poppler-annot.cc
+++ b/glib/poppler-annot.cc
@@ -640,12 +640,11 @@ poppler_annot_markup_get_popup_is_open (PopplerAnnotMarkup *poppler_annot)
 /**
  * poppler_annot_markup_get_popup_rectangle:
  * @poppler_annot: a #PopplerAnnotMarkup
- * @poppler_rect: a #PopplerRectangle to store the popup rectangle
+ * @poppler_rect: (out): a #PopplerRectangle to store the popup rectangle
  *
  * Retrieves the rectangle of the popup annot related to @poppler_annot.
  *
- * Return value: %TRUE if #PopplerRectangle was correctly filled,
- *               %FALSE otherwise
+ * Return value: %TRUE if #PopplerRectangle was correctly filled, %FALSE otherwise
  *
  * Since: 0.12
  **/
@@ -1076,15 +1075,15 @@ poppler_annot_callout_line_free (PopplerAnnotCalloutLine *callout)
 
 /* PopplerAnnotMovie */
 /**
-* poppler_annot_movie_get_title:
-* @poppler_annot: a #PopplerAnnotMovie
-*
-* Retrieves the movie title of @poppler_annot.
-*
-* Return value: the title text of @poppler_annot.
-*
-* Since: 0.14
-*/
+ * poppler_annot_movie_get_title:
+ * @poppler_annot: a #PopplerAnnotMovie
+ *
+ * Retrieves the movie title of @poppler_annot.
+ *
+ * Return value: the title text of @poppler_annot.
+ *
+ * Since: 0.14
+ */
 gchar *
 poppler_annot_movie_get_title (PopplerAnnotMovie *poppler_annot)
 {
@@ -1101,16 +1100,16 @@ poppler_annot_movie_get_title (PopplerAnnotMovie *poppler_annot)
 }
 
 /**
-* poppler_annot_movie_get_movie:
-* @poppler_annot: a #PopplerAnnotMovie
-*
-* Retrieves the movie object (PopplerMovie) stored in the @poppler_annot.
-*
-* Return value: the movie object stored in the @poppler_annot. The returned
-*               object is owned by #PopplerAnnotMovie and should not be freed
-*
-* Since: 0.14
-*/
+ * poppler_annot_movie_get_movie:
+ * @poppler_annot: a #PopplerAnnotMovie
+ *
+ * Retrieves the movie object (PopplerMovie) stored in the @poppler_annot.
+ *
+ * Return value: (transfer none): the movie object stored in the @poppler_annot. The returned
+ *               object is owned by #PopplerAnnotMovie and should not be freed
+ *
+ * Since: 0.14
+ */
 PopplerMovie *
 poppler_annot_movie_get_movie (PopplerAnnotMovie *poppler_annot)
 {
@@ -1124,7 +1123,7 @@ poppler_annot_movie_get_movie (PopplerAnnotMovie *poppler_annot)
  *
  * Retrieves the action (#PopplerAction) that shall be performed when @poppler_annot is activated
  *
- * Return value: the action to perform. The returned
+ * Return value: (transfer none): the action to perform. The returned
  *               object is owned by @poppler_annot and should not be freed
  *
  * Since: 0.14
diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index 68451d5..c013e25 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -456,12 +456,12 @@ poppler_document_has_attachments (PopplerDocument *document)
 /**
  * poppler_document_get_attachments:
  * @document: A #PopplerDocument
- * 
+ *
  * Returns a #GList containing #PopplerAttachment<!-- -->s.  These attachments
  * are unowned, and must be unreffed, and the list must be freed with
  * g_list_free().
- * 
- * Return value: a list of available attachments.
+ *
+ * Return value: (element-type PopplerAttachment) (transfer full): a list of available attachments.
  **/
 GList *
 poppler_document_get_attachments (PopplerDocument *document)
@@ -1467,7 +1467,7 @@ poppler_font_info_new (PopplerDocument *document)
  * poppler_font_info_scan:
  * @font_info: a #PopplerFontInfo
  * @n_pages: number of pages to scan
- * @iter: return location for a #PopplerFontsIter
+ * @iter: (out): return location for a #PopplerFontsIter
  *
  * Scans the document associated with @font_info for fonts. At most
  * @n_pages will be scanned starting from the current iterator. @iter will
diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc
index a1accf2..b96a755 100644
--- a/glib/poppler-page.cc
+++ b/glib/poppler-page.cc
@@ -843,7 +843,7 @@ poppler_page_get_thumbnail_size (PopplerPage *page,
  * #PopplerRectangle. The returned list must be freed with
  * poppler_page_selection_region_free().
  * 
- * Return value: a #GList of #PopplerRectangle
+ * Return value: (element-type PopplerRectangle) (transfer full): a #GList of #PopplerRectangle
  **/
 GList *
 poppler_page_get_selection_region (PopplerPage           *page,
@@ -972,7 +972,7 @@ poppler_page_get_text (PopplerPage          *page,
  * A #GList of rectangles for each occurance of the text on the page.
  * The coordinates are in PDF points.
  * 
- * Return value: a #GList of PopplerRectangle, 
+ * Return value: (element-type PopplerRectangle) (transfer full): a #GList of #PopplerRectangle,
  **/
 GList *
 poppler_page_find_text (PopplerPage *page,
@@ -1054,7 +1054,7 @@ poppler_page_get_image_output_dev (PopplerPage *page,
  * location on @page to an image of the page. This list must be freed
  * with poppler_page_free_image_mapping() when done.
  *
- * Return value: A #GList of #PopplerImageMapping
+ * Return value: (element-type PopplerImageMapping) (transfer full): A #GList of #PopplerImageMapping
  **/
 GList *
 poppler_page_get_image_mapping (PopplerPage *page)
@@ -1237,7 +1237,7 @@ poppler_page_init (PopplerPage *page)
  * location on @page to a #PopplerAction.  This list must be freed
  * with poppler_page_free_link_mapping() when done.
  * 
- * Return value: A #GList of #PopplerLinkMapping
+ * Return value: (element-type PopplerLinkMapping) (transfer full): A #GList of #PopplerLinkMapping
  **/
 GList *
 poppler_page_get_link_mapping (PopplerPage *page)
@@ -1345,7 +1345,7 @@ poppler_page_free_link_mapping (GList *list)
  * location on @page to a form field.  This list must be freed
  * with poppler_page_free_form_field_mapping() when done.
  *
- * Return value: A #GList of #PopplerFormFieldMapping
+ * Return value: (element-type PopplerFormFieldMapping) (transfer full): A #GList of #PopplerFormFieldMapping
  **/
 GList *
 poppler_page_get_form_field_mapping (PopplerPage *page)
@@ -1408,7 +1408,7 @@ poppler_page_free_form_field_mapping (GList *list)
  * @page to a #PopplerAnnot.  This list must be freed with
  * poppler_page_free_annot_mapping() when done.
  *
- * Return value: A #GList of #PopplerAnnotMapping
+ * Return value: (element-type PopplerAnnotMapping) (transfer full): A #GList of #PopplerAnnotMapping
  **/
 GList *
 poppler_page_get_annot_mapping (PopplerPage *page)
@@ -1880,7 +1880,14 @@ poppler_annot_mapping_free (PopplerAnnotMapping *mapping)
   g_slice_free (PopplerAnnotMapping, mapping);
 }
 
-void 
+/**
+ * poppler_page_get_crop_box:
+ * @page: a #PopplerPage
+ * @rect: (out): a #PopplerRectangle to fill
+ *
+ * Retrurns the crop box of @page
+ */
+void
 poppler_page_get_crop_box (PopplerPage *page, PopplerRectangle *rect)
 {
   PDFRectangle* cropBox = page->page->getCropBox ();
@@ -1894,7 +1901,7 @@ poppler_page_get_crop_box (PopplerPage *page, PopplerRectangle *rect)
 /**
  * poppler_page_get_text_layout:
  * @page: A #PopplerPage
- * @rectangles: return location for an array of #PopplerRectangle
+ * @rectangles: (out) (array length=n_rectangles) (transfer container): return location for an array of #PopplerRectangle
  * @n_rectangles: length of returned array
  *
  * Obtains the layout of the text as a list of #PopplerRectangle
diff --git a/glib/reference/poppler-docs.sgml b/glib/reference/poppler-docs.sgml
index e15cf16..8a08849 100644
--- a/glib/reference/poppler-docs.sgml
+++ b/glib/reference/poppler-docs.sgml
@@ -46,4 +46,6 @@
     <title>Index of new symbols in 0.16</title>
     <xi:include href="xml/api-index-0.16.xml"><xi:fallback /></xi:include>
   </index>
+
+  <xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
 </book>
commit 60242038e4dce7f0c90f2bfa0e771120247dbc9d
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Wed Jun 30 09:35:29 2010 +0200

    [glib] Add GObject introspection support

diff --git a/configure.ac b/configure.ac
index 8fa2b69..3b42a5a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -364,6 +364,7 @@ fi
 AC_SUBST(CAIRO_FEATURE)
 AC_SUBST(CAIRO_REQ)
 
+found_introspection=no
 if test x$enable_cairo_output = xyes; then
   POPPLER_GLIB_DISABLE_DEPRECATED=""
   POPPLER_GLIB_DISABLE_SINGLE_INCLUDES=""
@@ -382,6 +383,9 @@ if test x$enable_cairo_output = xyes; then
                       [enable_poppler_glib="no"])
   fi
   if test x$enable_poppler_glib = xyes; then
+    # Check for introspection
+    GOBJECT_INTROSPECTION_CHECK([0.6.7])
+
     GLIB_REQ="glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED cairo >= $CAIRO_VERSION"
     AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums])
     POPPLER_GLIB_DISABLE_DEPRECATED="$POPPLER_GLIB_DISABLE_DEPRECATED -DG_DISABLE_DEPRECATED"
@@ -662,6 +666,7 @@ echo "  qt wrapper:         $enable_poppler_qt"
 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"
 echo "  use libjpeg:        $enable_libjpeg"
diff --git a/glib/Makefile.am b/glib/Makefile.am
index 2b0fadd..3453224 100644
--- a/glib/Makefile.am
+++ b/glib/Makefile.am
@@ -97,3 +97,32 @@ BUILT_SOURCES =					\
 CLEANFILES = $(BUILT_SOURCES) $(stamp_files)
 DISTCLEANFILES = $(BUILT_SOURCES) $(stamp_files)
 MAINTAINERCLEANFILES = $(BUILT_SOURCES) $(stamp_files)
+
+# GObject Introspection
+if HAVE_INTROSPECTION
+-include $(INTROSPECTION_MAKEFILE)
+INTROSPECTION_GIRS =
+INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir)
+INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
+
+introspection_files = $(libpoppler_glib_la_SOURCES) $(poppler_glib_include_HEADERS)
+Poppler-0.14.gir: libpoppler-glib.la
+Poppler_0_14_gir_INCLUDES = GObject-2.0 cairo-1.0
+Poppler_0_14_gir_CFLAGS = $(INCLUDES)
+Poppler_0_14_gir_LIBS = libpoppler-glib.la
+Poppler_0_14_gir_FILES = $(addprefix $(srcdir)/, $(introspection_files))
+
+if BUILD_WITH_GDK
+Poppler_0_14_gir_INCLUDES += Gdk-2.0
+endif
+
+INTROSPECTION_GIRS += Poppler-0.14.gir
+
+girdir = $(datadir)/gir-1.0
+dist_gir_DATA = $(INTROSPECTION_GIRS)
+
+typelibsdir = $(libdir)/girepository-1.0
+typelibs_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
+
+CLEANFILES += $(dist_gir_DATA) $(typelibs_DATA)
+endif #HAVE_INTROSPECTION
\ No newline at end of file
diff --git a/m4/introspection.m4 b/m4/introspection.m4
new file mode 100644
index 0000000..589721c
--- /dev/null
+++ b/m4/introspection.m4
@@ -0,0 +1,94 @@
+dnl -*- mode: autoconf -*-
+dnl Copyright 2009 Johan Dahlin
+dnl
+dnl This file is free software; the author(s) gives unlimited
+dnl permission to copy and/or distribute it, with or without
+dnl modifications, as long as this notice is preserved.
+dnl
+
+# serial 1
+
+m4_define([_GOBJECT_INTROSPECTION_CHECK_INTERNAL],
+[
+    AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
+    AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
+    AC_BEFORE([LT_INIT],[$0])dnl setup libtool first
+
+    dnl enable/disable introspection
+    m4_if([$2], [require],
+    [dnl
+        enable_introspection=yes
+    ],[dnl
+        AC_ARG_ENABLE(introspection,
+                  AS_HELP_STRING([--enable-introspection[=@<:@no/auto/yes@:>@]],
+                                 [Enable introspection for this build]),, 
+                                 [enable_introspection=auto])
+    ])dnl
+
+    AC_MSG_CHECKING([for gobject-introspection])
+
+    dnl presence/version checking
+    AS_CASE([$enable_introspection],
+    [no], [dnl
+        found_introspection="no (disabled, use --enable-introspection to enable)"
+    ],dnl
+    [yes],[dnl
+        PKG_CHECK_EXISTS([gobject-introspection-1.0],,
+                         AC_MSG_ERROR([gobject-introspection-1.0 is not installed]))
+        PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1],
+                         found_introspection=yes,
+                         AC_MSG_ERROR([You need to have gobject-introspection >= $1 installed to build AC_PACKAGE_NAME]))
+    ],dnl
+    [auto],[dnl
+        PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], found_introspection=yes, found_introspection=no)
+    ],dnl
+    [dnl	
+        AC_MSG_ERROR([invalid argument passed to --enable-introspection, should be one of @<:@no/auto/yes@:>@])
+    ])dnl
+
+    AC_MSG_RESULT([$found_introspection])
+
+    INTROSPECTION_SCANNER=
+    INTROSPECTION_COMPILER=
+    INTROSPECTION_GENERATE=
+    INTROSPECTION_GIRDIR=
+    INTROSPECTION_TYPELIBDIR=
+    if test "x$found_introspection" = "xyes"; then
+       INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
+       INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
+       INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0`
+       INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0`
+       INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
+       INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0`
+       INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0`
+       INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection
+    fi
+    AC_SUBST(INTROSPECTION_SCANNER)
+    AC_SUBST(INTROSPECTION_COMPILER)
+    AC_SUBST(INTROSPECTION_GENERATE)
+    AC_SUBST(INTROSPECTION_GIRDIR)
+    AC_SUBST(INTROSPECTION_TYPELIBDIR)
+    AC_SUBST(INTROSPECTION_CFLAGS)
+    AC_SUBST(INTROSPECTION_LIBS)
+    AC_SUBST(INTROSPECTION_MAKEFILE)
+
+    AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = "xyes")
+])
+
+
+dnl Usage:
+dnl   GOBJECT_INTROSPECTION_CHECK([minimum-g-i-version])
+
+AC_DEFUN([GOBJECT_INTROSPECTION_CHECK],
+[
+  _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1])
+])
+
+dnl Usage:
+dnl   GOBJECT_INTROSPECTION_REQUIRE([minimum-g-i-version])
+
+
+AC_DEFUN([GOBJECT_INTROSPECTION_REQUIRE],
+[
+  _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1], [require])
+])


More information about the poppler mailing list