[gnome-documents: 1/2] Retire app menu



commit 28ddf16be259b95f5d4711274039443be11fa0d4
Author: Christopher Davis <brainblasted disroot org>
Date:   Thu Jan 17 18:36:30 2019 +0000

    Retire app menu

 data/meson.build                            |  4 ++--
 data/org.gnome.Documents.data.gresource.xml |  4 ++--
 data/ui/{app-menu.ui => books-app-menu.ui}  |  6 +-----
 data/ui/documents-app-menu.ui               | 26 ++++++++++++++++++++++++++
 po/POTFILES.in                              |  3 ++-
 src/mainToolbar.js                          | 22 +++++++++++++++++++++-
 src/overview.js                             |  5 ++++-
 src/preview.js                              |  2 +-
 8 files changed, 59 insertions(+), 13 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
index 1bc43bb1..5450d2d7 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -25,8 +25,8 @@ resource_data = files(
   'application.css',
   'media/dnd-counter.svg',
   'media/thumbnail-frame.png',
-  'ui/app-menu.ui',
-  'ui/app-menu.ui',
+  'ui/documents-app-menu.ui',
+  'ui/books-app-menu.ui',
   'ui/help-overlay.ui',
   'ui/help-overlay.ui',
   'ui/organize-collection-dialog.ui',
diff --git a/data/org.gnome.Documents.data.gresource.xml b/data/org.gnome.Documents.data.gresource.xml
index 9f6267ed..49cf01dd 100644
--- a/data/org.gnome.Documents.data.gresource.xml
+++ b/data/org.gnome.Documents.data.gresource.xml
@@ -2,6 +2,8 @@
 <gresources>
   <gresource prefix="/org/gnome/Documents">
     <file>application.css</file>
+    <file preprocess="xml-stripblanks">ui/books-app-menu.ui</file>
+    <file preprocess="xml-stripblanks">ui/documents-app-menu.ui</file>
     <file preprocess="xml-stripblanks">ui/organize-collection-dialog.ui</file>
     <file preprocess="xml-stripblanks">ui/preview-context-menu.ui</file>
     <file preprocess="xml-stripblanks">ui/preview-menu.ui</file>
@@ -12,11 +14,9 @@
     <file alias="ui/thumbnail-frame.png" preprocess="to-pixdata">media/thumbnail-frame.png</file>
   </gresource>
   <gresource prefix="/org/gnome/Documents/gtk">
-    <file alias="menus.ui" preprocess="xml-stripblanks">ui/app-menu.ui</file>
     <file alias="help-overlay.ui" preprocess="xml-stripblanks">ui/help-overlay.ui</file>
   </gresource>
   <gresource prefix="/org/gnome/Books/gtk">
-    <file alias="menus.ui" preprocess="xml-stripblanks">ui/app-menu.ui</file>
     <file alias="help-overlay.ui" preprocess="xml-stripblanks">ui/help-overlay.ui</file>
   </gresource>
 </gresources>
diff --git a/data/ui/app-menu.ui b/data/ui/books-app-menu.ui
similarity index 74%
rename from data/ui/app-menu.ui
rename to data/ui/books-app-menu.ui
index b778264b..29c463e9 100644
--- a/data/ui/app-menu.ui
+++ b/data/ui/books-app-menu.ui
@@ -17,11 +17,7 @@
       </item>
       <item>
         <attribute name="action">app.about</attribute>
-        <attribute name="label" translatable="yes">About</attribute>
-      </item>
-      <item>
-        <attribute name="action">app.quit</attribute>
-        <attribute name="label" translatable="yes" context="app menu">Quit</attribute>
+        <attribute name="label" translatable="yes">About Books</attribute>
       </item>
     </section>
   </menu>
diff --git a/data/ui/documents-app-menu.ui b/data/ui/documents-app-menu.ui
new file mode 100644
index 00000000..21d40a86
--- /dev/null
+++ b/data/ui/documents-app-menu.ui
@@ -0,0 +1,26 @@
+<interface>
+  <menu id="app-menu">
+    <section>
+      <item>
+        <attribute name="action">app.night-mode</attribute>
+        <attribute name="label" translatable="yes">Night Mode</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="action">win.show-help-overlay</attribute>
+        <attribute name="label" translatable="yes">Keyboard Shortcuts</attribute>
+      </item>
+      <item>
+        <attribute name="action">app.help</attribute>
+        <attribute name="label" translatable="yes">Help</attribute>
+      </item>
+      <item>
+        <attribute name="action">app.about</attribute>
+        <attribute name="label" translatable="yes">About Documents</attribute>
+      </item>
+    </section>
+  </menu>
+</interface>
+
+
diff --git a/po/POTFILES.in b/po/POTFILES.in
index a0257de4..a3da1d41 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -6,7 +6,8 @@ data/org.gnome.books.gschema.xml
 data/org.gnome.Documents.appdata.xml.in
 data/org.gnome.Documents.desktop.in
 data/org.gnome.documents.gschema.xml
-data/ui/app-menu.ui
+data/ui/books-app-menu.ui
+data/ui/documents-app-menu.ui
 data/ui/help-overlay.ui
 data/ui/organize-collection-dialog.ui
 data/ui/preview-context-menu.ui
diff --git a/src/mainToolbar.js b/src/mainToolbar.js
index 0848427b..53fc6c01 100644
--- a/src/mainToolbar.js
+++ b/src/mainToolbar.js
@@ -86,12 +86,32 @@ var MainToolbar = new Lang.Class({
         return res;
     },
 
+    addMenuButton: function() {
+      let path = null;
+      let model_name = null;
+      if (pkg.name == 'org.gnome.Books') {
+        path = "/org/gnome/Documents/ui/books-app-menu.ui";
+      } else {
+        path = "/org/gnome/Documents/ui/documents-app-menu.ui";
+      }
+
+      let builder = Gtk.Builder.new_from_resource(path);
+      let model = builder.get_object('app-menu');
+      let menuButton = new Gtk.MenuButton({ image: new Gtk.Image ({ icon_name: 'open-menu-symbolic' }),
+                                            tooltip_text: Gettext.pgettext("menu button tooltip", "Menu"),
+                                            visible: true });
+      menuButton.set_menu_model(model);
+
+      this.toolbar.pack_end(menuButton);
+      return menuButton;
+    },
+
     addSearchButton: function(actionName) {
         let searchButton = new Gtk.ToggleButton({ image: new Gtk.Image ({ icon_name: 'edit-find-symbolic' }),
                                                   tooltip_text: Gettext.pgettext("toolbar button tooltip", 
"Search"),
                                                   action_name: actionName,
                                                   visible: true });
-        this.toolbar.pack_end(searchButton);
+        this.toolbar.pack_start(searchButton);
         return searchButton;
     },
 
diff --git a/src/overview.js b/src/overview.js
index d178c134..6ee5f5b1 100644
--- a/src/overview.js
+++ b/src/overview.js
@@ -633,6 +633,7 @@ const OverviewToolbar = new Lang.Class({
             customTitle = null;
             if (!this._collBackButton) {
                 this._collBackButton = this.addBackButton();
+                this.toolbar.child_set_property(this._collBackButton, "position", 0);
                 this._collBackButton.show();
             }
         } else {
@@ -665,13 +666,15 @@ const OverviewToolbar = new Lang.Class({
         this.toolbar.set_custom_title(this._stackSwitcher);
         this._checkCollectionWidgets();
 
+        this.addSearchButton('view.search');
+        this.addMenuButton();
+
         let selectionButton = new Gtk.Button({ image: new Gtk.Image ({ icon_name: 'object-select-symbolic' 
}),
                                                tooltip_text: _("Select Items"),
                                                action_name: 'view.selection-mode' });
         this.toolbar.pack_end(selectionButton);
 
         this._addViewMenuButton();
-        this.addSearchButton('view.search');
 
         // connect to active collection changes while in this mode
         this._collectionId =
diff --git a/src/preview.js b/src/preview.js
index d436f276..707d6386 100644
--- a/src/preview.js
+++ b/src/preview.js
@@ -413,7 +413,7 @@ var PreviewToolbar = new Lang.Class({
         this.addBackButton();
 
         // menu button, on the right of the toolbar
-        let menuButton = new Gtk.MenuButton({ image: new Gtk.Image ({ icon_name: 'open-menu-symbolic' }),
+        let menuButton = new Gtk.MenuButton({ image: new Gtk.Image ({ icon_name: 'view-more-symbolic' }),
                                               menu_model: this._getPreviewMenu(),
                                               action_name: 'view.gear-menu' });
         this.toolbar.pack_end(menuButton);


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