]> www.fi.muni.cz Git - evince.git/blobdiff - ps/ps-document.c
Initial support for document title. Not working yet.
[evince.git] / ps / ps-document.c
index 7619f03fc3f55569b68dbd86b2c6d42450c7f3af..09e4ef3d32016e25ee0c25c035597d0274f0122a 100644 (file)
@@ -149,9 +149,7 @@ The DONE message indicates that ghostscript has finished processing.
 #include <stdio.h>
 #include <math.h>
 
-#include "ev-document.h"
 #include "ps-document.h"
-#include "ps.h"
 #include "gsdefaults.h"
 
 #ifdef HAVE_LOCALE_H
@@ -175,6 +173,11 @@ The DONE message indicates that ghostscript has finished processing.
 
 enum { INTERPRETER_MESSAGE, INTERPRETER_ERROR, LAST_SIGNAL };
 
+enum {
+       PROP_0,
+       PROP_TITLE
+};
+
 /* structure to describe section of file to send to ghostscript */
 struct record_list {
   FILE *fp;
@@ -282,6 +285,41 @@ ps_document_init(PSDocument * gs)
   gs->gs_status = _("No document loaded.");
 }
 
+static void
+ps_document_set_property (GObject *object,
+                         guint prop_id,
+                         const GValue *value,
+                         GParamSpec *pspec)
+{
+       switch (prop_id)
+
+       {
+               case PROP_TITLE:
+                       /* read only */
+                       break;
+       }
+}
+
+static void
+ps_document_get_property (GObject *object,
+                         guint prop_id,
+                         GValue *value,
+                         GParamSpec *pspec)
+{
+       PSDocument *ps = PS_DOCUMENT (object);
+
+       switch (prop_id)
+       {
+               case PROP_TITLE:
+                       if (ps->doc) {
+                               g_value_set_string (value, ps->doc->title);
+                       } else {
+                               g_value_set_string (value, NULL);
+                       }
+                       break;
+       }
+}
+
 static void
 ps_document_class_init(PSDocumentClass * klass)
 {
@@ -292,6 +330,8 @@ ps_document_class_init(PSDocumentClass * klass)
   gs_class = klass;
 
   object_class->finalize = ps_document_finalize;
+  object_class->get_property = ps_document_get_property;
+  object_class->set_property = ps_document_set_property;
 
   /* Create atoms */
   klass->gs_atom = gdk_atom_intern("GHOSTVIEW", FALSE);
@@ -300,6 +340,8 @@ ps_document_class_init(PSDocumentClass * klass)
   klass->string_atom = gdk_atom_intern("STRING", FALSE);
 
   gtk_gs_defaults_load();
+
+  g_object_class_override_property (object_class, PROP_TITLE, "title");
 }
 
 /* Clean all memory and temporal files */
@@ -1296,6 +1338,8 @@ document_load(PSDocument * gs, const gchar * fname)
     /* we grab the vital statistics!!! */
     gs->doc = psscan(gs->gs_psfile, gs->respect_eof, filename);
 
+    g_object_notify (G_OBJECT (gs), "title");
+
     if(gs->doc == NULL) {
       /* File does not seem to be a Postscript one */
       gchar buf[1024];