From f53f3523ebc7a082eb8a1c046cee836b67696912 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Mon, 03 Jan 2005 13:43:31 +0000 Subject: Initial support for document title. Not working yet. 2005-01-03 Marco Pesenti Gritti * backend/ev-document.c: (ev_document_get_type), (ev_document_class_init), (ev_document_load), (ev_document_get_title): * backend/ev-document.h: * pdf/xpdf/pdf-document.cc: * ps/ps-document.c: (ps_document_set_property), (ps_document_get_property), (ps_document_class_init), (document_load): * ps/ps-document.h: * ps/ps.h: * shell/ev-window.c: (update_window_title), (ev_window_open), (ev_window_init): Initial support for document title. Not working yet. --- (limited to 'ps/ps-document.c') diff --git a/ps/ps-document.c b/ps/ps-document.c index 7619f03..09e4ef3 100644 --- a/ps/ps-document.c +++ b/ps/ps-document.c @@ -149,9 +149,7 @@ The DONE message indicates that ghostscript has finished processing. #include #include -#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; @@ -283,6 +286,41 @@ ps_document_init(PSDocument * gs) } 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) { GObjectClass *object_class; @@ -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]; -- cgit v0.9.1