[poppler] poppler/glib: poppler-document.cc, 1.35, 1.36 poppler-document.h, 1.19, 1.20 poppler-private.h, 1.15, 1.16

Kristian Høgsberg krh at kemper.freedesktop.org
Fri May 19 13:54:15 PDT 2006


Update of /cvs/poppler/poppler/glib
In directory kemper:/tmp/cvs-serv10310/glib

Modified Files:
	poppler-document.cc poppler-document.h poppler-private.h 
Log Message:
2006-05-19  Kristian Høgsberg  <krh at redhat.com>

	Patch from Kouhei Sutou (#6905).
	
	* glib/poppler-document.cc:
	* glib/poppler-document.h:
	* glib/poppler-private.h:
	* glib/reference/tmpl/poppler-private.sgml:
	* glib/reference/tmpl/poppler.sgml: Make PopplerPSOutput a proper
	glib object.



Index: poppler-document.cc
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler-document.cc,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- poppler-document.cc	19 May 2006 19:21:59 -0000	1.35
+++ poppler-document.cc	19 May 2006 20:54:13 -0000	1.36
@@ -1227,6 +1227,45 @@
 	g_free (font_info);
 }
 
+
+typedef struct _PopplerPSFileClass PopplerPSFileClass;
+struct _PopplerPSFileClass
+{
+        GObjectClass parent_class;
+};
+
+G_DEFINE_TYPE (PopplerPSFile, poppler_ps_file, G_TYPE_OBJECT);
+
+static void poppler_ps_file_finalize (GObject *object);
+
+
+static void
+poppler_ps_file_class_init (PopplerPSFileClass *klass)
+{
+        GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+        gobject_class->finalize = poppler_ps_file_finalize;
+}
+
+static void
+poppler_ps_file_init (PopplerPSFile *ps_file)
+{
+        ps_file->out = NULL;
+        ps_file->paper_width = -1;
+        ps_file->paper_height = -1;
+        ps_file->duplex = FALSE;
+}
+
+static void
+poppler_ps_file_finalize (GObject *object)
+{
+        PopplerPSFile *ps_file = POPPLER_PS_FILE (object);
+
+        delete ps_file->out;
+        g_object_unref (ps_file->document);
+        g_free (ps_file->filename);
+}
+
 /**
  * poppler_ps_file_new:
  * @document: a #PopplerDocument
@@ -1248,12 +1287,12 @@
 	g_return_val_if_fail (filename != NULL, NULL);
 	g_return_val_if_fail (n_pages > 0, NULL);
 
-	ps_file = g_new0 (PopplerPSFile, 1);
+        ps_file = (PopplerPSFile *) g_object_new (POPPLER_TYPE_PS_FILE, NULL);
 	ps_file->document = (PopplerDocument *) g_object_ref (document);
         ps_file->filename = g_strdup (filename);
         ps_file->first_page = first_page + 1;
         ps_file->last_page = first_page + 1 + n_pages - 1;
-        
+
 	return ps_file;
 }
 
@@ -1305,11 +1344,5 @@
 poppler_ps_file_free (PopplerPSFile *ps_file)
 {
 	g_return_if_fail (ps_file != NULL);
-
-	delete ps_file->out;
-	g_object_unref (ps_file->document);
-        g_free (ps_file->filename);
-	g_free (ps_file);
+        g_object_unref (ps_file);
 }
-
-

Index: poppler-document.h
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler-document.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- poppler-document.h	16 Apr 2006 22:59:44 -0000	1.19
+++ poppler-document.h	19 May 2006 20:54:13 -0000	1.20
@@ -137,6 +137,10 @@
 gboolean          poppler_fonts_iter_next          (PopplerFontsIter  *iter);
 
 /* Export to ps */
+#define POPPLER_TYPE_PS_FILE             (poppler_ps_file_get_type ())
+#define POPPLER_PS_FILE(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), POPPLER_TYPE_PS_FILE, PopplerPSFile))
+#define POPPLER_IS_PS_FILE(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), POPPLER_TYPE_PS_FILE))
+GType          poppler_ps_file_get_type       (void) G_GNUC_CONST;
 PopplerPSFile *poppler_ps_file_new            (PopplerDocument *document,
                                                const char      *filename,
                                                int              first_page,

Index: poppler-private.h
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler-private.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- poppler-private.h	16 Apr 2006 22:59:44 -0000	1.15
+++ poppler-private.h	19 May 2006 20:54:13 -0000	1.16
@@ -32,6 +32,8 @@
 
 struct _PopplerPSFile
 {
+  GObject parent_instance;
+
   PopplerDocument *document;
   PSOutputDev *out;
   char *filename;



More information about the poppler mailing list