[evince/669-regression-2-page-document-page-placement-in-dual-view] make 2 page documents use dual-odd-left option



commit adf485444051eab29c240dc1593a6ba45f7d659a
Author: Nelson Benítez León <nbenitezl gmail com>
Date:   Mon Sep 17 14:47:34 2018 +0200

    make 2 page documents use dual-odd-left option
    
    when opened first time in Evince, to avoid gap pages
    when displaying in dual mode.
    
    Fixes a regression as in the past it was working properly.
    
    Issue #669

 libview/ev-view.c | 5 ++++-
 shell/ev-window.c | 5 +++++
 2 files changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/libview/ev-view.c b/libview/ev-view.c
index a8afc789..fbd3ca81 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -8401,7 +8401,10 @@ ev_view_dual_odd_left_changed_cb (EvDocumentModel *model,
 {
        view->dual_even_left = !ev_document_model_get_dual_page_odd_pages_left (model);
        view->pending_scroll = SCROLL_TO_PAGE_POSITION;
-       gtk_widget_queue_resize (GTK_WIDGET (view));
+       if (ev_document_model_get_dual_page (model))
+               /* odd_left may be set when not in dual mode,
+                  queue_resize is not needed in that case */
+               gtk_widget_queue_resize (GTK_WIDGET (view));
 }
 
 static void
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 522aaed0..2ee7a579 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -1282,8 +1282,13 @@ setup_document_from_metadata (EvWindow *window)
            ev_metadata_get_int (window->priv->metadata, "window_height", &height))
                return; /* size was already set in setup_size_from_metadata */
 
+       /* Following code is intended to be executed first time a document is opened
+        * in Evince, that's why is located *after* the previous return that exits
+        * when evince metadata for window_width{height} already exists. */
        if (n_pages == 1)
                ev_document_model_set_dual_page (window->priv->model, FALSE);
+       else if (n_pages == 2)
+               ev_document_model_set_dual_page_odd_pages_left (window->priv->model, TRUE);
 
        g_settings_get (window->priv->default_settings, "window-ratio", "(dd)", &width_ratio, &height_ratio);
        if (width_ratio > 0. && height_ratio > 0.) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]