[gnome-maps/wip/mlundblad/disable-maptype-shortcuts: 2/2] mainWindow: Only enable map type shortcuts when useful
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/mlundblad/disable-maptype-shortcuts: 2/2] mainWindow: Only enable map type shortcuts when useful
- Date: Tue, 1 Jun 2021 20:30:30 +0000 (UTC)
commit cf2446a9447acc84a50804df9259b1e085a774a8
Author: Marcus Lundblad <ml update uu se>
Date: Tue Jun 1 22:28:07 2021 +0200
mainWindow: Only enable map type shortcuts when useful
Only enable the shortcuts to switch b/w street and aerial
map types when aerial tiles are available.
src/mainWindow.js | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)
---
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 5d75f992..9abceb46 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -192,7 +192,7 @@ var MainWindow = GObject.registerClass({
}
_initActions() {
- Utils.addActions(this, {
+ let actions = {
'about': {
onActivate: () => this._onAboutActivate()
},
@@ -200,14 +200,6 @@ var MainWindow = GObject.registerClass({
state: ['b', false],
onActivate: () => this._onMapTypeMenuActivate()
},
- 'switch-to-street-view': {
- accels: ['<Primary>1', '<Primary>KP_1'],
- onActivate: () => this._onStreetViewActivate()
- },
- 'switch-to-aearial-view': {
- accels: ['<Primary>2', '<Primary>KP_2'],
- onActivate: () => this._onAerialViewActivate()
- },
'hybrid-aerial': {
paramType: 'b',
setting: 'hybrid-aerial'
@@ -252,7 +244,22 @@ var MainWindow = GObject.registerClass({
'export-as-image': {
onActivate: () => this._onExportActivated()
}
- }, Application.settings);
+ };
+
+ // when aerial tiles are available, add shortcuts to switch
+ if (Service.getService().tiles.aerial) {
+ actions['switch-to-street-view'] = {
+ accels: ['<Primary>1', '<Primary>KP_1'],
+ onActivate: () => this._onStreetViewActivate()
+ };
+
+ actions['switch-to-aearial-view'] = {
+ accels: ['<Primary>2', '<Primary>KP_2'],
+ onActivate: () => this._onAerialViewActivate()
+ };
+ }
+
+ Utils.addActions(this, actions, Application.settings);
}
_initSignals() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]