]> www.fi.muni.cz Git - evince.git/blobdiff - ps/ps-document.c
Fix for 169901
[evince.git] / ps / ps-document.c
index 9a7bf70b0c61d5004aeeafcab83a428c086000b8..a794e9956340dd0172a8e5689a454a4ea095b806 100644 (file)
@@ -68,11 +68,6 @@ GCond* pixbuf_cond = NULL;
 GMutex* pixbuf_mutex = NULL;
 GdkPixbuf *current_pixbuf = NULL;
 
-enum {
-       PROP_0,
-       PROP_TITLE
-};
-
 /* structure to describe section of file to send to ghostscript */
 struct record_list {
   FILE *fp;
@@ -151,41 +146,6 @@ ps_document_init (PSDocument *gs)
        pixbuf_mutex = g_mutex_new ();
 }
 
-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)
 {
@@ -196,15 +156,11 @@ 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;
 
        klass->gs_atom = gdk_atom_intern ("GHOSTVIEW", FALSE);
        klass->next_atom = gdk_atom_intern ("NEXT", FALSE);
        klass->page_atom = gdk_atom_intern ("PAGE", FALSE);
        klass->string_atom = gdk_atom_intern ("STRING", FALSE);
-
-       g_object_class_override_property (object_class, PROP_TITLE, "title");
 }
 
 static void
@@ -508,6 +464,12 @@ get_page_orientation (PSDocument *gs, int page)
        if (gs->structured_doc) {
                orientation = gs->doc->pages[page].orientation;
        }
+       if (orientation == GTK_GS_ORIENTATION_NONE) {
+               orientation = gs->doc->default_page_orientation;
+       }
+       if (orientation == GTK_GS_ORIENTATION_NONE) {
+               orientation = gs->doc->orientation;
+       }
        if (orientation == GTK_GS_ORIENTATION_NONE) {
                orientation = GTK_GS_ORIENTATION_PORTRAIT;
        }
@@ -1116,8 +1078,6 @@ document_load(PSDocument * gs, const gchar * fname)
     /* we grab the vital statistics!!! */
     gs->doc = psscan(gs->gs_psfile, TRUE, filename);
 
-    g_object_notify (G_OBJECT (gs), "title");
-
     if(gs->doc == NULL) {
       /* File does not seem to be a Postscript one */
       gchar buf[1024];
@@ -1403,6 +1363,19 @@ ps_document_render_pixbuf (EvDocument *document, int page, double scale)
        return pixbuf;
 }
 
+static EvDocumentInfo *
+ps_document_get_info (EvDocument *document)
+{
+       EvDocumentInfo *info;
+       PSDocument *ps = PS_DOCUMENT (document);
+
+       info = g_new0 (EvDocumentInfo, 1);
+       info->fields_mask = EV_DOCUMENT_INFO_TITLE;
+       info->title = ps->doc->title;
+
+       return info;
+}
+
 static void
 ps_document_document_iface_init (EvDocumentIface *iface)
 {
@@ -1412,6 +1385,7 @@ ps_document_document_iface_init (EvDocumentIface *iface)
        iface->get_n_pages = ps_document_get_n_pages;
        iface->get_page_size = ps_document_get_page_size;
        iface->render_pixbuf = ps_document_render_pixbuf;
+       iface->get_info = ps_document_get_info;
 }
 
 static void