]> www.fi.muni.cz Git - evince.git/commitdiff
Remove get_title from the interface, we can just use document info
authorMarco Pesenti Gritti <mpg@redhat.com>
Tue, 19 Apr 2005 16:40:32 +0000 (16:40 +0000)
committerMarco Pesenti Gritti <marco@src.gnome.org>
Tue, 19 Apr 2005 16:40:32 +0000 (16:40 +0000)
2005-04-19  Marco Pesenti Gritti <mpg@redhat.com>

        * backend/ev-document.c: (ev_document_class_init),
        (ev_document_get_info), (ev_document_render_pixbuf):
        * backend/ev-document.h:
        * backend/ev-page-cache.c: (_ev_page_cache_new):
        * pdf/ev-poppler.cc:
        * pixbuf/pixbuf-document.c: (pixbuf_document_class_init),
        (pixbuf_document_get_info), (pixbuf_document_document_iface_init):
        * ps/ps-document.c: (ps_document_class_init), (document_load),
        (ps_document_get_info), (ps_document_document_iface_init):

        Remove get_title from the interface, we can just use document info

ChangeLog
backend/ev-document.c
backend/ev-document.h
backend/ev-page-cache.c
pdf/ev-poppler.cc
pixbuf/pixbuf-document.c
ps/ps-document.c

index c53b7e8144301c58f665fbf6c89b6f6fbeaafc38..bf00f2c46f2c69588626e9d7396a29c89863308b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2005-04-19  Marco Pesenti Gritti <mpg@redhat.com>
+
+       * backend/ev-document.c: (ev_document_class_init),
+       (ev_document_get_info), (ev_document_render_pixbuf):
+       * backend/ev-document.h:
+       * backend/ev-page-cache.c: (_ev_page_cache_new):
+       * pdf/ev-poppler.cc:
+       * pixbuf/pixbuf-document.c: (pixbuf_document_class_init),
+       (pixbuf_document_get_info), (pixbuf_document_document_iface_init):
+       * ps/ps-document.c: (ps_document_class_init), (document_load),
+       (ps_document_get_info), (ps_document_document_iface_init):
+
+       Remove get_title from the interface, we can just use document info
+
 2005-04-19  Marco Pesenti Gritti <mpg@redhat.com>
 
        * backend/Makefile.am:
index 6aa0504cfbca4af500e3fa3dc5d171ae75f8fb2e..5df6e69ba7fe7ee6a2ec591f8221e787d73400ef 100644 (file)
@@ -67,12 +67,6 @@ ev_document_error_quark (void)
 static void
 ev_document_class_init (gpointer g_class)
 {
-       g_object_interface_install_property (g_class,
-                               g_param_spec_string ("title",
-                                                    "Document Title",
-                                                    "The title of the document",
-                                                    NULL,
-                                                    G_PARAM_READABLE));
 }
 
 #define PAGE_CACHE_STRING "ev-page-cache"
@@ -134,17 +128,6 @@ ev_document_save (EvDocument  *document,
        return retval;
 }
 
-char *
-ev_document_get_title (EvDocument  *document)
-{
-       char *title;
-
-       LOG ("ev_document_get_title");
-       g_object_get (document, "title", &title, NULL);
-
-       return title;
-}
-
 int
 ev_document_get_n_pages (EvDocument  *document)
 {
@@ -190,6 +173,14 @@ ev_document_can_get_text (EvDocument  *document)
        return iface->can_get_text (document);
 }
 
+EvDocumentInfo *
+ev_document_get_info (EvDocument *document)
+{
+       EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
+
+       return iface->get_info (document);
+}
+
 char *
 ev_document_get_text (EvDocument  *document,
                      int          page,
@@ -236,22 +227,3 @@ ev_document_render_pixbuf (EvDocument *document,
 
        return retval;
 }
-
-
-EvDocumentInfo *
-ev_document_render_get_info (EvDocument *document)
-{
-       EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
-       EvDocumentInfo *retval = NULL;
-
-       LOG ("ev_document_render_pixbuf");
-
-       if (iface->get_info != NULL)
-               retval = iface->get_info (document);
-
-       if (retval == NULL)
-               retval = g_new0 (EvDocumentInfo, 1);
-
-       return retval;
-
-}
index d8f8eba0d51efe64dc93c2cd16fac506541942d2..47a91eef79622cbe3f12bd7be4bf3c38620d84bf 100644 (file)
@@ -92,38 +92,33 @@ struct _EvDocumentIface
        EvDocumentInfo *(* get_info)    (EvDocument   *document);
 };
 
-GType        ev_document_get_type       (void);
-GQuark       ev_document_error_quark    (void);
-EvPageCache *ev_document_get_page_cache (EvDocument *document);
-GMutex      *ev_document_get_doc_mutex  (void);
-
-
-EvDocumentInfo *ev_document_get_info (EvDocument    *document);
-gboolean   ev_document_load          (EvDocument    *document,
-                                     const char    *uri,
-                                     GError       **error);
-gboolean   ev_document_save          (EvDocument    *document,
-                                     const char    *uri,
-                                     GError       **error);
-char      *ev_document_get_title     (EvDocument    *document);
-int        ev_document_get_n_pages   (EvDocument    *document);
-void       ev_document_get_page_size (EvDocument    *document,
-                                     int            page,
-                                     double        *width,
-                                     double        *height);
-char      *ev_document_get_page_label(EvDocument    *document,
-                                     int            page);
-gboolean   ev_document_can_get_text  (EvDocument    *document);
-char      *ev_document_get_text      (EvDocument    *document,
-                                     int            page,
-                                     EvRectangle   *rect);
-GList     *ev_document_get_links     (EvDocument    *document,
-                                     int            page);
-GdkPixbuf *ev_document_render_pixbuf (EvDocument    *document,
-                                     int            page,
-                                     double         scale);
-EvDocumentInfo *ev_document_render_get_info (EvDocument *document);
-
+GType          ev_document_get_type       (void);
+GQuark         ev_document_error_quark    (void);
+EvPageCache    *ev_document_get_page_cache (EvDocument     *document);
+GMutex        *ev_document_get_doc_mutex  (void);
+EvDocumentInfo *ev_document_get_info      (EvDocument     *document);
+gboolean       ev_document_load           (EvDocument     *document,
+                                           const char     *uri,
+                                           GError        **error);
+gboolean       ev_document_save           (EvDocument     *document,
+                                           const char     *uri,
+                                           GError        **error);
+int            ev_document_get_n_pages    (EvDocument     *document);
+void           ev_document_get_page_size  (EvDocument     *document,
+                                           int             page,
+                                           double         *width,
+                                           double         *height);
+char          *ev_document_get_page_label (EvDocument     *document,
+                                           int             page);
+gboolean       ev_document_can_get_text   (EvDocument     *document);
+char          *ev_document_get_text       (EvDocument     *document,
+                                           int             page,
+                                           EvRectangle    *rect);
+GList         *ev_document_get_links      (EvDocument     *document,
+                                           int             page);
+GdkPixbuf      *ev_document_render_pixbuf  (EvDocument     *document,
+                                           int             page,
+                                           double          scale);
 
 G_END_DECLS
 
index 491e0742a7b706f2b0c77161afa829928b1c23a4..935347e19430c9ee4e899ea68c94041a73b37a60 100644 (file)
@@ -89,6 +89,7 @@ ev_page_cache_finalize (GObject *object)
 EvPageCache *
 _ev_page_cache_new (EvDocument *document)
 {
+       EvDocumentInfo *doc_info;
        EvPageCache *page_cache;
        EvPageCacheInfo *info;
        gint i;
@@ -102,9 +103,16 @@ _ev_page_cache_new (EvDocument *document)
        /* Assume all pages are the same size until proven otherwise */
        page_cache->uniform = TRUE;
        page_cache->n_pages = ev_document_get_n_pages (document);
-       page_cache->title = ev_document_get_title (document);
        page_cache->page_labels = g_new0 (char *, page_cache->n_pages);
 
+       doc_info = ev_document_get_info (document);
+       if (doc_info->fields_mask & EV_DOCUMENT_INFO_TITLE) {
+               page_cache->title = g_strdup (doc_info->title);
+       } else {
+               page_cache->title = NULL;
+       }
+       g_free (doc_info);
+
        for (i = 0; i < page_cache->n_pages; i++) {
                double page_width = 0;
                double page_height = 0;
index 95ea00e5a91d02387bcdb12ab75f4b24b3b535c9..ac70a035d75aeca0f72f3439ed61dbbc9f87fbb6 100644 (file)
 #include "ev-document-security.h"
 #include "ev-document-thumbnails.h"
 
-
-enum {
-       PROP_0,
-       PROP_TITLE
-};
-
-
 typedef struct {
        PdfDocument *document;
        char *text;
@@ -94,34 +87,9 @@ G_DEFINE_TYPE_WITH_CODE (PdfDocument, pdf_document, G_TYPE_OBJECT,
                                                        pdf_document_ps_exporter_iface_init);
                         });
 
-
-static void
-pdf_document_get_property (GObject *object,
-                          guint prop_id,
-                          GValue *value,
-                          GParamSpec *pspec)
-{
-       PdfDocument *pdf_document = PDF_DOCUMENT (object);
-
-       switch (prop_id)
-       {
-               case PROP_TITLE:
-                       if (pdf_document->document == NULL)
-                               g_value_set_string (value, NULL);
-                       else
-                               g_object_get_property (G_OBJECT (pdf_document->document), "title", value);
-                       break;
-       }
-}
-
 static void
 pdf_document_class_init (PdfDocumentClass *klass)
 {
-       GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
-       gobject_class->get_property = pdf_document_get_property;
-
-       g_object_class_override_property (gobject_class, PROP_TITLE, "title");
 }
 
 static void
index 0aabb55f537d5172eee03589cd0bcaee09cfbdaf..18d357dfdb857b5d021aedc2faab8275dbff270c 100644 (file)
 #include "pixbuf-document.h"
 #include "ev-document-thumbnails.h"
 
-enum {
-       PROP_0,
-       PROP_TITLE
-};
-
 struct _PixbufDocumentClass
 {
        GObjectClass parent_class;
@@ -129,44 +124,12 @@ pixbuf_document_finalize (GObject *object)
        G_OBJECT_CLASS (pixbuf_document_parent_class)->finalize (object);
 }
 
-static void
-pixbuf_document_set_property (GObject *object,
-                             guint prop_id,
-                             const GValue *value,
-                             GParamSpec *pspec)
-{
-       switch (prop_id)
-       {
-               case PROP_TITLE:
-                       /* read only */
-                       break;
-       }
-}
-
-static void
-pixbuf_document_get_property (GObject *object,
-                             guint prop_id,
-                             GValue *value,
-                             GParamSpec *pspec)
-{
-       switch (prop_id)
-       {
-               case PROP_TITLE:
-                       g_value_set_string (value, NULL);
-                       break;
-       }
-}
-
 static void
 pixbuf_document_class_init (PixbufDocumentClass *klass)
 {
        GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
        gobject_class->finalize = pixbuf_document_finalize;
-       gobject_class->get_property = pixbuf_document_get_property;
-       gobject_class->set_property = pixbuf_document_set_property;
-
-       g_object_class_override_property (gobject_class, PROP_TITLE, "title");
 }
 
 static gboolean
@@ -175,6 +138,17 @@ pixbuf_document_can_get_text (EvDocument *document)
        return FALSE;
 }
 
+static EvDocumentInfo *
+pixbuf_document_get_info (EvDocument *document)
+{
+       EvDocumentInfo *info;
+
+       info = g_new0 (EvDocumentInfo, 1);
+       info->fields_mask = 0;
+
+       return info;
+}
+
 static void
 pixbuf_document_document_iface_init (EvDocumentIface *iface)
 {
@@ -184,6 +158,7 @@ pixbuf_document_document_iface_init (EvDocumentIface *iface)
        iface->get_n_pages = pixbuf_document_get_n_pages;
        iface->get_page_size = pixbuf_document_get_page_size;
        iface->render_pixbuf = pixbuf_document_render_pixbuf;
+       iface->get_info = pixbuf_document_get_info;
 }
 
 static GdkPixbuf *
index 8f514cfffd7c9cb644b8f8756480ef0fa1cdae7f..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
@@ -1122,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];
@@ -1409,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)
 {
@@ -1418,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