[gnome-documents/wip/christopherdavis/app-menu-migration] Retire app menu
- From: Christopher Davis <christopherdavis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents/wip/christopherdavis/app-menu-migration] Retire app menu
- Date: Sun, 9 Dec 2018 01:03:54 +0000 (UTC)
commit 926c8ad04751ee2d6fd26b7fca9796f3bfdc9f7a
Author: Christopher Davis <brainblasted disroot org>
Date: Sat Dec 8 19:59:08 2018 -0500
Retire app menu
App menus are being retired in favor of in-window menus. These
menus come in two flavors:
* Primary menu for the top level views
* Secondary menu for secondary views
The primary menu contains the actions of the old app menu.
For Documents and Books, the search button has been moved to
the left side in order to accommodate for the new button.
See https://gitlab.gnome.org/GNOME/Initiatives/issues/4 for
details.
Relevant issue is https://gitlab.gnome.org/GNOME/gnome-documents/issues/29
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 ++++++++++++++++++++++++++
src/mainToolbar.js | 22 +++++++++++++++++++++-
src/overview.js | 5 ++++-
src/preview.js | 2 +-
7 files changed, 57 insertions(+), 12 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
index ce0b6486..6c5351e1 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/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]