]> www.fi.muni.cz Git - evince.git/blobdiff - ps/ps-document.c
Copy-paste g_file_set_contents to keep compatibility with gtk 2.6
[evince.git] / ps / ps-document.c
index d1c5271bc39e9c1b3c7caf5ada53f4e93bc38b49..cfd22d9d0f0f0eeb910a6916b6502937e51da37e 100644 (file)
@@ -178,6 +178,12 @@ ps_document_dispose (GObject *object)
                gs->input_buffer = NULL;
        }
 
+       if (gs->target_window) {
+               gtk_widget_destroy (gs->target_window);
+               gs->target_window = NULL;
+               gs->pstarget = NULL;
+       }
+
        stop_interpreter (gs);
 
        G_OBJECT_CLASS (parent_class)->dispose (object);
@@ -1197,15 +1203,13 @@ ps_async_renderer_render_pixbuf (EvAsyncRenderer *renderer, int page, double sca
        PSDocument *gs = PS_DOCUMENT (renderer);
 
        if (gs->pstarget == NULL) {
-               GtkWidget *widget;
-
-               widget = gtk_window_new (GTK_WINDOW_POPUP);
-               gtk_widget_realize (widget);
-               gs->pstarget = widget->window;
+               gs->target_window = gtk_window_new (GTK_WINDOW_POPUP);
+               gtk_widget_realize (gs->target_window);
+               gs->pstarget = gs->target_window->window;
 
                g_assert (gs->pstarget != NULL);
 
-               g_signal_connect (widget, "event",
+               g_signal_connect (gs->target_window, "event",
                                  G_CALLBACK (ps_document_widget_event),
                                  gs);
        }
@@ -1236,58 +1240,6 @@ ps_document_get_info (EvDocument *document)
        return info;
 }
 
-static EvOrientation
-ps_document_get_orientation (EvDocument *document)
-{
-       EvOrientation orientation;
-       PSDocument *ps = PS_DOCUMENT (document);
-
-       g_return_val_if_fail (ps != NULL, EV_ORIENTATION_PORTRAIT);
-
-       switch (ps->orientation) {
-               case GTK_GS_ORIENTATION_PORTRAIT:
-                       orientation = EV_ORIENTATION_PORTRAIT;
-                       break;
-               case GTK_GS_ORIENTATION_LANDSCAPE:
-                       orientation = EV_ORIENTATION_LANDSCAPE;
-                       break;
-               case GTK_GS_ORIENTATION_UPSIDEDOWN:
-                       orientation = EV_ORIENTATION_UPSIDEDOWN;
-                       break;
-               case GTK_GS_ORIENTATION_SEASCAPE:
-                       orientation = EV_ORIENTATION_SEASCAPE;
-                       break;
-               default:
-                       orientation = EV_ORIENTATION_PORTRAIT;
-                       break;
-       }
-
-       return orientation;
-}
-
-static void
-ps_document_set_orientation (EvDocument *document, EvOrientation orientation)
-{
-       PSDocument *ps = PS_DOCUMENT (document);
-
-       g_return_if_fail (ps != NULL);
-
-       switch (orientation) {
-               case EV_ORIENTATION_PORTRAIT:
-                       ps->orientation = GTK_GS_ORIENTATION_PORTRAIT;
-                       break;
-               case EV_ORIENTATION_LANDSCAPE:
-                       ps->orientation = GTK_GS_ORIENTATION_LANDSCAPE;
-                       break;
-               case EV_ORIENTATION_UPSIDEDOWN:
-                       ps->orientation = GTK_GS_ORIENTATION_UPSIDEDOWN;
-                       break;
-               case EV_ORIENTATION_SEASCAPE:
-                       ps->orientation = GTK_GS_ORIENTATION_SEASCAPE;
-                       break;
-       }
-}
-
 static void
 ps_document_document_iface_init (EvDocumentIface *iface)
 {
@@ -1297,8 +1249,6 @@ 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->get_info = ps_document_get_info;
-       iface->set_orientation = ps_document_set_orientation;
-       iface->get_orientation = ps_document_get_orientation;
 }
 
 static void
@@ -1309,7 +1259,8 @@ ps_async_renderer_iface_init (EvAsyncRendererIface *iface)
 
 static void
 ps_document_ps_export_begin (EvPSExporter *exporter, const char *filename,
-                            int first_page, int last_page)
+                            int first_page, int last_page,
+                             double width, double height, gboolean duplex)
 {
        PSDocument *document = PS_DOCUMENT (exporter);
 
@@ -1320,11 +1271,11 @@ ps_document_ps_export_begin (EvPSExporter *exporter, const char *filename,
 }
 
 static void
-ps_document_ps_export_do_page (EvPSExporter *exporter, int page)
+ps_document_ps_export_do_page (EvPSExporter *exporter, EvRenderContext *rc)
 {
        PSDocument *document = PS_DOCUMENT (exporter);
        
-       document->ps_export_pagelist[page] = 1;
+       document->ps_export_pagelist[rc->page] = 1;
 }
 
 static void