glib/poppler-action.h | 113 ++++++++++++++++++++++++++++++++++++++++++++-- glib/poppler-attachment.h | 20 ++++++-- glib/poppler-document.cc | 29 ++++++----- glib/poppler-document.h | 2 glib/poppler-page.cc | 5 +- glib/poppler-page.h | 4 - 6 files changed, 150 insertions(+), 23 deletions(-)
New commits: commit e7fa274dd7c0bd5e66a3b68329d7d56541bb839b Author: Kyle Auble <kyle.au...@outlook.com> Date: Sat Nov 28 13:42:13 2020 -0500 glib: Add deprecation guards for compiler diff --git a/glib/poppler-attachment.h b/glib/poppler-attachment.h index 031c4840..40b7723b 100644 --- a/glib/poppler-attachment.h +++ b/glib/poppler-attachment.h @@ -49,7 +49,6 @@ G_BEGIN_DECLS */ typedef gboolean (*PopplerAttachmentSaveFunc)(const gchar *buf, gsize count, gpointer data, GError **error); -/* GTime is deprecated, but is part of our ABI here (see #715, #765). */ /** * PopplerAttachment: * @name: The filename. Deprecated in poppler 20.09.0. Use @@ -65,7 +64,6 @@ typedef gboolean (*PopplerAttachmentSaveFunc)(const gchar *buf, gsize count, gpo * @checksum: A 16-byte checksum of the file. Deprecated in poppler 20.09.0. Use * poppler_attachment_get_checksum() instead. */ -G_GNUC_BEGIN_IGNORE_DEPRECATIONS struct _PopplerAttachment { GObject parent; @@ -74,11 +72,15 @@ struct _PopplerAttachment gchar *name; gchar *description; gsize size; + + /* GTime is deprecated, but is part of our ABI here (see #715, #765). */ + G_GNUC_BEGIN_IGNORE_DEPRECATIONS GTime mtime; GTime ctime; + G_GNUC_END_IGNORE_DEPRECATIONS + GString *checksum; }; -G_GNUC_END_IGNORE_DEPRECATIONS /* This struct was never documented nor intended for external use, but * has technically been part of the API (see #33). */ @@ -93,7 +95,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS typedef struct _PopplerAttachmentClass { GObjectClass parent_class; -} PopplerAttachmentClass; +} PopplerAttachmentClass G_GNUC_DEPRECATED_FOR(PopplerAttachment); POPPLER_PUBLIC GType poppler_attachment_get_type(void) G_GNUC_CONST; diff --git a/glib/poppler-document.h b/glib/poppler-document.h index 5d19b52c..34d78d4c 100644 --- a/glib/poppler-document.h +++ b/glib/poppler-document.h @@ -293,7 +293,7 @@ GType poppler_document_get_type(void) G_GNUC_CONST; POPPLER_PUBLIC PopplerDocument *poppler_document_new_from_file(const char *uri, const char *password, GError **error); POPPLER_PUBLIC -PopplerDocument *poppler_document_new_from_data(char *data, int length, const char *password, GError **error); +PopplerDocument *poppler_document_new_from_data(char *data, int length, const char *password, GError **error) G_GNUC_DEPRECATED_FOR(poppler_document_new_from_bytes); POPPLER_PUBLIC PopplerDocument *poppler_document_new_from_bytes(GBytes *bytes, const char *password, GError **error); POPPLER_PUBLIC diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc index 35682d97..7e21c717 100644 --- a/glib/poppler-page.cc +++ b/glib/poppler-page.cc @@ -639,7 +639,10 @@ GList *poppler_page_get_selection_region(PopplerPage *page, gdouble scale, Poppl * * Frees @region * - * Deprecated: 0.16 + * Deprecated: 0.16: Use only to free deprecated regions created by + * poppler_page_get_selection_region(). Regions created by + * poppler_page_get_selected_region() should be freed with + * cairo_region_destroy() instead. */ void poppler_page_selection_region_free(GList *region) { diff --git a/glib/poppler-page.h b/glib/poppler-page.h index 56e9068d..95b0cf9c 100644 --- a/glib/poppler-page.h +++ b/glib/poppler-page.h @@ -72,9 +72,9 @@ char *poppler_page_get_selected_text(PopplerPage *page, PopplerSelectionStyle st POPPLER_PUBLIC cairo_region_t *poppler_page_get_selected_region(PopplerPage *page, gdouble scale, PopplerSelectionStyle style, PopplerRectangle *selection); POPPLER_PUBLIC -GList *poppler_page_get_selection_region(PopplerPage *page, gdouble scale, PopplerSelectionStyle style, PopplerRectangle *selection); +GList *poppler_page_get_selection_region(PopplerPage *page, gdouble scale, PopplerSelectionStyle style, PopplerRectangle *selection) G_GNUC_DEPRECATED_FOR(poppler_page_get_selected_region); POPPLER_PUBLIC -void poppler_page_selection_region_free(GList *region); +void poppler_page_selection_region_free(GList *region) G_GNUC_DEPRECATED_FOR(cairo_region_destroy); POPPLER_PUBLIC GList *poppler_page_get_link_mapping(PopplerPage *page); POPPLER_PUBLIC commit db52669444284b8ab00cbb12574496f489b2e093 Author: Kyle Auble <kyle.au...@outlook.com> Date: Wed Oct 28 00:49:42 2020 -0400 glib: Update more gtk-doc comments Expanding the note for poppler_document_new_from_data() fixes #550. Formally deprecating it also closes #100 as moot. diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc index d7e650be..bd26bc73 100644 --- a/glib/poppler-document.cc +++ b/glib/poppler-document.cc @@ -216,17 +216,21 @@ PopplerDocument *poppler_document_new_from_file(const char *uri, const char *pas * poppler_document_new_from_data: * @data: (array length=length) (element-type guint8): the pdf data * @length: the length of #data - * @password: (allow-none): password to unlock the file with, or %NULL - * @error: (allow-none): Return location for an error, or %NULL + * @password: (nullable): password to unlock the file with, or %NULL + * @error: (nullable): Return location for an error, or %NULL * * Creates a new #PopplerDocument. If %NULL is returned, then @error will be * set. Possible errors include those in the #POPPLER_ERROR and #G_FILE_ERROR * domains. * - * Note that @data must remain valid for as long as the returned document exists. - * Prefer using poppler_document_new_from_bytes(). + * Note that @data is not copied nor is a new reference to it created. + * It must remain valid and cannot be destroyed as long as the returned + * document exists. * * Return value: A newly created #PopplerDocument, or %NULL + * + * Deprecated: 0.82: This requires directly managing @length and @data. + * Use poppler_document_new_from_bytes() instead. **/ PopplerDocument *poppler_document_new_from_data(char *data, int length, const char *password, GError **error) { @@ -840,7 +844,7 @@ static void _poppler_dest_destroy_value(gpointer value) * poppler_document_create_dests_tree: * @document: A #PopplerDocument * - * Creates named destinations balanced binary tree in @document + * Creates a balanced binary tree of all named destinations in @document * * The tree key is strings in the form returned by * poppler_named_dest_to_bytestring() which constains a destination name. @@ -1088,10 +1092,11 @@ gchar *poppler_document_get_pdf_version_string(PopplerDocument *document) /** * poppler_document_get_pdf_version: * @document: A #PopplerDocument - * @major_version: (out) (allow-none): return location for the PDF major version number - * @minor_version: (out) (allow-none): return location for the PDF minor version number + * @major_version: (out) (nullable): return location for the PDF major version number + * @minor_version: (out) (nullable): return location for the PDF minor version number * - * Returns: the major and minor PDF version numbers + * Updates values referenced by @major_version & @minor_version with the + * major and minor PDF versions of @document. * * Since: 0.16 **/ @@ -1752,12 +1757,12 @@ gint poppler_document_get_print_n_copies(PopplerDocument *document) * @n_ranges: (out): return location for number of ranges * * Returns the suggested page ranges to print in the form of array - * of #PopplerPageRanges and number of ranges. - * NULL pointer means that the document does not specify page ranges + * of #PopplerPageRange<!-- -->s and number of ranges. + * %NULL pointer means that the document does not specify page ranges * for printing. * * Returns: (array length=n_ranges) (transfer full): an array - * of #PopplerPageRanges or NULL. Free the array when + * of #PopplerPageRange<!-- -->s or %NULL. Free the array when * it is no longer needed. * * Since: 0.80 @@ -1958,7 +1963,7 @@ gchar *poppler_document_get_metadata(PopplerDocument *document) /** * poppler_document_reset_form: * @document: A #PopplerDocument - * @fields: list of fields to reset + * @fields (element-type utf8) (nullable): list of fields to reset * @exclude_fields: whether to reset all fields except those in @fields * * Resets the form fields specified by fields if exclude_fields is FALSE. commit 4d3d3e31c8b1ae0a4169214a0e3f085a8f01f7a9 Author: Kyle Auble <kyle.au...@outlook.com> Date: Tue Oct 27 23:46:09 2020 -0400 glib: Deprecate unintentionally public class Fixes #33 by settling PopplerAttachmentClass (item 3). diff --git a/glib/poppler-attachment.h b/glib/poppler-attachment.h index 3837a750..031c4840 100644 --- a/glib/poppler-attachment.h +++ b/glib/poppler-attachment.h @@ -80,6 +80,16 @@ struct _PopplerAttachment }; G_GNUC_END_IGNORE_DEPRECATIONS +/* This struct was never documented nor intended for external use, but + * has technically been part of the API (see #33). */ +/** + * PopplerAttachmentClass: + * + * Provides a named wrapper for a single GObjectClass. + * + * Deprecated: 20.11: Use PopplerAttachment objects with the public + * poppler_attachment functions instead. + */ typedef struct _PopplerAttachmentClass { GObjectClass parent_class; commit 133fb388029ec6e124e74b3a4111da20abe9ce7e Author: Kyle Auble <kyle.au...@outlook.com> Date: Tue Oct 27 22:51:59 2020 -0400 glib: Document a recently added struct diff --git a/glib/poppler-action.h b/glib/poppler-action.h index 52a5d90d..b4ea01e5 100644 --- a/glib/poppler-action.h +++ b/glib/poppler-action.h @@ -346,7 +346,7 @@ struct _PopplerActionRendition * PopplerActionOCGState: * @type: action type (%POPPLER_ACTION_OCG_STATE) * @title: action title - * @state_list: (element-type PopplerActionLayer): list of #PopplerActionLayer<-- -->s + * @state_list: (element-type PopplerActionLayer): list of #PopplerActionLayer<!-- -->s * * State of layer. * @@ -378,6 +378,22 @@ struct _PopplerActionJavascript gchar *script; }; +/** + * PopplerActionResetForm: + * @type: action type (%POPPLER_ACTION_RESET_FORM) + * @title: action title + * @fields: (element-type utf8) (nullable): list of field names to + * reset / retain + * @exclude: whether to reset all but the listed fields + * + * Resets some or all fields within a PDF form. + * + * The default behavior resets only the list of @fields, but setting + * @exclude to %TRUE will cause the action to reset all fields but those + * listed. Providing an empty list of fields resets the entire form. + * + * Since: 0.90 + */ struct _PopplerActionResetForm { PopplerActionType type; @@ -390,7 +406,7 @@ struct _PopplerActionResetForm /** * PopplerAction: * - * A data structure for holding actions + * A generic wrapper for actions that exposes only #PopplerActionType. */ union _PopplerAction { PopplerActionType type; commit f58525e501684358a377b6412ea514a2ed8af333 Author: Evan Nemerson <e...@coeus-group.com> Date: Thu Feb 14 03:55:01 2013 -0800 glib: add documentation for PopplerActions Resolves most of #33 (items 1 & 2) Signed-off-by: Kyle Auble <kyle.au...@outlook.com> diff --git a/glib/poppler-action.h b/glib/poppler-action.h index 03aae084..52a5d90d 100644 --- a/glib/poppler-action.h +++ b/glib/poppler-action.h @@ -30,7 +30,7 @@ G_BEGIN_DECLS * @POPPLER_ACTION_NONE: no action specified * @POPPLER_ACTION_GOTO_DEST: go to destination * @POPPLER_ACTION_GOTO_REMOTE: go to destination in another document - * @POPPLER_ACTION_LAUNCH: launch app (or open document + * @POPPLER_ACTION_LAUNCH: launch app (or open document) * @POPPLER_ACTION_URI: URI * @POPPLER_ACTION_NAMED: predefined action * @POPPLER_ACTION_MOVIE: play movies. Since 0.14 @@ -195,7 +195,7 @@ struct _PopplerDest /** * PopplerActionLayer: * @action: a #PopplerActionLayerAction - * @layers: list of #PopplerLayer<!-- -->s + * @layers: (element-type PopplerLayer): list of #PopplerLayer<!-- -->s * * Action to perform over a list of layers */ @@ -205,12 +205,27 @@ struct _PopplerActionLayer GList *layers; }; +/** + * PopplerActionAny: + * @type: action type + * @title: action title + * + * Fields common to all #PopplerAction<!-- -->s + */ struct _PopplerActionAny { PopplerActionType type; gchar *title; }; +/** + * PopplerActionGotoDest: + * @type: action type (%POPPLER_ACTION_GOTO_DEST) + * @title: action title + * @dest: destination + * + * Go to destination + */ struct _PopplerActionGotoDest { PopplerActionType type; @@ -219,6 +234,15 @@ struct _PopplerActionGotoDest PopplerDest *dest; }; +/** + * PopplerActionGotoRemote: + * @type: action type (%POPPLER_ACTION_GOTO_REMOTE) + * @title: action title + * @file_name: file name + * @dest: destination + * + * Go to destination in another document + */ struct _PopplerActionGotoRemote { PopplerActionType type; @@ -228,6 +252,15 @@ struct _PopplerActionGotoRemote PopplerDest *dest; }; +/** + * PopplerActionLaunch: + * @type: action type (%POPPLER_ACTION_LAUNCH) + * @title: action title + * @file_name: file name + * @params: parameters + * + * Launch app (or open document) + */ struct _PopplerActionLaunch { PopplerActionType type; @@ -237,6 +270,14 @@ struct _PopplerActionLaunch gchar *params; }; +/** + * PopplerActionUri: + * @type: action type (%POPPLER_ACTION_URI) + * @title: action title + * @uri: URI + * + * URI + */ struct _PopplerActionUri { PopplerActionType type; @@ -245,6 +286,14 @@ struct _PopplerActionUri char *uri; }; +/** + * PopplerActionNamed: + * @type: action type (%POPPLER_ACTION_NAMED) + * @title: action title + * @named_dest: named destination + * + * Predefined action + */ struct _PopplerActionNamed { PopplerActionType type; @@ -253,6 +302,17 @@ struct _PopplerActionNamed gchar *named_dest; }; +/** + * PopplerActionMovie: + * @type: action type (%POPPLER_ACTION_MOVIE) + * @title: action title + * @operation: operation + * @movie: movie + * + * Play movies. + * + * Since: 0.14 + */ struct _PopplerActionMovie { PopplerActionType type; @@ -262,6 +322,17 @@ struct _PopplerActionMovie PopplerMovie *movie; }; +/** + * PopplerActionRendition: + * @type: action type (%POPPLER_ACTION_RENDITION) + * @title: action title + * @op: operation + * @media: media + * + * Play multimedia content. + * + * Since: 0.14 + */ struct _PopplerActionRendition { PopplerActionType type; @@ -271,6 +342,16 @@ struct _PopplerActionRendition PopplerMedia *media; }; +/** + * PopplerActionOCGState: + * @type: action type (%POPPLER_ACTION_OCG_STATE) + * @title: action title + * @state_list: (element-type PopplerActionLayer): list of #PopplerActionLayer<-- -->s + * + * State of layer. + * + * Since: 0.14 + */ struct _PopplerActionOCGState { PopplerActionType type; @@ -279,6 +360,16 @@ struct _PopplerActionOCGState GList *state_list; }; +/** + * PopplerActionJavascript: + * @type: action type (%POPPLER_ACTION_JAVASCRIPT) + * @title: action title + * @script: javascript + * + * Javascript. + * + * Since: 0.18 + */ struct _PopplerActionJavascript { PopplerActionType type; _______________________________________________ poppler mailing list poppler@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/poppler