]> www.fi.muni.cz Git - evince.git/blobdiff - backend/pdf/ev-poppler.cc
Make gnome-keyring optional. Fixes bug #509676.
[evince.git] / backend / pdf / ev-poppler.cc
index 690c90810412c7ba592c242c53c448d2e3447c3d..7c3a594df50e1fd15be9485140fa961a322aac7f 100644 (file)
@@ -45,6 +45,7 @@
 #include "ev-document-transition.h"
 #include "ev-document-forms.h"
 #include "ev-selection.h"
 #include "ev-document-transition.h"
 #include "ev-document-forms.h"
 #include "ev-selection.h"
+#include "ev-transition-effect.h"
 #include "ev-attachment.h"
 #include "ev-image.h"
 
 #include "ev-attachment.h"
 #include "ev-image.h"
 
@@ -123,10 +124,8 @@ static EvLink     *ev_link_from_action      (PdfDocument       *pdf_document,
 static void        pdf_document_search_free (PdfDocumentSearch *search);
 static void        pdf_print_context_free   (PdfPrintContext   *ctx);
 
 static void        pdf_document_search_free (PdfDocumentSearch *search);
 static void        pdf_print_context_free   (PdfPrintContext   *ctx);
 
-G_DEFINE_TYPE_WITH_CODE (PdfDocument, pdf_document, G_TYPE_OBJECT,
-                         {
-                                G_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT,
-                                                       pdf_document_document_iface_init);
+EV_BACKEND_REGISTER_WITH_CODE (PdfDocument, pdf_document,
+                        {
                                 G_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_SECURITY,
                                                        pdf_document_security_iface_init);
                                 G_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_THUMBNAILS,
                                 G_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_SECURITY,
                                                        pdf_document_security_iface_init);
                                 G_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_THUMBNAILS,
@@ -1969,16 +1968,49 @@ pdf_document_get_page_duration (EvDocumentTransition *trans,
        return duration;
 }
 
        return duration;
 }
 
-static void
-pdf_document_page_transition_iface_init (EvDocumentTransitionIface *iface)
+static EvTransitionEffect *
+pdf_document_get_effect (EvDocumentTransition *trans,
+                        gint                  page)
 {
 {
-       iface->get_page_duration = pdf_document_get_page_duration;
+       PdfDocument            *pdf_document;
+       PopplerPage            *poppler_page;
+       PopplerPageTransition  *page_transition;
+       EvTransitionEffect     *effect;
+
+       pdf_document = PDF_DOCUMENT (trans);
+       poppler_page = poppler_document_get_page (pdf_document->document, page);
+
+       if (!poppler_page)
+               return NULL;
+
+       page_transition = poppler_page_get_transition (poppler_page);
+
+       if (!page_transition) {
+               g_object_unref (poppler_page);
+               return NULL;
+       }
+
+       /* enums in PopplerPageTransition match the EvTransitionEffect ones */
+       effect = ev_transition_effect_new ((EvTransitionEffectType) page_transition->type,
+                                          "alignment", page_transition->alignment,
+                                          "direction", page_transition->direction,
+                                          "duration", page_transition->duration,
+                                          "angle", page_transition->angle,
+                                          "scale", page_transition->scale,
+                                          "rectangular", page_transition->rectangular,
+                                          NULL);
+
+       poppler_page_transition_free (page_transition);
+       g_object_unref (poppler_page);
+
+       return effect;
 }
 
 }
 
-PdfDocument *
-pdf_document_new (void)
+static void
+pdf_document_page_transition_iface_init (EvDocumentTransitionIface *iface)
 {
 {
-       return PDF_DOCUMENT (g_object_new (PDF_TYPE_DOCUMENT, NULL));
+       iface->get_page_duration = pdf_document_get_page_duration;
+       iface->get_effect = pdf_document_get_effect;
 }
 
 /* Forms */
 }
 
 /* Forms */