[evince] Move dual page with odd pages left to the view menu



commit 1078b8f707d89c9e03a9668c701febf91b9f4c1c
Author: Carlos Garcia Campos <carlosgc gnome org>
Date:   Sun Nov 25 11:53:10 2012 +0100

    Move dual page with odd pages left to the view menu
    
    As a toggle option only available in dual mode.

 libview/ev-document-model.c |   10 ----------
 libview/ev-view.c           |   10 ++--------
 shell/ev-toolbar.c          |    7 -------
 shell/ev-window.c           |   17 +++++++++--------
 shell/evince-ui.xml         |    1 +
 5 files changed, 12 insertions(+), 33 deletions(-)
---
diff --git a/libview/ev-document-model.c b/libview/ev-document-model.c
index 3cef354..1a21338 100644
--- a/libview/ev-document-model.c
+++ b/libview/ev-document-model.c
@@ -606,11 +606,6 @@ ev_document_model_set_dual_page (EvDocumentModel *model,
 	model->dual_page = dual_page;
 
 	g_object_notify (G_OBJECT (model), "dual-page");
-
-        if (dual_page && model->dual_page_odd_left) {
-                model->dual_page_odd_left = FALSE;
-                g_object_notify (G_OBJECT (model), "dual-odd-left");
-        }
 }
 
 gboolean
@@ -635,11 +630,6 @@ ev_document_model_set_dual_page_odd_pages_left (EvDocumentModel *model,
 	model->dual_page_odd_left = odd_left;
 
 	g_object_notify (G_OBJECT (model), "dual-odd-left");
-
-        if (odd_left && model->dual_page) {
-                model->dual_page = FALSE;
-                g_object_notify (G_OBJECT (model), "dual-page");
-        }
 }
 
 gboolean
diff --git a/libview/ev-view.c b/libview/ev-view.c
index eb084c8..bfa17c1 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -5408,9 +5408,7 @@ ev_view_dual_page_changed_cb (EvDocumentModel *model,
 			      GParamSpec      *pspec,
 			      EvView          *view)
 {
-	gboolean dual_page = ev_document_model_get_dual_page (model);
-
-	view->dual_page = dual_page || ev_document_model_get_dual_page_odd_pages_left (model);
+	view->dual_page = ev_document_model_get_dual_page (model);
 	view->pending_scroll = SCROLL_TO_PAGE_POSITION;
 	/* FIXME: if we're keeping the pixbuf cache around, we should extend the
 	 * preload_cache_size to be 2 if dual_page is set.
@@ -5423,11 +5421,7 @@ ev_view_dual_odd_left_changed_cb (EvDocumentModel *model,
 				  GParamSpec      *pspec,
 				  EvView          *view)
 {
-	gboolean dual_odd_left = ev_document_model_get_dual_page_odd_pages_left (model);
-
-	view->dual_page = dual_odd_left || ev_document_model_get_dual_page (model);
-	view->dual_even_left = !dual_odd_left;
-
+	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));
 }
diff --git a/shell/ev-toolbar.c b/shell/ev-toolbar.c
index 80b1880..c33e811 100644
--- a/shell/ev-toolbar.c
+++ b/shell/ev-toolbar.c
@@ -243,13 +243,6 @@ ev_toolbar_constructed (GObject *object)
         gtk_container_add (GTK_CONTAINER (hbox), button);
         gtk_widget_show (button);
 
-        action = gtk_action_group_get_action (action_group, "ViewDualOddLeft");
-        /* I don't know why our icon name is not set for our stock icons */
-        gtk_action_set_icon_name (action, EV_STOCK_VIEW_DUAL);
-        button = ev_toolbar_create_toggle_button (ev_toolbar, action);
-        gtk_container_add (GTK_CONTAINER (hbox), button);
-        gtk_widget_show (button);
-
         menu = gtk_ui_manager_get_widget (ui_manager, "/ViewMenuPopup");
         button = ev_toolbar_create_menu_button (ev_toolbar, "go-down-symbolic",
                                                 menu, GTK_ALIGN_END);
diff --git a/shell/ev-window.c b/shell/ev-window.c
index a5bb7ff..bd03112 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -493,11 +493,13 @@ ev_window_update_actions_sensitivity (EvWindow *ev_window)
 	gboolean has_pages = FALSE;
 	gboolean presentation_mode;
 	gboolean can_find_in_page = FALSE;
+	gboolean dual_mode = FALSE;
 
 	if (ev_window->priv->document) {
 		page = ev_document_model_get_page (ev_window->priv->model);
 		n_pages = ev_document_get_n_pages (ev_window->priv->document);
 		has_pages = n_pages > 0;
+		dual_mode = ev_document_model_get_dual_page (ev_window->priv->model);
 	}
 
 	can_find_in_page = (ev_window->priv->find_job &&
@@ -523,7 +525,8 @@ ev_window_update_actions_sensitivity (EvWindow *ev_window)
 					has_pages &&
 					ev_view_can_zoom_out (view) &&
 					!presentation_mode);
-	
+	ev_window_set_action_sensitive (ev_window, "ViewDualOddLeft", dual_mode);
+
         /* Go menu */
 	if (has_pages) {
 		ev_window_set_action_sensitive (ev_window, "GoPreviousPage", page > 0);
@@ -3833,10 +3836,8 @@ ev_window_cmd_dual_odd_pages_left (GtkAction *action, EvWindow *ev_window)
 {
 	gboolean dual_page_odd_left;
 
-	ev_window_stop_presentation (ev_window, TRUE);
 	dual_page_odd_left = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
-	ev_document_model_set_dual_page_odd_pages_left (ev_window->priv->model,
-							dual_page_odd_left);
+	ev_document_model_set_dual_page_odd_pages_left (ev_window->priv->model, dual_page_odd_left);
 }
 
 static void
@@ -5948,11 +5949,11 @@ static const GtkToggleActionEntry toggle_entries[] = {
         { "ViewContinuous", EV_STOCK_VIEW_CONTINUOUS, N_("_Continuous"), NULL,
 	  N_("Show the entire document"),
 	  G_CALLBACK (ev_window_cmd_continuous), TRUE },
-        { "ViewDual", EV_STOCK_VIEW_DUAL, N_("_Dual (Even pages left)"), NULL,
-	  N_("Show two pages at once with even pages on the left"),
+        { "ViewDual", EV_STOCK_VIEW_DUAL, N_("_Dual"), NULL,
+	  N_("Show two pages at once"),
 	  G_CALLBACK (ev_window_cmd_dual), FALSE },
-	{ "ViewDualOddLeft", EV_STOCK_VIEW_DUAL, N_("Dual (_Odd pages left)"), NULL,
-	  N_("Show two pages at once with odd pages on the left"),
+	{ "ViewDualOddLeft", NULL, N_("_Odd pages left"), NULL,
+	  N_("Show odd pages on the left in dual mode"),
 	  G_CALLBACK (ev_window_cmd_dual_odd_pages_left), FALSE },
         { "ViewFullscreen", GTK_STOCK_FULLSCREEN, N_("_Fullscreen"), "F11",
           N_("Expand the window to fill the screen"),
diff --git a/shell/evince-ui.xml b/shell/evince-ui.xml
index a1dec62..18469d5 100644
--- a/shell/evince-ui.xml
+++ b/shell/evince-ui.xml
@@ -43,6 +43,7 @@
     <menuitem name="ViewZoomInMenu" action="ViewZoomIn"/>
     <menuitem name="ViewZoomOutMenu" action="ViewZoomOut"/>
     <separator/>
+    <menuitem name="ViewDualOddLeftMenu" action="ViewDualOddLeft"/>
     <menuitem name="ViewInvertedColors" action="ViewInvertedColors"/>
     <separator/>
     <menuitem name="ViewReload" action="ViewReload"/>



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