[gnome-maps] Do not forget route on sidebar hide
- From: Jonas Danielsson <jonasdn src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps] Do not forget route on sidebar hide
- Date: Fri, 12 Sep 2014 18:18:21 +0000 (UTC)
commit ddcf913b667040a349b97ccec5e2538983e60357
Author: Jonas Danielsson <jonas danielsson threetimestwo org>
Date: Wed Sep 10 01:45:25 2014 -0400
Do not forget route on sidebar hide
https://bugzilla.gnome.org/show_bug.cgi?id=736347
src/mainWindow.js | 7 +++----
src/mapView.js | 20 ++++++++++++++++++++
2 files changed, 23 insertions(+), 4 deletions(-)
---
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 885f5c6..4863ab9 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -68,6 +68,9 @@ const MainWindow = new Lang.Class({
this._sidebar = new Sidebar.Sidebar(this.mapView);
Application.routeService.route.connect('update',
this._setRevealSidebar.bind(this, true));
+ this._sidebar.bind_property('reveal-child',
+ this.mapView, 'routeVisible',
+ GObject.BindingFlags.DEFAULT);
this._contextMenu = new ContextMenu.ContextMenu(this.mapView);
@@ -279,10 +282,6 @@ const MainWindow = new Lang.Class({
action.set_state(variant);
let reveal = variant.get_boolean();
- if (!reveal) {
- Application.routeService.route.reset();
- Application.routeService.query.reset();
- }
this._sidebar.set_reveal_child(reveal);
},
diff --git a/src/mapView.js b/src/mapView.js
index 7504e44..c668dfd 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -28,6 +28,7 @@ const Gtk = imports.gi.Gtk;
const GtkChamplain = imports.gi.GtkChamplain;
const Champlain = imports.gi.Champlain;
const Geocode = imports.gi.GeocodeGlib;
+const GObject = imports.gi.GObject;
const Lang = imports.lang;
const Mainloop = imports.mainloop;
@@ -54,6 +55,25 @@ const MapMinZoom = 2;
const MapView = new Lang.Class({
Name: 'MapView',
Extends: GtkChamplain.Embed,
+ Properties: {
+ 'routeVisible': GObject.ParamSpec.boolean('routeVisible',
+ 'Route visible',
+ 'Visibility of route layers',
+ GObject.ParamFlags.READWRITE,
+ false)
+ },
+
+ get routeVisible() {
+ return this._routeLayer.visible || this._instructionMarkerLayer.visible;
+ },
+
+ set routeVisible(value) {
+ let isValid = Application.routeService.query.isValid();
+
+ this._routeLayer.visible = value && isValid;
+ this._instructionMarkerLayer.visible = value && isValid;
+ this.notify('routeVisible');
+ },
_init: function() {
this.parent();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]