/* pdf.c generated by valac 0.56.17, the Vala compiler
 * generated from pdf.vala, do not modify */

#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gobject/gvaluecollector.h>
#include <float.h>
#include <math.h>
#include <poppler.h>
#include <gee.h>
#include <gio/gio.h>
#include <json-glib/json-glib.h>
#include <glib/gstdio.h>
#include <pango/pango.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define PDFPC_METADATA_TYPE_SLIDE_NOTE (pdfpc_metadata_slide_note_get_type ())
#define PDFPC_METADATA_SLIDE_NOTE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_METADATA_TYPE_SLIDE_NOTE, pdfpcMetadataSlideNote))
#define PDFPC_METADATA_SLIDE_NOTE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_METADATA_TYPE_SLIDE_NOTE, pdfpcMetadataSlideNoteClass))
#define PDFPC_METADATA_IS_SLIDE_NOTE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_METADATA_TYPE_SLIDE_NOTE))
#define PDFPC_METADATA_IS_SLIDE_NOTE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_METADATA_TYPE_SLIDE_NOTE))
#define PDFPC_METADATA_SLIDE_NOTE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_METADATA_TYPE_SLIDE_NOTE, pdfpcMetadataSlideNoteClass))

typedef struct _pdfpcMetadataSlideNote pdfpcMetadataSlideNote;
typedef struct _pdfpcMetadataSlideNoteClass pdfpcMetadataSlideNoteClass;
typedef struct _pdfpcMetadataSlideNotePrivate pdfpcMetadataSlideNotePrivate;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _pdfpcMetadataParamSpecSlideNote pdfpcMetadataParamSpecSlideNote;

#define PDFPC_METADATA_TYPE_PAGE_META (pdfpc_metadata_page_meta_get_type ())
#define PDFPC_METADATA_PAGE_META(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_METADATA_TYPE_PAGE_META, pdfpcMetadataPageMeta))
#define PDFPC_METADATA_PAGE_META_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_METADATA_TYPE_PAGE_META, pdfpcMetadataPageMetaClass))
#define PDFPC_METADATA_IS_PAGE_META(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_METADATA_TYPE_PAGE_META))
#define PDFPC_METADATA_IS_PAGE_META_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_METADATA_TYPE_PAGE_META))
#define PDFPC_METADATA_PAGE_META_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_METADATA_TYPE_PAGE_META, pdfpcMetadataPageMetaClass))

typedef struct _pdfpcMetadataPageMeta pdfpcMetadataPageMeta;
typedef struct _pdfpcMetadataPageMetaClass pdfpcMetadataPageMetaClass;
typedef struct _pdfpcMetadataPageMetaPrivate pdfpcMetadataPageMetaPrivate;
#define _pdfpc_metadata_slide_note_unref0(var) ((var == NULL) ? NULL : (var = (pdfpc_metadata_slide_note_unref (var), NULL)))
typedef struct _pdfpcMetadataParamSpecPageMeta pdfpcMetadataParamSpecPageMeta;

#define PDFPC_METADATA_TYPE_META_FILE_ERROR (pdfpc_metadata_meta_file_error_get_type ())

#define PDFPC_METADATA_TYPE_PDF (pdfpc_metadata_pdf_get_type ())
#define PDFPC_METADATA_PDF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_METADATA_TYPE_PDF, pdfpcMetadataPdf))
#define PDFPC_METADATA_PDF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_METADATA_TYPE_PDF, pdfpcMetadataPdfClass))
#define PDFPC_METADATA_IS_PDF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_METADATA_TYPE_PDF))
#define PDFPC_METADATA_IS_PDF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_METADATA_TYPE_PDF))
#define PDFPC_METADATA_PDF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_METADATA_TYPE_PDF, pdfpcMetadataPdfClass))

typedef struct _pdfpcMetadataPdf pdfpcMetadataPdf;
typedef struct _pdfpcMetadataPdfClass pdfpcMetadataPdfClass;
typedef struct _pdfpcMetadataPdfPrivate pdfpcMetadataPdfPrivate;

#define PDFPC_TYPE_PRESENTATION_CONTROLLER (pdfpc_presentation_controller_get_type ())
#define PDFPC_PRESENTATION_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_TYPE_PRESENTATION_CONTROLLER, pdfpcPresentationController))
#define PDFPC_PRESENTATION_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_TYPE_PRESENTATION_CONTROLLER, pdfpcPresentationControllerClass))
#define PDFPC_IS_PRESENTATION_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_TYPE_PRESENTATION_CONTROLLER))
#define PDFPC_IS_PRESENTATION_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_TYPE_PRESENTATION_CONTROLLER))
#define PDFPC_PRESENTATION_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_TYPE_PRESENTATION_CONTROLLER, pdfpcPresentationControllerClass))

typedef struct _pdfpcPresentationController pdfpcPresentationController;
typedef struct _pdfpcPresentationControllerClass pdfpcPresentationControllerClass;
typedef enum  {
	PDFPC_METADATA_NOTES_POSITION_NONE,
	PDFPC_METADATA_NOTES_POSITION_TOP,
	PDFPC_METADATA_NOTES_POSITION_BOTTOM,
	PDFPC_METADATA_NOTES_POSITION_RIGHT,
	PDFPC_METADATA_NOTES_POSITION_LEFT
} pdfpcMetadataNotesPosition;

#define PDFPC_METADATA_TYPE_NOTES_POSITION (pdfpc_metadata_notes_position_get_type ())

#define PDFPC_RENDERER_TYPE_PDF (pdfpc_renderer_pdf_get_type ())
#define PDFPC_RENDERER_PDF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_RENDERER_TYPE_PDF, pdfpcRendererPdf))
#define PDFPC_RENDERER_PDF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_RENDERER_TYPE_PDF, pdfpcRendererPdfClass))
#define PDFPC_RENDERER_IS_PDF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_RENDERER_TYPE_PDF))
#define PDFPC_RENDERER_IS_PDF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_RENDERER_TYPE_PDF))
#define PDFPC_RENDERER_PDF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_RENDERER_TYPE_PDF, pdfpcRendererPdfClass))

typedef struct _pdfpcRendererPdf pdfpcRendererPdf;
typedef struct _pdfpcRendererPdfClass pdfpcRendererPdfClass;

#define PDFPC_TYPE_ACTION_MAPPING (pdfpc_action_mapping_get_type ())
#define PDFPC_ACTION_MAPPING(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_TYPE_ACTION_MAPPING, pdfpcActionMapping))
#define PDFPC_ACTION_MAPPING_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_TYPE_ACTION_MAPPING, pdfpcActionMappingClass))
#define PDFPC_IS_ACTION_MAPPING(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_TYPE_ACTION_MAPPING))
#define PDFPC_IS_ACTION_MAPPING_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_TYPE_ACTION_MAPPING))
#define PDFPC_ACTION_MAPPING_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_TYPE_ACTION_MAPPING, pdfpcActionMappingClass))

typedef struct _pdfpcActionMapping pdfpcActionMapping;
typedef struct _pdfpcActionMappingClass pdfpcActionMappingClass;
enum  {
	PDFPC_METADATA_PDF_0_PROPERTY,
	PDFPC_METADATA_PDF_RENDERER_PROPERTY,
	PDFPC_METADATA_PDF_PDF_FNAME_PROPERTY,
	PDFPC_METADATA_PDF_DOCUMENT_PROPERTY,
	PDFPC_METADATA_PDF_DEFAULT_TRANSITION_PROPERTY,
	PDFPC_METADATA_PDF_IS_READY_PROPERTY,
	PDFPC_METADATA_PDF_HAS_BEAMER_NOTES_PROPERTY,
	PDFPC_METADATA_PDF_NUM_PROPERTIES
};
static GParamSpec* pdfpc_metadata_pdf_properties[PDFPC_METADATA_PDF_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define PDFPC_TYPE_CONTROLLED_MOVIE (pdfpc_controlled_movie_get_type ())
#define PDFPC_CONTROLLED_MOVIE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_TYPE_CONTROLLED_MOVIE, pdfpcControlledMovie))
#define PDFPC_CONTROLLED_MOVIE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_TYPE_CONTROLLED_MOVIE, pdfpcControlledMovieClass))
#define PDFPC_IS_CONTROLLED_MOVIE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_TYPE_CONTROLLED_MOVIE))
#define PDFPC_IS_CONTROLLED_MOVIE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_TYPE_CONTROLLED_MOVIE))
#define PDFPC_CONTROLLED_MOVIE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_TYPE_CONTROLLED_MOVIE, pdfpcControlledMovieClass))

typedef struct _pdfpcControlledMovie pdfpcControlledMovie;
typedef struct _pdfpcControlledMovieClass pdfpcControlledMovieClass;

#define PDFPC_TYPE_LINK_ACTION (pdfpc_link_action_get_type ())
#define PDFPC_LINK_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_TYPE_LINK_ACTION, pdfpcLinkAction))
#define PDFPC_LINK_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_TYPE_LINK_ACTION, pdfpcLinkActionClass))
#define PDFPC_IS_LINK_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_TYPE_LINK_ACTION))
#define PDFPC_IS_LINK_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_TYPE_LINK_ACTION))
#define PDFPC_LINK_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_TYPE_LINK_ACTION, pdfpcLinkActionClass))

typedef struct _pdfpcLinkAction pdfpcLinkAction;
typedef struct _pdfpcLinkActionClass pdfpcLinkActionClass;
#define __vala_PopplerPageTransition_free0(var) ((var == NULL) ? NULL : (var = (_vala_PopplerPageTransition_free (var), NULL)))
#define _pdfpc_metadata_page_meta_unref0(var) ((var == NULL) ? NULL : (var = (pdfpc_metadata_page_meta_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define __vala_JsonNode_free0(var) ((var == NULL) ? NULL : (var = (_vala_JsonNode_free (var), NULL)))
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))

#define PDFPC_TYPE_XML_PARSER (pdfpc_xml_parser_get_type ())
#define PDFPC_XML_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_TYPE_XML_PARSER, pdfpcXmlParser))
#define PDFPC_XML_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_TYPE_XML_PARSER, pdfpcXmlParserClass))
#define PDFPC_IS_XML_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_TYPE_XML_PARSER))
#define PDFPC_IS_XML_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_TYPE_XML_PARSER))
#define PDFPC_XML_PARSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_TYPE_XML_PARSER, pdfpcXmlParserClass))

typedef struct _pdfpcXmlParser pdfpcXmlParser;
typedef struct _pdfpcXmlParserClass pdfpcXmlParserClass;
#define __vala_PopplerDest_free0(var) ((var == NULL) ? NULL : (var = (_vala_PopplerDest_free (var), NULL)))

struct _pdfpcMetadataSlideNote {
	GTypeInstance parent_instance;
	volatile int ref_count;
	pdfpcMetadataSlideNotePrivate * priv;
	gchar* note_text;
	gboolean is_native;
};

struct _pdfpcMetadataSlideNoteClass {
	GTypeClass parent_class;
	void (*finalize) (pdfpcMetadataSlideNote *self);
};

struct _pdfpcMetadataParamSpecSlideNote {
	GParamSpec parent_instance;
};

struct _pdfpcMetadataPageMeta {
	GTypeInstance parent_instance;
	volatile int ref_count;
	pdfpcMetadataPageMetaPrivate * priv;
	gchar* label;
	gint user_slide;
	gboolean forced_overlay;
	gboolean hidden;
	pdfpcMetadataSlideNote* note;
};

struct _pdfpcMetadataPageMetaClass {
	GTypeClass parent_class;
	void (*finalize) (pdfpcMetadataPageMeta *self);
};

struct _pdfpcMetadataParamSpecPageMeta {
	GParamSpec parent_instance;
};

typedef enum  {
	PDFPC_METADATA_META_FILE_ERROR_INVALID_FORMAT,
	PDFPC_METADATA_META_FILE_ERROR_UNSUPPORTED_VERSION
} pdfpcMetadataMetaFileError;
#define PDFPC_METADATA_META_FILE_ERROR pdfpc_metadata_meta_file_error_quark ()

struct _pdfpcMetadataPdf {
	GObject parent_instance;
	pdfpcMetadataPdfPrivate * priv;
	pdfpcPresentationController* controller;
	gchar* pdfpc_fname;
	guint page_count;
	gdouble original_page_width;
	gdouble original_page_height;
	gint format_version;
	pdfpcMetadataNotesPosition notes_position;
	gboolean disable_markdown;
	guint duration;
	gchar* start_time;
	gchar* end_time;
	guint last_minutes;
	gint font_size;
};

struct _pdfpcMetadataPdfClass {
	GObjectClass parent_class;
};

struct _pdfpcMetadataPdfPrivate {
	pdfpcRendererPdf* _renderer;
	gchar* _pdf_fname;
	PopplerDocument* _document;
	gint mapping_page_num;
	GeeList* action_mapping;
	pdfpcActionMapping** blanks;
	gint blanks_length1;
	gint _blanks_size_;
	gboolean dirty_state;
	GeeList* pages;
	gint end_user_slide;
	gint last_saved_slide;
	PopplerPageTransition* _default_transition;
};

static gpointer pdfpc_metadata_slide_note_parent_class = NULL;
static gpointer pdfpc_metadata_page_meta_parent_class = NULL;
static gint pdfpcMetadataPdf_private_offset;
static gpointer pdfpc_metadata_pdf_parent_class = NULL;
VALA_EXTERN gchar* pdfpc_options_pdfpc_location;
VALA_EXTERN guint pdfpc_options_duration;
VALA_EXTERN gchar* pdfpc_options_start_time;
VALA_EXTERN gchar* pdfpc_options_end_time;
VALA_EXTERN guint pdfpc_options_last_minutes;
VALA_EXTERN gchar* pdfpc_options_notes_position;
VALA_EXTERN gchar* pdfpc_options_default_transition;
VALA_EXTERN gchar* pdfpc_options_notes_format;
VALA_EXTERN gboolean pdfpc_options_disable_auto_grouping;

VALA_EXTERN gpointer pdfpc_metadata_slide_note_ref (gpointer instance);
VALA_EXTERN void pdfpc_metadata_slide_note_unref (gpointer instance);
VALA_EXTERN GParamSpec* pdfpc_metadata_param_spec_slide_note (const gchar* name,
                                                  const gchar* nick,
                                                  const gchar* blurb,
                                                  GType object_type,
                                                  GParamFlags flags);
VALA_EXTERN void pdfpc_metadata_value_set_slide_note (GValue* value,
                                          gpointer v_object);
VALA_EXTERN void pdfpc_metadata_value_take_slide_note (GValue* value,
                                           gpointer v_object);
VALA_EXTERN gpointer pdfpc_metadata_value_get_slide_note (const GValue* value);
VALA_EXTERN GType pdfpc_metadata_slide_note_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (pdfpcMetadataSlideNote, pdfpc_metadata_slide_note_unref)
VALA_EXTERN pdfpcMetadataSlideNote* pdfpc_metadata_slide_note_new (void);
VALA_EXTERN pdfpcMetadataSlideNote* pdfpc_metadata_slide_note_construct (GType object_type);
static void pdfpc_metadata_slide_note_finalize (pdfpcMetadataSlideNote * obj);
static GType pdfpc_metadata_slide_note_get_type_once (void);
VALA_EXTERN gpointer pdfpc_metadata_page_meta_ref (gpointer instance);
VALA_EXTERN void pdfpc_metadata_page_meta_unref (gpointer instance);
VALA_EXTERN GParamSpec* pdfpc_metadata_param_spec_page_meta (const gchar* name,
                                                 const gchar* nick,
                                                 const gchar* blurb,
                                                 GType object_type,
                                                 GParamFlags flags);
VALA_EXTERN void pdfpc_metadata_value_set_page_meta (GValue* value,
                                         gpointer v_object);
VALA_EXTERN void pdfpc_metadata_value_take_page_meta (GValue* value,
                                          gpointer v_object);
VALA_EXTERN gpointer pdfpc_metadata_value_get_page_meta (const GValue* value);
VALA_EXTERN GType pdfpc_metadata_page_meta_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (pdfpcMetadataPageMeta, pdfpc_metadata_page_meta_unref)
VALA_EXTERN pdfpcMetadataPageMeta* pdfpc_metadata_page_meta_new (void);
VALA_EXTERN pdfpcMetadataPageMeta* pdfpc_metadata_page_meta_construct (GType object_type);
static void pdfpc_metadata_page_meta_finalize (pdfpcMetadataPageMeta * obj);
static GType pdfpc_metadata_page_meta_get_type_once (void);
VALA_EXTERN GQuark pdfpc_metadata_meta_file_error_quark (void);
VALA_EXTERN GType pdfpc_metadata_meta_file_error_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType pdfpc_metadata_pdf_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (pdfpcMetadataPdf, g_object_unref)
VALA_EXTERN GType pdfpc_presentation_controller_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (pdfpcPresentationController, g_object_unref)
VALA_EXTERN GType pdfpc_metadata_notes_position_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType pdfpc_renderer_pdf_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (pdfpcRendererPdf, g_object_unref)
VALA_EXTERN GType pdfpc_action_mapping_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (pdfpcActionMapping, g_object_unref)
VALA_EXTERN pdfpcControlledMovie* pdfpc_controlled_movie_new (void);
VALA_EXTERN pdfpcControlledMovie* pdfpc_controlled_movie_construct (GType object_type);
VALA_EXTERN GType pdfpc_controlled_movie_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (pdfpcControlledMovie, g_object_unref)
VALA_EXTERN pdfpcLinkAction* pdfpc_link_action_new (void);
VALA_EXTERN pdfpcLinkAction* pdfpc_link_action_construct (GType object_type);
VALA_EXTERN GType pdfpc_link_action_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (pdfpcLinkAction, g_object_unref)
static void _vala_PopplerPageTransition_free (PopplerPageTransition* self);
VALA_EXTERN pdfpcMetadataPageMeta* pdfpc_metadata_pdf_get_page_meta (pdfpcMetadataPdf* self,
                                                         gint slide_number);
VALA_EXTERN gchar* pdfpc_metadata_pdf_get_url (pdfpcMetadataPdf* self);
VALA_EXTERN const gchar* pdfpc_metadata_pdf_get_pdf_fname (pdfpcMetadataPdf* self);
VALA_EXTERN void pdfpc_metadata_pdf_set_note (pdfpcMetadataPdf* self,
                                  const gchar* note_text,
                                  gint slide_number,
                                  gboolean is_native);
VALA_EXTERN gchar* pdfpc_metadata_pdf_get_note (pdfpcMetadataPdf* self,
                                    gint slide_number);
VALA_EXTERN gboolean pdfpc_metadata_pdf_is_note_read_only (pdfpcMetadataPdf* self,
                                               gint slide_number);
VALA_EXTERN void pdfpc_metadata_pdf_save_to_disk (pdfpcMetadataPdf* self);
VALA_EXTERN PopplerPageTransition* pdfpc_metadata_pdf_get_default_transition (pdfpcMetadataPdf* self);
static gchar* pdfpc_metadata_pdf_get_default_transition_string (pdfpcMetadataPdf* self);
VALA_EXTERN gchar* pdfpc_metadata_notes_position_to_string (pdfpcMetadataNotesPosition self);
static void _vala_JsonNode_free (JsonNode* self);
static void pdfpc_metadata_pdf_parse_pdfpc_page (pdfpcMetadataPdf* self,
                                          JsonNode* node,
                                          GError** error);
VALA_EXTERN gint pdfpc_metadata_pdf_slide_get_overlay (pdfpcMetadataPdf* self,
                                           gint number);
VALA_EXTERN gint pdfpc_metadata_pdf_set_slide_hidden (pdfpcMetadataPdf* self,
                                          gint slide_number,
                                          gboolean onoff);
VALA_EXTERN gint pdfpc_metadata_pdf_add_overlay (pdfpcMetadataPdf* self,
                                     gint slide_number);
static void pdfpc_metadata_pdf_parse_pdfpc_pages (pdfpcMetadataPdf* self,
                                           JsonNode* node,
                                           GError** error);
static void pdfpc_metadata_pdf_parse_pdfpc_file (pdfpcMetadataPdf* self,
                                          GError** error);
static JsonNode* _vala_JsonNode_copy (JsonNode* self);
VALA_EXTERN pdfpcMetadataNotesPosition pdfpc_metadata_notes_position_from_string (const gchar* position);
VALA_EXTERN void pdfpc_metadata_pdf_set_default_transition_from_string (pdfpcMetadataPdf* self,
                                                            const gchar* line);
static void pdfpc_metadata_pdf_parse_pdfpc_file_old (pdfpcMetadataPdf* self,
                                              gchar** notes_content,
                                              gchar** skip_line);
static void pdfpc_metadata_pdf_parse_skip_line_old (pdfpcMetadataPdf* self,
                                             const gchar* line);
static void pdfpc_metadata_pdf_parse_notes_old (pdfpcMetadataPdf* self,
                                         gchar** lines,
                                         gint lines_length1);
VALA_EXTERN gint pdfpc_metadata_pdf_user_slide_to_real_slide (pdfpcMetadataPdf* self,
                                                  gint number,
                                                  gboolean lastSlide);
VALA_EXTERN void pdfpc_metadata_pdf_fill_path_info (pdfpcMetadataPdf* self,
                                        const gchar* fname,
                                        const gchar* fpcname);
VALA_EXTERN void pdfpc_metadata_pdf_set_pdf_fname (pdfpcMetadataPdf* self,
                                       const gchar* value);
static PopplerPageTransition* _vala_PopplerPageTransition_copy (PopplerPageTransition* self);
VALA_EXTERN void pdfpc_metadata_pdf_set_default_transition (pdfpcMetadataPdf* self,
                                                PopplerPageTransition* value);
VALA_EXTERN gdouble pdfpc_metadata_pdf_get_slide_duration (pdfpcMetadataPdf* self,
                                               gint slide_number);
VALA_EXTERN guint pdfpc_metadata_pdf_get_slide_count (pdfpcMetadataPdf* self);
VALA_EXTERN PopplerDocument* pdfpc_metadata_pdf_get_document (pdfpcMetadataPdf* self);
static void pdfpc_metadata_pdf_deactivate_mappings (pdfpcMetadataPdf* self);
VALA_EXTERN void pdfpc_action_mapping_deactivate (pdfpcActionMapping* self);
VALA_EXTERN void pdfpc_metadata_pdf_quit (pdfpcMetadataPdf* self);
VALA_EXTERN gboolean pdfpc_metadata_pdf_get_is_ready (pdfpcMetadataPdf* self);
static void pdfpc_metadata_pdf_notes_from_document (pdfpcMetadataPdf* self);
static void _vala_PopplerAnnotMapping_free (PopplerAnnotMapping* self);
static void __vala_PopplerAnnotMapping_free0_ (gpointer var);
static inline void _g_list_free___vala_PopplerAnnotMapping_free0_ (GList* self);
static void pdfpc_metadata_pdf_metadata_from_document (pdfpcMetadataPdf* self);
VALA_EXTERN GType pdfpc_xml_parser_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (pdfpcXmlParser, g_object_unref)
VALA_EXTERN pdfpcXmlParser* pdfpc_xml_parser_new (void);
VALA_EXTERN pdfpcXmlParser* pdfpc_xml_parser_construct (GType object_type);
VALA_EXTERN GeeHashMap* pdfpc_xml_parser_parse (pdfpcXmlParser* self,
                                    const gchar* content,
                                    GError** error);
VALA_EXTERN pdfpcMetadataPdf* pdfpc_metadata_pdf_new (const gchar* pdfFilename);
VALA_EXTERN pdfpcMetadataPdf* pdfpc_metadata_pdf_construct (GType object_type,
                                                const gchar* pdfFilename);
VALA_EXTERN void pdfpc_metadata_pdf_load (pdfpcMetadataPdf* self,
                              const gchar* pdfFilename);
VALA_EXTERN pdfpcRendererPdf* pdfpc_renderer_pdf_new (pdfpcMetadataPdf* metadata);
VALA_EXTERN pdfpcRendererPdf* pdfpc_renderer_pdf_construct (GType object_type,
                                                pdfpcMetadataPdf* metadata);
VALA_EXTERN void pdfpc_metadata_pdf_set_renderer (pdfpcMetadataPdf* self,
                                      pdfpcRendererPdf* value);
VALA_EXTERN PopplerDocument* pdfpc_metadata_pdf_open_pdf_document (pdfpcMetadataPdf* self,
                                                       const gchar* fname);
VALA_EXTERN void pdfpc_metadata_pdf_set_document (pdfpcMetadataPdf* self,
                                      PopplerDocument* value);
VALA_EXTERN void pdfpc_metadata_pdf_set_duration (pdfpcMetadataPdf* self,
                                      guint d);
VALA_EXTERN void pdfpc_metadata_pdf_set_start_time (pdfpcMetadataPdf* self,
                                        const gchar* timestr);
VALA_EXTERN void pdfpc_metadata_pdf_set_end_time (pdfpcMetadataPdf* self,
                                      const gchar* timestr);
VALA_EXTERN void pdfpc_metadata_pdf_set_last_minutes (pdfpcMetadataPdf* self,
                                          guint last_minutes);
VALA_EXTERN void pdfpc_metadata_pdf_set_notes_position (pdfpcMetadataPdf* self,
                                            pdfpcMetadataNotesPosition position);
VALA_EXTERN void pdfpc_metadata_pdf_set_disable_markdown (pdfpcMetadataPdf* self,
                                              gboolean onoff);
VALA_EXTERN gint pdfpc_metadata_pdf_get_user_slide_count (pdfpcMetadataPdf* self);
VALA_EXTERN gint pdfpc_metadata_pdf_get_end_user_slide (pdfpcMetadataPdf* self);
VALA_EXTERN void pdfpc_metadata_pdf_set_end_user_slide (pdfpcMetadataPdf* self,
                                            gint slide);
VALA_EXTERN gint pdfpc_metadata_pdf_get_font_size (pdfpcMetadataPdf* self);
VALA_EXTERN void pdfpc_metadata_pdf_set_font_size (pdfpcMetadataPdf* self,
                                       gint size);
VALA_EXTERN gint pdfpc_metadata_pdf_get_last_saved_slide (pdfpcMetadataPdf* self);
VALA_EXTERN void pdfpc_metadata_pdf_set_last_saved_slide (pdfpcMetadataPdf* self,
                                              gint slide);
VALA_EXTERN guint pdfpc_metadata_pdf_get_last_minutes (pdfpcMetadataPdf* self);
VALA_EXTERN gchar* pdfpc_metadata_pdf_get_start_time (pdfpcMetadataPdf* self);
VALA_EXTERN gchar* pdfpc_metadata_pdf_get_end_time (pdfpcMetadataPdf* self);
VALA_EXTERN pdfpcMetadataNotesPosition pdfpc_metadata_pdf_get_notes_position (pdfpcMetadataPdf* self);
VALA_EXTERN gboolean pdfpc_metadata_pdf_get_disable_markdown (pdfpcMetadataPdf* self);
VALA_EXTERN gboolean pdfpc_metadata_pdf_get_slide_hidden (pdfpcMetadataPdf* self,
                                              gint slide_number);
VALA_EXTERN gboolean pdfpc_metadata_pdf_get_user_slide_hidden (pdfpcMetadataPdf* self,
                                                   gint user_slide);
VALA_EXTERN gint pdfpc_metadata_pdf_real_slide_to_user_slide (pdfpcMetadataPdf* self,
                                                  gint number);
VALA_EXTERN gint pdfpc_metadata_pdf_nearest_nonhidden (pdfpcMetadataPdf* self,
                                           gint slide_number,
                                           gboolean backwards);
VALA_EXTERN gboolean pdfpc_metadata_pdf_is_user_slide (pdfpcMetadataPdf* self,
                                           gint number);
VALA_EXTERN gint pdfpc_metadata_pdf_next_in_overlay (pdfpcMetadataPdf* self,
                                         gint slide_number);
VALA_EXTERN gint pdfpc_metadata_pdf_prev_in_overlay (pdfpcMetadataPdf* self,
                                         gint slide_number);
VALA_EXTERN gdouble pdfpc_metadata_pdf_get_page_width (pdfpcMetadataPdf* self);
VALA_EXTERN gdouble pdfpc_metadata_pdf_get_corrected_page_width (pdfpcMetadataPdf* self,
                                                     gdouble page_width);
VALA_EXTERN gdouble pdfpc_metadata_pdf_get_page_height (pdfpcMetadataPdf* self);
VALA_EXTERN gdouble pdfpc_metadata_pdf_get_corrected_page_height (pdfpcMetadataPdf* self,
                                                      gdouble page_height);
VALA_EXTERN gdouble pdfpc_metadata_pdf_get_horizontal_offset (pdfpcMetadataPdf* self,
                                                  gboolean notes_area,
                                                  gdouble page_width);
VALA_EXTERN gdouble pdfpc_metadata_pdf_get_vertical_offset (pdfpcMetadataPdf* self,
                                                gboolean notes_area,
                                                gdouble page_height);
VALA_EXTERN gchar* pdfpc_metadata_pdf_get_title (pdfpcMetadataPdf* self);
VALA_EXTERN guint pdfpc_metadata_pdf_get_duration (pdfpcMetadataPdf* self);
VALA_EXTERN GeeList* pdfpc_metadata_pdf_get_action_mapping (pdfpcMetadataPdf* self,
                                                gint page_num);
VALA_EXTERN pdfpcActionMapping* pdfpc_action_mapping_new_from_link_mapping (pdfpcActionMapping* self,
                                                                PopplerLinkMapping* mapping,
                                                                pdfpcPresentationController* controller);
VALA_EXTERN pdfpcActionMapping* pdfpc_action_mapping_new_from_annot_mapping (pdfpcActionMapping* self,
                                                                 PopplerAnnotMapping* mapping,
                                                                 pdfpcPresentationController* controller);
static void _vala_PopplerLinkMapping_free (PopplerLinkMapping* self);
static void __vala_PopplerLinkMapping_free0_ (gpointer var);
static inline void _g_list_free___vala_PopplerLinkMapping_free0_ (GList* self);
VALA_EXTERN gint pdfpc_metadata_pdf_find_dest (pdfpcMetadataPdf* self,
                                   PopplerDest* dest);
static void _vala_PopplerDest_free (PopplerDest* self);
VALA_EXTERN pdfpcRendererPdf* pdfpc_metadata_pdf_get_renderer (pdfpcMetadataPdf* self);
VALA_EXTERN gboolean pdfpc_metadata_pdf_get_has_beamer_notes (pdfpcMetadataPdf* self);
static void pdfpc_metadata_pdf_finalize (GObject * obj);
static GType pdfpc_metadata_pdf_get_type_once (void);
static void _vala_pdfpc_metadata_pdf_get_property (GObject * object,
                                            guint property_id,
                                            GValue * value,
                                            GParamSpec * pspec);
static void _vala_pdfpc_metadata_pdf_set_property (GObject * object,
                                            guint property_id,
                                            const GValue * value,
                                            GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static gssize _vala_array_length (gpointer array);

pdfpcMetadataSlideNote*
pdfpc_metadata_slide_note_construct (GType object_type)
{
	pdfpcMetadataSlideNote* self = NULL;
	self = (pdfpcMetadataSlideNote*) g_type_create_instance (object_type);
	return self;
}

pdfpcMetadataSlideNote*
pdfpc_metadata_slide_note_new (void)
{
	return pdfpc_metadata_slide_note_construct (PDFPC_METADATA_TYPE_SLIDE_NOTE);
}

static void
pdfpc_metadata_value_slide_note_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
pdfpc_metadata_value_slide_note_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		pdfpc_metadata_slide_note_unref (value->data[0].v_pointer);
	}
}

static void
pdfpc_metadata_value_slide_note_copy_value (const GValue* src_value,
                                            GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = pdfpc_metadata_slide_note_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
pdfpc_metadata_value_slide_note_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
pdfpc_metadata_value_slide_note_collect_value (GValue* value,
                                               guint n_collect_values,
                                               GTypeCValue* collect_values,
                                               guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		pdfpcMetadataSlideNote * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = pdfpc_metadata_slide_note_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
pdfpc_metadata_value_slide_note_lcopy_value (const GValue* value,
                                             guint n_collect_values,
                                             GTypeCValue* collect_values,
                                             guint collect_flags)
{
	pdfpcMetadataSlideNote ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = pdfpc_metadata_slide_note_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
pdfpc_metadata_param_spec_slide_note (const gchar* name,
                                      const gchar* nick,
                                      const gchar* blurb,
                                      GType object_type,
                                      GParamFlags flags)
{
	pdfpcMetadataParamSpecSlideNote* spec;
	g_return_val_if_fail (g_type_is_a (object_type, PDFPC_METADATA_TYPE_SLIDE_NOTE), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
pdfpc_metadata_value_get_slide_note (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, PDFPC_METADATA_TYPE_SLIDE_NOTE), NULL);
	return value->data[0].v_pointer;
}

void
pdfpc_metadata_value_set_slide_note (GValue* value,
                                     gpointer v_object)
{
	pdfpcMetadataSlideNote * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, PDFPC_METADATA_TYPE_SLIDE_NOTE));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, PDFPC_METADATA_TYPE_SLIDE_NOTE));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		pdfpc_metadata_slide_note_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		pdfpc_metadata_slide_note_unref (old);
	}
}

void
pdfpc_metadata_value_take_slide_note (GValue* value,
                                      gpointer v_object)
{
	pdfpcMetadataSlideNote * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, PDFPC_METADATA_TYPE_SLIDE_NOTE));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, PDFPC_METADATA_TYPE_SLIDE_NOTE));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		pdfpc_metadata_slide_note_unref (old);
	}
}

static void
pdfpc_metadata_slide_note_class_init (pdfpcMetadataSlideNoteClass * klass,
                                      gpointer klass_data)
{
	pdfpc_metadata_slide_note_parent_class = g_type_class_peek_parent (klass);
	((pdfpcMetadataSlideNoteClass *) klass)->finalize = pdfpc_metadata_slide_note_finalize;
}

static void
pdfpc_metadata_slide_note_instance_init (pdfpcMetadataSlideNote * self,
                                         gpointer klass)
{
	self->note_text = NULL;
	self->is_native = FALSE;
	self->ref_count = 1;
}

static void
pdfpc_metadata_slide_note_finalize (pdfpcMetadataSlideNote * obj)
{
	pdfpcMetadataSlideNote * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PDFPC_METADATA_TYPE_SLIDE_NOTE, pdfpcMetadataSlideNote);
	g_signal_handlers_destroy (self);
	_g_free0 (self->note_text);
}

static GType
pdfpc_metadata_slide_note_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { pdfpc_metadata_value_slide_note_init, pdfpc_metadata_value_slide_note_free_value, pdfpc_metadata_value_slide_note_copy_value, pdfpc_metadata_value_slide_note_peek_pointer, "p", pdfpc_metadata_value_slide_note_collect_value, "p", pdfpc_metadata_value_slide_note_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (pdfpcMetadataSlideNoteClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) pdfpc_metadata_slide_note_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (pdfpcMetadataSlideNote), 0, (GInstanceInitFunc) pdfpc_metadata_slide_note_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType pdfpc_metadata_slide_note_type_id;
	pdfpc_metadata_slide_note_type_id = g_type_register_fundamental (g_type_fundamental_next (), "pdfpcMetadataSlideNote", &g_define_type_info, &g_define_type_fundamental_info, 0);
	return pdfpc_metadata_slide_note_type_id;
}

GType
pdfpc_metadata_slide_note_get_type (void)
{
	static volatile gsize pdfpc_metadata_slide_note_type_id__once = 0;
	if (g_once_init_enter (&pdfpc_metadata_slide_note_type_id__once)) {
		GType pdfpc_metadata_slide_note_type_id;
		pdfpc_metadata_slide_note_type_id = pdfpc_metadata_slide_note_get_type_once ();
		g_once_init_leave (&pdfpc_metadata_slide_note_type_id__once, pdfpc_metadata_slide_note_type_id);
	}
	return pdfpc_metadata_slide_note_type_id__once;
}

gpointer
pdfpc_metadata_slide_note_ref (gpointer instance)
{
	pdfpcMetadataSlideNote * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
pdfpc_metadata_slide_note_unref (gpointer instance)
{
	pdfpcMetadataSlideNote * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		PDFPC_METADATA_SLIDE_NOTE_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

pdfpcMetadataPageMeta*
pdfpc_metadata_page_meta_construct (GType object_type)
{
	pdfpcMetadataPageMeta* self = NULL;
	self = (pdfpcMetadataPageMeta*) g_type_create_instance (object_type);
	return self;
}

pdfpcMetadataPageMeta*
pdfpc_metadata_page_meta_new (void)
{
	return pdfpc_metadata_page_meta_construct (PDFPC_METADATA_TYPE_PAGE_META);
}

static void
pdfpc_metadata_value_page_meta_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
pdfpc_metadata_value_page_meta_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		pdfpc_metadata_page_meta_unref (value->data[0].v_pointer);
	}
}

static void
pdfpc_metadata_value_page_meta_copy_value (const GValue* src_value,
                                           GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = pdfpc_metadata_page_meta_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
pdfpc_metadata_value_page_meta_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
pdfpc_metadata_value_page_meta_collect_value (GValue* value,
                                              guint n_collect_values,
                                              GTypeCValue* collect_values,
                                              guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		pdfpcMetadataPageMeta * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = pdfpc_metadata_page_meta_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
pdfpc_metadata_value_page_meta_lcopy_value (const GValue* value,
                                            guint n_collect_values,
                                            GTypeCValue* collect_values,
                                            guint collect_flags)
{
	pdfpcMetadataPageMeta ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = pdfpc_metadata_page_meta_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
pdfpc_metadata_param_spec_page_meta (const gchar* name,
                                     const gchar* nick,
                                     const gchar* blurb,
                                     GType object_type,
                                     GParamFlags flags)
{
	pdfpcMetadataParamSpecPageMeta* spec;
	g_return_val_if_fail (g_type_is_a (object_type, PDFPC_METADATA_TYPE_PAGE_META), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
pdfpc_metadata_value_get_page_meta (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, PDFPC_METADATA_TYPE_PAGE_META), NULL);
	return value->data[0].v_pointer;
}

void
pdfpc_metadata_value_set_page_meta (GValue* value,
                                    gpointer v_object)
{
	pdfpcMetadataPageMeta * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, PDFPC_METADATA_TYPE_PAGE_META));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, PDFPC_METADATA_TYPE_PAGE_META));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		pdfpc_metadata_page_meta_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		pdfpc_metadata_page_meta_unref (old);
	}
}

void
pdfpc_metadata_value_take_page_meta (GValue* value,
                                     gpointer v_object)
{
	pdfpcMetadataPageMeta * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, PDFPC_METADATA_TYPE_PAGE_META));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, PDFPC_METADATA_TYPE_PAGE_META));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		pdfpc_metadata_page_meta_unref (old);
	}
}

static void
pdfpc_metadata_page_meta_class_init (pdfpcMetadataPageMetaClass * klass,
                                     gpointer klass_data)
{
	pdfpc_metadata_page_meta_parent_class = g_type_class_peek_parent (klass);
	((pdfpcMetadataPageMetaClass *) klass)->finalize = pdfpc_metadata_page_meta_finalize;
}

static void
pdfpc_metadata_page_meta_instance_init (pdfpcMetadataPageMeta * self,
                                        gpointer klass)
{
	self->ref_count = 1;
}

static void
pdfpc_metadata_page_meta_finalize (pdfpcMetadataPageMeta * obj)
{
	pdfpcMetadataPageMeta * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PDFPC_METADATA_TYPE_PAGE_META, pdfpcMetadataPageMeta);
	g_signal_handlers_destroy (self);
	_g_free0 (self->label);
	_pdfpc_metadata_slide_note_unref0 (self->note);
}

static GType
pdfpc_metadata_page_meta_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { pdfpc_metadata_value_page_meta_init, pdfpc_metadata_value_page_meta_free_value, pdfpc_metadata_value_page_meta_copy_value, pdfpc_metadata_value_page_meta_peek_pointer, "p", pdfpc_metadata_value_page_meta_collect_value, "p", pdfpc_metadata_value_page_meta_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (pdfpcMetadataPageMetaClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) pdfpc_metadata_page_meta_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (pdfpcMetadataPageMeta), 0, (GInstanceInitFunc) pdfpc_metadata_page_meta_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType pdfpc_metadata_page_meta_type_id;
	pdfpc_metadata_page_meta_type_id = g_type_register_fundamental (g_type_fundamental_next (), "pdfpcMetadataPageMeta", &g_define_type_info, &g_define_type_fundamental_info, 0);
	return pdfpc_metadata_page_meta_type_id;
}

GType
pdfpc_metadata_page_meta_get_type (void)
{
	static volatile gsize pdfpc_metadata_page_meta_type_id__once = 0;
	if (g_once_init_enter (&pdfpc_metadata_page_meta_type_id__once)) {
		GType pdfpc_metadata_page_meta_type_id;
		pdfpc_metadata_page_meta_type_id = pdfpc_metadata_page_meta_get_type_once ();
		g_once_init_leave (&pdfpc_metadata_page_meta_type_id__once, pdfpc_metadata_page_meta_type_id);
	}
	return pdfpc_metadata_page_meta_type_id__once;
}

gpointer
pdfpc_metadata_page_meta_ref (gpointer instance)
{
	pdfpcMetadataPageMeta * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
pdfpc_metadata_page_meta_unref (gpointer instance)
{
	pdfpcMetadataPageMeta * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		PDFPC_METADATA_PAGE_META_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

GQuark
pdfpc_metadata_meta_file_error_quark (void)
{
	return g_quark_from_static_string ("pdfpc-metadata-meta-file-error-quark");
}

static GType
pdfpc_metadata_meta_file_error_get_type_once (void)
{
	static const GEnumValue values[] = {{PDFPC_METADATA_META_FILE_ERROR_INVALID_FORMAT, "PDFPC_METADATA_META_FILE_ERROR_INVALID_FORMAT", "invalid-format"}, {PDFPC_METADATA_META_FILE_ERROR_UNSUPPORTED_VERSION, "PDFPC_METADATA_META_FILE_ERROR_UNSUPPORTED_VERSION", "unsupported-version"}, {0, NULL, NULL}};
	GType pdfpc_metadata_meta_file_error_type_id;
	pdfpc_metadata_meta_file_error_type_id = g_enum_register_static ("pdfpcMetadataMetaFileError", values);
	return pdfpc_metadata_meta_file_error_type_id;
}

GType
pdfpc_metadata_meta_file_error_get_type (void)
{
	static volatile gsize pdfpc_metadata_meta_file_error_type_id__once = 0;
	if (g_once_init_enter (&pdfpc_metadata_meta_file_error_type_id__once)) {
		GType pdfpc_metadata_meta_file_error_type_id;
		pdfpc_metadata_meta_file_error_type_id = pdfpc_metadata_meta_file_error_get_type_once ();
		g_once_init_leave (&pdfpc_metadata_meta_file_error_type_id__once, pdfpc_metadata_meta_file_error_type_id);
	}
	return pdfpc_metadata_meta_file_error_type_id__once;
}

static inline gpointer
pdfpc_metadata_pdf_get_instance_private (pdfpcMetadataPdf* self)
{
	return G_STRUCT_MEMBER_P (self, pdfpcMetadataPdf_private_offset);
}

static void
_vala_PopplerPageTransition_free (PopplerPageTransition* self)
{
	g_boxed_free (poppler_page_transition_get_type (), self);
}

pdfpcMetadataPageMeta*
pdfpc_metadata_pdf_get_page_meta (pdfpcMetadataPdf* self,
                                  gint slide_number)
{
	gboolean _tmp0_ = FALSE;
	pdfpcMetadataPageMeta* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (slide_number >= 0) {
		GeeList* _tmp1_;
		gint _tmp2_;
		gint _tmp3_;
		_tmp1_ = self->priv->pages;
		_tmp2_ = gee_collection_get_size ((GeeCollection*) _tmp1_);
		_tmp3_ = _tmp2_;
		_tmp0_ = slide_number < _tmp3_;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		GeeList* _tmp4_;
		gpointer _tmp5_;
		_tmp4_ = self->priv->pages;
		_tmp5_ = gee_list_get (_tmp4_, slide_number);
		result = (pdfpcMetadataPageMeta*) _tmp5_;
		return result;
	} else {
		result = NULL;
		return result;
	}
}

/**
         * Unique Resource Locator for the given slideset
         */
gchar*
pdfpc_metadata_pdf_get_url (pdfpcMetadataPdf* self)
{
	const gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_pdf_fname;
	if (_tmp0_ != NULL) {
		const gchar* _tmp1_;
		GFile* _tmp2_;
		GFile* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		_tmp1_ = self->priv->_pdf_fname;
		_tmp2_ = g_file_new_for_commandline_arg (_tmp1_);
		_tmp3_ = _tmp2_;
		_tmp4_ = g_file_get_uri (_tmp3_);
		_tmp5_ = _tmp4_;
		_g_object_unref0 (_tmp3_);
		result = _tmp5_;
		return result;
	} else {
		result = NULL;
		return result;
	}
}

/**
         * Set a note for a given slide (not a user_slide!)
         */
void
pdfpc_metadata_pdf_set_note (pdfpcMetadataPdf* self,
                             const gchar* note_text,
                             gint slide_number,
                             gboolean is_native)
{
	pdfpcMetadataPageMeta* page = NULL;
	pdfpcMetadataPageMeta* _tmp0_;
	pdfpcMetadataPageMeta* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (note_text != NULL);
	_tmp0_ = pdfpc_metadata_pdf_get_page_meta (self, slide_number);
	page = _tmp0_;
	_tmp1_ = page;
	if (_tmp1_ != NULL) {
		pdfpcMetadataPageMeta* _tmp2_;
		pdfpcMetadataSlideNote* _tmp3_;
		pdfpcMetadataPageMeta* _tmp6_;
		pdfpcMetadataSlideNote* _tmp7_;
		const gchar* _tmp8_;
		pdfpcMetadataPageMeta* _tmp12_;
		pdfpcMetadataSlideNote* _tmp13_;
		_tmp2_ = page;
		_tmp3_ = _tmp2_->note;
		if (_tmp3_ == NULL) {
			pdfpcMetadataPageMeta* _tmp4_;
			pdfpcMetadataSlideNote* _tmp5_;
			_tmp4_ = page;
			_tmp5_ = pdfpc_metadata_slide_note_new ();
			_pdfpc_metadata_slide_note_unref0 (_tmp4_->note);
			_tmp4_->note = _tmp5_;
		}
		_tmp6_ = page;
		_tmp7_ = _tmp6_->note;
		_tmp8_ = _tmp7_->note_text;
		if (g_strcmp0 (_tmp8_, note_text) != 0) {
			pdfpcMetadataPageMeta* _tmp9_;
			pdfpcMetadataSlideNote* _tmp10_;
			gchar* _tmp11_;
			_tmp9_ = page;
			_tmp10_ = _tmp9_->note;
			_tmp11_ = g_strdup (note_text);
			_g_free0 (_tmp10_->note_text);
			_tmp10_->note_text = _tmp11_;
			self->priv->dirty_state = TRUE;
		}
		_tmp12_ = page;
		_tmp13_ = _tmp12_->note;
		if (_tmp13_->is_native != is_native) {
			pdfpcMetadataPageMeta* _tmp14_;
			pdfpcMetadataSlideNote* _tmp15_;
			_tmp14_ = page;
			_tmp15_ = _tmp14_->note;
			_tmp15_->is_native = is_native;
			self->priv->dirty_state = TRUE;
		}
	}
	_pdfpc_metadata_page_meta_unref0 (page);
}

/**
         * Return the text of a note
         */
gchar*
pdfpc_metadata_pdf_get_note (pdfpcMetadataPdf* self,
                             gint slide_number)
{
	pdfpcMetadataPageMeta* page = NULL;
	pdfpcMetadataPageMeta* _tmp0_;
	gboolean _tmp1_ = FALSE;
	pdfpcMetadataPageMeta* _tmp2_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = pdfpc_metadata_pdf_get_page_meta (self, slide_number);
	page = _tmp0_;
	_tmp2_ = page;
	if (_tmp2_ != NULL) {
		pdfpcMetadataPageMeta* _tmp3_;
		pdfpcMetadataSlideNote* _tmp4_;
		_tmp3_ = page;
		_tmp4_ = _tmp3_->note;
		_tmp1_ = _tmp4_ != NULL;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		pdfpcMetadataPageMeta* _tmp5_;
		pdfpcMetadataSlideNote* _tmp6_;
		const gchar* _tmp7_;
		gchar* _tmp8_;
		_tmp5_ = page;
		_tmp6_ = _tmp5_->note;
		_tmp7_ = _tmp6_->note_text;
		_tmp8_ = g_strdup (_tmp7_);
		result = _tmp8_;
		_pdfpc_metadata_page_meta_unref0 (page);
		return result;
	} else {
		gchar* _tmp9_;
		_tmp9_ = g_strdup ("");
		result = _tmp9_;
		_pdfpc_metadata_page_meta_unref0 (page);
		return result;
	}
}

gboolean
pdfpc_metadata_pdf_is_note_read_only (pdfpcMetadataPdf* self,
                                      gint slide_number)
{
	pdfpcMetadataPageMeta* page = NULL;
	pdfpcMetadataPageMeta* _tmp0_;
	gboolean _tmp1_ = FALSE;
	pdfpcMetadataPageMeta* _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = pdfpc_metadata_pdf_get_page_meta (self, slide_number);
	page = _tmp0_;
	_tmp2_ = page;
	if (_tmp2_ != NULL) {
		pdfpcMetadataPageMeta* _tmp3_;
		pdfpcMetadataSlideNote* _tmp4_;
		_tmp3_ = page;
		_tmp4_ = _tmp3_->note;
		_tmp1_ = _tmp4_ != NULL;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		pdfpcMetadataPageMeta* _tmp5_;
		pdfpcMetadataSlideNote* _tmp6_;
		_tmp5_ = page;
		_tmp6_ = _tmp5_->note;
		result = _tmp6_->is_native;
		_pdfpc_metadata_page_meta_unref0 (page);
		return result;
	} else {
		result = FALSE;
		_pdfpc_metadata_page_meta_unref0 (page);
		return result;
	}
}

/**
         * Save the metadata to disk
         */
static void
_vala_JsonNode_free (JsonNode* self)
{
	g_boxed_free (json_node_get_type (), self);
}

void
pdfpc_metadata_pdf_save_to_disk (pdfpcMetadataPdf* self)
{
	JsonBuilder* builder = NULL;
	JsonBuilder* _tmp0_;
	JsonBuilder* _tmp1_;
	JsonBuilder* _tmp2_;
	JsonBuilder* _tmp3_;
	const gchar* _tmp6_;
	const gchar* _tmp10_;
	PopplerPageTransition* _tmp20_;
	JsonBuilder* _tmp29_;
	JsonBuilder* _tmp30_;
	JsonBuilder* _tmp33_;
	JsonBuilder* _tmp34_;
	gint idx = 0;
	gint overlay = 0;
	gchar* label = NULL;
	gchar* _tmp35_;
	JsonBuilder* _tmp94_;
	JsonBuilder* _tmp95_;
	JsonGenerator* generator = NULL;
	JsonGenerator* _tmp96_;
	JsonNode* root = NULL;
	JsonBuilder* _tmp97_;
	JsonNode* _tmp98_;
	JsonGenerator* _tmp99_;
	JsonNode* _tmp100_;
	gchar* contents = NULL;
	JsonGenerator* _tmp101_;
	gchar* _tmp102_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = json_builder_new ();
	builder = _tmp0_;
	_tmp1_ = builder;
	json_builder_begin_object (_tmp1_);
	_tmp2_ = builder;
	json_builder_set_member_name (_tmp2_, "pdfpcFormat");
	_tmp3_ = builder;
	json_builder_add_int_value (_tmp3_, (gint64) self->format_version);
	if (self->duration > ((guint) 0)) {
		JsonBuilder* _tmp4_;
		JsonBuilder* _tmp5_;
		_tmp4_ = builder;
		json_builder_set_member_name (_tmp4_, "duration");
		_tmp5_ = builder;
		json_builder_add_int_value (_tmp5_, (gint64) self->duration);
	}
	_tmp6_ = self->end_time;
	if (_tmp6_ != NULL) {
		JsonBuilder* _tmp7_;
		JsonBuilder* _tmp8_;
		const gchar* _tmp9_;
		_tmp7_ = builder;
		json_builder_set_member_name (_tmp7_, "endTime");
		_tmp8_ = builder;
		_tmp9_ = self->end_time;
		json_builder_add_string_value (_tmp8_, _tmp9_);
	}
	_tmp10_ = self->start_time;
	if (_tmp10_ != NULL) {
		JsonBuilder* _tmp11_;
		JsonBuilder* _tmp12_;
		const gchar* _tmp13_;
		_tmp11_ = builder;
		json_builder_set_member_name (_tmp11_, "startTime");
		_tmp12_ = builder;
		_tmp13_ = self->start_time;
		json_builder_add_string_value (_tmp12_, _tmp13_);
	}
	if (self->last_minutes != ((guint) 5)) {
		JsonBuilder* _tmp14_;
		JsonBuilder* _tmp15_;
		_tmp14_ = builder;
		json_builder_set_member_name (_tmp14_, "lastMinutes");
		_tmp15_ = builder;
		json_builder_add_int_value (_tmp15_, (gint64) self->last_minutes);
	}
	if (self->priv->end_user_slide >= 0) {
		JsonBuilder* _tmp16_;
		JsonBuilder* _tmp17_;
		_tmp16_ = builder;
		json_builder_set_member_name (_tmp16_, "endSlide");
		_tmp17_ = builder;
		json_builder_add_int_value (_tmp17_, (gint64) self->priv->end_user_slide);
	}
	if (self->priv->last_saved_slide >= 0) {
		JsonBuilder* _tmp18_;
		JsonBuilder* _tmp19_;
		_tmp18_ = builder;
		json_builder_set_member_name (_tmp18_, "savedSlide");
		_tmp19_ = builder;
		json_builder_add_int_value (_tmp19_, (gint64) self->priv->last_saved_slide);
	}
	_tmp20_ = self->priv->_default_transition;
	if (_tmp20_->type != POPPLER_PAGE_TRANSITION_REPLACE) {
		JsonBuilder* _tmp21_;
		gchar* trans_str = NULL;
		gchar* _tmp22_;
		JsonBuilder* _tmp23_;
		const gchar* _tmp24_;
		_tmp21_ = builder;
		json_builder_set_member_name (_tmp21_, "defaultTransition");
		_tmp22_ = pdfpc_metadata_pdf_get_default_transition_string (self);
		trans_str = _tmp22_;
		_tmp23_ = builder;
		_tmp24_ = trans_str;
		json_builder_add_string_value (_tmp23_, _tmp24_);
		_g_free0 (trans_str);
	}
	if (self->notes_position != PDFPC_METADATA_NOTES_POSITION_NONE) {
		JsonBuilder* _tmp25_;
		JsonBuilder* _tmp26_;
		gchar* _tmp27_;
		gchar* _tmp28_;
		_tmp25_ = builder;
		json_builder_set_member_name (_tmp25_, "beamerNotePosition");
		_tmp26_ = builder;
		_tmp27_ = pdfpc_metadata_notes_position_to_string (self->notes_position);
		_tmp28_ = _tmp27_;
		json_builder_add_string_value (_tmp26_, _tmp28_);
		_g_free0 (_tmp28_);
	}
	_tmp29_ = builder;
	json_builder_set_member_name (_tmp29_, "disableMarkdown");
	_tmp30_ = builder;
	json_builder_add_boolean_value (_tmp30_, self->disable_markdown);
	if (self->font_size > 0) {
		JsonBuilder* _tmp31_;
		JsonBuilder* _tmp32_;
		_tmp31_ = builder;
		json_builder_set_member_name (_tmp31_, "noteFontSize");
		_tmp32_ = builder;
		json_builder_add_int_value (_tmp32_, (gint64) self->font_size);
	}
	_tmp33_ = builder;
	json_builder_set_member_name (_tmp33_, "pages");
	_tmp34_ = builder;
	json_builder_begin_array (_tmp34_);
	idx = 0;
	overlay = 0;
	_tmp35_ = g_strdup ("");
	label = _tmp35_;
	{
		GeeList* _page_list = NULL;
		GeeList* _tmp36_;
		gint _page_size = 0;
		GeeList* _tmp37_;
		gint _tmp38_;
		gint _tmp39_;
		gint _page_index = 0;
		_tmp36_ = self->priv->pages;
		_page_list = _tmp36_;
		_tmp37_ = _page_list;
		_tmp38_ = gee_collection_get_size ((GeeCollection*) _tmp37_);
		_tmp39_ = _tmp38_;
		_page_size = _tmp39_;
		_page_index = -1;
		while (TRUE) {
			gint _tmp40_;
			gint _tmp41_;
			pdfpcMetadataPageMeta* page = NULL;
			GeeList* _tmp42_;
			gpointer _tmp43_;
			const gchar* _tmp44_;
			pdfpcMetadataPageMeta* _tmp45_;
			const gchar* _tmp46_;
			gboolean _tmp50_ = FALSE;
			gboolean _tmp51_ = FALSE;
			pdfpcMetadataPageMeta* _tmp52_;
			gint _tmp92_;
			gint _tmp93_;
			_page_index = _page_index + 1;
			_tmp40_ = _page_index;
			_tmp41_ = _page_size;
			if (!(_tmp40_ < _tmp41_)) {
				break;
			}
			_tmp42_ = _page_list;
			_tmp43_ = gee_list_get (_tmp42_, _page_index);
			page = (pdfpcMetadataPageMeta*) _tmp43_;
			_tmp44_ = label;
			_tmp45_ = page;
			_tmp46_ = _tmp45_->label;
			if (g_strcmp0 (_tmp44_, _tmp46_) != 0) {
				pdfpcMetadataPageMeta* _tmp47_;
				const gchar* _tmp48_;
				gchar* _tmp49_;
				_tmp47_ = page;
				_tmp48_ = _tmp47_->label;
				_tmp49_ = g_strdup (_tmp48_);
				_g_free0 (label);
				label = _tmp49_;
				overlay = 0;
			}
			_tmp52_ = page;
			if (_tmp52_->forced_overlay) {
				_tmp51_ = TRUE;
			} else {
				pdfpcMetadataPageMeta* _tmp53_;
				_tmp53_ = page;
				_tmp51_ = _tmp53_->hidden;
			}
			if (_tmp51_) {
				_tmp50_ = TRUE;
			} else {
				gboolean _tmp54_ = FALSE;
				gboolean _tmp55_ = FALSE;
				pdfpcMetadataPageMeta* _tmp56_;
				pdfpcMetadataSlideNote* _tmp57_;
				_tmp56_ = page;
				_tmp57_ = _tmp56_->note;
				if (_tmp57_ != NULL) {
					pdfpcMetadataPageMeta* _tmp58_;
					pdfpcMetadataSlideNote* _tmp59_;
					_tmp58_ = page;
					_tmp59_ = _tmp58_->note;
					_tmp55_ = !_tmp59_->is_native;
				} else {
					_tmp55_ = FALSE;
				}
				if (_tmp55_) {
					pdfpcMetadataPageMeta* _tmp60_;
					pdfpcMetadataSlideNote* _tmp61_;
					const gchar* _tmp62_;
					_tmp60_ = page;
					_tmp61_ = _tmp60_->note;
					_tmp62_ = _tmp61_->note_text;
					_tmp54_ = _tmp62_ != NULL;
				} else {
					_tmp54_ = FALSE;
				}
				_tmp50_ = _tmp54_;
			}
			if (_tmp50_) {
				JsonBuilder* _tmp63_;
				JsonBuilder* _tmp64_;
				JsonBuilder* _tmp65_;
				JsonBuilder* _tmp66_;
				JsonBuilder* _tmp67_;
				const gchar* _tmp68_;
				JsonBuilder* _tmp69_;
				JsonBuilder* _tmp70_;
				pdfpcMetadataPageMeta* _tmp71_;
				pdfpcMetadataPageMeta* _tmp74_;
				gboolean _tmp77_ = FALSE;
				gboolean _tmp78_ = FALSE;
				pdfpcMetadataPageMeta* _tmp79_;
				pdfpcMetadataSlideNote* _tmp80_;
				JsonBuilder* _tmp91_;
				_tmp63_ = builder;
				json_builder_begin_object (_tmp63_);
				_tmp64_ = builder;
				json_builder_set_member_name (_tmp64_, "idx");
				_tmp65_ = builder;
				json_builder_add_int_value (_tmp65_, (gint64) idx);
				_tmp66_ = builder;
				json_builder_set_member_name (_tmp66_, "label");
				_tmp67_ = builder;
				_tmp68_ = label;
				json_builder_add_string_value (_tmp67_, _tmp68_);
				_tmp69_ = builder;
				json_builder_set_member_name (_tmp69_, "overlay");
				_tmp70_ = builder;
				json_builder_add_int_value (_tmp70_, (gint64) overlay);
				_tmp71_ = page;
				if (_tmp71_->forced_overlay) {
					JsonBuilder* _tmp72_;
					JsonBuilder* _tmp73_;
					_tmp72_ = builder;
					json_builder_set_member_name (_tmp72_, "forcedOverlay");
					_tmp73_ = builder;
					json_builder_add_boolean_value (_tmp73_, TRUE);
				}
				_tmp74_ = page;
				if (_tmp74_->hidden) {
					JsonBuilder* _tmp75_;
					JsonBuilder* _tmp76_;
					_tmp75_ = builder;
					json_builder_set_member_name (_tmp75_, "hidden");
					_tmp76_ = builder;
					json_builder_add_boolean_value (_tmp76_, TRUE);
				}
				_tmp79_ = page;
				_tmp80_ = _tmp79_->note;
				if (_tmp80_ != NULL) {
					pdfpcMetadataPageMeta* _tmp81_;
					pdfpcMetadataSlideNote* _tmp82_;
					_tmp81_ = page;
					_tmp82_ = _tmp81_->note;
					_tmp78_ = _tmp82_->is_native != TRUE;
				} else {
					_tmp78_ = FALSE;
				}
				if (_tmp78_) {
					pdfpcMetadataPageMeta* _tmp83_;
					pdfpcMetadataSlideNote* _tmp84_;
					const gchar* _tmp85_;
					_tmp83_ = page;
					_tmp84_ = _tmp83_->note;
					_tmp85_ = _tmp84_->note_text;
					_tmp77_ = _tmp85_ != NULL;
				} else {
					_tmp77_ = FALSE;
				}
				if (_tmp77_) {
					JsonBuilder* _tmp86_;
					JsonBuilder* _tmp87_;
					pdfpcMetadataPageMeta* _tmp88_;
					pdfpcMetadataSlideNote* _tmp89_;
					const gchar* _tmp90_;
					_tmp86_ = builder;
					json_builder_set_member_name (_tmp86_, "note");
					_tmp87_ = builder;
					_tmp88_ = page;
					_tmp89_ = _tmp88_->note;
					_tmp90_ = _tmp89_->note_text;
					json_builder_add_string_value (_tmp87_, _tmp90_);
				}
				_tmp91_ = builder;
				json_builder_end_object (_tmp91_);
			}
			_tmp92_ = idx;
			idx = _tmp92_ + 1;
			_tmp93_ = overlay;
			overlay = _tmp93_ + 1;
			_pdfpc_metadata_page_meta_unref0 (page);
		}
	}
	_tmp94_ = builder;
	json_builder_end_array (_tmp94_);
	_tmp95_ = builder;
	json_builder_end_object (_tmp95_);
	_tmp96_ = json_generator_new ();
	generator = _tmp96_;
	_tmp97_ = builder;
	_tmp98_ = json_builder_get_root (_tmp97_);
	root = _tmp98_;
	_tmp99_ = generator;
	_tmp100_ = root;
	json_generator_set_root (_tmp99_, _tmp100_);
	_tmp101_ = generator;
	_tmp102_ = json_generator_to_data (_tmp101_, NULL);
	contents = _tmp102_;
	{
		const gchar* _tmp103_;
		_tmp103_ = contents;
		if (g_strcmp0 (_tmp103_, "") != 0) {
			const gchar* _tmp104_;
			const gchar* _tmp105_;
			_tmp104_ = self->pdfpc_fname;
			_tmp105_ = contents;
			g_file_set_contents (_tmp104_, _tmp105_, (gssize) -1, &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp106_;
		const gchar* _tmp107_;
		const gchar* _tmp108_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp106_ = e;
		_tmp107_ = _tmp106_->message;
		g_printerr ("Failed to store metadata on disk: %s\n", _tmp107_);
		_tmp108_ = contents;
		g_printerr ("The metadata was:\n%s\n", _tmp108_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_free0 (contents);
		__vala_JsonNode_free0 (root);
		_g_object_unref0 (generator);
		_g_free0 (label);
		_g_object_unref0 (builder);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
	_g_free0 (contents);
	__vala_JsonNode_free0 (root);
	_g_object_unref0 (generator);
	_g_free0 (label);
	_g_object_unref0 (builder);
}

static void
pdfpc_metadata_pdf_parse_pdfpc_page (pdfpcMetadataPdf* self,
                                     JsonNode* node,
                                     GError** error)
{
	JsonObject* obj = NULL;
	JsonObject* _tmp2_;
	gchar* page_label = NULL;
	gchar* _tmp3_;
	gchar* note = NULL;
	gchar* _tmp4_;
	gint idx = 0;
	gint overlay = 0;
	gint slide_number = 0;
	gboolean forced_overlay = FALSE;
	gboolean hidden = FALSE;
	JsonObject* _tmp5_;
	GList* _tmp6_;
	const gchar* _tmp25_;
	const gchar* _tmp45_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (node != NULL);
	if (json_node_get_node_type (node) != JSON_NODE_OBJECT) {
		const gchar* _tmp0_;
		GError* _tmp1_;
		_tmp0_ = json_node_type_name (node);
		_tmp1_ = g_error_new (PDFPC_METADATA_META_FILE_ERROR, PDFPC_METADATA_META_FILE_ERROR_INVALID_FORMAT, "Unexpected element type %s", _tmp0_);
		_inner_error0_ = _tmp1_;
		g_propagate_error (error, _inner_error0_);
		return;
	}
	_tmp2_ = json_node_get_object (node);
	obj = _tmp2_;
	_tmp3_ = g_strdup ("");
	page_label = _tmp3_;
	_tmp4_ = g_strdup ("");
	note = _tmp4_;
	idx = -1;
	overlay = 0;
	slide_number = -1;
	forced_overlay = FALSE;
	hidden = FALSE;
	_tmp5_ = obj;
	_tmp6_ = json_object_get_members (_tmp5_);
	{
		GList* name_collection = NULL;
		GList* name_it = NULL;
		name_collection = _tmp6_;
		for (name_it = name_collection; name_it != NULL; name_it = name_it->next) {
			const gchar* name = NULL;
			name = (const gchar*) name_it->data;
			{
				JsonNode* item = NULL;
				JsonObject* _tmp7_;
				const gchar* _tmp8_;
				JsonNode* _tmp9_;
				const gchar* _tmp10_;
				const gchar* _tmp11_;
				GQuark _tmp13_ = 0U;
				static GQuark _tmp12_label0 = 0;
				static GQuark _tmp12_label1 = 0;
				static GQuark _tmp12_label2 = 0;
				static GQuark _tmp12_label3 = 0;
				static GQuark _tmp12_label4 = 0;
				static GQuark _tmp12_label5 = 0;
				_tmp7_ = obj;
				_tmp8_ = name;
				_tmp9_ = json_object_get_member (_tmp7_, _tmp8_);
				item = _tmp9_;
				_tmp10_ = name;
				_tmp11_ = _tmp10_;
				_tmp13_ = (NULL == _tmp11_) ? 0 : g_quark_from_string (_tmp11_);
				if (_tmp13_ == ((0 != _tmp12_label0) ? _tmp12_label0 : (_tmp12_label0 = g_quark_from_static_string ("idx")))) {
					switch (0) {
						default:
						{
							JsonNode* _tmp14_;
							_tmp14_ = item;
							idx = (gint) json_node_get_int (_tmp14_);
							break;
						}
					}
				} else if (_tmp13_ == ((0 != _tmp12_label1) ? _tmp12_label1 : (_tmp12_label1 = g_quark_from_static_string ("label")))) {
					switch (0) {
						default:
						{
							JsonNode* _tmp15_;
							const gchar* _tmp16_;
							gchar* _tmp17_;
							_tmp15_ = item;
							_tmp16_ = json_node_get_string (_tmp15_);
							_tmp17_ = g_strdup (_tmp16_);
							_g_free0 (page_label);
							page_label = _tmp17_;
							break;
						}
					}
				} else if (_tmp13_ == ((0 != _tmp12_label2) ? _tmp12_label2 : (_tmp12_label2 = g_quark_from_static_string ("overlay")))) {
					switch (0) {
						default:
						{
							JsonNode* _tmp18_;
							_tmp18_ = item;
							overlay = (gint) json_node_get_int (_tmp18_);
							break;
						}
					}
				} else if (_tmp13_ == ((0 != _tmp12_label3) ? _tmp12_label3 : (_tmp12_label3 = g_quark_from_static_string ("forcedOverlay")))) {
					switch (0) {
						default:
						{
							JsonNode* _tmp19_;
							_tmp19_ = item;
							forced_overlay = json_node_get_boolean (_tmp19_);
							break;
						}
					}
				} else if (_tmp13_ == ((0 != _tmp12_label4) ? _tmp12_label4 : (_tmp12_label4 = g_quark_from_static_string ("hidden")))) {
					switch (0) {
						default:
						{
							JsonNode* _tmp20_;
							_tmp20_ = item;
							hidden = json_node_get_boolean (_tmp20_);
							break;
						}
					}
				} else if (_tmp13_ == ((0 != _tmp12_label5) ? _tmp12_label5 : (_tmp12_label5 = g_quark_from_static_string ("note")))) {
					switch (0) {
						default:
						{
							JsonNode* _tmp21_;
							const gchar* _tmp22_;
							gchar* _tmp23_;
							_tmp21_ = item;
							_tmp22_ = json_node_get_string (_tmp21_);
							_tmp23_ = g_strdup (_tmp22_);
							_g_free0 (note);
							note = _tmp23_;
							break;
						}
					}
				} else {
					switch (0) {
						default:
						{
							const gchar* _tmp24_;
							_tmp24_ = name;
							g_printerr ("Unknown page item \"%s\"\n", _tmp24_);
							break;
						}
					}
				}
			}
		}
		(name_collection == NULL) ? NULL : (name_collection = (g_list_free (name_collection), NULL));
	}
	_tmp25_ = page_label;
	if (g_strcmp0 (_tmp25_, "") != 0) {
		pdfpcMetadataPageMeta* page = NULL;
		pdfpcMetadataPageMeta* _tmp26_;
		gboolean _tmp27_ = FALSE;
		gboolean _tmp28_ = FALSE;
		pdfpcMetadataPageMeta* _tmp29_;
		_tmp26_ = pdfpc_metadata_pdf_get_page_meta (self, idx);
		page = _tmp26_;
		_tmp29_ = page;
		if (_tmp29_ != NULL) {
			pdfpcMetadataPageMeta* _tmp30_;
			const gchar* _tmp31_;
			const gchar* _tmp32_;
			_tmp30_ = page;
			_tmp31_ = _tmp30_->label;
			_tmp32_ = page_label;
			_tmp28_ = g_strcmp0 (_tmp31_, _tmp32_) == 0;
		} else {
			_tmp28_ = FALSE;
		}
		if (_tmp28_) {
			_tmp27_ = pdfpc_metadata_pdf_slide_get_overlay (self, idx) == overlay;
		} else {
			_tmp27_ = FALSE;
		}
		if (_tmp27_) {
			slide_number = idx;
		} else {
			pdfpcMetadataPageMeta* _tmp39_;
			gboolean _tmp40_ = FALSE;
			pdfpcMetadataPageMeta* _tmp41_;
			{
				gint i = 0;
				i = 0;
				{
					gboolean _tmp33_ = FALSE;
					_tmp33_ = TRUE;
					while (TRUE) {
						pdfpcMetadataPageMeta* _tmp35_;
						pdfpcMetadataPageMeta* _tmp36_;
						const gchar* _tmp37_;
						const gchar* _tmp38_;
						if (!_tmp33_) {
							gint _tmp34_;
							_tmp34_ = i;
							i = _tmp34_ + 1;
						}
						_tmp33_ = FALSE;
						if (!(((guint) i) < self->page_count)) {
							break;
						}
						_tmp35_ = pdfpc_metadata_pdf_get_page_meta (self, i);
						_pdfpc_metadata_page_meta_unref0 (page);
						page = _tmp35_;
						_tmp36_ = page;
						_tmp37_ = _tmp36_->label;
						_tmp38_ = page_label;
						if (g_strcmp0 (_tmp37_, _tmp38_) == 0) {
							slide_number = i + overlay;
							break;
						}
					}
				}
			}
			_tmp39_ = pdfpc_metadata_pdf_get_page_meta (self, slide_number);
			_pdfpc_metadata_page_meta_unref0 (page);
			page = _tmp39_;
			_tmp41_ = page;
			if (_tmp41_ == NULL) {
				_tmp40_ = TRUE;
			} else {
				pdfpcMetadataPageMeta* _tmp42_;
				const gchar* _tmp43_;
				const gchar* _tmp44_;
				_tmp42_ = page;
				_tmp43_ = _tmp42_->label;
				_tmp44_ = page_label;
				_tmp40_ = g_strcmp0 (_tmp43_, _tmp44_) != 0;
			}
			if (_tmp40_) {
				slide_number = idx;
			}
		}
		_pdfpc_metadata_page_meta_unref0 (page);
	} else {
		slide_number = idx;
	}
	pdfpc_metadata_pdf_set_slide_hidden (self, slide_number, hidden);
	if (forced_overlay) {
		pdfpc_metadata_pdf_add_overlay (self, slide_number);
	}
	_tmp45_ = note;
	if (g_strcmp0 (_tmp45_, "") != 0) {
		const gchar* _tmp46_;
		_tmp46_ = note;
		pdfpc_metadata_pdf_set_note (self, _tmp46_, slide_number, FALSE);
	}
	_g_free0 (note);
	_g_free0 (page_label);
}

static void
pdfpc_metadata_pdf_parse_pdfpc_pages (pdfpcMetadataPdf* self,
                                      JsonNode* node,
                                      GError** error)
{
	JsonArray* array = NULL;
	JsonArray* _tmp2_;
	JsonArray* _tmp3_;
	GList* _tmp4_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (node != NULL);
	if (json_node_get_node_type (node) != JSON_NODE_ARRAY) {
		const gchar* _tmp0_;
		GError* _tmp1_;
		_tmp0_ = json_node_type_name (node);
		_tmp1_ = g_error_new (PDFPC_METADATA_META_FILE_ERROR, PDFPC_METADATA_META_FILE_ERROR_INVALID_FORMAT, "Unexpected element type %s", _tmp0_);
		_inner_error0_ = _tmp1_;
		g_propagate_error (error, _inner_error0_);
		return;
	}
	_tmp2_ = json_node_get_array (node);
	array = _tmp2_;
	_tmp3_ = array;
	_tmp4_ = json_array_get_elements (_tmp3_);
	{
		GList* item_collection = NULL;
		GList* item_it = NULL;
		item_collection = _tmp4_;
		for (item_it = item_collection; item_it != NULL; item_it = item_it->next) {
			JsonNode* item = NULL;
			item = (JsonNode*) item_it->data;
			{
				JsonNode* _tmp5_;
				_tmp5_ = item;
				pdfpc_metadata_pdf_parse_pdfpc_page (self, _tmp5_, &_inner_error0_);
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					g_propagate_error (error, _inner_error0_);
					(item_collection == NULL) ? NULL : (item_collection = (g_list_free (item_collection), NULL));
					return;
				}
			}
		}
		(item_collection == NULL) ? NULL : (item_collection = (g_list_free (item_collection), NULL));
	}
}

static JsonNode*
_vala_JsonNode_copy (JsonNode* self)
{
	return g_boxed_copy (json_node_get_type (), self);
}

static gpointer
__vala_JsonNode_copy0 (gpointer self)
{
	return self ? _vala_JsonNode_copy (self) : NULL;
}

static gpointer
_g_error_copy0 (gpointer self)
{
	return self ? g_error_copy (self) : NULL;
}

static void
pdfpc_metadata_pdf_parse_pdfpc_file (pdfpcMetadataPdf* self,
                                     GError** error)
{
	JsonParser* parser = NULL;
	JsonParser* _tmp0_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = json_parser_new ();
	parser = _tmp0_;
	{
		JsonParser* _tmp1_;
		const gchar* _tmp2_;
		JsonNode* node = NULL;
		JsonParser* _tmp3_;
		JsonNode* _tmp4_;
		JsonNode* _tmp5_;
		JsonNode* _tmp6_;
		JsonObject* obj = NULL;
		JsonNode* _tmp10_;
		JsonObject* _tmp11_;
		JsonObject* _tmp12_;
		GList* _tmp13_;
		_tmp1_ = parser;
		_tmp2_ = self->pdfpc_fname;
		json_parser_load_from_file (_tmp1_, _tmp2_, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp3_ = parser;
		_tmp4_ = json_parser_get_root (_tmp3_);
		_tmp5_ = __vala_JsonNode_copy0 (_tmp4_);
		node = _tmp5_;
		_tmp6_ = node;
		if (json_node_get_node_type (_tmp6_) != JSON_NODE_OBJECT) {
			JsonNode* _tmp7_;
			const gchar* _tmp8_;
			GError* _tmp9_;
			_tmp7_ = node;
			_tmp8_ = json_node_type_name (_tmp7_);
			_tmp9_ = g_error_new (PDFPC_METADATA_META_FILE_ERROR, PDFPC_METADATA_META_FILE_ERROR_INVALID_FORMAT, "Unexpected element type %s", _tmp8_);
			_inner_error0_ = _tmp9_;
			__vala_JsonNode_free0 (node);
			goto __catch0_g_error;
		}
		_tmp10_ = node;
		_tmp11_ = json_node_get_object (_tmp10_);
		obj = _tmp11_;
		_tmp12_ = obj;
		_tmp13_ = json_object_get_members (_tmp12_);
		{
			GList* name_collection = NULL;
			GList* name_it = NULL;
			name_collection = _tmp13_;
			for (name_it = name_collection; name_it != NULL; name_it = name_it->next) {
				const gchar* name = NULL;
				name = (const gchar*) name_it->data;
				{
					JsonNode* item = NULL;
					JsonObject* _tmp14_;
					const gchar* _tmp15_;
					JsonNode* _tmp16_;
					const gchar* _tmp17_;
					const gchar* _tmp18_;
					GQuark _tmp20_ = 0U;
					static GQuark _tmp19_label0 = 0;
					static GQuark _tmp19_label1 = 0;
					static GQuark _tmp19_label2 = 0;
					static GQuark _tmp19_label3 = 0;
					static GQuark _tmp19_label4 = 0;
					static GQuark _tmp19_label5 = 0;
					static GQuark _tmp19_label6 = 0;
					static GQuark _tmp19_label7 = 0;
					static GQuark _tmp19_label8 = 0;
					static GQuark _tmp19_label9 = 0;
					static GQuark _tmp19_label10 = 0;
					static GQuark _tmp19_label11 = 0;
					_tmp14_ = obj;
					_tmp15_ = name;
					_tmp16_ = json_object_get_member (_tmp14_, _tmp15_);
					item = _tmp16_;
					_tmp17_ = name;
					_tmp18_ = _tmp17_;
					_tmp20_ = (NULL == _tmp18_) ? 0 : g_quark_from_string (_tmp18_);
					if (_tmp20_ == ((0 != _tmp19_label0) ? _tmp19_label0 : (_tmp19_label0 = g_quark_from_static_string ("pdfpcFormat")))) {
						switch (0) {
							default:
							{
								gint format = 0;
								JsonNode* _tmp21_;
								_tmp21_ = item;
								format = (gint) json_node_get_int (_tmp21_);
								if (format > self->format_version) {
									GError* _tmp22_;
									_tmp22_ = g_error_new (PDFPC_METADATA_META_FILE_ERROR, PDFPC_METADATA_META_FILE_ERROR_UNSUPPORTED_VERSION, "Unsupported pdfpc format version %d", format);
									_inner_error0_ = _tmp22_;
									(name_collection == NULL) ? NULL : (name_collection = (g_list_free (name_collection), NULL));
									__vala_JsonNode_free0 (node);
									goto __catch0_g_error;
								}
								break;
							}
						}
					} else if (_tmp20_ == ((0 != _tmp19_label1) ? _tmp19_label1 : (_tmp19_label1 = g_quark_from_static_string ("duration")))) {
						switch (0) {
							default:
							{
								JsonNode* _tmp23_;
								_tmp23_ = item;
								self->duration = (guint) json_node_get_int (_tmp23_);
								break;
							}
						}
					} else if (_tmp20_ == ((0 != _tmp19_label2) ? _tmp19_label2 : (_tmp19_label2 = g_quark_from_static_string ("startTime")))) {
						switch (0) {
							default:
							{
								JsonNode* _tmp24_;
								const gchar* _tmp25_;
								gchar* _tmp26_;
								_tmp24_ = item;
								_tmp25_ = json_node_get_string (_tmp24_);
								_tmp26_ = g_strdup (_tmp25_);
								_g_free0 (self->start_time);
								self->start_time = _tmp26_;
								break;
							}
						}
					} else if (_tmp20_ == ((0 != _tmp19_label3) ? _tmp19_label3 : (_tmp19_label3 = g_quark_from_static_string ("endTime")))) {
						switch (0) {
							default:
							{
								JsonNode* _tmp27_;
								const gchar* _tmp28_;
								gchar* _tmp29_;
								_tmp27_ = item;
								_tmp28_ = json_node_get_string (_tmp27_);
								_tmp29_ = g_strdup (_tmp28_);
								_g_free0 (self->end_time);
								self->end_time = _tmp29_;
								break;
							}
						}
					} else if (_tmp20_ == ((0 != _tmp19_label4) ? _tmp19_label4 : (_tmp19_label4 = g_quark_from_static_string ("endSlide")))) {
						switch (0) {
							default:
							{
								JsonNode* _tmp30_;
								_tmp30_ = item;
								self->priv->end_user_slide = (gint) json_node_get_int (_tmp30_);
								break;
							}
						}
					} else if (_tmp20_ == ((0 != _tmp19_label5) ? _tmp19_label5 : (_tmp19_label5 = g_quark_from_static_string ("savedSlide")))) {
						switch (0) {
							default:
							{
								JsonNode* _tmp31_;
								_tmp31_ = item;
								self->priv->last_saved_slide = (gint) json_node_get_int (_tmp31_);
								break;
							}
						}
					} else if (_tmp20_ == ((0 != _tmp19_label6) ? _tmp19_label6 : (_tmp19_label6 = g_quark_from_static_string ("lastMinutes")))) {
						switch (0) {
							default:
							{
								JsonNode* _tmp32_;
								_tmp32_ = item;
								self->last_minutes = (guint) ((gint) json_node_get_int (_tmp32_));
								break;
							}
						}
					} else if (_tmp20_ == ((0 != _tmp19_label7) ? _tmp19_label7 : (_tmp19_label7 = g_quark_from_static_string ("beamerNotePosition")))) {
						switch (0) {
							default:
							{
								JsonNode* _tmp33_;
								const gchar* _tmp34_;
								_tmp33_ = item;
								_tmp34_ = json_node_get_string (_tmp33_);
								self->notes_position = pdfpc_metadata_notes_position_from_string (_tmp34_);
								break;
							}
						}
					} else if (_tmp20_ == ((0 != _tmp19_label8) ? _tmp19_label8 : (_tmp19_label8 = g_quark_from_static_string ("defaultTransition")))) {
						switch (0) {
							default:
							{
								JsonNode* _tmp35_;
								const gchar* _tmp36_;
								_tmp35_ = item;
								_tmp36_ = json_node_get_string (_tmp35_);
								pdfpc_metadata_pdf_set_default_transition_from_string (self, _tmp36_);
								break;
							}
						}
					} else if (_tmp20_ == ((0 != _tmp19_label9) ? _tmp19_label9 : (_tmp19_label9 = g_quark_from_static_string ("disableMarkdown")))) {
						switch (0) {
							default:
							{
								JsonNode* _tmp37_;
								_tmp37_ = item;
								self->disable_markdown = json_node_get_boolean (_tmp37_);
								break;
							}
						}
					} else if (_tmp20_ == ((0 != _tmp19_label10) ? _tmp19_label10 : (_tmp19_label10 = g_quark_from_static_string ("noteFontSize")))) {
						switch (0) {
							default:
							{
								JsonNode* _tmp38_;
								_tmp38_ = item;
								self->font_size = (gint) json_node_get_int (_tmp38_);
								break;
							}
						}
					} else if (_tmp20_ == ((0 != _tmp19_label11) ? _tmp19_label11 : (_tmp19_label11 = g_quark_from_static_string ("pages")))) {
						switch (0) {
							default:
							{
								JsonNode* _tmp39_;
								_tmp39_ = item;
								pdfpc_metadata_pdf_parse_pdfpc_pages (self, _tmp39_, &_inner_error0_);
								if (G_UNLIKELY (_inner_error0_ != NULL)) {
									(name_collection == NULL) ? NULL : (name_collection = (g_list_free (name_collection), NULL));
									__vala_JsonNode_free0 (node);
									goto __catch0_g_error;
								}
								break;
							}
						}
					} else {
						switch (0) {
							default:
							{
								const gchar* _tmp40_;
								_tmp40_ = name;
								g_printerr ("Unknown item \"%s\"\n", _tmp40_);
								break;
							}
						}
					}
				}
			}
			(name_collection == NULL) ? NULL : (name_collection = (g_list_free (name_collection), NULL));
		}
		__vala_JsonNode_free0 (node);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp41_;
		GError* _tmp42_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp41_ = e;
		_tmp42_ = _g_error_copy0 (_tmp41_);
		_inner_error0_ = _tmp42_;
		_g_error_free0 (e);
		goto __finally0;
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (parser);
		return;
	}
	_g_object_unref0 (parser);
}

/**
         * Parse the given pdfpc file, old format
         */
static gchar*
string_strip (const gchar* self)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	g_strstrip (_result_);
	result = _result_;
	return result;
}

static void
pdfpc_metadata_pdf_parse_pdfpc_file_old (pdfpcMetadataPdf* self,
                                         gchar** notes_content,
                                         gchar** skip_line)
{
	gchar* _vala_notes_content = NULL;
	gchar* _vala_skip_line = NULL;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_g_free0 (_vala_notes_content);
	_vala_notes_content = NULL;
	_g_free0 (_vala_skip_line);
	_vala_skip_line = NULL;
	{
		gchar* content = NULL;
		const gchar* _tmp0_;
		gchar* _tmp1_ = NULL;
		GRegex* regex = NULL;
		GRegex* _tmp2_;
		gchar** config_sections = NULL;
		GRegex* _tmp3_;
		const gchar* _tmp4_;
		gchar** _tmp5_;
		gchar** _tmp6_;
		gint config_sections_length1;
		gint _config_sections_size_;
		gchar* pdfpc_bak = NULL;
		const gchar* _tmp34_;
		gchar* _tmp35_;
		gint status = 0;
		const gchar* _tmp36_;
		const gchar* _tmp37_;
		_tmp0_ = self->pdfpc_fname;
		g_file_get_contents (_tmp0_, &_tmp1_, NULL, &_inner_error0_);
		_g_free0 (content);
		content = _tmp1_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_free0 (content);
			goto __catch0_g_error;
		}
		_tmp2_ = g_regex_new ("(\\[[A-Za-z_]+\\])", 0, 0, &_inner_error0_);
		regex = _tmp2_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_free0 (content);
			goto __catch0_g_error;
		}
		_tmp3_ = regex;
		_tmp4_ = content;
		_tmp6_ = _tmp5_ = g_regex_split_full (_tmp3_, _tmp4_, (gssize) -1, 0, 0, 0, &_inner_error0_);
		config_sections = _tmp6_;
		config_sections_length1 = _vala_array_length (_tmp5_);
		_config_sections_size_ = config_sections_length1;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_regex_unref0 (regex);
			_g_free0 (content);
			goto __catch0_g_error;
		}
		{
			gint i = 0;
			i = 1;
			{
				gboolean _tmp7_ = FALSE;
				_tmp7_ = TRUE;
				while (TRUE) {
					gchar** _tmp8_;
					gint _tmp8__length1;
					gchar* section_type = NULL;
					gchar** _tmp9_;
					gint _tmp9__length1;
					const gchar* _tmp10_;
					gchar* _tmp11_;
					gchar* section_content = NULL;
					gchar** _tmp12_;
					gint _tmp12__length1;
					const gchar* _tmp13_;
					gchar* _tmp14_;
					const gchar* _tmp15_;
					const gchar* _tmp16_;
					GQuark _tmp18_ = 0U;
					static GQuark _tmp17_label0 = 0;
					static GQuark _tmp17_label1 = 0;
					static GQuark _tmp17_label2 = 0;
					static GQuark _tmp17_label3 = 0;
					static GQuark _tmp17_label4 = 0;
					static GQuark _tmp17_label5 = 0;
					static GQuark _tmp17_label6 = 0;
					static GQuark _tmp17_label7 = 0;
					static GQuark _tmp17_label8 = 0;
					static GQuark _tmp17_label9 = 0;
					if (!_tmp7_) {
						i += 2;
					}
					_tmp7_ = FALSE;
					_tmp8_ = config_sections;
					_tmp8__length1 = config_sections_length1;
					if (!(i < _tmp8__length1)) {
						break;
					}
					_tmp9_ = config_sections;
					_tmp9__length1 = config_sections_length1;
					_tmp10_ = _tmp9_[i];
					_tmp11_ = string_strip (_tmp10_);
					section_type = _tmp11_;
					_tmp12_ = config_sections;
					_tmp12__length1 = config_sections_length1;
					_tmp13_ = _tmp12_[i + 1];
					_tmp14_ = string_strip (_tmp13_);
					section_content = _tmp14_;
					_tmp15_ = section_type;
					_tmp16_ = _tmp15_;
					_tmp18_ = (NULL == _tmp16_) ? 0 : g_quark_from_string (_tmp16_);
					if (_tmp18_ == ((0 != _tmp17_label0) ? _tmp17_label0 : (_tmp17_label0 = g_quark_from_static_string ("[duration]")))) {
						switch (0) {
							default:
							{
								{
									const gchar* _tmp19_;
									_tmp19_ = section_content;
									self->duration = (guint) atoi (_tmp19_);
									break;
								}
							}
						}
					} else if (_tmp18_ == ((0 != _tmp17_label1) ? _tmp17_label1 : (_tmp17_label1 = g_quark_from_static_string ("[end_time]")))) {
						switch (0) {
							default:
							{
								{
									const gchar* _tmp20_;
									gchar* _tmp21_;
									_tmp20_ = section_content;
									_tmp21_ = g_strdup (_tmp20_);
									_g_free0 (self->end_time);
									self->end_time = _tmp21_;
									break;
								}
							}
						}
					} else if (_tmp18_ == ((0 != _tmp17_label2) ? _tmp17_label2 : (_tmp17_label2 = g_quark_from_static_string ("[end_user_slide]")))) {
						switch (0) {
							default:
							{
								{
									const gchar* _tmp22_;
									_tmp22_ = section_content;
									self->priv->end_user_slide = atoi (_tmp22_);
									break;
								}
							}
						}
					} else if (_tmp18_ == ((0 != _tmp17_label3) ? _tmp17_label3 : (_tmp17_label3 = g_quark_from_static_string ("[font_size]")))) {
						switch (0) {
							default:
							{
								{
									const gchar* _tmp23_;
									_tmp23_ = section_content;
									self->font_size = atoi (_tmp23_);
									if (self->font_size >= 1000) {
										self->font_size = self->font_size / PANGO_SCALE;
									}
									break;
								}
							}
						}
					} else if (_tmp18_ == ((0 != _tmp17_label4) ? _tmp17_label4 : (_tmp17_label4 = g_quark_from_static_string ("[last_saved_slide]")))) {
						switch (0) {
							default:
							{
								{
									const gchar* _tmp24_;
									_tmp24_ = section_content;
									self->priv->last_saved_slide = atoi (_tmp24_);
									break;
								}
							}
						}
					} else if (_tmp18_ == ((0 != _tmp17_label5) ? _tmp17_label5 : (_tmp17_label5 = g_quark_from_static_string ("[last_minutes]")))) {
						switch (0) {
							default:
							{
								{
									const gchar* _tmp25_;
									_tmp25_ = section_content;
									self->last_minutes = (guint) atoi (_tmp25_);
									break;
								}
							}
						}
					} else if (_tmp18_ == ((0 != _tmp17_label6) ? _tmp17_label6 : (_tmp17_label6 = g_quark_from_static_string ("[notes]")))) {
						switch (0) {
							default:
							{
								{
									const gchar* _tmp26_;
									gchar* _tmp27_;
									_tmp26_ = section_content;
									_tmp27_ = g_strdup (_tmp26_);
									_g_free0 (_vala_notes_content);
									_vala_notes_content = _tmp27_;
									break;
								}
							}
						}
					} else if (_tmp18_ == ((0 != _tmp17_label7) ? _tmp17_label7 : (_tmp17_label7 = g_quark_from_static_string ("[notes_position]")))) {
						switch (0) {
							default:
							{
								{
									const gchar* _tmp28_;
									_tmp28_ = section_content;
									self->notes_position = pdfpc_metadata_notes_position_from_string (_tmp28_);
									break;
								}
							}
						}
					} else if (_tmp18_ == ((0 != _tmp17_label8) ? _tmp17_label8 : (_tmp17_label8 = g_quark_from_static_string ("[skip]")))) {
						switch (0) {
							default:
							{
								{
									const gchar* _tmp29_;
									gchar* _tmp30_;
									_tmp29_ = section_content;
									_tmp30_ = g_strdup (_tmp29_);
									_g_free0 (_vala_skip_line);
									_vala_skip_line = _tmp30_;
									break;
								}
							}
						}
					} else if (_tmp18_ == ((0 != _tmp17_label9) ? _tmp17_label9 : (_tmp17_label9 = g_quark_from_static_string ("[start_time]")))) {
						switch (0) {
							default:
							{
								{
									const gchar* _tmp31_;
									gchar* _tmp32_;
									_tmp31_ = section_content;
									_tmp32_ = g_strdup (_tmp31_);
									_g_free0 (self->start_time);
									self->start_time = _tmp32_;
									break;
								}
							}
						}
					} else {
						switch (0) {
							default:
							{
								{
									const gchar* _tmp33_;
									_tmp33_ = section_type;
									g_printerr ("unknown section type %s\n", _tmp33_);
									break;
								}
							}
						}
					}
					_g_free0 (section_content);
					_g_free0 (section_type);
				}
			}
		}
		_tmp34_ = self->pdfpc_fname;
		_tmp35_ = g_strconcat (_tmp34_, "~", NULL);
		pdfpc_bak = _tmp35_;
		_tmp36_ = self->pdfpc_fname;
		_tmp37_ = pdfpc_bak;
		status = g_rename (_tmp36_, _tmp37_);
		if (status != 0) {
			const gchar* _tmp38_;
			const gchar* _tmp39_;
			_tmp38_ = self->pdfpc_fname;
			_tmp39_ = pdfpc_bak;
			g_printerr ("Failed renaming %s to %s\n", _tmp38_, _tmp39_);
		} else {
			const gchar* _tmp40_;
			_tmp40_ = pdfpc_bak;
			g_printerr ("The legacy pdfpc file was saved as %s\n", _tmp40_);
		}
		_g_free0 (pdfpc_bak);
		config_sections = (_vala_array_free (config_sections, config_sections_length1, (GDestroyNotify) g_free), NULL);
		_g_regex_unref0 (regex);
		_g_free0 (content);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		const gchar* _tmp41_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp41_ = e->message;
		g_printerr ("%s\n", _tmp41_);
		exit (1);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_free0 (_vala_notes_content);
		_g_free0 (_vala_skip_line);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
	if (notes_content) {
		*notes_content = _vala_notes_content;
	} else {
		_g_free0 (_vala_notes_content);
	}
	if (skip_line) {
		*skip_line = _vala_skip_line;
	} else {
		_g_free0 (_vala_skip_line);
	}
}

/**
         * Parse the line for the skip slides, old pdfpc format
         */
static void
pdfpc_metadata_pdf_parse_skip_line_old (pdfpcMetadataPdf* self,
                                        const gchar* line)
{
	gchar** fields = NULL;
	gchar** _tmp0_;
	gchar** _tmp1_;
	gint fields_length1;
	gint _fields_size_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (line != NULL);
	_tmp1_ = _tmp0_ = g_strsplit (line, ",", 0);
	fields = _tmp1_;
	fields_length1 = _vala_array_length (_tmp0_);
	_fields_size_ = fields_length1;
	{
		gint f = 0;
		f = 0;
		{
			gboolean _tmp2_ = FALSE;
			_tmp2_ = TRUE;
			while (TRUE) {
				gchar** _tmp4_;
				gint _tmp4__length1;
				gchar** _tmp5_;
				gint _tmp5__length1;
				const gchar* _tmp6_;
				if (!_tmp2_) {
					gint _tmp3_;
					f = f + 1;
					_tmp3_ = f;
				}
				_tmp2_ = FALSE;
				_tmp4_ = fields;
				_tmp4__length1 = fields_length1;
				if (!(f < (_tmp4__length1 - 1))) {
					break;
				}
				_tmp5_ = fields;
				_tmp5__length1 = fields_length1;
				_tmp6_ = _tmp5_[f];
				if (g_strcmp0 (_tmp6_, "") != 0) {
					gint current_skip = 0;
					gchar** _tmp7_;
					gint _tmp7__length1;
					const gchar* _tmp8_;
					_tmp7_ = fields;
					_tmp7__length1 = fields_length1;
					_tmp8_ = _tmp7_[f];
					current_skip = atoi (_tmp8_) - 1;
					pdfpc_metadata_pdf_add_overlay (self, current_skip);
				}
			}
		}
	}
	fields = (_vala_array_free (fields, fields_length1, (GDestroyNotify) g_free), NULL);
}

/**
         * Parse the notes section of the pdfpc file, old format
         */
static gchar*
_vala_g_strjoinv (const gchar* separator,
                  gchar** str_array,
                  gint str_array_length1)
{
	gboolean _tmp0_ = FALSE;
	gchar* result;
	if (separator == NULL) {
		separator = "";
	}
	if (str_array != NULL) {
		gboolean _tmp1_ = FALSE;
		if (str_array_length1 > 0) {
			_tmp1_ = TRUE;
		} else {
			gboolean _tmp2_ = FALSE;
			if (str_array_length1 == -1) {
				const gchar* _tmp3_;
				_tmp3_ = str_array[0];
				_tmp2_ = _tmp3_ != NULL;
			} else {
				_tmp2_ = FALSE;
			}
			_tmp1_ = _tmp2_;
		}
		_tmp0_ = _tmp1_;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		gint i = 0;
		gsize len = 0UL;
		gint _tmp16_;
		gint _tmp17_;
		const gchar* res = NULL;
		void* _tmp18_;
		const gchar* _tmp19_ = NULL;
		const gchar* _tmp20_;
		void* ptr = NULL;
		const gchar* _tmp22_;
		void* _tmp23_;
		const gchar* _tmp33_;
		len = (gsize) 1;
		{
			gboolean _tmp4_ = FALSE;
			i = 0;
			_tmp4_ = TRUE;
			while (TRUE) {
				gboolean _tmp6_ = FALSE;
				gboolean _tmp7_ = FALSE;
				gint _tmp10_ = 0;
				const gchar* _tmp11_;
				if (!_tmp4_) {
					gint _tmp5_;
					_tmp5_ = i;
					i = _tmp5_ + 1;
				}
				_tmp4_ = FALSE;
				if (str_array_length1 != -1) {
					_tmp7_ = i < str_array_length1;
				} else {
					_tmp7_ = FALSE;
				}
				if (_tmp7_) {
					_tmp6_ = TRUE;
				} else {
					gboolean _tmp8_ = FALSE;
					if (str_array_length1 == -1) {
						const gchar* _tmp9_;
						_tmp9_ = str_array[i];
						_tmp8_ = _tmp9_ != NULL;
					} else {
						_tmp8_ = FALSE;
					}
					_tmp6_ = _tmp8_;
				}
				if (!_tmp6_) {
					break;
				}
				_tmp11_ = str_array[i];
				if (_tmp11_ != NULL) {
					const gchar* _tmp12_;
					gint _tmp13_;
					gint _tmp14_;
					_tmp12_ = str_array[i];
					_tmp13_ = strlen ((const gchar*) _tmp12_);
					_tmp14_ = _tmp13_;
					_tmp10_ = _tmp14_;
				} else {
					_tmp10_ = 0;
				}
				len += (gsize) _tmp10_;
			}
		}
		if (i == 0) {
			gchar* _tmp15_;
			_tmp15_ = g_strdup ("");
			result = _tmp15_;
			return result;
		}
		str_array_length1 = i;
		_tmp16_ = strlen ((const gchar*) separator);
		_tmp17_ = _tmp16_;
		len += (gsize) (_tmp17_ * (i - 1));
		_tmp18_ = g_malloc (len);
		res = _tmp18_;
		_tmp20_ = str_array[0];
		if (_tmp20_ != NULL) {
			const gchar* _tmp21_;
			_tmp21_ = str_array[0];
			_tmp19_ = (const gchar*) _tmp21_;
		} else {
			_tmp19_ = "";
		}
		_tmp22_ = res;
		_tmp23_ = g_stpcpy ((void*) _tmp22_, _tmp19_);
		ptr = _tmp23_;
		{
			gboolean _tmp24_ = FALSE;
			i = 1;
			_tmp24_ = TRUE;
			while (TRUE) {
				void* _tmp26_;
				void* _tmp27_;
				const gchar* _tmp28_ = NULL;
				const gchar* _tmp29_;
				void* _tmp31_;
				void* _tmp32_;
				if (!_tmp24_) {
					gint _tmp25_;
					_tmp25_ = i;
					i = _tmp25_ + 1;
				}
				_tmp24_ = FALSE;
				if (!(i < str_array_length1)) {
					break;
				}
				_tmp26_ = ptr;
				_tmp27_ = g_stpcpy (_tmp26_, (const gchar*) separator);
				ptr = _tmp27_;
				_tmp29_ = str_array[i];
				if (_tmp29_ != NULL) {
					const gchar* _tmp30_;
					_tmp30_ = str_array[i];
					_tmp28_ = (const gchar*) _tmp30_;
				} else {
					_tmp28_ = "";
				}
				_tmp31_ = ptr;
				_tmp32_ = g_stpcpy (_tmp31_, _tmp28_);
				ptr = _tmp32_;
			}
		}
		_tmp33_ = res;
		res = NULL;
		result = (gchar*) _tmp33_;
		return result;
	} else {
		gchar* _tmp34_;
		_tmp34_ = g_strdup ("");
		result = _tmp34_;
		return result;
	}
}

static gint
string_index_of (const gchar* self,
                 const gchar* needle,
                 gint start_index)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	g_return_val_if_fail (needle != NULL, 0);
	_tmp0_ = strstr (((gchar*) self) + start_index, (gchar*) needle);
	_result_ = _tmp0_;
	_tmp1_ = _result_;
	if (_tmp1_ != NULL) {
		gchar* _tmp2_;
		_tmp2_ = _result_;
		result = (gint) (_tmp2_ - ((gchar*) self));
		return result;
	} else {
		result = -1;
		return result;
	}
}

static gchar*
string_slice (const gchar* self,
              glong start,
              glong end)
{
	glong string_length = 0L;
	gint _tmp0_;
	gint _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gchar* _tmp4_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	string_length = (glong) _tmp1_;
	if (start < ((glong) 0)) {
		start = string_length + start;
	}
	if (end < ((glong) 0)) {
		end = string_length + end;
	}
	if (start >= ((glong) 0)) {
		_tmp2_ = start <= string_length;
	} else {
		_tmp2_ = FALSE;
	}
	g_return_val_if_fail (_tmp2_, NULL);
	if (end >= ((glong) 0)) {
		_tmp3_ = end <= string_length;
	} else {
		_tmp3_ = FALSE;
	}
	g_return_val_if_fail (_tmp3_, NULL);
	g_return_val_if_fail (start <= end, NULL);
	_tmp4_ = g_strndup (((gchar*) self) + start, (gsize) (end - start));
	result = _tmp4_;
	return result;
}

static void
pdfpc_metadata_pdf_parse_notes_old (pdfpcMetadataPdf* self,
                                    gchar** lines,
                                    gint lines_length1)
{
	gchar* long_line = NULL;
	gchar* _tmp0_;
	gchar** notes_sections = NULL;
	const gchar* _tmp1_;
	gchar** _tmp2_;
	gchar** _tmp3_;
	gint notes_sections_length1;
	gint _notes_sections_size_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = _vala_g_strjoinv ("\n", lines, (gint) lines_length1);
	long_line = _tmp0_;
	_tmp1_ = long_line;
	_tmp3_ = _tmp2_ = g_strsplit (_tmp1_, "### ", 0);
	notes_sections = _tmp3_;
	notes_sections_length1 = _vala_array_length (_tmp2_);
	_notes_sections_size_ = notes_sections_length1;
	{
		GRegex* unescape_regex = NULL;
		GRegex* _tmp4_;
		_tmp4_ = g_regex_new ("\\\\([\\[\\]#])", 0, 0, &_inner_error0_);
		unescape_regex = _tmp4_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			notes_sections = (_vala_array_free (notes_sections, notes_sections_length1, (GDestroyNotify) g_free), NULL);
			_g_free0 (long_line);
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
		{
			gint notes_section = 0;
			notes_section = 0;
			{
				gboolean _tmp5_ = FALSE;
				_tmp5_ = TRUE;
				while (TRUE) {
					gchar** _tmp7_;
					gint _tmp7__length1;
					gchar** _tmp8_;
					gint _tmp8__length1;
					const gchar* _tmp9_;
					gint _tmp10_;
					gint _tmp11_;
					gint first_newline = 0;
					gchar** _tmp12_;
					gint _tmp12__length1;
					const gchar* _tmp13_;
					gchar* header_string = NULL;
					gchar** _tmp14_;
					gint _tmp14__length1;
					const gchar* _tmp15_;
					gchar* _tmp16_;
					gchar* notes = NULL;
					gchar** _tmp17_;
					gint _tmp17__length1;
					const gchar* _tmp18_;
					gchar** _tmp19_;
					gint _tmp19__length1;
					const gchar* _tmp20_;
					gint _tmp21_;
					gint _tmp22_;
					gchar* _tmp23_;
					gchar* notes_unescaped = NULL;
					GRegex* _tmp24_;
					const gchar* _tmp25_;
					const gchar* _tmp26_;
					gint _tmp27_;
					gint _tmp28_;
					gchar* _tmp29_;
					gint user_slide = 0;
					const gchar* _tmp30_;
					gint slide_number = 0;
					if (!_tmp5_) {
						gint _tmp6_;
						notes_section = notes_section + 1;
						_tmp6_ = notes_section;
					}
					_tmp5_ = FALSE;
					_tmp7_ = notes_sections;
					_tmp7__length1 = notes_sections_length1;
					if (!(notes_section < _tmp7__length1)) {
						break;
					}
					_tmp8_ = notes_sections;
					_tmp8__length1 = notes_sections_length1;
					_tmp9_ = _tmp8_[notes_section];
					_tmp10_ = strlen (_tmp9_);
					_tmp11_ = _tmp10_;
					if (_tmp11_ == 0) {
						continue;
					}
					_tmp12_ = notes_sections;
					_tmp12__length1 = notes_sections_length1;
					_tmp13_ = _tmp12_[notes_section];
					first_newline = string_index_of (_tmp13_, "\n", 0);
					_tmp14_ = notes_sections;
					_tmp14__length1 = notes_sections_length1;
					_tmp15_ = _tmp14_[notes_section];
					_tmp16_ = string_slice (_tmp15_, (glong) 0, (glong) first_newline);
					header_string = _tmp16_;
					_tmp17_ = notes_sections;
					_tmp17__length1 = notes_sections_length1;
					_tmp18_ = _tmp17_[notes_section];
					_tmp19_ = notes_sections;
					_tmp19__length1 = notes_sections_length1;
					_tmp20_ = _tmp19_[notes_section];
					_tmp21_ = strlen (_tmp20_);
					_tmp22_ = _tmp21_;
					_tmp23_ = string_slice (_tmp18_, (glong) (first_newline + 1), (glong) _tmp22_);
					notes = _tmp23_;
					_tmp24_ = unescape_regex;
					_tmp25_ = notes;
					_tmp26_ = notes;
					_tmp27_ = strlen (_tmp26_);
					_tmp28_ = _tmp27_;
					_tmp29_ = g_regex_replace (_tmp24_, _tmp25_, (gssize) _tmp28_, 0, "\\1", 0, &_inner_error0_);
					notes_unescaped = _tmp29_;
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						_g_free0 (notes);
						_g_free0 (header_string);
						_g_regex_unref0 (unescape_regex);
						if (_inner_error0_->domain == G_REGEX_ERROR) {
							goto __catch0_g_regex_error;
						}
						notes_sections = (_vala_array_free (notes_sections, notes_sections_length1, (GDestroyNotify) g_free), NULL);
						_g_free0 (long_line);
						g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
						g_clear_error (&_inner_error0_);
						return;
					}
					_tmp30_ = header_string;
					user_slide = atoi (_tmp30_) - 1;
					slide_number = pdfpc_metadata_pdf_user_slide_to_real_slide (self, user_slide, FALSE);
					{
						gint i = 0;
						i = slide_number;
						{
							gboolean _tmp31_ = FALSE;
							_tmp31_ = TRUE;
							while (TRUE) {
								pdfpcMetadataPageMeta* page = NULL;
								pdfpcMetadataPageMeta* _tmp33_;
								pdfpcMetadataPageMeta* _tmp34_;
								if (!_tmp31_) {
									gint _tmp32_;
									_tmp32_ = i;
									i = _tmp32_ + 1;
								}
								_tmp31_ = FALSE;
								if (!(((guint) i) < self->page_count)) {
									break;
								}
								_tmp33_ = pdfpc_metadata_pdf_get_page_meta (self, i);
								page = _tmp33_;
								_tmp34_ = page;
								if (_tmp34_->user_slide == user_slide) {
									const gchar* _tmp35_;
									_tmp35_ = notes_unescaped;
									pdfpc_metadata_pdf_set_note (self, _tmp35_, i, FALSE);
								} else {
									_pdfpc_metadata_page_meta_unref0 (page);
									break;
								}
								_pdfpc_metadata_page_meta_unref0 (page);
							}
						}
					}
					_g_free0 (notes_unescaped);
					_g_free0 (notes);
					_g_free0 (header_string);
				}
			}
		}
		_g_regex_unref0 (unescape_regex);
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		g_clear_error (&_inner_error0_);
		g_printerr ("Parsing notes file failed.\n");
		exit (1);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		notes_sections = (_vala_array_free (notes_sections, notes_sections_length1, (GDestroyNotify) g_free), NULL);
		_g_free0 (long_line);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
	notes_sections = (_vala_array_free (notes_sections, notes_sections_length1, (GDestroyNotify) g_free), NULL);
	_g_free0 (long_line);
}

/**
         * Fill the path information starting from the user provided filename
         */
static gint
string_last_index_of (const gchar* self,
                      const gchar* needle,
                      gint start_index)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	g_return_val_if_fail (needle != NULL, 0);
	_tmp0_ = g_strrstr (((gchar*) self) + start_index, (gchar*) needle);
	_result_ = _tmp0_;
	_tmp1_ = _result_;
	if (_tmp1_ != NULL) {
		gchar* _tmp2_;
		_tmp2_ = _result_;
		result = (gint) (_tmp2_ - ((gchar*) self));
		return result;
	} else {
		result = -1;
		return result;
	}
}

void
pdfpc_metadata_pdf_fill_path_info (pdfpcMetadataPdf* self,
                                   const gchar* fname,
                                   const gchar* fpcname)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (fname != NULL);
	if (fpcname != NULL) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (fpcname);
		_g_free0 (self->pdfpc_fname);
		self->pdfpc_fname = _tmp0_;
		pdfpc_metadata_pdf_set_pdf_fname (self, fname);
	} else {
		gint extension_index = 0;
		pdfpc_metadata_pdf_set_pdf_fname (self, fname);
		extension_index = string_last_index_of (fname, ".", 0);
		if (extension_index > -1) {
			gchar* _tmp1_;
			gchar* _tmp2_;
			gchar* _tmp3_;
			_tmp1_ = string_slice (fname, (glong) 0, (glong) extension_index);
			_tmp2_ = _tmp1_;
			_tmp3_ = g_strconcat (_tmp2_, ".pdfpc", NULL);
			_g_free0 (self->pdfpc_fname);
			self->pdfpc_fname = _tmp3_;
			_g_free0 (_tmp2_);
		} else {
			gchar* _tmp4_;
			_tmp4_ = g_strconcat (fname, ".pdfpc", NULL);
			_g_free0 (self->pdfpc_fname);
			self->pdfpc_fname = _tmp4_;
		}
	}
}

static PopplerPageTransition*
_vala_PopplerPageTransition_copy (PopplerPageTransition* self)
{
	return g_boxed_copy (poppler_page_transition_get_type (), self);
}

static gpointer
__vala_PopplerPageTransition_copy0 (gpointer self)
{
	return self ? _vala_PopplerPageTransition_copy (self) : NULL;
}

static gdouble
double_parse (const gchar* str)
{
	gdouble result;
	g_return_val_if_fail (str != NULL, 0.0);
	result = g_ascii_strtod (str, NULL);
	return result;
}

void
pdfpc_metadata_pdf_set_default_transition_from_string (pdfpcMetadataPdf* self,
                                                       const gchar* line)
{
	PopplerPageTransition* trans = NULL;
	PopplerPageTransition* _tmp0_;
	PopplerPageTransition* _tmp1_;
	gchar** tokens = NULL;
	gchar** _tmp2_;
	gchar** _tmp3_;
	gint tokens_length1;
	gint _tokens_size_;
	gchar* trans_type = NULL;
	gchar** _tmp4_;
	gint _tmp4__length1;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	GQuark _tmp10_ = 0U;
	static GQuark _tmp9_label0 = 0;
	static GQuark _tmp9_label1 = 0;
	static GQuark _tmp9_label2 = 0;
	static GQuark _tmp9_label3 = 0;
	static GQuark _tmp9_label4 = 0;
	static GQuark _tmp9_label5 = 0;
	static GQuark _tmp9_label6 = 0;
	static GQuark _tmp9_label7 = 0;
	static GQuark _tmp9_label8 = 0;
	static GQuark _tmp9_label9 = 0;
	static GQuark _tmp9_label10 = 0;
	static GQuark _tmp9_label11 = 0;
	gchar** _tmp24_;
	gint _tmp24__length1;
	gchar** _tmp28_;
	gint _tmp28__length1;
	gchar** _tmp32_;
	gint _tmp32__length1;
	gchar** _tmp43_;
	gint _tmp43__length1;
	PopplerPageTransition* _tmp54_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (line != NULL);
	_tmp0_ = self->priv->_default_transition;
	_tmp1_ = __vala_PopplerPageTransition_copy0 (_tmp0_);
	trans = _tmp1_;
	_tmp3_ = _tmp2_ = g_strsplit (line, ":", 0);
	tokens = _tmp3_;
	tokens_length1 = _vala_array_length (_tmp2_);
	_tokens_size_ = tokens_length1;
	_tmp4_ = tokens;
	_tmp4__length1 = tokens_length1;
	_tmp5_ = _tmp4_[0];
	_tmp6_ = g_strdup (_tmp5_);
	trans_type = _tmp6_;
	_tmp7_ = trans_type;
	_tmp8_ = _tmp7_;
	_tmp10_ = (NULL == _tmp8_) ? 0 : g_quark_from_string (_tmp8_);
	if (_tmp10_ == ((0 != _tmp9_label0) ? _tmp9_label0 : (_tmp9_label0 = g_quark_from_static_string ("blinds")))) {
		switch (0) {
			default:
			{
				PopplerPageTransition* _tmp11_;
				_tmp11_ = trans;
				_tmp11_->type = POPPLER_PAGE_TRANSITION_BLINDS;
				break;
			}
		}
	} else if (_tmp10_ == ((0 != _tmp9_label1) ? _tmp9_label1 : (_tmp9_label1 = g_quark_from_static_string ("box")))) {
		switch (0) {
			default:
			{
				PopplerPageTransition* _tmp12_;
				_tmp12_ = trans;
				_tmp12_->type = POPPLER_PAGE_TRANSITION_BOX;
				break;
			}
		}
	} else if (_tmp10_ == ((0 != _tmp9_label2) ? _tmp9_label2 : (_tmp9_label2 = g_quark_from_static_string ("cover")))) {
		switch (0) {
			default:
			{
				PopplerPageTransition* _tmp13_;
				_tmp13_ = trans;
				_tmp13_->type = POPPLER_PAGE_TRANSITION_COVER;
				break;
			}
		}
	} else if (_tmp10_ == ((0 != _tmp9_label3) ? _tmp9_label3 : (_tmp9_label3 = g_quark_from_static_string ("dissolve")))) {
		switch (0) {
			default:
			{
				PopplerPageTransition* _tmp14_;
				_tmp14_ = trans;
				_tmp14_->type = POPPLER_PAGE_TRANSITION_DISSOLVE;
				break;
			}
		}
	} else if (_tmp10_ == ((0 != _tmp9_label4) ? _tmp9_label4 : (_tmp9_label4 = g_quark_from_static_string ("fade")))) {
		switch (0) {
			default:
			{
				PopplerPageTransition* _tmp15_;
				_tmp15_ = trans;
				_tmp15_->type = POPPLER_PAGE_TRANSITION_FADE;
				break;
			}
		}
	} else if (_tmp10_ == ((0 != _tmp9_label5) ? _tmp9_label5 : (_tmp9_label5 = g_quark_from_static_string ("fly")))) {
		switch (0) {
			default:
			{
				PopplerPageTransition* _tmp16_;
				_tmp16_ = trans;
				_tmp16_->type = POPPLER_PAGE_TRANSITION_FLY;
				break;
			}
		}
	} else if (_tmp10_ == ((0 != _tmp9_label6) ? _tmp9_label6 : (_tmp9_label6 = g_quark_from_static_string ("glitter")))) {
		switch (0) {
			default:
			{
				PopplerPageTransition* _tmp17_;
				_tmp17_ = trans;
				_tmp17_->type = POPPLER_PAGE_TRANSITION_GLITTER;
				break;
			}
		}
	} else if (_tmp10_ == ((0 != _tmp9_label7) ? _tmp9_label7 : (_tmp9_label7 = g_quark_from_static_string ("push")))) {
		switch (0) {
			default:
			{
				PopplerPageTransition* _tmp18_;
				_tmp18_ = trans;
				_tmp18_->type = POPPLER_PAGE_TRANSITION_PUSH;
				break;
			}
		}
	} else if (_tmp10_ == ((0 != _tmp9_label8) ? _tmp9_label8 : (_tmp9_label8 = g_quark_from_static_string ("replace")))) {
		switch (0) {
			default:
			{
				PopplerPageTransition* _tmp19_;
				_tmp19_ = trans;
				_tmp19_->type = POPPLER_PAGE_TRANSITION_REPLACE;
				break;
			}
		}
	} else if (_tmp10_ == ((0 != _tmp9_label9) ? _tmp9_label9 : (_tmp9_label9 = g_quark_from_static_string ("split")))) {
		switch (0) {
			default:
			{
				PopplerPageTransition* _tmp20_;
				_tmp20_ = trans;
				_tmp20_->type = POPPLER_PAGE_TRANSITION_SPLIT;
				break;
			}
		}
	} else if (_tmp10_ == ((0 != _tmp9_label10) ? _tmp9_label10 : (_tmp9_label10 = g_quark_from_static_string ("uncover")))) {
		switch (0) {
			default:
			{
				PopplerPageTransition* _tmp21_;
				_tmp21_ = trans;
				_tmp21_->type = POPPLER_PAGE_TRANSITION_UNCOVER;
				break;
			}
		}
	} else if (_tmp10_ == ((0 != _tmp9_label11) ? _tmp9_label11 : (_tmp9_label11 = g_quark_from_static_string ("wipe")))) {
		switch (0) {
			default:
			{
				PopplerPageTransition* _tmp22_;
				_tmp22_ = trans;
				_tmp22_->type = POPPLER_PAGE_TRANSITION_WIPE;
				break;
			}
		}
	} else {
		switch (0) {
			default:
			{
				const gchar* _tmp23_;
				_tmp23_ = trans_type;
				g_printerr ("Unknown trans type %s\n", _tmp23_);
				_g_free0 (trans_type);
				tokens = (_vala_array_free (tokens, tokens_length1, (GDestroyNotify) g_free), NULL);
				__vala_PopplerPageTransition_free0 (trans);
				return;
			}
		}
	}
	_tmp24_ = tokens;
	_tmp24__length1 = tokens_length1;
	if (_tmp24__length1 > 1) {
		gdouble trans_duration = 0.0;
		gchar** _tmp25_;
		gint _tmp25__length1;
		const gchar* _tmp26_;
		_tmp25_ = tokens;
		_tmp25__length1 = tokens_length1;
		_tmp26_ = _tmp25_[1];
		trans_duration = double_parse (_tmp26_);
		if (trans_duration > ((gdouble) 0)) {
			PopplerPageTransition* _tmp27_;
			_tmp27_ = trans;
			_tmp27_->duration_real = trans_duration;
		} else {
			g_printerr ("Transition duration must be positive\n");
			_g_free0 (trans_type);
			tokens = (_vala_array_free (tokens, tokens_length1, (GDestroyNotify) g_free), NULL);
			__vala_PopplerPageTransition_free0 (trans);
			return;
		}
	}
	_tmp28_ = tokens;
	_tmp28__length1 = tokens_length1;
	if (_tmp28__length1 > 2) {
		PopplerPageTransition* _tmp29_;
		gchar** _tmp30_;
		gint _tmp30__length1;
		const gchar* _tmp31_;
		_tmp29_ = trans;
		_tmp30_ = tokens;
		_tmp30__length1 = tokens_length1;
		_tmp31_ = _tmp30_[2];
		_tmp29_->angle = atoi (_tmp31_);
	}
	_tmp32_ = tokens;
	_tmp32__length1 = tokens_length1;
	if (_tmp32__length1 > 3) {
		gchar* alignment = NULL;
		gchar** _tmp33_;
		gint _tmp33__length1;
		const gchar* _tmp34_;
		gchar* _tmp35_;
		const gchar* _tmp36_;
		const gchar* _tmp37_;
		GQuark _tmp39_ = 0U;
		static GQuark _tmp38_label0 = 0;
		static GQuark _tmp38_label1 = 0;
		static GQuark _tmp38_label2 = 0;
		static GQuark _tmp38_label3 = 0;
		static GQuark _tmp38_label4 = 0;
		_tmp33_ = tokens;
		_tmp33__length1 = tokens_length1;
		_tmp34_ = _tmp33_[3];
		_tmp35_ = g_strdup (_tmp34_);
		alignment = _tmp35_;
		_tmp36_ = alignment;
		_tmp37_ = _tmp36_;
		_tmp39_ = (NULL == _tmp37_) ? 0 : g_quark_from_string (_tmp37_);
		if ((_tmp39_ == ((0 != _tmp38_label0) ? _tmp38_label0 : (_tmp38_label0 = g_quark_from_static_string ("h")))) || (_tmp39_ == ((0 != _tmp38_label1) ? _tmp38_label1 : (_tmp38_label1 = g_quark_from_static_string ("horizontal"))))) {
			switch (0) {
				default:
				{
					PopplerPageTransition* _tmp40_;
					_tmp40_ = trans;
					_tmp40_->alignment = POPPLER_PAGE_TRANSITION_HORIZONTAL;
					break;
				}
			}
		} else if ((_tmp39_ == ((0 != _tmp38_label2) ? _tmp38_label2 : (_tmp38_label2 = g_quark_from_static_string ("v")))) || (_tmp39_ == ((0 != _tmp38_label3) ? _tmp38_label3 : (_tmp38_label3 = g_quark_from_static_string ("vertical"))))) {
			switch (0) {
				default:
				{
					PopplerPageTransition* _tmp41_;
					_tmp41_ = trans;
					_tmp41_->alignment = POPPLER_PAGE_TRANSITION_VERTICAL;
					break;
				}
			}
		} else if (_tmp39_ == ((0 != _tmp38_label4) ? _tmp38_label4 : (_tmp38_label4 = g_quark_from_static_string ("")))) {
			switch (0) {
				default:
				{
					break;
				}
			}
		} else {
			switch (0) {
				default:
				{
					const gchar* _tmp42_;
					_tmp42_ = alignment;
					g_printerr ("Invalid transition alignment %s\n", _tmp42_);
					_g_free0 (alignment);
					_g_free0 (trans_type);
					tokens = (_vala_array_free (tokens, tokens_length1, (GDestroyNotify) g_free), NULL);
					__vala_PopplerPageTransition_free0 (trans);
					return;
				}
			}
		}
		_g_free0 (alignment);
	}
	_tmp43_ = tokens;
	_tmp43__length1 = tokens_length1;
	if (_tmp43__length1 > 4) {
		gchar* direction = NULL;
		gchar** _tmp44_;
		gint _tmp44__length1;
		const gchar* _tmp45_;
		gchar* _tmp46_;
		const gchar* _tmp47_;
		const gchar* _tmp48_;
		GQuark _tmp50_ = 0U;
		static GQuark _tmp49_label0 = 0;
		static GQuark _tmp49_label1 = 0;
		static GQuark _tmp49_label2 = 0;
		static GQuark _tmp49_label3 = 0;
		static GQuark _tmp49_label4 = 0;
		_tmp44_ = tokens;
		_tmp44__length1 = tokens_length1;
		_tmp45_ = _tmp44_[4];
		_tmp46_ = g_strdup (_tmp45_);
		direction = _tmp46_;
		_tmp47_ = direction;
		_tmp48_ = _tmp47_;
		_tmp50_ = (NULL == _tmp48_) ? 0 : g_quark_from_string (_tmp48_);
		if ((_tmp50_ == ((0 != _tmp49_label0) ? _tmp49_label0 : (_tmp49_label0 = g_quark_from_static_string ("i")))) || (_tmp50_ == ((0 != _tmp49_label1) ? _tmp49_label1 : (_tmp49_label1 = g_quark_from_static_string ("inward"))))) {
			switch (0) {
				default:
				{
					PopplerPageTransition* _tmp51_;
					_tmp51_ = trans;
					_tmp51_->direction = POPPLER_PAGE_TRANSITION_INWARD;
					break;
				}
			}
		} else if ((_tmp50_ == ((0 != _tmp49_label2) ? _tmp49_label2 : (_tmp49_label2 = g_quark_from_static_string ("o")))) || (_tmp50_ == ((0 != _tmp49_label3) ? _tmp49_label3 : (_tmp49_label3 = g_quark_from_static_string ("outward"))))) {
			switch (0) {
				default:
				{
					PopplerPageTransition* _tmp52_;
					_tmp52_ = trans;
					_tmp52_->direction = POPPLER_PAGE_TRANSITION_OUTWARD;
					break;
				}
			}
		} else if (_tmp50_ == ((0 != _tmp49_label4) ? _tmp49_label4 : (_tmp49_label4 = g_quark_from_static_string ("")))) {
			switch (0) {
				default:
				{
					break;
				}
			}
		} else {
			switch (0) {
				default:
				{
					const gchar* _tmp53_;
					_tmp53_ = direction;
					g_printerr ("Invalid transition direction %s\n", _tmp53_);
					_g_free0 (direction);
					_g_free0 (trans_type);
					tokens = (_vala_array_free (tokens, tokens_length1, (GDestroyNotify) g_free), NULL);
					__vala_PopplerPageTransition_free0 (trans);
					return;
				}
			}
		}
		_g_free0 (direction);
	}
	_tmp54_ = trans;
	pdfpc_metadata_pdf_set_default_transition (self, _tmp54_);
	self->priv->dirty_state = TRUE;
	_g_free0 (trans_type);
	tokens = (_vala_array_free (tokens, tokens_length1, (GDestroyNotify) g_free), NULL);
	__vala_PopplerPageTransition_free0 (trans);
}

static gchar*
double_to_string (gdouble self)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gint _tmp1__length1;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* result;
	_tmp0_ = g_new0 (gchar, G_ASCII_DTOSTR_BUF_SIZE);
	_tmp1_ = _tmp0_;
	_tmp1__length1 = G_ASCII_DTOSTR_BUF_SIZE;
	_tmp2_ = g_ascii_dtostr (_tmp1_, (gint) G_ASCII_DTOSTR_BUF_SIZE, self);
	_tmp3_ = g_strdup (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp1_ = (g_free (_tmp1_), NULL);
	result = _tmp4_;
	return result;
}

static gchar*
pdfpc_metadata_pdf_get_default_transition_string (pdfpcMetadataPdf* self)
{
	gchar* str = NULL;
	gchar* _tmp0_;
	PopplerPageTransition* _tmp1_;
	const gchar* _tmp14_;
	PopplerPageTransition* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	const gchar* _tmp21_;
	PopplerPageTransition* _tmp22_;
	gchar* _tmp23_;
	gchar* _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	PopplerPageTransition* _tmp28_;
	PopplerPageTransition* _tmp33_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup ("");
	str = _tmp0_;
	_tmp1_ = self->priv->_default_transition;
	switch (_tmp1_->type) {
		case POPPLER_PAGE_TRANSITION_BLINDS:
		{
			gchar* _tmp2_;
			_tmp2_ = g_strdup ("blinds");
			_g_free0 (str);
			str = _tmp2_;
			break;
		}
		case POPPLER_PAGE_TRANSITION_BOX:
		{
			gchar* _tmp3_;
			_tmp3_ = g_strdup ("box");
			_g_free0 (str);
			str = _tmp3_;
			break;
		}
		case POPPLER_PAGE_TRANSITION_COVER:
		{
			gchar* _tmp4_;
			_tmp4_ = g_strdup ("cover");
			_g_free0 (str);
			str = _tmp4_;
			break;
		}
		case POPPLER_PAGE_TRANSITION_DISSOLVE:
		{
			gchar* _tmp5_;
			_tmp5_ = g_strdup ("dissolve");
			_g_free0 (str);
			str = _tmp5_;
			break;
		}
		case POPPLER_PAGE_TRANSITION_FADE:
		{
			gchar* _tmp6_;
			_tmp6_ = g_strdup ("fade");
			_g_free0 (str);
			str = _tmp6_;
			break;
		}
		case POPPLER_PAGE_TRANSITION_FLY:
		{
			gchar* _tmp7_;
			_tmp7_ = g_strdup ("fly");
			_g_free0 (str);
			str = _tmp7_;
			break;
		}
		case POPPLER_PAGE_TRANSITION_GLITTER:
		{
			gchar* _tmp8_;
			_tmp8_ = g_strdup ("glitter");
			_g_free0 (str);
			str = _tmp8_;
			break;
		}
		case POPPLER_PAGE_TRANSITION_PUSH:
		{
			gchar* _tmp9_;
			_tmp9_ = g_strdup ("push");
			_g_free0 (str);
			str = _tmp9_;
			break;
		}
		case POPPLER_PAGE_TRANSITION_REPLACE:
		{
			gchar* _tmp10_;
			_tmp10_ = g_strdup ("replace");
			_g_free0 (str);
			str = _tmp10_;
			break;
		}
		case POPPLER_PAGE_TRANSITION_SPLIT:
		{
			gchar* _tmp11_;
			_tmp11_ = g_strdup ("split");
			_g_free0 (str);
			str = _tmp11_;
			break;
		}
		case POPPLER_PAGE_TRANSITION_UNCOVER:
		{
			gchar* _tmp12_;
			_tmp12_ = g_strdup ("uncover");
			_g_free0 (str);
			str = _tmp12_;
			break;
		}
		case POPPLER_PAGE_TRANSITION_WIPE:
		{
			gchar* _tmp13_;
			_tmp13_ = g_strdup ("wipe");
			_g_free0 (str);
			str = _tmp13_;
			break;
		}
		default:
		break;
	}
	_tmp14_ = str;
	_tmp15_ = self->priv->_default_transition;
	_tmp16_ = double_to_string (_tmp15_->duration_real);
	_tmp17_ = _tmp16_;
	_tmp18_ = g_strconcat (":", _tmp17_, NULL);
	_tmp19_ = _tmp18_;
	_tmp20_ = g_strconcat (_tmp14_, _tmp19_, NULL);
	_g_free0 (str);
	str = _tmp20_;
	_g_free0 (_tmp19_);
	_g_free0 (_tmp17_);
	_tmp21_ = str;
	_tmp22_ = self->priv->_default_transition;
	_tmp23_ = g_strdup_printf ("%i", _tmp22_->angle);
	_tmp24_ = _tmp23_;
	_tmp25_ = g_strconcat (":", _tmp24_, NULL);
	_tmp26_ = _tmp25_;
	_tmp27_ = g_strconcat (_tmp21_, _tmp26_, NULL);
	_g_free0 (str);
	str = _tmp27_;
	_g_free0 (_tmp26_);
	_g_free0 (_tmp24_);
	_tmp28_ = self->priv->_default_transition;
	switch (_tmp28_->alignment) {
		case POPPLER_PAGE_TRANSITION_HORIZONTAL:
		{
			const gchar* _tmp29_;
			gchar* _tmp30_;
			_tmp29_ = str;
			_tmp30_ = g_strconcat (_tmp29_, ":h", NULL);
			_g_free0 (str);
			str = _tmp30_;
			break;
		}
		case POPPLER_PAGE_TRANSITION_VERTICAL:
		{
			const gchar* _tmp31_;
			gchar* _tmp32_;
			_tmp31_ = str;
			_tmp32_ = g_strconcat (_tmp31_, ":v", NULL);
			_g_free0 (str);
			str = _tmp32_;
			break;
		}
		default:
		break;
	}
	_tmp33_ = self->priv->_default_transition;
	switch (_tmp33_->direction) {
		case POPPLER_PAGE_TRANSITION_INWARD:
		{
			const gchar* _tmp34_;
			gchar* _tmp35_;
			_tmp34_ = str;
			_tmp35_ = g_strconcat (_tmp34_, ":i", NULL);
			_g_free0 (str);
			str = _tmp35_;
			break;
		}
		case POPPLER_PAGE_TRANSITION_OUTWARD:
		{
			const gchar* _tmp36_;
			gchar* _tmp37_;
			_tmp36_ = str;
			_tmp37_ = g_strconcat (_tmp36_, ":o", NULL);
			_g_free0 (str);
			str = _tmp37_;
			break;
		}
		default:
		break;
	}
	result = str;
	return result;
}

/**
         * Return slide duration
         */
gdouble
pdfpc_metadata_pdf_get_slide_duration (pdfpcMetadataPdf* self,
                                       gint slide_number)
{
	gboolean _tmp0_ = FALSE;
	gdouble result;
	g_return_val_if_fail (self != NULL, 0.0);
	if (slide_number >= 0) {
		_tmp0_ = ((guint) slide_number) < pdfpc_metadata_pdf_get_slide_count (self);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		PopplerPage* page = NULL;
		PopplerDocument* _tmp1_;
		PopplerPage* _tmp2_;
		PopplerPage* _tmp3_;
		_tmp1_ = self->priv->_document;
		_tmp2_ = poppler_document_get_page (_tmp1_, slide_number);
		page = _tmp2_;
		_tmp3_ = page;
		result = poppler_page_get_duration (_tmp3_);
		_g_object_unref0 (page);
		return result;
	} else {
		result = (gdouble) -1;
		return result;
	}
}

/**
         * Deactivate all active mappings
         */
static void
pdfpc_metadata_pdf_deactivate_mappings (pdfpcMetadataPdf* self)
{
	GeeList* _tmp9_;
	g_return_if_fail (self != NULL);
	{
		GeeList* _mapping_list = NULL;
		GeeList* _tmp0_;
		gint _mapping_size = 0;
		GeeList* _tmp1_;
		gint _tmp2_;
		gint _tmp3_;
		gint _mapping_index = 0;
		_tmp0_ = self->priv->action_mapping;
		_mapping_list = _tmp0_;
		_tmp1_ = _mapping_list;
		_tmp2_ = gee_collection_get_size ((GeeCollection*) _tmp1_);
		_tmp3_ = _tmp2_;
		_mapping_size = _tmp3_;
		_mapping_index = -1;
		while (TRUE) {
			gint _tmp4_;
			gint _tmp5_;
			pdfpcActionMapping* mapping = NULL;
			GeeList* _tmp6_;
			gpointer _tmp7_;
			pdfpcActionMapping* _tmp8_;
			_mapping_index = _mapping_index + 1;
			_tmp4_ = _mapping_index;
			_tmp5_ = _mapping_size;
			if (!(_tmp4_ < _tmp5_)) {
				break;
			}
			_tmp6_ = _mapping_list;
			_tmp7_ = gee_list_get (_tmp6_, _mapping_index);
			mapping = (pdfpcActionMapping*) _tmp7_;
			_tmp8_ = mapping;
			pdfpc_action_mapping_deactivate (_tmp8_);
			_g_object_unref0 (mapping);
		}
	}
	_tmp9_ = self->priv->action_mapping;
	gee_collection_clear ((GeeCollection*) _tmp9_);
	self->priv->mapping_page_num = -1;
}

/**
         * Called on quit
         */
void
pdfpc_metadata_pdf_quit (pdfpcMetadataPdf* self)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp1_ = pdfpc_metadata_pdf_get_is_ready (self);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		_tmp0_ = self->priv->dirty_state;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		pdfpc_metadata_pdf_save_to_disk (self);
	}
	pdfpc_metadata_pdf_deactivate_mappings (self);
}

/**
         * Fill the slide notes from pdf text annotations.
         */
static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

static void
_vala_PopplerAnnotMapping_free (PopplerAnnotMapping* self)
{
	g_boxed_free (poppler_annot_mapping_get_type (), self);
}

static void
__vala_PopplerAnnotMapping_free0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (_vala_PopplerAnnotMapping_free (var), NULL));
}

static inline void
_g_list_free___vala_PopplerAnnotMapping_free0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) __vala_PopplerAnnotMapping_free0_);
}

static void
pdfpc_metadata_pdf_notes_from_document (pdfpcMetadataPdf* self)
{
	g_return_if_fail (self != NULL);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				PopplerPage* page = NULL;
				PopplerDocument* _tmp2_;
				PopplerPage* _tmp3_;
				gchar* note_text = NULL;
				gchar* _tmp4_;
				GList* anns = NULL;
				PopplerPage* _tmp5_;
				GList* _tmp6_;
				GList* _tmp7_;
				const gchar* _tmp24_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				if (!(((guint) i) < self->page_count)) {
					break;
				}
				_tmp2_ = self->priv->_document;
				_tmp3_ = poppler_document_get_page (_tmp2_, i);
				page = _tmp3_;
				_tmp4_ = g_strdup ("");
				note_text = _tmp4_;
				_tmp5_ = page;
				_tmp6_ = poppler_page_get_annot_mapping (_tmp5_);
				anns = _tmp6_;
				_tmp7_ = anns;
				{
					GList* am_collection = NULL;
					GList* am_it = NULL;
					am_collection = _tmp7_;
					for (am_it = am_collection; am_it != NULL; am_it = am_it->next) {
						PopplerAnnotMapping* am = NULL;
						am = (PopplerAnnotMapping*) am_it->data;
						{
							PopplerAnnot* a = NULL;
							PopplerAnnotMapping* _tmp8_;
							PopplerAnnot* _tmp9_;
							PopplerAnnot* _tmp10_;
							PopplerAnnot* _tmp11_;
							_tmp8_ = am;
							_tmp9_ = _tmp8_->annot;
							_tmp10_ = _g_object_ref0 (_tmp9_);
							a = _tmp10_;
							_tmp11_ = a;
							switch (poppler_annot_get_annot_type (_tmp11_)) {
								case POPPLER_ANNOT_TEXT:
								case POPPLER_ANNOT_FREE_TEXT:
								case POPPLER_ANNOT_HIGHLIGHT:
								case POPPLER_ANNOT_UNDERLINE:
								case POPPLER_ANNOT_SQUIGGLY:
								{
									const gchar* _tmp12_;
									gint _tmp13_;
									gint _tmp14_;
									const gchar* _tmp17_;
									PopplerAnnot* _tmp18_;
									gchar* _tmp19_;
									gchar* _tmp20_;
									gchar* _tmp21_;
									PopplerPage* _tmp22_;
									PopplerAnnot* _tmp23_;
									_tmp12_ = note_text;
									_tmp13_ = strlen (_tmp12_);
									_tmp14_ = _tmp13_;
									if (_tmp14_ > 0) {
										const gchar* _tmp15_;
										gchar* _tmp16_;
										_tmp15_ = note_text;
										_tmp16_ = g_strconcat (_tmp15_, "\n", NULL);
										_g_free0 (note_text);
										note_text = _tmp16_;
									}
									_tmp17_ = note_text;
									_tmp18_ = a;
									_tmp19_ = poppler_annot_get_contents (_tmp18_);
									_tmp20_ = _tmp19_;
									_tmp21_ = g_strconcat (_tmp17_, _tmp20_, NULL);
									_g_free0 (note_text);
									note_text = _tmp21_;
									_g_free0 (_tmp20_);
									_tmp22_ = page;
									_tmp23_ = a;
									poppler_page_remove_annot (_tmp22_, _tmp23_);
									break;
								}
								default:
								{
									break;
								}
							}
							_g_object_unref0 (a);
						}
					}
				}
				_tmp24_ = note_text;
				if (g_strcmp0 (_tmp24_, "") != 0) {
					const gchar* _tmp25_;
					_tmp25_ = note_text;
					pdfpc_metadata_pdf_set_note (self, _tmp25_, i, TRUE);
				}
				(anns == NULL) ? NULL : (anns = (_g_list_free___vala_PopplerAnnotMapping_free0_ (anns), NULL));
				_g_free0 (note_text);
				_g_object_unref0 (page);
			}
		}
	}
}

/**
         * Parse XMP metadata from the document, if exists
         */
static gboolean
bool_parse (const gchar* str)
{
	gboolean result;
	g_return_val_if_fail (str != NULL, FALSE);
	if (g_strcmp0 (str, "true") == 0) {
		result = TRUE;
		return result;
	} else {
		result = FALSE;
		return result;
	}
}

static void
pdfpc_metadata_pdf_metadata_from_document (pdfpcMetadataPdf* self)
{
	gchar* meta = NULL;
	PopplerDocument* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	pdfpcXmlParser* parser = NULL;
	pdfpcXmlParser* _tmp3_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_document;
	_tmp1_ = poppler_document_get_metadata (_tmp0_);
	meta = _tmp1_;
	_tmp2_ = meta;
	if (_tmp2_ == NULL) {
		_g_free0 (meta);
		return;
	}
	_tmp3_ = pdfpc_xml_parser_new ();
	parser = _tmp3_;
	{
		GeeHashMap* tags = NULL;
		pdfpcXmlParser* _tmp4_;
		const gchar* _tmp5_;
		GeeHashMap* _tmp6_;
		_tmp4_ = parser;
		_tmp5_ = meta;
		_tmp6_ = pdfpc_xml_parser_parse (_tmp4_, _tmp5_, &_inner_error0_);
		tags = _tmp6_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		{
			GeeIterator* _entry_it = NULL;
			GeeHashMap* _tmp7_;
			GeeSet* _tmp8_;
			GeeSet* _tmp9_;
			GeeSet* _tmp10_;
			GeeIterator* _tmp11_;
			GeeIterator* _tmp12_;
			_tmp7_ = tags;
			_tmp8_ = gee_abstract_map_get_entries ((GeeAbstractMap*) _tmp7_);
			_tmp9_ = _tmp8_;
			_tmp10_ = _tmp9_;
			_tmp11_ = gee_iterable_iterator ((GeeIterable*) _tmp10_);
			_tmp12_ = _tmp11_;
			_g_object_unref0 (_tmp10_);
			_entry_it = _tmp12_;
			while (TRUE) {
				GeeIterator* _tmp13_;
				GeeMapEntry* entry = NULL;
				GeeIterator* _tmp14_;
				gpointer _tmp15_;
				GeeMapEntry* _tmp16_;
				gconstpointer _tmp17_;
				gconstpointer _tmp18_;
				const gchar* _tmp19_;
				GQuark _tmp21_ = 0U;
				static GQuark _tmp20_label0 = 0;
				static GQuark _tmp20_label1 = 0;
				static GQuark _tmp20_label2 = 0;
				static GQuark _tmp20_label3 = 0;
				static GQuark _tmp20_label4 = 0;
				static GQuark _tmp20_label5 = 0;
				static GQuark _tmp20_label6 = 0;
				static GQuark _tmp20_label7 = 0;
				_tmp13_ = _entry_it;
				if (!gee_iterator_next (_tmp13_)) {
					break;
				}
				_tmp14_ = _entry_it;
				_tmp15_ = gee_iterator_get (_tmp14_);
				entry = (GeeMapEntry*) _tmp15_;
				_tmp16_ = entry;
				_tmp17_ = gee_map_entry_get_key (_tmp16_);
				_tmp18_ = _tmp17_;
				_tmp19_ = (const gchar*) _tmp18_;
				_tmp21_ = (NULL == _tmp19_) ? 0 : g_quark_from_string (_tmp19_);
				if (_tmp21_ == ((0 != _tmp20_label0) ? _tmp20_label0 : (_tmp20_label0 = g_quark_from_static_string ("Duration")))) {
					switch (0) {
						default:
						{
							GeeMapEntry* _tmp22_;
							gconstpointer _tmp23_;
							gconstpointer _tmp24_;
							_tmp22_ = entry;
							_tmp23_ = gee_map_entry_get_value (_tmp22_);
							_tmp24_ = _tmp23_;
							self->duration = (guint) atoi ((const gchar*) _tmp24_);
							break;
						}
					}
				} else if (_tmp21_ == ((0 != _tmp20_label1) ? _tmp20_label1 : (_tmp20_label1 = g_quark_from_static_string ("EndUserSlide")))) {
					switch (0) {
						default:
						{
							GeeMapEntry* _tmp25_;
							gconstpointer _tmp26_;
							gconstpointer _tmp27_;
							_tmp25_ = entry;
							_tmp26_ = gee_map_entry_get_value (_tmp25_);
							_tmp27_ = _tmp26_;
							self->priv->end_user_slide = atoi ((const gchar*) _tmp27_) - 1;
							break;
						}
					}
				} else if (_tmp21_ == ((0 != _tmp20_label2) ? _tmp20_label2 : (_tmp20_label2 = g_quark_from_static_string ("StartTime")))) {
					switch (0) {
						default:
						{
							GeeMapEntry* _tmp28_;
							gconstpointer _tmp29_;
							gconstpointer _tmp30_;
							gchar* _tmp31_;
							_tmp28_ = entry;
							_tmp29_ = gee_map_entry_get_value (_tmp28_);
							_tmp30_ = _tmp29_;
							_tmp31_ = g_strdup ((const gchar*) _tmp30_);
							_g_free0 (self->start_time);
							self->start_time = _tmp31_;
							break;
						}
					}
				} else if (_tmp21_ == ((0 != _tmp20_label3) ? _tmp20_label3 : (_tmp20_label3 = g_quark_from_static_string ("EndTime")))) {
					switch (0) {
						default:
						{
							GeeMapEntry* _tmp32_;
							gconstpointer _tmp33_;
							gconstpointer _tmp34_;
							gchar* _tmp35_;
							_tmp32_ = entry;
							_tmp33_ = gee_map_entry_get_value (_tmp32_);
							_tmp34_ = _tmp33_;
							_tmp35_ = g_strdup ((const gchar*) _tmp34_);
							_g_free0 (self->end_time);
							self->end_time = _tmp35_;
							break;
						}
					}
				} else if (_tmp21_ == ((0 != _tmp20_label4) ? _tmp20_label4 : (_tmp20_label4 = g_quark_from_static_string ("LastMinutes")))) {
					switch (0) {
						default:
						{
							GeeMapEntry* _tmp36_;
							gconstpointer _tmp37_;
							gconstpointer _tmp38_;
							_tmp36_ = entry;
							_tmp37_ = gee_map_entry_get_value (_tmp36_);
							_tmp38_ = _tmp37_;
							self->last_minutes = (guint) atoi ((const gchar*) _tmp38_);
							break;
						}
					}
				} else if (_tmp21_ == ((0 != _tmp20_label5) ? _tmp20_label5 : (_tmp20_label5 = g_quark_from_static_string ("NotesPosition")))) {
					switch (0) {
						default:
						{
							GeeMapEntry* _tmp39_;
							gconstpointer _tmp40_;
							gconstpointer _tmp41_;
							_tmp39_ = entry;
							_tmp40_ = gee_map_entry_get_value (_tmp39_);
							_tmp41_ = _tmp40_;
							self->notes_position = pdfpc_metadata_notes_position_from_string ((const gchar*) _tmp41_);
							break;
						}
					}
				} else if (_tmp21_ == ((0 != _tmp20_label6) ? _tmp20_label6 : (_tmp20_label6 = g_quark_from_static_string ("DefaultTransition")))) {
					switch (0) {
						default:
						{
							GeeMapEntry* _tmp42_;
							gconstpointer _tmp43_;
							gconstpointer _tmp44_;
							_tmp42_ = entry;
							_tmp43_ = gee_map_entry_get_value (_tmp42_);
							_tmp44_ = _tmp43_;
							pdfpc_metadata_pdf_set_default_transition_from_string (self, (const gchar*) _tmp44_);
							break;
						}
					}
				} else if (_tmp21_ == ((0 != _tmp20_label7) ? _tmp20_label7 : (_tmp20_label7 = g_quark_from_static_string ("DisableMarkdown")))) {
					switch (0) {
						default:
						{
							GeeMapEntry* _tmp45_;
							gconstpointer _tmp46_;
							gconstpointer _tmp47_;
							_tmp45_ = entry;
							_tmp46_ = gee_map_entry_get_value (_tmp45_);
							_tmp47_ = _tmp46_;
							self->disable_markdown = bool_parse ((const gchar*) _tmp47_);
							break;
						}
					}
				} else {
					switch (0) {
						default:
						{
							GeeMapEntry* _tmp48_;
							gconstpointer _tmp49_;
							gconstpointer _tmp50_;
							_tmp48_ = entry;
							_tmp49_ = gee_map_entry_get_key (_tmp48_);
							_tmp50_ = _tmp49_;
							g_printerr ("unknown XMP entry %s\n", (const gchar*) _tmp50_);
							break;
						}
					}
				}
				_g_object_unref0 (entry);
			}
			_g_object_unref0 (_entry_it);
		}
		_g_object_unref0 (tags);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp51_;
		const gchar* _tmp52_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp51_ = e;
		_tmp52_ = _tmp51_->message;
		g_printerr ("XMP parsing error: %s\n", _tmp52_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_object_unref0 (parser);
		_g_free0 (meta);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
	_g_object_unref0 (parser);
	_g_free0 (meta);
}

/**
         * Base constructor taking the file url to the pdf file
         */
pdfpcMetadataPdf*
pdfpc_metadata_pdf_construct (GType object_type,
                              const gchar* pdfFilename)
{
	pdfpcMetadataPdf * self = NULL;
	PopplerPageTransition* _tmp0_;
	PopplerPageTransition* _tmp1_;
	PopplerPageTransition* _tmp2_;
	pdfpcRendererPdf* _tmp3_;
	pdfpcRendererPdf* _tmp4_;
	self = (pdfpcMetadataPdf*) g_object_new (object_type, NULL);
	_tmp0_ = poppler_page_transition_new ();
	_tmp1_ = _tmp0_;
	pdfpc_metadata_pdf_set_default_transition (self, _tmp1_);
	__vala_PopplerPageTransition_free0 (_tmp1_);
	_tmp2_ = self->priv->_default_transition;
	_tmp2_->duration_real = 1.0;
	if (pdfFilename != NULL) {
		pdfpc_metadata_pdf_load (self, pdfFilename);
	}
	_tmp3_ = pdfpc_renderer_pdf_new (self);
	_tmp4_ = _tmp3_;
	pdfpc_metadata_pdf_set_renderer (self, _tmp4_);
	_g_object_unref0 (_tmp4_);
	return self;
}

pdfpcMetadataPdf*
pdfpc_metadata_pdf_new (const gchar* pdfFilename)
{
	return pdfpc_metadata_pdf_construct (PDFPC_METADATA_TYPE_PDF, pdfFilename);
}

/**
         * Actual file loading, initialization, etc
         */
void
pdfpc_metadata_pdf_load (pdfpcMetadataPdf* self,
                         const gchar* pdfFilename)
{
	gchar* fname = NULL;
	gchar* _tmp0_;
	gchar* cwd = NULL;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* fpcname = NULL;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	gboolean _tmp8_ = FALSE;
	const gchar* _tmp9_;
	gboolean _tmp14_ = FALSE;
	const gchar* _tmp15_;
	GeeList* _tmp18_;
	const gchar* _tmp20_;
	const gchar* _tmp21_;
	const gchar* _tmp22_;
	PopplerDocument* _tmp23_;
	PopplerDocument* _tmp24_;
	PopplerDocument* _tmp25_;
	GeeArrayList* _tmp26_;
	gchar* notes_content_old = NULL;
	gchar* skip_line_old = NULL;
	gboolean old_pdfpc = FALSE;
	const gchar* _tmp46_;
	const gchar* _tmp52_;
	const gchar* _tmp54_;
	const gchar* _tmp56_;
	const gchar* _tmp58_;
	const gchar* _tmp60_;
	gboolean disable_auto_grouping = FALSE;
	gboolean _tmp65_ = FALSE;
	const gchar* _tmp82_;
	const gchar* _tmp87_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (pdfFilename != NULL);
	_tmp0_ = g_strdup (pdfFilename);
	fname = _tmp0_;
	_tmp1_ = g_get_current_dir ();
	cwd = _tmp1_;
	_tmp2_ = fname;
	if (!g_path_is_absolute (_tmp2_)) {
		const gchar* _tmp3_;
		const gchar* _tmp4_;
		gchar* _tmp5_;
		_tmp3_ = cwd;
		_tmp4_ = fname;
		_tmp5_ = g_build_filename (_tmp3_, _tmp4_, NULL);
		_g_free0 (fname);
		fname = _tmp5_;
	}
	_tmp6_ = pdfpc_options_pdfpc_location;
	_tmp7_ = g_strdup (_tmp6_);
	fpcname = _tmp7_;
	_tmp9_ = fpcname;
	if (_tmp9_ != NULL) {
		const gchar* _tmp10_;
		_tmp10_ = fpcname;
		_tmp8_ = !g_path_is_absolute (_tmp10_);
	} else {
		_tmp8_ = FALSE;
	}
	if (_tmp8_) {
		const gchar* _tmp11_;
		const gchar* _tmp12_;
		gchar* _tmp13_;
		_tmp11_ = cwd;
		_tmp12_ = fpcname;
		_tmp13_ = g_build_filename (_tmp11_, _tmp12_, NULL);
		_g_free0 (fpcname);
		fpcname = _tmp13_;
	}
	_tmp15_ = fpcname;
	if (_tmp15_ != NULL) {
		const gchar* _tmp16_;
		_tmp16_ = fpcname;
		_tmp14_ = !g_file_test (_tmp16_, G_FILE_TEST_IS_REGULAR);
	} else {
		_tmp14_ = FALSE;
	}
	if (_tmp14_) {
		const gchar* _tmp17_;
		_tmp17_ = fpcname;
		g_printerr ("Can't find custom pdfpc file at %s\n", _tmp17_);
		exit (1);
	}
	_tmp18_ = self->priv->action_mapping;
	if (_tmp18_ != NULL) {
		pdfpc_metadata_pdf_deactivate_mappings (self);
	} else {
		GeeArrayList* _tmp19_;
		_tmp19_ = gee_array_list_new (PDFPC_TYPE_ACTION_MAPPING, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
		_g_object_unref0 (self->priv->action_mapping);
		self->priv->action_mapping = (GeeList*) _tmp19_;
	}
	_tmp20_ = fname;
	_tmp21_ = fpcname;
	pdfpc_metadata_pdf_fill_path_info (self, _tmp20_, _tmp21_);
	_tmp22_ = self->priv->_pdf_fname;
	_tmp23_ = pdfpc_metadata_pdf_open_pdf_document (self, _tmp22_);
	_tmp24_ = _tmp23_;
	pdfpc_metadata_pdf_set_document (self, _tmp24_);
	_g_object_unref0 (_tmp24_);
	_tmp25_ = self->priv->_document;
	self->page_count = (guint) poppler_document_get_n_pages (_tmp25_);
	_tmp26_ = gee_array_list_new (PDFPC_METADATA_TYPE_PAGE_META, (GBoxedCopyFunc) pdfpc_metadata_page_meta_ref, (GDestroyNotify) pdfpc_metadata_page_meta_unref, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->pages);
	self->priv->pages = (GeeList*) _tmp26_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp27_ = FALSE;
			_tmp27_ = TRUE;
			while (TRUE) {
				pdfpcMetadataPageMeta* page = NULL;
				pdfpcMetadataPageMeta* _tmp29_;
				pdfpcMetadataPageMeta* _tmp30_;
				pdfpcMetadataPageMeta* _tmp31_;
				PopplerDocument* _tmp32_;
				PopplerPage* _tmp33_;
				PopplerPage* _tmp34_;
				gchar* _tmp35_;
				gchar* _tmp36_;
				GeeList* _tmp37_;
				pdfpcMetadataPageMeta* _tmp38_;
				if (!_tmp27_) {
					gint _tmp28_;
					_tmp28_ = i;
					i = _tmp28_ + 1;
				}
				_tmp27_ = FALSE;
				if (!(((guint) i) < self->page_count)) {
					break;
				}
				_tmp29_ = pdfpc_metadata_page_meta_new ();
				page = _tmp29_;
				_tmp30_ = page;
				_tmp30_->user_slide = i;
				_tmp31_ = page;
				_tmp32_ = self->priv->_document;
				_tmp33_ = poppler_document_get_page (_tmp32_, i);
				_tmp34_ = _tmp33_;
				_tmp35_ = poppler_page_get_label (_tmp34_);
				_tmp36_ = _tmp35_;
				_g_free0 (_tmp31_->label);
				_tmp31_->label = _tmp36_;
				_g_object_unref0 (_tmp34_);
				_tmp37_ = self->priv->pages;
				_tmp38_ = page;
				gee_collection_add ((GeeCollection*) _tmp37_, _tmp38_);
				_pdfpc_metadata_page_meta_unref0 (page);
			}
		}
	}
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp39_ = FALSE;
			_tmp39_ = TRUE;
			while (TRUE) {
				gdouble width1 = 0.0;
				gdouble height1 = 0.0;
				PopplerDocument* _tmp41_;
				PopplerPage* _tmp42_;
				PopplerPage* _tmp43_;
				gdouble _tmp44_ = 0.0;
				gdouble _tmp45_ = 0.0;
				if (!_tmp39_) {
					gint _tmp40_;
					_tmp40_ = i;
					i = _tmp40_ + 1;
				}
				_tmp39_ = FALSE;
				if (!(((guint) i) < self->page_count)) {
					break;
				}
				_tmp41_ = self->priv->_document;
				_tmp42_ = poppler_document_get_page (_tmp41_, i);
				_tmp43_ = _tmp42_;
				poppler_page_get_size (_tmp43_, &_tmp44_, &_tmp45_);
				width1 = _tmp44_;
				height1 = _tmp45_;
				_g_object_unref0 (_tmp43_);
				if (self->original_page_width < width1) {
					self->original_page_width = width1;
				}
				if (self->original_page_height < height1) {
					self->original_page_height = height1;
				}
			}
		}
	}
	notes_content_old = NULL;
	skip_line_old = NULL;
	old_pdfpc = FALSE;
	_tmp46_ = self->pdfpc_fname;
	if (g_file_test (_tmp46_, G_FILE_TEST_IS_REGULAR)) {
		{
			pdfpc_metadata_pdf_parse_pdfpc_file (self, &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
		}
		goto __finally0;
		__catch0_g_error:
		{
			GError* e = NULL;
			GError* _tmp47_;
			const gchar* _tmp48_;
			GError* _tmp49_;
			e = _inner_error0_;
			_inner_error0_ = NULL;
			_tmp47_ = e;
			_tmp48_ = _tmp47_->message;
			g_printerr ("%s\n", _tmp48_);
			_tmp49_ = e;
			if (_tmp49_->code == PDFPC_METADATA_META_FILE_ERROR_UNSUPPORTED_VERSION) {
				exit (1);
			} else {
				gchar* _tmp50_ = NULL;
				gchar* _tmp51_ = NULL;
				pdfpc_metadata_pdf_parse_pdfpc_file_old (self, &_tmp50_, &_tmp51_);
				_g_free0 (notes_content_old);
				notes_content_old = _tmp50_;
				_g_free0 (skip_line_old);
				skip_line_old = _tmp51_;
				old_pdfpc = TRUE;
			}
			_g_error_free0 (e);
		}
		__finally0:
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_free0 (skip_line_old);
			_g_free0 (notes_content_old);
			_g_free0 (fpcname);
			_g_free0 (cwd);
			_g_free0 (fname);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
	}
	pdfpc_metadata_pdf_metadata_from_document (self);
	pdfpc_metadata_pdf_notes_from_document (self);
	if (!old_pdfpc) {
		self->priv->dirty_state = FALSE;
	}
	if (pdfpc_options_duration != ((guint) 0)) {
		pdfpc_metadata_pdf_set_duration (self, pdfpc_options_duration);
	}
	_tmp52_ = pdfpc_options_start_time;
	if (_tmp52_ != NULL) {
		const gchar* _tmp53_;
		_tmp53_ = pdfpc_options_start_time;
		pdfpc_metadata_pdf_set_start_time (self, _tmp53_);
	}
	_tmp54_ = pdfpc_options_end_time;
	if (_tmp54_ != NULL) {
		const gchar* _tmp55_;
		_tmp55_ = pdfpc_options_end_time;
		pdfpc_metadata_pdf_set_end_time (self, _tmp55_);
	}
	if (pdfpc_options_last_minutes != ((guint) 0)) {
		pdfpc_metadata_pdf_set_last_minutes (self, pdfpc_options_last_minutes);
	}
	_tmp56_ = pdfpc_options_notes_position;
	if (_tmp56_ != NULL) {
		pdfpcMetadataNotesPosition new_notes_position = 0;
		const gchar* _tmp57_;
		_tmp57_ = pdfpc_options_notes_position;
		new_notes_position = pdfpc_metadata_notes_position_from_string (_tmp57_);
		pdfpc_metadata_pdf_set_notes_position (self, new_notes_position);
	}
	_tmp58_ = pdfpc_options_default_transition;
	if (_tmp58_ != NULL) {
		const gchar* _tmp59_;
		_tmp59_ = pdfpc_options_default_transition;
		pdfpc_metadata_pdf_set_default_transition_from_string (self, _tmp59_);
	}
	_tmp60_ = pdfpc_options_notes_format;
	if (_tmp60_ != NULL) {
		const gchar* _tmp61_;
		pdfpcMetadataNotesPosition new_notes_position = 0;
		const gchar* _tmp64_;
		_tmp61_ = pdfpc_options_notes_format;
		if (g_strcmp0 (_tmp61_, "plain") == 0) {
			pdfpc_metadata_pdf_set_disable_markdown (self, TRUE);
		} else {
			const gchar* _tmp62_;
			_tmp62_ = pdfpc_options_notes_format;
			if (g_strcmp0 (_tmp62_, "markdown") == 0) {
				pdfpc_metadata_pdf_set_disable_markdown (self, FALSE);
			} else {
				const gchar* _tmp63_;
				_tmp63_ = pdfpc_options_notes_format;
				g_printerr ("Unknown format \"%s\"\n", _tmp63_);
				exit (1);
			}
		}
		_tmp64_ = pdfpc_options_notes_position;
		new_notes_position = pdfpc_metadata_notes_position_from_string (_tmp64_);
		pdfpc_metadata_pdf_set_notes_position (self, new_notes_position);
	}
	disable_auto_grouping = pdfpc_options_disable_auto_grouping;
	if (!disable_auto_grouping) {
		gboolean _tmp66_ = FALSE;
		if (self->notes_position != PDFPC_METADATA_NOTES_POSITION_NONE) {
			_tmp66_ = TRUE;
		} else {
			const gchar* _tmp67_;
			_tmp67_ = skip_line_old;
			_tmp66_ = _tmp67_ != NULL;
		}
		_tmp65_ = _tmp66_;
	} else {
		_tmp65_ = FALSE;
	}
	if (_tmp65_) {
		disable_auto_grouping = TRUE;
		g_printerr ("Notes position set, auto grouping disabled.\n");
	}
	if (!disable_auto_grouping) {
		gchar* previous_label = NULL;
		gint user_slide = 0;
		previous_label = NULL;
		user_slide = -1;
		{
			gint i = 0;
			i = 0;
			{
				gboolean _tmp68_ = FALSE;
				_tmp68_ = TRUE;
				while (TRUE) {
					pdfpcMetadataPageMeta* page = NULL;
					pdfpcMetadataPageMeta* _tmp70_;
					gchar* this_label = NULL;
					pdfpcMetadataPageMeta* _tmp71_;
					const gchar* _tmp72_;
					gchar* _tmp73_;
					gboolean _tmp74_ = FALSE;
					const gchar* _tmp75_;
					const gchar* _tmp76_;
					pdfpcMetadataPageMeta* _tmp81_;
					if (!_tmp68_) {
						gint _tmp69_;
						i = i + 1;
						_tmp69_ = i;
					}
					_tmp68_ = FALSE;
					if (!(((guint) i) < self->page_count)) {
						break;
					}
					_tmp70_ = pdfpc_metadata_pdf_get_page_meta (self, i);
					page = _tmp70_;
					_tmp71_ = page;
					_tmp72_ = _tmp71_->label;
					_tmp73_ = g_strdup (_tmp72_);
					this_label = _tmp73_;
					_tmp75_ = this_label;
					_tmp76_ = previous_label;
					if (g_strcmp0 (_tmp75_, _tmp76_) != 0) {
						pdfpcMetadataPageMeta* _tmp77_;
						_tmp77_ = page;
						_tmp74_ = !_tmp77_->forced_overlay;
					} else {
						_tmp74_ = FALSE;
					}
					if (_tmp74_) {
						gint _tmp78_;
						const gchar* _tmp79_;
						gchar* _tmp80_;
						_tmp78_ = user_slide;
						user_slide = _tmp78_ + 1;
						_tmp79_ = this_label;
						_tmp80_ = g_strdup (_tmp79_);
						_g_free0 (previous_label);
						previous_label = _tmp80_;
					}
					_tmp81_ = page;
					_tmp81_->user_slide = user_slide;
					_g_free0 (this_label);
					_pdfpc_metadata_page_meta_unref0 (page);
				}
			}
		}
		_g_free0 (previous_label);
	}
	_tmp82_ = notes_content_old;
	if (_tmp82_ != NULL) {
		const gchar* _tmp83_;
		gchar** _tmp84_;
		gchar** _tmp85_;
		gchar** _tmp86_;
		gint _tmp86__length1;
		_tmp83_ = notes_content_old;
		_tmp85_ = _tmp84_ = g_strsplit (_tmp83_, "\n", 0);
		_tmp86_ = _tmp85_;
		_tmp86__length1 = _vala_array_length (_tmp84_);
		pdfpc_metadata_pdf_parse_notes_old (self, _tmp86_, (gint) _vala_array_length (_tmp84_));
		_tmp86_ = (_vala_array_free (_tmp86_, _tmp86__length1, (GDestroyNotify) g_free), NULL);
		self->disable_markdown = TRUE;
	}
	_tmp87_ = skip_line_old;
	if (_tmp87_ != NULL) {
		const gchar* _tmp88_;
		_tmp88_ = skip_line_old;
		pdfpc_metadata_pdf_parse_skip_line_old (self, _tmp88_);
	}
	_g_free0 (skip_line_old);
	_g_free0 (notes_content_old);
	_g_free0 (fpcname);
	_g_free0 (cwd);
	_g_free0 (fname);
}

/**
         * Return the number of pages in the pdf document
         */
guint
pdfpc_metadata_pdf_get_slide_count (pdfpcMetadataPdf* self)
{
	guint result;
	g_return_val_if_fail (self != NULL, 0U);
	result = self->page_count;
	return result;
}

/**
         * Return the number of user slides
         */
gint
pdfpc_metadata_pdf_get_user_slide_count (pdfpcMetadataPdf* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	if (self->page_count > ((guint) 0)) {
		pdfpcMetadataPageMeta* page = NULL;
		pdfpcMetadataPageMeta* _tmp0_;
		pdfpcMetadataPageMeta* _tmp1_;
		_tmp0_ = pdfpc_metadata_pdf_get_page_meta (self, ((gint) self->page_count) - 1);
		page = _tmp0_;
		_tmp1_ = page;
		result = _tmp1_->user_slide + 1;
		_pdfpc_metadata_page_meta_unref0 (page);
		return result;
	} else {
		result = 0;
		return result;
	}
}

/**
         * Get/set the last user-defined slide
         */
gint
pdfpc_metadata_pdf_get_end_user_slide (pdfpcMetadataPdf* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	if (self->priv->end_user_slide >= 0) {
		result = self->priv->end_user_slide;
		return result;
	} else {
		result = pdfpc_metadata_pdf_get_user_slide_count (self) - 1;
		return result;
	}
}

void
pdfpc_metadata_pdf_set_end_user_slide (pdfpcMetadataPdf* self,
                                       gint slide)
{
	g_return_if_fail (self != NULL);
	if (self->priv->end_user_slide != slide) {
		self->priv->end_user_slide = slide;
		self->priv->dirty_state = TRUE;
	}
}

/**
         * Get/set font size of notes
         */
gint
pdfpc_metadata_pdf_get_font_size (pdfpcMetadataPdf* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->font_size;
	return result;
}

void
pdfpc_metadata_pdf_set_font_size (pdfpcMetadataPdf* self,
                                  gint size)
{
	g_return_if_fail (self != NULL);
	if (self->font_size != size) {
		self->font_size = size;
		self->priv->dirty_state = TRUE;
	}
}

/**
         * Get/set the last bookmarked slide
         */
gint
pdfpc_metadata_pdf_get_last_saved_slide (pdfpcMetadataPdf* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->last_saved_slide;
	return result;
}

void
pdfpc_metadata_pdf_set_last_saved_slide (pdfpcMetadataPdf* self,
                                         gint slide)
{
	g_return_if_fail (self != NULL);
	if (self->priv->last_saved_slide != slide) {
		self->priv->last_saved_slide = slide;
		self->priv->dirty_state = TRUE;
	}
}

/**
         * Get/set last minutes
         */
guint
pdfpc_metadata_pdf_get_last_minutes (pdfpcMetadataPdf* self)
{
	guint result;
	g_return_val_if_fail (self != NULL, 0U);
	result = self->last_minutes;
	return result;
}

void
pdfpc_metadata_pdf_set_last_minutes (pdfpcMetadataPdf* self,
                                     guint last_minutes)
{
	g_return_if_fail (self != NULL);
	if (self->last_minutes != last_minutes) {
		self->last_minutes = last_minutes;
		self->priv->dirty_state = TRUE;
	}
}

/**
         * Get/set the start time
         */
gchar*
pdfpc_metadata_pdf_get_start_time (pdfpcMetadataPdf* self)
{
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->start_time;
	_tmp1_ = g_strdup (_tmp0_);
	result = _tmp1_;
	return result;
}

void
pdfpc_metadata_pdf_set_start_time (pdfpcMetadataPdf* self,
                                   const gchar* timestr)
{
	const gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->start_time;
	if (g_strcmp0 (_tmp0_, timestr) != 0) {
		gchar* _tmp1_;
		_tmp1_ = g_strdup (timestr);
		_g_free0 (self->start_time);
		self->start_time = _tmp1_;
		self->priv->dirty_state = TRUE;
	}
}

/**
         * Get/set the end time
         */
gchar*
pdfpc_metadata_pdf_get_end_time (pdfpcMetadataPdf* self)
{
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->end_time;
	_tmp1_ = g_strdup (_tmp0_);
	result = _tmp1_;
	return result;
}

void
pdfpc_metadata_pdf_set_end_time (pdfpcMetadataPdf* self,
                                 const gchar* timestr)
{
	const gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->end_time;
	if (g_strcmp0 (_tmp0_, timestr) != 0) {
		gchar* _tmp1_;
		_tmp1_ = g_strdup (timestr);
		_g_free0 (self->end_time);
		self->end_time = _tmp1_;
		self->priv->dirty_state = TRUE;
	}
}

/**
         * Get/set notes position
         */
pdfpcMetadataNotesPosition
pdfpc_metadata_pdf_get_notes_position (pdfpcMetadataPdf* self)
{
	pdfpcMetadataNotesPosition result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->notes_position;
	return result;
}

void
pdfpc_metadata_pdf_set_notes_position (pdfpcMetadataPdf* self,
                                       pdfpcMetadataNotesPosition position)
{
	g_return_if_fail (self != NULL);
	if (self->notes_position != position) {
		self->notes_position = position;
		self->priv->dirty_state = TRUE;
	}
}

/**
         * Get/set disable_markdown flag
         */
gboolean
pdfpc_metadata_pdf_get_disable_markdown (pdfpcMetadataPdf* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->disable_markdown;
	return result;
}

void
pdfpc_metadata_pdf_set_disable_markdown (pdfpcMetadataPdf* self,
                                         gboolean onoff)
{
	g_return_if_fail (self != NULL);
	if (self->disable_markdown != onoff) {
		self->disable_markdown = onoff;
		self->priv->dirty_state = TRUE;
	}
}

/**
         * Add current slide as an overlay
         *
         * Returns the offset to move the current user_slide_number
         */
gint
pdfpc_metadata_pdf_add_overlay (pdfpcMetadataPdf* self,
                                gint slide_number)
{
	pdfpcMetadataPageMeta* prev_page = NULL;
	pdfpcMetadataPageMeta* _tmp0_;
	pdfpcMetadataPageMeta* _tmp1_;
	gint prev_user_slide_number = 0;
	pdfpcMetadataPageMeta* _tmp2_;
	pdfpcMetadataPageMeta* page = NULL;
	pdfpcMetadataPageMeta* _tmp3_;
	gboolean _tmp4_ = FALSE;
	pdfpcMetadataPageMeta* _tmp5_;
	pdfpcMetadataPageMeta* _tmp7_;
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	if (slide_number <= 0) {
		result = 0;
		return result;
	}
	_tmp0_ = pdfpc_metadata_pdf_get_page_meta (self, slide_number - 1);
	prev_page = _tmp0_;
	_tmp1_ = prev_page;
	if (_tmp1_ == NULL) {
		result = 0;
		_pdfpc_metadata_page_meta_unref0 (prev_page);
		return result;
	}
	_tmp2_ = prev_page;
	prev_user_slide_number = _tmp2_->user_slide;
	_tmp3_ = pdfpc_metadata_pdf_get_page_meta (self, slide_number);
	page = _tmp3_;
	_tmp5_ = page;
	if (_tmp5_ == NULL) {
		_tmp4_ = TRUE;
	} else {
		pdfpcMetadataPageMeta* _tmp6_;
		_tmp6_ = page;
		_tmp4_ = _tmp6_->user_slide == prev_user_slide_number;
	}
	if (_tmp4_) {
		result = 0;
		_pdfpc_metadata_page_meta_unref0 (page);
		_pdfpc_metadata_page_meta_unref0 (prev_page);
		return result;
	}
	_tmp7_ = page;
	_tmp7_->forced_overlay = TRUE;
	{
		gint i = 0;
		i = slide_number;
		{
			gboolean _tmp8_ = FALSE;
			_tmp8_ = TRUE;
			while (TRUE) {
				pdfpcMetadataPageMeta* _tmp10_;
				pdfpcMetadataPageMeta* _tmp11_;
				gint _tmp12_;
				if (!_tmp8_) {
					gint _tmp9_;
					_tmp9_ = i;
					i = _tmp9_ + 1;
				}
				_tmp8_ = FALSE;
				if (!(((guint) i) < self->page_count)) {
					break;
				}
				_tmp10_ = pdfpc_metadata_pdf_get_page_meta (self, i);
				_pdfpc_metadata_page_meta_unref0 (page);
				page = _tmp10_;
				_tmp11_ = page;
				_tmp12_ = _tmp11_->user_slide;
				_tmp11_->user_slide = _tmp12_ - 1;
			}
		}
	}
	self->priv->dirty_state = TRUE;
	result = -1;
	_pdfpc_metadata_page_meta_unref0 (page);
	_pdfpc_metadata_page_meta_unref0 (prev_page);
	return result;
}

/**
         * Get the "hidden" flag of a slide
         *
         * Note that for an invalid slide_number it returns false
         */
gboolean
pdfpc_metadata_pdf_get_slide_hidden (pdfpcMetadataPdf* self,
                                     gint slide_number)
{
	pdfpcMetadataPageMeta* page = NULL;
	pdfpcMetadataPageMeta* _tmp0_;
	pdfpcMetadataPageMeta* _tmp1_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = pdfpc_metadata_pdf_get_page_meta (self, slide_number);
	page = _tmp0_;
	_tmp1_ = page;
	if (_tmp1_ == NULL) {
		result = FALSE;
		_pdfpc_metadata_page_meta_unref0 (page);
		return result;
	} else {
		pdfpcMetadataPageMeta* _tmp2_;
		_tmp2_ = page;
		result = _tmp2_->hidden;
		_pdfpc_metadata_page_meta_unref0 (page);
		return result;
	}
}

/**
         * Set the "hidden" flag of a slide
         *
         * If the new state = hidden, return the offset to the next
         * non-hidden slide
         */
gint
pdfpc_metadata_pdf_set_slide_hidden (pdfpcMetadataPdf* self,
                                     gint slide_number,
                                     gboolean onoff)
{
	pdfpcMetadataPageMeta* page = NULL;
	pdfpcMetadataPageMeta* _tmp0_;
	gboolean _tmp1_ = FALSE;
	pdfpcMetadataPageMeta* _tmp2_;
	pdfpcMetadataPageMeta* _tmp4_;
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = pdfpc_metadata_pdf_get_page_meta (self, slide_number);
	page = _tmp0_;
	_tmp2_ = page;
	if (_tmp2_ == NULL) {
		_tmp1_ = TRUE;
	} else {
		pdfpcMetadataPageMeta* _tmp3_;
		_tmp3_ = page;
		_tmp1_ = _tmp3_->hidden == onoff;
	}
	if (_tmp1_) {
		result = 0;
		_pdfpc_metadata_page_meta_unref0 (page);
		return result;
	}
	_tmp4_ = page;
	_tmp4_->hidden = onoff;
	self->priv->dirty_state = TRUE;
	if (onoff) {
		{
			gint i = 0;
			i = slide_number;
			{
				gboolean _tmp5_ = FALSE;
				_tmp5_ = TRUE;
				while (TRUE) {
					pdfpcMetadataPageMeta* _tmp7_;
					gboolean _tmp8_ = FALSE;
					pdfpcMetadataPageMeta* _tmp9_;
					if (!_tmp5_) {
						gint _tmp6_;
						_tmp6_ = i;
						i = _tmp6_ + 1;
					}
					_tmp5_ = FALSE;
					if (!(((guint) i) < self->page_count)) {
						break;
					}
					_tmp7_ = pdfpc_metadata_pdf_get_page_meta (self, i);
					_pdfpc_metadata_page_meta_unref0 (page);
					page = _tmp7_;
					_tmp9_ = page;
					if (_tmp9_ != NULL) {
						pdfpcMetadataPageMeta* _tmp10_;
						_tmp10_ = page;
						_tmp8_ = !_tmp10_->hidden;
					} else {
						_tmp8_ = FALSE;
					}
					if (_tmp8_) {
						result = i - slide_number;
						_pdfpc_metadata_page_meta_unref0 (page);
						return result;
					}
				}
			}
		}
		{
			gint i = 0;
			i = slide_number - 1;
			{
				gboolean _tmp11_ = FALSE;
				_tmp11_ = TRUE;
				while (TRUE) {
					pdfpcMetadataPageMeta* _tmp13_;
					gboolean _tmp14_ = FALSE;
					pdfpcMetadataPageMeta* _tmp15_;
					if (!_tmp11_) {
						gint _tmp12_;
						_tmp12_ = i;
						i = _tmp12_ - 1;
					}
					_tmp11_ = FALSE;
					if (!(i >= 0)) {
						break;
					}
					_tmp13_ = pdfpc_metadata_pdf_get_page_meta (self, i);
					_pdfpc_metadata_page_meta_unref0 (page);
					page = _tmp13_;
					_tmp15_ = page;
					if (_tmp15_ != NULL) {
						pdfpcMetadataPageMeta* _tmp16_;
						_tmp16_ = page;
						_tmp14_ = !_tmp16_->hidden;
					} else {
						_tmp14_ = FALSE;
					}
					if (_tmp14_) {
						result = i - slide_number;
						_pdfpc_metadata_page_meta_unref0 (page);
						return result;
					}
				}
			}
		}
	}
	result = 0;
	_pdfpc_metadata_page_meta_unref0 (page);
	return result;
}

/**
         * Check whether a user slide is (at least partially) hidden
         *
         * Note that for an invalid user_slide it returns false
         */
gboolean
pdfpc_metadata_pdf_get_user_slide_hidden (pdfpcMetadataPdf* self,
                                          gint user_slide)
{
	gint slide_number = 0;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	slide_number = pdfpc_metadata_pdf_user_slide_to_real_slide (self, user_slide, FALSE);
	{
		gboolean _tmp0_ = FALSE;
		_tmp0_ = TRUE;
		while (TRUE) {
			gint _tmp2_;
			if (!_tmp0_) {
				gboolean _tmp1_ = FALSE;
				if (((guint) slide_number) < self->page_count) {
					_tmp1_ = pdfpc_metadata_pdf_real_slide_to_user_slide (self, slide_number) == user_slide;
				} else {
					_tmp1_ = FALSE;
				}
				if (!_tmp1_) {
					break;
				}
			}
			_tmp0_ = FALSE;
			if (pdfpc_metadata_pdf_get_slide_hidden (self, slide_number)) {
				result = TRUE;
				return result;
			}
			_tmp2_ = slide_number;
			slide_number = _tmp2_ + 1;
		}
	}
	result = FALSE;
	return result;
}

/**
         * Find a nearest non-hidden slide, optionally looking up backwards
         */
gint
pdfpc_metadata_pdf_nearest_nonhidden (pdfpcMetadataPdf* self,
                                      gint slide_number,
                                      gboolean backwards)
{
	gint new_slide_number = 0;
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	new_slide_number = slide_number;
	while (TRUE) {
		if (!pdfpc_metadata_pdf_get_slide_hidden (self, new_slide_number)) {
			break;
		}
		if (backwards) {
			gint _tmp0_;
			_tmp0_ = new_slide_number;
			new_slide_number = _tmp0_ - 1;
		} else {
			gint _tmp1_;
			_tmp1_ = new_slide_number;
			new_slide_number = _tmp1_ + 1;
		}
	}
	result = new_slide_number;
	return result;
}

/**
         * Transform from user slide numbers to real slide numbers
         *
         * If lastSlide is true, the last page of an overlay will be returned,
         * otherwise, the first one
         */
gint
pdfpc_metadata_pdf_user_slide_to_real_slide (pdfpcMetadataPdf* self,
                                             gint number,
                                             gboolean lastSlide)
{
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	if (number < 0) {
		result = 0;
		return result;
	} else {
		if (lastSlide) {
			{
				gint i = 0;
				i = ((gint) self->page_count) - 1;
				{
					gboolean _tmp0_ = FALSE;
					_tmp0_ = TRUE;
					while (TRUE) {
						pdfpcMetadataPageMeta* page = NULL;
						pdfpcMetadataPageMeta* _tmp2_;
						pdfpcMetadataPageMeta* _tmp3_;
						if (!_tmp0_) {
							gint _tmp1_;
							_tmp1_ = i;
							i = _tmp1_ - 1;
						}
						_tmp0_ = FALSE;
						if (!(i >= 0)) {
							break;
						}
						_tmp2_ = pdfpc_metadata_pdf_get_page_meta (self, i);
						page = _tmp2_;
						_tmp3_ = page;
						if (_tmp3_->user_slide == number) {
							result = i;
							_pdfpc_metadata_page_meta_unref0 (page);
							return result;
						}
						_pdfpc_metadata_page_meta_unref0 (page);
					}
				}
			}
		} else {
			{
				gint i = 0;
				i = 0;
				{
					gboolean _tmp4_ = FALSE;
					_tmp4_ = TRUE;
					while (TRUE) {
						pdfpcMetadataPageMeta* page = NULL;
						pdfpcMetadataPageMeta* _tmp6_;
						pdfpcMetadataPageMeta* _tmp7_;
						if (!_tmp4_) {
							gint _tmp5_;
							_tmp5_ = i;
							i = _tmp5_ + 1;
						}
						_tmp4_ = FALSE;
						if (!(((guint) i) < self->page_count)) {
							break;
						}
						_tmp6_ = pdfpc_metadata_pdf_get_page_meta (self, i);
						page = _tmp6_;
						_tmp7_ = page;
						if (_tmp7_->user_slide == number) {
							result = i;
							_pdfpc_metadata_page_meta_unref0 (page);
							return result;
						}
						_pdfpc_metadata_page_meta_unref0 (page);
					}
				}
			}
		}
	}
	result = -1;
	return result;
}

/**
         * The user slide corresponding to a real slide.
         *
         * If number is larger than the number of real slides return the
         * last user slide.
         */
gint
pdfpc_metadata_pdf_real_slide_to_user_slide (pdfpcMetadataPdf* self,
                                             gint number)
{
	gboolean _tmp0_ = FALSE;
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	if (self->page_count == ((guint) 0)) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = number < 0;
	}
	if (_tmp0_) {
		result = -1;
		return result;
	} else {
		if (((guint) number) >= self->page_count) {
			result = pdfpc_metadata_pdf_get_user_slide_count (self) - 1;
			return result;
		} else {
			pdfpcMetadataPageMeta* page = NULL;
			pdfpcMetadataPageMeta* _tmp1_;
			pdfpcMetadataPageMeta* _tmp2_;
			_tmp1_ = pdfpc_metadata_pdf_get_page_meta (self, number);
			page = _tmp1_;
			_tmp2_ = page;
			result = _tmp2_->user_slide;
			_pdfpc_metadata_page_meta_unref0 (page);
			return result;
		}
	}
}

/**
         * Check whether the given slide is the full user slide (i.e., the
         * last slide within an overlay)
         */
gboolean
pdfpc_metadata_pdf_is_user_slide (pdfpcMetadataPdf* self,
                                  gint number)
{
	gint user_slide = 0;
	gint last_slide = 0;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	user_slide = pdfpc_metadata_pdf_real_slide_to_user_slide (self, number);
	last_slide = pdfpc_metadata_pdf_user_slide_to_real_slide (self, user_slide, TRUE);
	result = number == last_slide;
	return result;
}

/**
         * Get the overlay index of the given slide
         */
gint
pdfpc_metadata_pdf_slide_get_overlay (pdfpcMetadataPdf* self,
                                      gint number)
{
	gint user_slide = 0;
	gint first_slide = 0;
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	user_slide = pdfpc_metadata_pdf_real_slide_to_user_slide (self, number);
	first_slide = pdfpc_metadata_pdf_user_slide_to_real_slide (self, user_slide, FALSE);
	result = number - first_slide;
	return result;
}

/**
         * Return the next slide in the overlay (or -1 if doesn't exist),
         * but skipping over slides with automatic advancing
         */
gint
pdfpc_metadata_pdf_next_in_overlay (pdfpcMetadataPdf* self,
                                    gint slide_number)
{
	gboolean _tmp0_ = FALSE;
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	if (slide_number < 0) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = ((guint) slide_number) >= (pdfpc_metadata_pdf_get_slide_count (self) - 1);
	}
	if (_tmp0_) {
		result = -1;
		return result;
	} else {
		gint next_slide_number = 0;
		next_slide_number = slide_number + 1;
		while (TRUE) {
			gint _tmp1_;
			if (!(pdfpc_metadata_pdf_real_slide_to_user_slide (self, slide_number) == pdfpc_metadata_pdf_real_slide_to_user_slide (self, next_slide_number))) {
				break;
			}
			if (pdfpc_metadata_pdf_get_slide_duration (self, next_slide_number) <= ((gdouble) 0)) {
				result = next_slide_number;
				return result;
			}
			_tmp1_ = next_slide_number;
			next_slide_number = _tmp1_ + 1;
		}
		result = -1;
		return result;
	}
}

/**
         * Return the previous slide in the overlay (or -1 if doesn't exist),
         * but skipping over slides with automatic advancing
         */
gint
pdfpc_metadata_pdf_prev_in_overlay (pdfpcMetadataPdf* self,
                                    gint slide_number)
{
	gboolean _tmp0_ = FALSE;
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	if (slide_number < 1) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = ((guint) slide_number) >= pdfpc_metadata_pdf_get_slide_count (self);
	}
	if (_tmp0_) {
		result = -1;
		return result;
	} else {
		gint prev_slide_number = 0;
		prev_slide_number = slide_number - 1;
		while (TRUE) {
			gint _tmp1_;
			if (!(pdfpc_metadata_pdf_real_slide_to_user_slide (self, slide_number) == pdfpc_metadata_pdf_real_slide_to_user_slide (self, prev_slide_number))) {
				break;
			}
			if (pdfpc_metadata_pdf_get_slide_duration (self, prev_slide_number) <= ((gdouble) 0)) {
				result = prev_slide_number;
				return result;
			}
			_tmp1_ = prev_slide_number;
			prev_slide_number = _tmp1_ - 1;
		}
		result = -1;
		return result;
	}
}

/**
         * Return the width of the first page of the loaded pdf document.
         *
         * If slides also contain notes, return the width of the content part only
         *
         * In presentations all pages will have the same size in most cases,
         * therefore this value is assumed to be useful.
         */
gdouble
pdfpc_metadata_pdf_get_page_width (pdfpcMetadataPdf* self)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, 0.0);
	result = pdfpc_metadata_pdf_get_corrected_page_width (self, self->original_page_width);
	return result;
}

/**
         * Fixes the page width if pdfpc uses notes in split mode
         */
gdouble
pdfpc_metadata_pdf_get_corrected_page_width (pdfpcMetadataPdf* self,
                                             gdouble page_width)
{
	gboolean _tmp0_ = FALSE;
	gdouble result;
	g_return_val_if_fail (self != NULL, 0.0);
	if (self->notes_position == PDFPC_METADATA_NOTES_POSITION_LEFT) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = self->notes_position == PDFPC_METADATA_NOTES_POSITION_RIGHT;
	}
	if (_tmp0_) {
		result = page_width / 2;
		return result;
	} else {
		result = page_width;
		return result;
	}
}

/**
         * Return the height of the first page of the loaded pdf document.
         *
         * If slides also contain notes, return the height of the content part only
         *
         * In presentations all pages will have the same size in most cases,
         * therefore this value is assumed to be useful.
         */
gdouble
pdfpc_metadata_pdf_get_page_height (pdfpcMetadataPdf* self)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, 0.0);
	result = pdfpc_metadata_pdf_get_corrected_page_height (self, self->original_page_height);
	return result;
}

/**
         * Fixes the page height if pdfpc uses notes in split mode
         */
gdouble
pdfpc_metadata_pdf_get_corrected_page_height (pdfpcMetadataPdf* self,
                                              gdouble page_height)
{
	gboolean _tmp0_ = FALSE;
	gdouble result;
	g_return_val_if_fail (self != NULL, 0.0);
	if (self->notes_position == PDFPC_METADATA_NOTES_POSITION_TOP) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = self->notes_position == PDFPC_METADATA_NOTES_POSITION_BOTTOM;
	}
	if (_tmp0_) {
		result = page_height / 2;
		return result;
	} else {
		result = page_height;
		return result;
	}
}

/**
         * Return the horizontal offset of the given area on the page
         */
gdouble
pdfpc_metadata_pdf_get_horizontal_offset (pdfpcMetadataPdf* self,
                                          gboolean notes_area,
                                          gdouble page_width)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, 0.0);
	if (page_width == ((gdouble) 0)) {
		page_width = self->original_page_width;
	}
	if (notes_area) {
		switch (self->notes_position) {
			case PDFPC_METADATA_NOTES_POSITION_RIGHT:
			{
				result = page_width / 2;
				return result;
			}
			default:
			{
				result = (gdouble) 0;
				return result;
			}
		}
	} else {
		switch (self->notes_position) {
			case PDFPC_METADATA_NOTES_POSITION_LEFT:
			{
				result = page_width / 2;
				return result;
			}
			default:
			{
				result = (gdouble) 0;
				return result;
			}
		}
	}
}

/**
         * Return the vertical offset of the given area on the page
         */
gdouble
pdfpc_metadata_pdf_get_vertical_offset (pdfpcMetadataPdf* self,
                                        gboolean notes_area,
                                        gdouble page_height)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, 0.0);
	if (page_height == ((gdouble) 0)) {
		page_height = self->original_page_height;
	}
	if (notes_area) {
		switch (self->notes_position) {
			case PDFPC_METADATA_NOTES_POSITION_BOTTOM:
			{
				result = page_height / 2;
				return result;
			}
			default:
			{
				result = (gdouble) 0;
				return result;
			}
		}
	} else {
		switch (self->notes_position) {
			case PDFPC_METADATA_NOTES_POSITION_TOP:
			{
				result = page_height / 2;
				return result;
			}
			default:
			{
				result = (gdouble) 0;
				return result;
			}
		}
	}
}

/**
         * Return the PDF title
         */
gchar*
pdfpc_metadata_pdf_get_title (pdfpcMetadataPdf* self)
{
	PopplerDocument* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_document;
	if (_tmp0_ != NULL) {
		PopplerDocument* _tmp1_;
		gchar* _tmp2_;
		_tmp1_ = self->priv->_document;
		_tmp2_ = poppler_document_get_title (_tmp1_);
		result = _tmp2_;
		return result;
	} else {
		gchar* _tmp3_;
		_tmp3_ = g_strdup ("");
		result = _tmp3_;
		return result;
	}
}

/**
         * Get/set the duration of the presentation
         */
guint
pdfpc_metadata_pdf_get_duration (pdfpcMetadataPdf* self)
{
	guint result;
	g_return_val_if_fail (self != NULL, 0U);
	result = self->duration;
	return result;
}

void
pdfpc_metadata_pdf_set_duration (pdfpcMetadataPdf* self,
                                 guint d)
{
	g_return_if_fail (self != NULL);
	if (self->duration != d) {
		self->duration = d;
		self->priv->dirty_state = TRUE;
	}
}

/**
         * Open a given pdf document url and return a Poppler.Document for it.
         */
PopplerDocument*
pdfpc_metadata_pdf_open_pdf_document (pdfpcMetadataPdf* self,
                                      const gchar* fname)
{
	gchar* uri = NULL;
	GFile* _tmp0_;
	GFile* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	PopplerDocument* document = NULL;
	GError* _inner_error0_ = NULL;
	PopplerDocument* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (fname != NULL, NULL);
	_tmp0_ = g_file_new_for_commandline_arg (fname);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_file_get_uri (_tmp1_);
	_tmp3_ = _tmp2_;
	_g_object_unref0 (_tmp1_);
	uri = _tmp3_;
	document = NULL;
	{
		PopplerDocument* _tmp4_ = NULL;
		PopplerDocument* _tmp5_;
		PopplerDocument* _tmp6_;
		_tmp5_ = poppler_document_new_from_file (uri, NULL, &_inner_error0_);
		_tmp4_ = _tmp5_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp6_ = _tmp4_;
		_tmp4_ = NULL;
		_g_object_unref0 (document);
		document = _tmp6_;
		_g_object_unref0 (_tmp4_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		const gchar* _tmp7_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp7_ = e->message;
		g_printerr ("Unable to open pdf file \"%s\": %s\n", fname, _tmp7_);
		exit (1);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_object_unref0 (document);
		_g_free0 (uri);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
	result = document;
	_g_free0 (uri);
	return result;
}

/**
         * Return the action mappings (link and annotation mappings) for the
         * specified page.  If that page is different from the previous one,
         * destroy the existing action mappings and create new mappings for
         * the new page.
         */
static void
_vala_PopplerLinkMapping_free (PopplerLinkMapping* self)
{
	g_boxed_free (poppler_link_mapping_get_type (), self);
}

static void
__vala_PopplerLinkMapping_free0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (_vala_PopplerLinkMapping_free (var), NULL));
}

static inline void
_g_list_free___vala_PopplerLinkMapping_free0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) __vala_PopplerLinkMapping_free0_);
}

GeeList*
pdfpc_metadata_pdf_get_action_mapping (pdfpcMetadataPdf* self,
                                       gint page_num)
{
	GeeList* _tmp26_;
	GeeList* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (page_num != self->priv->mapping_page_num) {
		PopplerPage* page = NULL;
		PopplerDocument* _tmp0_;
		PopplerPage* _tmp1_;
		GList* link_mappings = NULL;
		PopplerPage* _tmp2_;
		GList* _tmp3_;
		GList* _tmp4_;
		GList* annot_mappings = NULL;
		PopplerPage* _tmp14_;
		GList* _tmp15_;
		GList* _tmp16_;
		pdfpc_metadata_pdf_deactivate_mappings (self);
		_tmp0_ = self->priv->_document;
		_tmp1_ = poppler_document_get_page (_tmp0_, page_num);
		page = _tmp1_;
		_tmp2_ = page;
		_tmp3_ = poppler_page_get_link_mapping (_tmp2_);
		link_mappings = _tmp3_;
		_tmp4_ = link_mappings;
		{
			GList* mapping_collection = NULL;
			GList* mapping_it = NULL;
			mapping_collection = _tmp4_;
			for (mapping_it = mapping_collection; mapping_it != NULL; mapping_it = mapping_it->next) {
				PopplerLinkMapping* mapping = NULL;
				mapping = (PopplerLinkMapping*) mapping_it->data;
				{
					pdfpcActionMapping** _tmp5_;
					gint _tmp5__length1;
					_tmp5_ = self->priv->blanks;
					_tmp5__length1 = self->priv->blanks_length1;
					{
						pdfpcActionMapping** blank_collection = NULL;
						gint blank_collection_length1 = 0;
						gint _blank_collection_size_ = 0;
						gint blank_it = 0;
						blank_collection = _tmp5_;
						blank_collection_length1 = _tmp5__length1;
						for (blank_it = 0; blank_it < blank_collection_length1; blank_it = blank_it + 1) {
							pdfpcActionMapping* _tmp6_;
							pdfpcActionMapping* blank = NULL;
							_tmp6_ = _g_object_ref0 (blank_collection[blank_it]);
							blank = _tmp6_;
							{
								pdfpcActionMapping* action = NULL;
								pdfpcActionMapping* _tmp7_;
								PopplerLinkMapping* _tmp8_;
								pdfpcPresentationController* _tmp9_;
								pdfpcActionMapping* _tmp10_;
								pdfpcActionMapping* _tmp11_;
								_tmp7_ = blank;
								_tmp8_ = mapping;
								_tmp9_ = self->controller;
								_tmp10_ = pdfpc_action_mapping_new_from_link_mapping (_tmp7_, _tmp8_, _tmp9_);
								action = _tmp10_;
								_tmp11_ = action;
								if (_tmp11_ != NULL) {
									GeeList* _tmp12_;
									pdfpcActionMapping* _tmp13_;
									_tmp12_ = self->priv->action_mapping;
									_tmp13_ = action;
									gee_collection_add ((GeeCollection*) _tmp12_, _tmp13_);
									_g_object_unref0 (action);
									_g_object_unref0 (blank);
									break;
								}
								_g_object_unref0 (action);
								_g_object_unref0 (blank);
							}
						}
					}
				}
			}
		}
		_tmp14_ = page;
		_tmp15_ = poppler_page_get_annot_mapping (_tmp14_);
		annot_mappings = _tmp15_;
		_tmp16_ = annot_mappings;
		{
			GList* mapping_collection = NULL;
			GList* mapping_it = NULL;
			mapping_collection = _tmp16_;
			for (mapping_it = mapping_collection; mapping_it != NULL; mapping_it = mapping_it->next) {
				PopplerAnnotMapping* mapping = NULL;
				mapping = (PopplerAnnotMapping*) mapping_it->data;
				{
					pdfpcActionMapping** _tmp17_;
					gint _tmp17__length1;
					_tmp17_ = self->priv->blanks;
					_tmp17__length1 = self->priv->blanks_length1;
					{
						pdfpcActionMapping** blank_collection = NULL;
						gint blank_collection_length1 = 0;
						gint _blank_collection_size_ = 0;
						gint blank_it = 0;
						blank_collection = _tmp17_;
						blank_collection_length1 = _tmp17__length1;
						for (blank_it = 0; blank_it < blank_collection_length1; blank_it = blank_it + 1) {
							pdfpcActionMapping* _tmp18_;
							pdfpcActionMapping* blank = NULL;
							_tmp18_ = _g_object_ref0 (blank_collection[blank_it]);
							blank = _tmp18_;
							{
								pdfpcActionMapping* action = NULL;
								pdfpcActionMapping* _tmp19_;
								PopplerAnnotMapping* _tmp20_;
								pdfpcPresentationController* _tmp21_;
								pdfpcActionMapping* _tmp22_;
								pdfpcActionMapping* _tmp23_;
								_tmp19_ = blank;
								_tmp20_ = mapping;
								_tmp21_ = self->controller;
								_tmp22_ = pdfpc_action_mapping_new_from_annot_mapping (_tmp19_, _tmp20_, _tmp21_);
								action = _tmp22_;
								_tmp23_ = action;
								if (_tmp23_ != NULL) {
									GeeList* _tmp24_;
									pdfpcActionMapping* _tmp25_;
									_tmp24_ = self->priv->action_mapping;
									_tmp25_ = action;
									gee_collection_add ((GeeCollection*) _tmp24_, _tmp25_);
									_g_object_unref0 (action);
									_g_object_unref0 (blank);
									break;
								}
								_g_object_unref0 (action);
								_g_object_unref0 (blank);
							}
						}
					}
				}
			}
		}
		self->priv->mapping_page_num = page_num;
		(annot_mappings == NULL) ? NULL : (annot_mappings = (_g_list_free___vala_PopplerAnnotMapping_free0_ (annot_mappings), NULL));
		(link_mappings == NULL) ? NULL : (link_mappings = (_g_list_free___vala_PopplerLinkMapping_free0_ (link_mappings), NULL));
		_g_object_unref0 (page);
	}
	_tmp26_ = self->priv->action_mapping;
	result = _tmp26_;
	return result;
}

/**
         * Return slide number corresponding to a named destination
         */
static void
_vala_PopplerDest_free (PopplerDest* self)
{
	g_boxed_free (poppler_dest_get_type (), self);
}

gint
pdfpc_metadata_pdf_find_dest (pdfpcMetadataPdf* self,
                              PopplerDest* dest)
{
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	g_return_val_if_fail (dest != NULL, 0);
	if (dest->type == POPPLER_DEST_NAMED) {
		PopplerDest* found_dest = NULL;
		PopplerDocument* _tmp0_;
		const gchar* _tmp1_;
		PopplerDest* _tmp2_;
		PopplerDest* _tmp3_;
		_tmp0_ = self->priv->_document;
		_tmp1_ = dest->named_dest;
		_tmp2_ = poppler_document_find_dest (_tmp0_, _tmp1_);
		found_dest = _tmp2_;
		_tmp3_ = found_dest;
		if (_tmp3_ != NULL) {
			PopplerDest* _tmp4_;
			_tmp4_ = found_dest;
			result = _tmp4_->page_num - 1;
			__vala_PopplerDest_free0 (found_dest);
			return result;
		}
		__vala_PopplerDest_free0 (found_dest);
	}
	result = -1;
	return result;
}

pdfpcRendererPdf*
pdfpc_metadata_pdf_get_renderer (pdfpcMetadataPdf* self)
{
	pdfpcRendererPdf* result;
	pdfpcRendererPdf* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_renderer;
	result = _tmp0_;
	return result;
}

void
pdfpc_metadata_pdf_set_renderer (pdfpcMetadataPdf* self,
                                 pdfpcRendererPdf* value)
{
	pdfpcRendererPdf* old_value;
	g_return_if_fail (self != NULL);
	old_value = pdfpc_metadata_pdf_get_renderer (self);
	if (old_value != value) {
		pdfpcRendererPdf* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_renderer);
		self->priv->_renderer = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, pdfpc_metadata_pdf_properties[PDFPC_METADATA_PDF_RENDERER_PROPERTY]);
	}
}

const gchar*
pdfpc_metadata_pdf_get_pdf_fname (pdfpcMetadataPdf* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_pdf_fname;
	result = _tmp0_;
	return result;
}

void
pdfpc_metadata_pdf_set_pdf_fname (pdfpcMetadataPdf* self,
                                  const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = pdfpc_metadata_pdf_get_pdf_fname (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_pdf_fname);
		self->priv->_pdf_fname = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, pdfpc_metadata_pdf_properties[PDFPC_METADATA_PDF_PDF_FNAME_PROPERTY]);
	}
}

PopplerDocument*
pdfpc_metadata_pdf_get_document (pdfpcMetadataPdf* self)
{
	PopplerDocument* result;
	PopplerDocument* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_document;
	result = _tmp0_;
	return result;
}

void
pdfpc_metadata_pdf_set_document (pdfpcMetadataPdf* self,
                                 PopplerDocument* value)
{
	PopplerDocument* old_value;
	g_return_if_fail (self != NULL);
	old_value = pdfpc_metadata_pdf_get_document (self);
	if (old_value != value) {
		PopplerDocument* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_document);
		self->priv->_document = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, pdfpc_metadata_pdf_properties[PDFPC_METADATA_PDF_DOCUMENT_PROPERTY]);
	}
}

PopplerPageTransition*
pdfpc_metadata_pdf_get_default_transition (pdfpcMetadataPdf* self)
{
	PopplerPageTransition* result;
	PopplerPageTransition* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_default_transition;
	result = _tmp0_;
	return result;
}

void
pdfpc_metadata_pdf_set_default_transition (pdfpcMetadataPdf* self,
                                           PopplerPageTransition* value)
{
	PopplerPageTransition* old_value;
	g_return_if_fail (self != NULL);
	old_value = pdfpc_metadata_pdf_get_default_transition (self);
	if (old_value != value) {
		PopplerPageTransition* _tmp0_;
		_tmp0_ = __vala_PopplerPageTransition_copy0 (value);
		__vala_PopplerPageTransition_free0 (self->priv->_default_transition);
		self->priv->_default_transition = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, pdfpc_metadata_pdf_properties[PDFPC_METADATA_PDF_DEFAULT_TRANSITION_PROPERTY]);
	}
}

gboolean
pdfpc_metadata_pdf_get_is_ready (pdfpcMetadataPdf* self)
{
	gboolean result;
	PopplerDocument* _tmp0_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_document;
	result = _tmp0_ != NULL;
	return result;
}

gboolean
pdfpc_metadata_pdf_get_has_beamer_notes (pdfpcMetadataPdf* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->notes_position != PDFPC_METADATA_NOTES_POSITION_NONE;
	return result;
}

static void
pdfpc_metadata_pdf_class_init (pdfpcMetadataPdfClass * klass,
                               gpointer klass_data)
{
	pdfpc_metadata_pdf_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &pdfpcMetadataPdf_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_pdfpc_metadata_pdf_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_pdfpc_metadata_pdf_set_property;
	G_OBJECT_CLASS (klass)->finalize = pdfpc_metadata_pdf_finalize;
	/**
	         * Renderer to be used for rendering the slides
	         */
	g_object_class_install_property (G_OBJECT_CLASS (klass), PDFPC_METADATA_PDF_RENDERER_PROPERTY, pdfpc_metadata_pdf_properties[PDFPC_METADATA_PDF_RENDERER_PROPERTY] = g_param_spec_object ("renderer", "renderer", "renderer", PDFPC_RENDERER_TYPE_PDF, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PDFPC_METADATA_PDF_PDF_FNAME_PROPERTY, pdfpc_metadata_pdf_properties[PDFPC_METADATA_PDF_PDF_FNAME_PROPERTY] = g_param_spec_string ("pdf-fname", "pdf-fname", "pdf-fname", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	/**
	         * Poppler document of the associated PDF file
	         */
	g_object_class_install_property (G_OBJECT_CLASS (klass), PDFPC_METADATA_PDF_DOCUMENT_PROPERTY, pdfpc_metadata_pdf_properties[PDFPC_METADATA_PDF_DOCUMENT_PROPERTY] = g_param_spec_object ("document", "document", "document", poppler_document_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	/**
	         * Default page transition
	         */
	g_object_class_install_property (G_OBJECT_CLASS (klass), PDFPC_METADATA_PDF_DEFAULT_TRANSITION_PROPERTY, pdfpc_metadata_pdf_properties[PDFPC_METADATA_PDF_DEFAULT_TRANSITION_PROPERTY] = g_param_spec_boxed ("default-transition", "default-transition", "default-transition", poppler_page_transition_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PDFPC_METADATA_PDF_IS_READY_PROPERTY, pdfpc_metadata_pdf_properties[PDFPC_METADATA_PDF_IS_READY_PROPERTY] = g_param_spec_boolean ("is-ready", "is-ready", "is-ready", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PDFPC_METADATA_PDF_HAS_BEAMER_NOTES_PROPERTY, pdfpc_metadata_pdf_properties[PDFPC_METADATA_PDF_HAS_BEAMER_NOTES_PROPERTY] = g_param_spec_boolean ("has-beamer-notes", "has-beamer-notes", "has-beamer-notes", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
pdfpc_metadata_pdf_instance_init (pdfpcMetadataPdf * self,
                                  gpointer klass)
{
	pdfpcControlledMovie* _tmp0_;
	pdfpcLinkAction* _tmp1_;
	pdfpcActionMapping** _tmp2_;
	self->priv = pdfpc_metadata_pdf_get_instance_private (self);
	self->controller = NULL;
	self->priv->_pdf_fname = NULL;
	self->pdfpc_fname = NULL;
	self->original_page_width = (gdouble) 0;
	self->original_page_height = (gdouble) 0;
	self->priv->mapping_page_num = -1;
	_tmp0_ = pdfpc_controlled_movie_new ();
	_tmp1_ = pdfpc_link_action_new ();
	_tmp2_ = g_new0 (pdfpcActionMapping*, 2 + 1);
	_tmp2_[0] = (pdfpcActionMapping*) _tmp0_;
	_tmp2_[1] = (pdfpcActionMapping*) _tmp1_;
	self->priv->blanks = _tmp2_;
	self->priv->blanks_length1 = 2;
	self->priv->_blanks_size_ = self->priv->blanks_length1;
	self->format_version = 2;
	self->priv->dirty_state = FALSE;
	self->notes_position = PDFPC_METADATA_NOTES_POSITION_NONE;
	self->disable_markdown = FALSE;
	self->priv->end_user_slide = -1;
	self->priv->last_saved_slide = -1;
	self->start_time = NULL;
	self->end_time = NULL;
	self->last_minutes = (guint) 5;
	self->font_size = 20;
}

static void
pdfpc_metadata_pdf_finalize (GObject * obj)
{
	pdfpcMetadataPdf * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PDFPC_METADATA_TYPE_PDF, pdfpcMetadataPdf);
	_g_object_unref0 (self->priv->_renderer);
	_g_free0 (self->priv->_pdf_fname);
	_g_free0 (self->pdfpc_fname);
	_g_object_unref0 (self->priv->_document);
	_g_object_unref0 (self->priv->action_mapping);
	self->priv->blanks = (_vala_array_free (self->priv->blanks, self->priv->blanks_length1, (GDestroyNotify) g_object_unref), NULL);
	_g_object_unref0 (self->priv->pages);
	_g_free0 (self->start_time);
	_g_free0 (self->end_time);
	__vala_PopplerPageTransition_free0 (self->priv->_default_transition);
	G_OBJECT_CLASS (pdfpc_metadata_pdf_parent_class)->finalize (obj);
}

/**
     * Metadata for PDF files
     */
static GType
pdfpc_metadata_pdf_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (pdfpcMetadataPdfClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) pdfpc_metadata_pdf_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (pdfpcMetadataPdf), 0, (GInstanceInitFunc) pdfpc_metadata_pdf_instance_init, NULL };
	GType pdfpc_metadata_pdf_type_id;
	pdfpc_metadata_pdf_type_id = g_type_register_static (G_TYPE_OBJECT, "pdfpcMetadataPdf", &g_define_type_info, 0);
	pdfpcMetadataPdf_private_offset = g_type_add_instance_private (pdfpc_metadata_pdf_type_id, sizeof (pdfpcMetadataPdfPrivate));
	return pdfpc_metadata_pdf_type_id;
}

GType
pdfpc_metadata_pdf_get_type (void)
{
	static volatile gsize pdfpc_metadata_pdf_type_id__once = 0;
	if (g_once_init_enter (&pdfpc_metadata_pdf_type_id__once)) {
		GType pdfpc_metadata_pdf_type_id;
		pdfpc_metadata_pdf_type_id = pdfpc_metadata_pdf_get_type_once ();
		g_once_init_leave (&pdfpc_metadata_pdf_type_id__once, pdfpc_metadata_pdf_type_id);
	}
	return pdfpc_metadata_pdf_type_id__once;
}

static void
_vala_pdfpc_metadata_pdf_get_property (GObject * object,
                                       guint property_id,
                                       GValue * value,
                                       GParamSpec * pspec)
{
	pdfpcMetadataPdf * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PDFPC_METADATA_TYPE_PDF, pdfpcMetadataPdf);
	switch (property_id) {
		case PDFPC_METADATA_PDF_RENDERER_PROPERTY:
		g_value_set_object (value, pdfpc_metadata_pdf_get_renderer (self));
		break;
		case PDFPC_METADATA_PDF_PDF_FNAME_PROPERTY:
		g_value_set_string (value, pdfpc_metadata_pdf_get_pdf_fname (self));
		break;
		case PDFPC_METADATA_PDF_DOCUMENT_PROPERTY:
		g_value_set_object (value, pdfpc_metadata_pdf_get_document (self));
		break;
		case PDFPC_METADATA_PDF_DEFAULT_TRANSITION_PROPERTY:
		g_value_set_boxed (value, pdfpc_metadata_pdf_get_default_transition (self));
		break;
		case PDFPC_METADATA_PDF_IS_READY_PROPERTY:
		g_value_set_boolean (value, pdfpc_metadata_pdf_get_is_ready (self));
		break;
		case PDFPC_METADATA_PDF_HAS_BEAMER_NOTES_PROPERTY:
		g_value_set_boolean (value, pdfpc_metadata_pdf_get_has_beamer_notes (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_pdfpc_metadata_pdf_set_property (GObject * object,
                                       guint property_id,
                                       const GValue * value,
                                       GParamSpec * pspec)
{
	pdfpcMetadataPdf * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PDFPC_METADATA_TYPE_PDF, pdfpcMetadataPdf);
	switch (property_id) {
		case PDFPC_METADATA_PDF_RENDERER_PROPERTY:
		pdfpc_metadata_pdf_set_renderer (self, g_value_get_object (value));
		break;
		case PDFPC_METADATA_PDF_PDF_FNAME_PROPERTY:
		pdfpc_metadata_pdf_set_pdf_fname (self, g_value_get_string (value));
		break;
		case PDFPC_METADATA_PDF_DOCUMENT_PROPERTY:
		pdfpc_metadata_pdf_set_document (self, g_value_get_object (value));
		break;
		case PDFPC_METADATA_PDF_DEFAULT_TRANSITION_PROPERTY:
		pdfpc_metadata_pdf_set_default_transition (self, g_value_get_boxed (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

/**
     * Indicates if a pdf has also notes on the pages (and there position)
     */
pdfpcMetadataNotesPosition
pdfpc_metadata_notes_position_from_string (const gchar* position)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	GQuark _tmp3_ = 0U;
	static GQuark _tmp2_label0 = 0;
	static GQuark _tmp2_label1 = 0;
	static GQuark _tmp2_label2 = 0;
	static GQuark _tmp2_label3 = 0;
	pdfpcMetadataNotesPosition result;
	if (position == NULL) {
		result = PDFPC_METADATA_NOTES_POSITION_NONE;
		return result;
	}
	_tmp0_ = g_utf8_strdown (position, (gssize) -1);
	_tmp1_ = _tmp0_;
	_tmp3_ = (NULL == _tmp1_) ? 0 : g_quark_from_string (_tmp1_);
	g_free (_tmp1_);
	if (_tmp3_ == ((0 != _tmp2_label0) ? _tmp2_label0 : (_tmp2_label0 = g_quark_from_static_string ("left")))) {
		switch (0) {
			default:
			{
				result = PDFPC_METADATA_NOTES_POSITION_LEFT;
				return result;
			}
		}
	} else if (_tmp3_ == ((0 != _tmp2_label1) ? _tmp2_label1 : (_tmp2_label1 = g_quark_from_static_string ("right")))) {
		switch (0) {
			default:
			{
				result = PDFPC_METADATA_NOTES_POSITION_RIGHT;
				return result;
			}
		}
	} else if (_tmp3_ == ((0 != _tmp2_label2) ? _tmp2_label2 : (_tmp2_label2 = g_quark_from_static_string ("top")))) {
		switch (0) {
			default:
			{
				result = PDFPC_METADATA_NOTES_POSITION_TOP;
				return result;
			}
		}
	} else if (_tmp3_ == ((0 != _tmp2_label3) ? _tmp2_label3 : (_tmp2_label3 = g_quark_from_static_string ("bottom")))) {
		switch (0) {
			default:
			{
				result = PDFPC_METADATA_NOTES_POSITION_BOTTOM;
				return result;
			}
		}
	} else {
		switch (0) {
			default:
			{
				result = PDFPC_METADATA_NOTES_POSITION_NONE;
				return result;
			}
		}
	}
}

gchar*
pdfpc_metadata_notes_position_to_string (pdfpcMetadataNotesPosition self)
{
	gchar* result;
	switch (self) {
		case PDFPC_METADATA_NOTES_POSITION_NONE:
		{
			gchar* _tmp0_;
			_tmp0_ = g_strdup ("NONE");
			result = _tmp0_;
			return result;
		}
		case PDFPC_METADATA_NOTES_POSITION_TOP:
		{
			gchar* _tmp1_;
			_tmp1_ = g_strdup ("TOP");
			result = _tmp1_;
			return result;
		}
		case PDFPC_METADATA_NOTES_POSITION_BOTTOM:
		{
			gchar* _tmp2_;
			_tmp2_ = g_strdup ("BOTTOM");
			result = _tmp2_;
			return result;
		}
		case PDFPC_METADATA_NOTES_POSITION_RIGHT:
		{
			gchar* _tmp3_;
			_tmp3_ = g_strdup ("RIGHT");
			result = _tmp3_;
			return result;
		}
		case PDFPC_METADATA_NOTES_POSITION_LEFT:
		{
			gchar* _tmp4_;
			_tmp4_ = g_strdup ("LEFT");
			result = _tmp4_;
			return result;
		}
		default:
		{
			g_assert_not_reached ();
		}
	}
}

static GType
pdfpc_metadata_notes_position_get_type_once (void)
{
	static const GEnumValue values[] = {{PDFPC_METADATA_NOTES_POSITION_NONE, "PDFPC_METADATA_NOTES_POSITION_NONE", "none"}, {PDFPC_METADATA_NOTES_POSITION_TOP, "PDFPC_METADATA_NOTES_POSITION_TOP", "top"}, {PDFPC_METADATA_NOTES_POSITION_BOTTOM, "PDFPC_METADATA_NOTES_POSITION_BOTTOM", "bottom"}, {PDFPC_METADATA_NOTES_POSITION_RIGHT, "PDFPC_METADATA_NOTES_POSITION_RIGHT", "right"}, {PDFPC_METADATA_NOTES_POSITION_LEFT, "PDFPC_METADATA_NOTES_POSITION_LEFT", "left"}, {0, NULL, NULL}};
	GType pdfpc_metadata_notes_position_type_id;
	pdfpc_metadata_notes_position_type_id = g_enum_register_static ("pdfpcMetadataNotesPosition", values);
	return pdfpc_metadata_notes_position_type_id;
}

GType
pdfpc_metadata_notes_position_get_type (void)
{
	static volatile gsize pdfpc_metadata_notes_position_type_id__once = 0;
	if (g_once_init_enter (&pdfpc_metadata_notes_position_type_id__once)) {
		GType pdfpc_metadata_notes_position_type_id;
		pdfpc_metadata_notes_position_type_id = pdfpc_metadata_notes_position_get_type_once ();
		g_once_init_leave (&pdfpc_metadata_notes_position_type_id__once, pdfpc_metadata_notes_position_type_id);
	}
	return pdfpc_metadata_notes_position_type_id__once;
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

static gssize
_vala_array_length (gpointer array)
{
	gssize length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}

