[evince/wip/gpoo/fix-odd-pages-left] shell: Enable odd pages left when dual page is on




commit ddb6ed00d474e5c421849796dbba7dae78dc178c
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 f3f42bcf..fab121ca 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -4276,10 +4276,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]