[gnome-maps] Move InstructionRow class to its own file
- From: Jonas Danielsson <jonasdn src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps] Move InstructionRow class to its own file
- Date: Mon, 18 Jan 2016 17:26:29 +0000 (UTC)
commit 0a8dceb53a81af82efa8ae2181282434e4061eab
Author: Amisha Singla <amishas157 gmail com>
Date: Mon Jan 18 12:45:47 2016 +0530
Move InstructionRow class to its own file
src/instructionRow.js | 47 ++++++++++++++++++++++++++++++++++
src/org.gnome.Maps.src.gresource.xml | 1 +
src/sidebar.js | 27 ++-----------------
3 files changed, 51 insertions(+), 24 deletions(-)
---
diff --git a/src/instructionRow.js b/src/instructionRow.js
new file mode 100644
index 0000000..c91321a
--- /dev/null
+++ b/src/instructionRow.js
@@ -0,0 +1,47 @@
+/* -*- Mode: JS2; indent-tabs-mode: nil; js2-basic-offset: 4 -*- */
+/* vim: set et ts=4 sw=4: */
+/*
+ * Copyright (c) 2011, 2012, 2013 Red Hat, Inc.
+ *
+ * GNOME Maps is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * GNOME Maps is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with GNOME Maps; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
+ * Mattias Bengtsson <mattias jc bengtsson gmail com>
+ */
+
+const Gtk = imports.gi.Gtk;
+const Lang = imports.lang;
+const Utils = imports.utils;
+
+const InstructionRow = new Lang.Class({
+ Name: "InstructionRow",
+ Extends: Gtk.ListBoxRow,
+ Template: 'resource:///org/gnome/Maps/ui/instruction-row.ui',
+ InternalChildren: [ 'directionImage',
+ 'instructionLabel',
+ 'distanceLabel' ],
+
+ _init: function(params) {
+ this.turnPoint = params.turnPoint;
+ delete params.turnPoint;
+
+ this.parent(params);
+
+ this._instructionLabel.label = this.turnPoint.instruction;
+ this._directionImage.icon_name = this.turnPoint.iconName;
+
+ if (this.turnPoint.distance > 0)
+ this._distanceLabel.label = Utils.prettyDistance(this.turnPoint.distance);
+ }
+});
diff --git a/src/org.gnome.Maps.src.gresource.xml b/src/org.gnome.Maps.src.gresource.xml
index 36f4c07..66302ac 100644
--- a/src/org.gnome.Maps.src.gresource.xml
+++ b/src/org.gnome.Maps.src.gresource.xml
@@ -19,6 +19,7 @@
<file>geoJSONSource.js</file>
<file>geoJSONStyle.js</file>
<file>http.js</file>
+ <file>instructionRow.js</file>
<file>layersPopover.js</file>
<file>location.js</file>
<file>locationServiceNotification.js</file>
diff --git a/src/sidebar.js b/src/sidebar.js
index 4026344..f20d535 100644
--- a/src/sidebar.js
+++ b/src/sidebar.js
@@ -28,34 +28,13 @@ const Lang = imports.lang;
const Mainloop = imports.mainloop;
const Application = imports.application;
+const InstructionRow = imports.instructionRow;
const PlaceStore = imports.placeStore;
const RouteEntry = imports.routeEntry;
const RouteQuery = imports.routeQuery;
const StoredRoute = imports.storedRoute;
const Utils = imports.utils;
-const InstructionRow = new Lang.Class({
- Name: "InstructionRow",
- Extends: Gtk.ListBoxRow,
- Template: 'resource:///org/gnome/Maps/ui/instruction-row.ui',
- InternalChildren: [ 'directionImage',
- 'instructionLabel',
- 'distanceLabel' ],
-
- _init: function(params) {
- this.turnPoint = params.turnPoint;
- delete params.turnPoint;
-
- this.parent(params);
-
- this._instructionLabel.label = this.turnPoint.instruction;
- this._directionImage.icon_name = this.turnPoint.iconName;
-
- if (this.turnPoint.distance > 0)
- this._distanceLabel.label = Utils.prettyDistance(this.turnPoint.distance);
- }
-});
-
const Sidebar = new Lang.Class({
Name: 'Sidebar',
Extends: Gtk.Revealer,
@@ -222,8 +201,8 @@ const Sidebar = new Lang.Class({
}).bind(this));
route.turnPoints.forEach((function(turnPoint) {
- let row = new InstructionRow({ visible: true,
- turnPoint: turnPoint });
+ let row = new InstructionRow.InstructionRow({ visible: true,
+ turnPoint: turnPoint });
this._instructionList.add(row);
}).bind(this));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]