summaryrefslogtreecommitdiff
path: root/glib/poppler-attachment.cc
diff options
context:
space:
mode:
authorCarlos Garcia Campos <carlosgc@gnome.org>2011-05-07 12:55:34 +0200
committerCarlos Garcia Campos <carlosgc@gnome.org>2011-05-27 15:12:56 +0200
commit04dfb2c984b3c9949466e2b70e26b58029c5a7d3 (patch)
treee60f57a13ad2503b24876bc8f5d8f7e3b2319606 /glib/poppler-attachment.cc
parent74f9befddd4b5848c4af0c1b2848a1322f8cd0a2 (diff)
Make FileSpec a class and move EmbFile from Catalog to FileSpec
Qt and cpp frontends adapted by Pino Toscano
Diffstat (limited to 'glib/poppler-attachment.cc')
-rw-r--r--glib/poppler-attachment.cc33
1 files changed, 19 insertions, 14 deletions
diff --git a/glib/poppler-attachment.cc b/glib/poppler-attachment.cc
index 1218b9bd..d07f1ab7 100644
--- a/glib/poppler-attachment.cc
+++ b/glib/poppler-attachment.cc
@@ -100,32 +100,37 @@ poppler_attachment_finalize (GObject *obj)
/* Public functions */
PopplerAttachment *
-_poppler_attachment_new (EmbFile *emb_file)
+_poppler_attachment_new (FileSpec *emb_file)
{
PopplerAttachment *attachment;
PopplerAttachmentPrivate *priv;
+ EmbFile *embFile;
g_assert (emb_file != NULL);
attachment = (PopplerAttachment *) g_object_new (POPPLER_TYPE_ATTACHMENT, NULL);
priv = POPPLER_ATTACHMENT_GET_PRIVATE (attachment);
- if (emb_file->name ())
- attachment->name = _poppler_goo_string_to_utf8 (emb_file->name ());
- if (emb_file->description ())
- attachment->description = _poppler_goo_string_to_utf8 (emb_file->description ());
+ if (emb_file->getFileName ())
+ attachment->name = _poppler_goo_string_to_utf8 (emb_file->getFileName ());
+ if (emb_file->getDescription ())
+ attachment->description = _poppler_goo_string_to_utf8 (emb_file->getDescription ());
- attachment->size = emb_file->size ();
-
- _poppler_convert_pdf_date_to_gtime (emb_file->createDate (), (time_t *)&attachment->ctime);
- _poppler_convert_pdf_date_to_gtime (emb_file->modDate (), (time_t *)&attachment->mtime);
+ embFile = emb_file->getEmbeddedFile();
+ attachment->size = embFile->size ();
- if (emb_file->checksum ()->getLength () > 0)
- attachment->checksum = g_string_new_len (emb_file->checksum ()->getCString (),
- emb_file->checksum ()->getLength ());
-
+ if (embFile->createDate ())
+ _poppler_convert_pdf_date_to_gtime (embFile->createDate (), (time_t *)&attachment->ctime);
+ if (embFile->modDate ())
+ _poppler_convert_pdf_date_to_gtime (embFile->modDate (), (time_t *)&attachment->mtime);
+
+ if (embFile->checksum () && embFile->checksum ()->getLength () > 0)
+ attachment->checksum = g_string_new_len (embFile->checksum ()->getCString (),
+ embFile->checksum ()->getLength ());
priv->obj_stream = new Object();
- emb_file->streamObject().copy(priv->obj_stream);
+ priv->obj_stream->initStream(embFile->stream());
+ // Copy the stream
+ embFile->stream()->incRef();
return attachment;
}