Commit 5a61eb75 authored by Marek Kasik's avatar Marek Kasik

glib: Use C struct for PopplerPageRange

Boxed type is not needed so use just common C struct.
Use G_GNUC_MALLOC attribute on
poppler_document_get_print_page_ranges().

poppler/poppler#290
parent 18afdb2e
......@@ -1662,7 +1662,7 @@ poppler_document_get_print_scaling (PopplerDocument *document)
*
* Returns: a #PopplerPrintDuplex that should be used when document is printed
*
* Since: 0.78
* Since: 0.80
**/
PopplerPrintDuplex
poppler_document_get_print_duplex (PopplerDocument *document)
......@@ -1706,7 +1706,7 @@ poppler_document_get_print_duplex (PopplerDocument *document)
*
* Returns: Number of copies
*
* Since: 0.78
* Since: 0.80
**/
gint
poppler_document_get_print_n_copies (PopplerDocument *document)
......@@ -1728,53 +1728,6 @@ poppler_document_get_print_n_copies (PopplerDocument *document)
return retval;
}
/* PopplerPageRange */
POPPLER_DEFINE_BOXED_TYPE (PopplerPageRange, poppler_page_range,
poppler_page_range_copy,
poppler_page_range_free)
/**
* poppler_page_range_new:
*
* Creates a new #PopplerPageRange
*
* Returns: a new #PopplerPageRange, use poppler_page_range_free() to free it
*/
PopplerPageRange *
poppler_page_range_new (void)
{
return g_slice_new0 (PopplerPageRange);
}
/**
* poppler_page_range_copy:
* @range: a #PopplerPageRange to copy
*
* Creates a copy of @range
*
* Returns: a new allocated copy of @range
*/
PopplerPageRange *
poppler_page_range_copy (PopplerPageRange *range)
{
g_return_val_if_fail (range != nullptr, NULL);
return g_slice_dup (PopplerPageRange, range);
}
/**
* poppler_page_range_free:
* @range: a #PopplerPageRange
*
* Frees the given #PopplerPageRange
*/
void
poppler_page_range_free (PopplerPageRange *range)
{
g_slice_free (PopplerPageRange, range);
}
/**
* poppler_document_get_print_page_ranges:
* @document: A #PopplerDocument
......@@ -1787,7 +1740,7 @@ poppler_page_range_free (PopplerPageRange *range)
* of #PopplerPageRanges or NULL. Free the array when
* it is no longer needed.
*
* Since: 0.78
* Since: 0.80
**/
PopplerPageRange *
poppler_document_get_print_page_ranges (PopplerDocument *document,
......@@ -2342,7 +2295,7 @@ poppler_document_class_init (PopplerDocumentClass *klass)
/**
* PopplerDocument:print-duplex:
*
* Since: 0.78
* Since: 0.80
*/
g_object_class_install_property (G_OBJECT_CLASS (klass),
PROP_PRINT_DUPLEX,
......@@ -2358,7 +2311,7 @@ poppler_document_class_init (PopplerDocumentClass *klass)
*
* Suggested number of copies to be printed for this document
*
* Since: 0.78
* Since: 0.80
*/
g_object_class_install_property (G_OBJECT_CLASS (klass),
PROP_PRINT_N_COPIES,
......
......@@ -161,7 +161,7 @@ typedef enum
*
* Duplex viewer preference
*
* Since: 0.78
* Since: 0.80
*/
typedef enum
{
......@@ -400,7 +400,7 @@ POPPLER_PUBLIC
gint poppler_document_get_print_n_copies (PopplerDocument *document);
POPPLER_PUBLIC
PopplerPageRange *poppler_document_get_print_page_ranges (PopplerDocument *document,
int *n_ranges);
int *n_ranges) G_GNUC_MALLOC;
/* Attachments */
POPPLER_PUBLIC
......@@ -531,25 +531,14 @@ void poppler_ps_file_free (PopplerPSFile *ps_file);
*
* A #PopplerPageRange is used to specify a range of pages.
*
* Since: 0.78
* Since: 0.80
*/
#define POPPLER_TYPE_PAGE_RANGE (poppler_page_range_get_type ())
struct _PopplerPageRange
{
gint start_page;
gint end_page;
};
POPPLER_PUBLIC
GType poppler_page_range_get_type (void) G_GNUC_CONST;
POPPLER_PUBLIC
PopplerPageRange *poppler_page_range_new ();
POPPLER_PUBLIC
PopplerPageRange *poppler_page_range_copy (PopplerPageRange *range);
POPPLER_PUBLIC
void poppler_page_range_free (PopplerPageRange *range);
G_END_DECLS
#endif /* __POPPLER_DOCUMENT_H__ */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment