Index: glib/poppler-document.cc =================================================================== RCS file: /cvs/poppler/poppler/glib/poppler-document.cc,v retrieving revision 1.34 diff -u -p -r1.34 poppler-document.cc --- glib/poppler-document.cc 16 Apr 2006 22:59:44 -0000 1.34 +++ glib/poppler-document.cc 14 May 2006 15:53:21 -0000 @@ -1163,6 +1163,42 @@ poppler_fonts_iter_new (GooList *items) return iter; } + +typedef struct _PopplerFontInfoClass PopplerFontInfoClass; +struct _PopplerFontInfoClass +{ + GObjectClass parent_class; +}; + +G_DEFINE_TYPE (PopplerFontInfo, poppler_font_info, G_TYPE_OBJECT); + +static void poppler_font_info_finalize (GObject *object); + + +static void +poppler_font_info_class_init (PopplerFontInfoClass *klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + + gobject_class->finalize = poppler_font_info_finalize; +} + +static void +poppler_font_info_init (PopplerFontInfo *font_info) +{ + font_info->document = NULL; + font_info->scanner = NULL; +} + +static void +poppler_font_info_finalize (GObject *object) +{ + PopplerFontInfo *font_info = POPPLER_FONT_INFO (object); + + delete font_info->scanner; + g_object_unref (font_info->document); +} + PopplerFontInfo * poppler_font_info_new (PopplerDocument *document) { @@ -1170,7 +1206,8 @@ poppler_font_info_new (PopplerDocument * g_return_val_if_fail (POPPLER_IS_DOCUMENT (document), NULL); - font_info = g_new0 (PopplerFontInfo, 1); + font_info = (PopplerFontInfo *) g_object_new (POPPLER_TYPE_FONT_INFO, + NULL); font_info->document = (PopplerDocument *) g_object_ref (document); font_info->scanner = new FontInfoScanner(document->doc); @@ -1200,15 +1237,6 @@ poppler_font_info_scan (PopplerFontInfo return (items != NULL); } -void -poppler_font_info_free (PopplerFontInfo *font_info) -{ - g_return_if_fail (font_info != NULL); - - delete font_info->scanner; - g_object_unref (font_info->document); - g_free (font_info); -} /** * poppler_ps_file_new: Index: glib/poppler-document.h =================================================================== RCS file: /cvs/poppler/poppler/glib/poppler-document.h,v retrieving revision 1.19 diff -u -p -r1.19 poppler-document.h --- glib/poppler-document.h 16 Apr 2006 22:59:44 -0000 1.19 +++ glib/poppler-document.h 14 May 2006 15:53:22 -0000 @@ -120,11 +120,15 @@ PopplerAction *poppler_index_iter_get gboolean poppler_index_iter_next (PopplerIndexIter *iter); /* Interface for getting the Fonts of a poppler_document */ +#define POPPLER_TYPE_FONT_INFO (poppler_font_info_get_type ()) +#define POPPLER_FONT_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), POPPLER_TYPE_FONT_INFO, PopplerFontInfo)) +#define POPPLER_IS_FONT_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), POPPLER_TYPE_FONT_INFO)) +GType poppler_font_info_get_type (void) G_GNUC_CONST; PopplerFontInfo *poppler_font_info_new (PopplerDocument *document); gboolean poppler_font_info_scan (PopplerFontInfo *font_info, int n_pages, PopplerFontsIter **iter); -void poppler_font_info_free (PopplerFontInfo *font_info); + GType poppler_fonts_iter_get_type (void) G_GNUC_CONST; PopplerFontsIter *poppler_fonts_iter_copy (PopplerFontsIter *iter); Index: glib/test-poppler-glib.c =================================================================== RCS file: /cvs/poppler/poppler/glib/test-poppler-glib.c,v retrieving revision 1.18 diff -u -p -r1.18 test-poppler-glib.c --- glib/test-poppler-glib.c 28 Feb 2006 18:25:00 -0000 1.18 +++ glib/test-poppler-glib.c 14 May 2006 15:53:22 -0000 @@ -85,7 +85,7 @@ print_document_info (PopplerDocument *do poppler_fonts_iter_free (fonts_iter); } } - poppler_font_info_free (font_info); + g_object_unref (font_info); index_iter = poppler_index_iter_new (document); if (index_iter)