]> www.fi.muni.cz Git - evince.git/commitdiff
read "Creator:" comment, free creator field if necessary.
authorMartin Kretzschmar <martink@src.gnome.org>
Fri, 17 Jun 2005 13:33:00 +0000 (13:33 +0000)
committerMartin Kretzschmar <martink@src.gnome.org>
Fri, 17 Jun 2005 13:33:00 +0000 (13:33 +0000)
* ps/ps.c (psscan, psfree): read "Creator:" comment, free creator
field if necessary.

* ps/ps.h: add creator field to document.

* ps/ps-document.c (ps_document_get_info): set format to PostScript,
set creator field.

ChangeLog
ps/ps-document.c
ps/ps.c
ps/ps.h

index 5d435402ede4cba410eae3a7a23e5f2be538e2c9..33594657fea37464666b6ba3ffa210fee8235237 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2005-06-17  Martin Kretzschmar  <martink@gnome.org>
+
+       * ps/ps.c (psscan, psfree): read "Creator:" comment, free creator
+       field if necessary.
+
+       * ps/ps.h: add creator field to document.
+
+       * ps/ps-document.c (ps_document_get_info): set format to PostScript,
+       set creator field.
+
 2005-06-17  Marco Pesenti Gritti  <mpg@redhat.com>
 
        * data/evince-properties.glade:
index 642f5c8ef9a7a3acbf581162bd70d623433f232d..0febcea448db6359e3fbf37318dfb2434ff1b7a2 100644 (file)
@@ -1234,8 +1234,13 @@ ps_document_get_info (EvDocument *document)
 
        info = g_new0 (EvDocumentInfo, 1);
        info->fields_mask = EV_DOCUMENT_INFO_TITLE |
+                           EV_DOCUMENT_INFO_FORMAT |
+                           EV_DOCUMENT_INFO_CREATOR |
                            EV_DOCUMENT_INFO_N_PAGES;
        info->title = g_strdup (ps->doc->title);
+       info->format = ps->doc->epsf ? g_strdup (_("Encapsulated PostScript"))
+                                    : g_strdup (_("PostScript"));
+       info->creator = g_strdup (ps->doc->creator);
        info->n_pages = ev_document_get_n_pages (document);
 
        return info;
diff --git a/ps/ps.c b/ps/ps.c
index c95c8152c683dd7b5dee07d2fd30568cde16dc53..e79fb0631957dab61aff8fe589d175995477d829 100644 (file)
--- a/ps/ps.c
+++ b/ps/ps.c
@@ -133,7 +133,7 @@ pages_new(struct page *pages, int current, int maxpages)
  *      Page Size (for the Page Size), Bounding Box (to minimize backing
  *      pixmap size or determine window size for encapsulated PostScript), 
  *      Orientation of Paper (for default transformation matrix), and
- *      Page Order.  The title and CreationDate are also retrieved to
+ *      Page Order.  The Title, Creator, and CreationDate are also retrieved to
  *      help identify the document.
  *
  *      The following comments are examined:
@@ -144,6 +144,7 @@ pages_new(struct page *pages, int current, int maxpages)
  *
  *      %!PS-Adobe-* [EPSF-*]
  *      %%BoundingBox: <int> <int> <int> <int>|(atend)
+ *      %%Creator: <textline>
  *      %%CreationDate: <textline>
  *      %%Orientation: Portrait|Landscape|(atend)
  *      %%Pages: <uint> [<int>]|(atend)
@@ -348,6 +349,9 @@ psscan(FILE * file, int respect_eof, const gchar * fname)
     else if(doc->date == NULL && iscomment(line + 2, "CreationDate:")) {
       doc->date = gettextline(line + length("%%CreationDate:"));
     }
+    else if(doc->creator == NULL && iscomment(line + 2, "Creator:")) {
+      doc->creator = gettextline(line + length("%%Creator:"));
+    }
     else if(bb_set == NONE && iscomment(line + 2, "BoundingBox:")) {
       sscanf(line + length("%%BoundingBox:"), "%256s", text);
       if(strcmp(text, "(atend)") == 0) {
@@ -1155,6 +1159,8 @@ psfree(doc)
       g_free(doc->title);
     if(doc->date)
       g_free(doc->date);
+    if(doc->creator)
+      g_free(doc->creator);
     if(doc->pages)
       g_free(doc->pages);
     if(doc->size)
diff --git a/ps/ps.h b/ps/ps.h
index 09039f17dce80d61e123efc3a3e1992bf250bb4e..5e27618bfd006141c5b418672e61c0179a347d68 100644 (file)
--- a/ps/ps.h
+++ b/ps/ps.h
@@ -49,6 +49,7 @@ struct document {
   int epsf;                     /* Encapsulated PostScript flag. */
   char *title;                  /* Title of document. */
   char *date;                   /* Creation date. */
+  char *creator;                /* Program that created the file */
   int pageorder;                /* ASCEND, DESCEND, SPECIAL */
   long beginheader, endheader;  /* offsets into file */
   unsigned int lenheader;