[evince] shell: Reorganize navigation in the Headerbar



commit 5e9b37e8c12982f10b22d5feedf2a07d308c4a55
Author: Germán Poo-Caamaño <gpoo gnome org>
Date:   Mon Jul 2 13:06:59 2018 -0400

    shell: Reorganize navigation in the Headerbar
    
    * Remove EvHistoryAction widget from the Headerbar.
      The actions are not always active, and therefore, not a
      primary action that deserves to be always on spot.
    * Integrate the history functionality in the
      EvPageActionWidget through a Popover menu.
    * Move the navigation menu items from the View menu into
      EvPageActionWidget.
    
    By removing EvHistoryAction widget, there is more space
    for the title in the Headerbar, and it looks less
    overwhelming.
    
    However, these changes introduces a regression: the
    HistoryAction widget had a menu where the user could
    select where to jump in the history.
    
    It was a hidden feature, that may or may not be missed.
    However, to improve its usability, it could be reintroduced
    later as another item in the sidebar, and/or with a keyboard
    shortcut (document in the help overlay).

 shell/Makefile.am         |   2 -
 shell/ev-history-action.c | 281 ----------------------------------------------
 shell/ev-history-action.h |  58 ----------
 shell/ev-toolbar.c        |  17 +--
 shell/evince-menus.ui     |  53 +++++----
 5 files changed, 38 insertions(+), 373 deletions(-)
---
diff --git a/shell/Makefile.am b/shell/Makefile.am
index 15d2d82d..092f7780 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -23,8 +23,6 @@ evince_SOURCES=                               \
        ev-find-sidebar.c               \
        ev-history.c                    \
        ev-history.h                    \
-       ev-history-action.c             \
-       ev-history-action.h             \
        ev-keyring.h                    \
        ev-keyring.c                    \
        ev-loading-message.c            \
diff --git a/shell/ev-toolbar.c b/shell/ev-toolbar.c
index 10e43789..47da0143 100644
--- a/shell/ev-toolbar.c
+++ b/shell/ev-toolbar.c
@@ -2,7 +2,7 @@
  *  this file is part of evince, a gnome document viewer
  *
  * Copyright (C) 2012-2014 Carlos Garcia Campos <carlosgc gnome org>
- * Copyright (C) 2014 Germán Poo-Caamaño <gpoo gnome org>
+ * Copyright (C) 2014-2018 Germán Poo-Caamaño <gpoo gnome org>
  *
  * Evince is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by
@@ -29,7 +29,6 @@
 
 #include "ev-stock-icons.h"
 #include "ev-zoom-action.h"
-#include "ev-history-action.h"
 #include "ev-application.h"
 #include "ev-page-action-widget.h"
 #include <math.h>
@@ -45,7 +44,6 @@ struct _EvToolbarPrivate {
 
         GtkWidget *view_menu_button;
         GtkWidget *action_menu_button;
-        GtkWidget *history_action;
         GtkWidget *zoom_action;
         GtkWidget *page_selector;
         GtkWidget *navigation_action;
@@ -192,7 +190,7 @@ ev_toolbar_constructed (GObject *object)
         EvToolbar      *ev_toolbar = EV_TOOLBAR (object);
         GtkBuilder     *builder;
         GtkWidget      *tool_item;
-        GtkWidget      *hbox, *vbox;
+        GtkWidget      *vbox;
         GtkWidget      *button;
         GMenuModel     *menu;
         GMenuModel     *bookmarks_submenu_model;
@@ -210,7 +208,7 @@ ev_toolbar_constructed (GObject *object)
 
         /* Page selector */
         /* Use EvPageActionWidget for now, since the page selector action is also used by the previewer */
-        tool_item = GTK_WIDGET (g_object_new (EV_TYPE_PAGE_ACTION_WIDGET, NULL));
+        tool_item = ev_page_action_widget_new (G_MENU (gtk_builder_get_object (builder, "navigation-menu")));
         gtk_widget_set_tooltip_text (tool_item, _("Select page or search in the index"));
         atk_object_set_name (gtk_widget_get_accessible (tool_item), _("Select page"));
         ev_toolbar->priv->page_selector = tool_item;
@@ -218,11 +216,6 @@ ev_toolbar_constructed (GObject *object)
                                          ev_window_get_document_model (ev_toolbar->priv->window));
         gtk_header_bar_pack_start (GTK_HEADER_BAR (ev_toolbar), tool_item);
 
-        /* History */
-        hbox = ev_history_action_new (ev_window_get_history (ev_toolbar->priv->window));
-        ev_toolbar->priv->history_action = hbox;
-        gtk_header_bar_pack_start (GTK_HEADER_BAR (ev_toolbar), hbox);
-
         /* Find */
         button = ev_toolbar_create_toggle_button (ev_toolbar, "win.toggle-find", "edit-find-symbolic",
                                                   _("Find a word or phrase in the document"));
@@ -351,7 +344,7 @@ ev_toolbar_has_visible_popups (EvToolbar *ev_toolbar)
         if (ev_zoom_action_get_popup_shown (EV_ZOOM_ACTION (ev_toolbar->priv->zoom_action)))
                 return TRUE;
 
-        if (ev_history_action_get_popup_shown (EV_HISTORY_ACTION (ev_toolbar->priv->history_action)))
+        if (ev_page_action_widget_get_popup_shown (EV_PAGE_ACTION_WIDGET (ev_toolbar->priv->page_selector)))
                 return TRUE;
 
         return FALSE;
@@ -390,7 +383,6 @@ ev_toolbar_set_mode (EvToolbar     *ev_toolbar,
         case EV_TOOLBAR_MODE_FULLSCREEN:
                 gtk_widget_show (priv->view_menu_button);
                 gtk_widget_show (priv->action_menu_button);
-                gtk_widget_show (priv->history_action);
                 gtk_widget_show (priv->zoom_action);
                 gtk_widget_show (priv->page_selector);
                 gtk_widget_show (priv->find_button);
@@ -400,7 +392,6 @@ ev_toolbar_set_mode (EvToolbar     *ev_toolbar,
        case EV_TOOLBAR_MODE_RECENT_VIEW:
                 gtk_widget_hide (priv->view_menu_button);
                 gtk_widget_hide (priv->action_menu_button);
-                gtk_widget_hide (priv->history_action);
                 gtk_widget_hide (priv->zoom_action);
                 gtk_widget_hide (priv->page_selector);
                 gtk_widget_hide (priv->find_button);
diff --git a/shell/evince-menus.ui b/shell/evince-menus.ui
index 4e100b0a..6f7bad70 100644
--- a/shell/evince-menus.ui
+++ b/shell/evince-menus.ui
@@ -79,24 +79,6 @@
         <attribute name="action">win.rotate-right</attribute>
       </item>
     </section>
-    <section>
-      <item>
-        <attribute name="label" translatable="yes">First Page</attribute>
-        <attribute name="action">win.go-first-page</attribute>
-      </item>
-      <item>
-        <attribute name="label" translatable="yes">Previous Page</attribute>
-        <attribute name="action">win.go-previous-page</attribute>
-      </item>
-      <item>
-        <attribute name="label" translatable="yes">Next Page</attribute>
-        <attribute name="action">win.go-next-page</attribute>
-      </item>
-      <item>
-        <attribute name="label" translatable="yes">Last Page</attribute>
-        <attribute name="action">win.go-last-page</attribute>
-      </item>
-    </section>
     <section>
       <item>
         <attribute name="label" translatable="yes">Zoom _In</attribute>
@@ -310,6 +292,39 @@
     </section>
   </menu>
 
+  <menu id="navigation-menu">
+    <section>
+      <attribute name="label" translatable="yes">Navigation</attribute>
+      <item>
+        <attribute name="label" translatable="yes">First Page</attribute>
+        <attribute name="action">win.go-first-page</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Previous Page</attribute>
+        <attribute name="action">win.go-previous-page</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Next Page</attribute>
+        <attribute name="action">win.go-next-page</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Last Page</attribute>
+        <attribute name="action">win.go-last-page</attribute>
+      </item>
+    </section>
+    <section>
+      <attribute name="label" translatable="yes">History</attribute>
+      <item>
+        <attribute name="label" translatable="yes">Back</attribute>
+        <attribute name="action">win.go-back-history</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Forward</attribute>
+        <attribute name="action">win.go-forward-history</attribute>
+      </item>
+    </section>
+  </menu>
+
   <menu id="attachments-popup">
     <section>
       <item>
@@ -322,4 +337,4 @@
       </item>
     </section>
   </menu>
-</interface>
+</interface>
\ No newline at end of file


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