Commit 3c5063e8 authored by Carlos Garcia Campos's avatar Carlos Garcia Campos
Browse files

Add API to get Core Propoerties of a XPS file

parent 9ae0299e
......@@ -8,7 +8,6 @@ GXPSFile
--------
- Thumbnail API
- Core-properties API
GXPSDocument
------------
......
......@@ -18,6 +18,7 @@
<xi:include href="xml/gxps-page.xml"/>
<xi:include href="xml/gxps-links.xml"/>
<xi:include href="xml/gxps-document-structure.xml"/>
<xi:include href="xml/gxps-core-properties.xml"/>
<xi:include href="xml/gxps-error.xml"/>
<xi:include href="xml/gxps-version.xml"/>
</chapter>
......
......@@ -10,6 +10,7 @@ gxps_file_new
gxps_file_get_n_documents
gxps_file_get_document
gxps_file_get_document_for_link_target
gxps_file_get_core_properties
<SUBSECTION Standard>
GXPS_TYPE_FILE
......@@ -128,6 +129,40 @@ GXPSDocumentStructurePrivate
gxps_document_structure_get_type
</SECTION>
<SECTION>
<FILE>gxps-core-properties</FILE>
<TITLE>GXPSCoreProperties</TITLE>
GXPSCoreProperties
gxps_core_properties_get_title
gxps_core_properties_get_creator
gxps_core_properties_get_description
gxps_core_properties_get_subject
gxps_core_properties_get_keywords
gxps_core_properties_get_version
gxps_core_properties_get_revision
gxps_core_properties_get_identifier
gxps_core_properties_get_language
gxps_core_properties_get_category
gxps_core_properties_get_content_status
gxps_core_properties_get_content_type
gxps_core_properties_get_created
gxps_core_properties_get_last_modified_by
gxps_core_properties_get_modified
gxps_core_properties_get_last_printed
<SUBSECTION Standard>
GXPS_TYPE_CORE_PROPERTIES
GXPS_CORE_PROPERTIES
GXPS_IS_CORE_PROPERTIES
GXPS_CORE_PROPERTIES_CLASS
GXPS_IS_CORE_PROPERTIES_CLASS
GXPS_CORE_PROPERTIES_GET_CLASS
<SUBSECTION Private>
GXPSCorePropertiesPrivate
gxps_core_properties_get_type
</SECTION>
<SECTION>
<FILE>gxps-error</FILE>
GXPS_ERROR
......
......@@ -6,3 +6,4 @@ gxps_page_get_type
gxps_link_target_get_type
gxps_link_get_type
gxps_document_structure_get_type
gxps_core_properties_get_type
......@@ -16,6 +16,7 @@ NOINST_H_FILES = \
INST_H_FILES = \
gxps.h \
gxps-core-properties.h \
gxps-document.h \
gxps-document-structure.h \
gxps-error.h \
......@@ -31,6 +32,7 @@ libgxps_la_SOURCES = \
gxps-archive.c \
gxps-brush.c \
gxps-color.c \
gxps-core-properties.c \
gxps-debug.c \
gxps-document.c \
gxps-document-structure.c \
......
This diff is collapsed.
/* GXPSCoreProperties
*
* Copyright (C) 2013 Carlos Garcia Campos <carlosgc@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#if !defined (__GXPS_H_INSIDE__) && !defined (GXPS_COMPILATION)
#error "Only <libgxps/gxps.h> can be included directly."
#endif
#ifndef __GXPS_CORE_PROPERTIES_H__
#define __GXPS_CORE_PROPERTIES_H__
#include <glib-object.h>
G_BEGIN_DECLS
#define GXPS_TYPE_CORE_PROPERTIES (gxps_core_properties_get_type ())
#define GXPS_CORE_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_CAST (obj, GXPS_TYPE_CORE_PROPERTIES, GXPSCoreProperties))
#define GXPS_IS_CORE_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, GXPS_TYPE_CORE_PROPERTIES))
#define GXPS_CORE_PROPERTIES_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST (cls, GXPS_TYPE_CORE_PROPERTIES, GXPSCorePropertiesClass))
#define GXPS_IS_CORE_PROPERTIES_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE (obj, GXPS_TYPE_CORE_PROPERTIES))
#define GXPS_CORE_PROPERTIES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GXPS_TYPE_CORE_PROPERTIES, GXPSCorePropertiesClass))
typedef struct _GXPSCoreProperties GXPSCoreProperties;
typedef struct _GXPSCorePropertiesClass GXPSCorePropertiesClass;
typedef struct _GXPSCorePropertiesPrivate GXPSCorePropertiesPrivate;
/**
* GXPSCoreProperties:
*
* The <structname>GXPSCoreProperties</structname> struct contains
* only private fields and should not be directly accessed.
*/
struct _GXPSCoreProperties {
GObject parent;
/*< private >*/
GXPSCorePropertiesPrivate *priv;
};
struct _GXPSCorePropertiesClass {
GObjectClass parent_class;
};
GType gxps_core_properties_get_type (void) G_GNUC_CONST;
const gchar *gxps_core_properties_get_title (GXPSCoreProperties *core_props);
const gchar *gxps_core_properties_get_creator (GXPSCoreProperties *core_props);
const gchar *gxps_core_properties_get_description (GXPSCoreProperties *core_props);
const gchar *gxps_core_properties_get_subject (GXPSCoreProperties *core_props);
const gchar *gxps_core_properties_get_keywords (GXPSCoreProperties *core_props);
const gchar *gxps_core_properties_get_version (GXPSCoreProperties *core_props);
const gchar *gxps_core_properties_get_revision (GXPSCoreProperties *core_props);
const gchar *gxps_core_properties_get_identifier (GXPSCoreProperties *core_props);
const gchar *gxps_core_properties_get_language (GXPSCoreProperties *core_props);
const gchar *gxps_core_properties_get_category (GXPSCoreProperties *core_props);
const gchar *gxps_core_properties_get_content_status (GXPSCoreProperties *core_props);
const gchar *gxps_core_properties_get_content_type (GXPSCoreProperties *core_props);
time_t gxps_core_properties_get_created (GXPSCoreProperties *core_props);
const gchar *gxps_core_properties_get_last_modified_by (GXPSCoreProperties *core_props);
time_t gxps_core_properties_get_modified (GXPSCoreProperties *core_props);
time_t gxps_core_properties_get_last_printed (GXPSCoreProperties *core_props);
G_END_DECLS
#endif /* __GXPS_CORE_PROPERTIES_H__ */
......@@ -473,3 +473,28 @@ gxps_file_get_document_for_link_target (GXPSFile *xps,
return -1;
}
/**
* gxps_file_get_core_properties:
* @xps: a #GXPSFile
* @error: #GError for error reporting, or %NULL to ignore
*
* Create a #GXPSCoreProperties object containing the metadata
* of @xpsm, or %NULL in case of error or if the #GXPSFile
* doesn't contain core properties.
*
* Returns: (transfer full): a new #GXPSCoreProperties or %NULL.
* Free the returned object with g_object_unref().
*/
GXPSCoreProperties *
gxps_file_get_core_properties (GXPSFile *xps,
GError **error)
{
g_return_val_if_fail (GXPS_IS_FILE (xps), NULL);
if (!xps->priv->core_props)
return NULL;
return _gxps_core_properties_new (xps->priv->zip,
xps->priv->core_props,
error);
}
......@@ -29,6 +29,7 @@
#include "gxps-document.h"
#include "gxps-links.h"
#include "gxps-core-properties.h"
G_BEGIN_DECLS
......@@ -79,17 +80,19 @@ struct _GXPSFileClass {
GObjectClass parent_class;
};
GType gxps_file_get_type (void) G_GNUC_CONST;
GQuark gxps_file_error_quark (void) G_GNUC_CONST;
GXPSFile *gxps_file_new (GFile *filename,
GError **error);
guint gxps_file_get_n_documents (GXPSFile *xps);
GXPSDocument *gxps_file_get_document (GXPSFile *xps,
guint n_doc,
GError **error);
gint gxps_file_get_document_for_link_target (GXPSFile *xps,
GXPSLinkTarget *target);
GType gxps_file_get_type (void) G_GNUC_CONST;
GQuark gxps_file_error_quark (void) G_GNUC_CONST;
GXPSFile *gxps_file_new (GFile *filename,
GError **error);
guint gxps_file_get_n_documents (GXPSFile *xps);
GXPSDocument *gxps_file_get_document (GXPSFile *xps,
guint n_doc,
GError **error);
gint gxps_file_get_document_for_link_target (GXPSFile *xps,
GXPSLinkTarget *target);
GXPSCoreProperties *gxps_file_get_core_properties (GXPSFile *xps,
GError **error);
G_END_DECLS
......
......@@ -27,6 +27,7 @@
#include "gxps-parse-utils.h"
#include "gxps-links.h"
#include "gxps-document-structure.h"
#include "gxps-core-properties.h"
G_BEGIN_DECLS
......@@ -43,6 +44,9 @@ GXPSLinkTarget *_gxps_link_target_new (GXPSArchive *zip,
const gchar *uri);
GXPSDocumentStructure *_gxps_document_structure_new (GXPSArchive *zip,
const gchar *source);
GXPSCoreProperties *_gxps_core_properties_new (GXPSArchive *zip,
const gchar *source,
GError **error);
G_END_DECLS
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment