[evince/gnome-3-38] shell: Enable odd pages left when dual page is on



commit baf6244a00a2ce8f5a1b150bc65aa6be46f9fd25
Author: Germán Poo-Caamaño <gpoo gnome org>
Date:   Sun Jun 13 19:18:13 2021 -0400

    shell: Enable odd pages left when dual page is on
    
    Enable odd pages left option evert time dual page is enabled.
    There are two states to keep track of: the document model and
    the menu. The document model is updated every time. We can force
    updating the menus every time the value of dual page changes.
    
    Fixes #602

 shell/ev-window.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
---
diff --git a/shell/ev-window.c b/shell/ev-window.c
index b4cfd2b4..59b9abe8 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -4254,10 +4254,24 @@ ev_window_cmd_dual (GSimpleAction *action,
 {
        EvWindow *window = user_data;
        EvWindowPrivate *priv = GET_PRIVATE (window);
+       EvDocument *document = priv->document;
+       gboolean has_pages = FALSE;
+       gboolean dual_page;
+       gboolean recent_view_mode;
+
+       dual_page = g_variant_get_boolean (state);
 
        ev_window_stop_presentation (window, TRUE);
-       ev_document_model_set_dual_page (priv->model, g_variant_get_boolean (state));
+       ev_document_model_set_dual_page (priv->model, dual_page);
        g_simple_action_set_state (action, state);
+
+       recent_view_mode = ev_window_is_recent_view (window);
+
+       if (document)
+               has_pages = ev_document_get_n_pages (priv->document) > 0;
+
+       ev_window_set_action_enabled (window, "dual-odd-left", dual_page &&
+                                     has_pages && !recent_view_mode);
 }
 
 static void


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