[poppler] glib/poppler-document.cc glib/poppler-document.h glib/reference
Carlos Garcia Campos
carlosgc at kemper.freedesktop.org
Fri May 6 05:58:11 PDT 2011
glib/poppler-document.cc | 34 ++++++++++++++++++++++++----------
glib/poppler-document.h | 1 +
glib/reference/poppler-sections.txt | 1 +
3 files changed, 26 insertions(+), 10 deletions(-)
New commits:
commit 4db2452b3d345d9531987998e6b5532a59137e1d
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date: Fri May 6 14:57:51 2011 +0200
glib: Add poppler_document_get_n_attachments()
diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index 99af651..e56b414 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -476,6 +476,29 @@ poppler_document_get_page_by_label (PopplerDocument *document,
}
/**
+ * poppler_document_get_n_attachments:
+ * @document: A #PopplerDocument
+ *
+ * Returns the number of attachments in a loaded document.
+ * See also poppler_document_get_attachments()
+ *
+ * Return value: Number of attachments
+ *
+ * Since: 0.18
+ */
+guint
+poppler_document_get_n_attachments (PopplerDocument *document)
+{
+ Catalog *catalog;
+
+ g_return_val_if_fail (POPPLER_IS_DOCUMENT (document), 0);
+
+ catalog = document->doc->getCatalog ();
+
+ return catalog && catalog->isOk () ? catalog->numEmbeddedFiles () : 0;
+}
+
+/**
* poppler_document_has_attachments:
* @document: A #PopplerDocument
*
@@ -486,18 +509,9 @@ poppler_document_get_page_by_label (PopplerDocument *document,
gboolean
poppler_document_has_attachments (PopplerDocument *document)
{
- Catalog *catalog;
- int n_files = 0;
-
g_return_val_if_fail (POPPLER_IS_DOCUMENT (document), FALSE);
- catalog = document->doc->getCatalog ();
- if (catalog && catalog->isOk ())
- {
- n_files = catalog->numEmbeddedFiles ();
- }
-
- return (n_files != 0);
+ return (poppler_document_get_n_attachments (document) != 0);
}
/**
diff --git a/glib/poppler-document.h b/glib/poppler-document.h
index 70cd5f3..69d0871 100644
--- a/glib/poppler-document.h
+++ b/glib/poppler-document.h
@@ -205,6 +205,7 @@ PopplerPermissions poppler_document_get_permissions (PopplerDocument *doc
gchar *poppler_document_get_metadata (PopplerDocument *document);
/* Attachments */
+guint poppler_document_get_n_attachments (PopplerDocument *document);
gboolean poppler_document_has_attachments (PopplerDocument *document);
GList *poppler_document_get_attachments (PopplerDocument *document);
diff --git a/glib/reference/poppler-sections.txt b/glib/reference/poppler-sections.txt
index 90c1dcf..9495052 100644
--- a/glib/reference/poppler-sections.txt
+++ b/glib/reference/poppler-sections.txt
@@ -134,6 +134,7 @@ poppler_document_get_n_pages
poppler_document_get_page
poppler_document_get_page_by_label
poppler_document_find_dest
+poppler_document_get_n_attachments
poppler_document_has_attachments
poppler_document_get_attachments
poppler_document_get_form_field
More information about the poppler
mailing list