[gnome-documents] books: Hide the "Present" menu item in Books
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] books: Hide the "Present" menu item in Books
- Date: Fri, 3 Jun 2016 11:12:42 +0000 (UTC)
commit 34d7c0abe97276401e2c360276cfdfb88abee077
Author: Bastien Nocera <hadess hadess net>
Date: Tue May 31 19:24:32 2016 +0200
books: Hide the "Present" menu item in Books
We're unlikely to make presentations with files from Books, so remove
the menu item.
https://bugzilla.gnome.org/show_bug.cgi?id=767083
data/ui/preview-menu.ui | 1 +
src/application.js | 18 ++++++++++--------
src/preview.js | 12 ++++++++----
3 files changed, 19 insertions(+), 12 deletions(-)
---
diff --git a/data/ui/preview-menu.ui b/data/ui/preview-menu.ui
index 56d63c4..0550027 100644
--- a/data/ui/preview-menu.ui
+++ b/data/ui/preview-menu.ui
@@ -16,6 +16,7 @@
</item>
<item>
<attribute name="action">app.present-current</attribute>
+ <attribute name='hidden-when'>action-missing</attribute>
<attribute name="label" translatable="yes">Present</attribute>
<attribute name="accel">F5</attribute>
</item>
diff --git a/src/application.js b/src/application.js
index e2c68b4..aee1777 100644
--- a/src/application.js
+++ b/src/application.js
@@ -573,11 +573,6 @@ const Application = new Lang.Class({
{ name: 'edit-current' },
{ name: 'view-current',
window_mode: WindowMode.WindowMode.EDIT },
- { name: 'present-current',
- window_mode: WindowMode.WindowMode.PREVIEW,
- callback: this._onActionToggle,
- state: GLib.Variant.new('b', false),
- accels: ['F5'] },
{ name: 'print-current', accels: ['<Primary>p'],
callback: this._onActionPrintCurrent },
{ name: 'search',
@@ -641,11 +636,18 @@ const Application = new Lang.Class({
WindowMode.WindowMode.SEARCH] }
];
+ if (!this.isBooks) {
+ this._actionEntries.push (
+ { name: 'present-current',
+ window_mode: WindowMode.WindowMode.PREVIEW,
+ callback: this._onActionToggle,
+ state: GLib.Variant.new('b', false),
+ accels: ['F5'] });
+ this._initGettingStarted();
+ }
+
this._initActions();
this._initAppMenu();
-
- if (!this.isBooks)
- this._initGettingStarted();
},
_createWindow: function() {
diff --git a/src/preview.js b/src/preview.js
index bd9bb04..e882710 100644
--- a/src/preview.js
+++ b/src/preview.js
@@ -146,8 +146,10 @@ const PreviewView = new Lang.Class({
Lang.bind(this, this._updateNightMode));
this._togglePresentation = Application.application.lookup_action('present-current');
- let presentCurrentId = Application.application.connect('action-state-changed::present-current',
- Lang.bind(this, this._onPresentStateChanged));
+ if (!Application.application.isBooks) {
+ let presentCurrentId = Application.application.connect('action-state-changed::present-current',
+ Lang.bind(this, this._onPresentStateChanged));
+ }
Application.documentManager.connect('load-started',
Lang.bind(this, this._onLoadStarted));
@@ -165,7 +167,8 @@ const PreviewView = new Lang.Class({
rotLeft.disconnect(rotLeftId);
rotRight.disconnect(rotRightId);
this._places.disconnect(placesId);
- Application.application.disconnect(presentCurrentId);
+ if (!Application.application.isBooks)
+ Application.application.disconnect(presentCurrentId);
Application.application.disconnect(nightModeId);
}));
},
@@ -560,7 +563,8 @@ const PreviewView = new Lang.Class({
this.view.set_model(this._model);
this._navControls.setModel(model);
this._navControls.show();
- this._togglePresentation.enabled = true;
+ if (this._togglePresentation)
+ this._togglePresentation.enabled = true;
if (Application.documentManager.metadata)
this._bookmarks = new GdPrivate.Bookmarks({ metadata: Application.documentManager.metadata
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]