[gnome-maps] Micro readability improvments



commit eac4e89a30095a67493063f3093c984cdb6b4912
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Mon Mar 25 18:57:34 2013 +0200

    Micro readability improvments

 src/mainToolbar.js |   32 ++++++++++++++++++--------------
 1 files changed, 18 insertions(+), 14 deletions(-)
---
diff --git a/src/mainToolbar.js b/src/mainToolbar.js
index 7c9ee43..1fc0649 100644
--- a/src/mainToolbar.js
+++ b/src/mainToolbar.js
@@ -57,23 +57,27 @@ const MainToolbar = new Lang.Class({
         let forward = Geocode.Forward.new_for_string(str);
         this._markerLayer.remove_all();
 
-        try {
-            let locations = forward.search ();
-            log (locations.length + " locations found");
-            if (locations.length == 0)
-                return;
+        let locations = [];
 
-            locations.forEach(Lang.bind(this,
-                function(location) {
-                    log ("location: " + location);
-                    let marker = new Champlain.Label();
-                    marker.set_text(location.description);
-                    marker.set_location(location.latitude, location.longitude);
-                    this._markerLayer.add_marker(marker);
-                    log ("Added marker at " + location.latitude + ", " + location.longitude);
-                }));
+        try {
+            locations = forward.search ();
         } catch (e) {
             log ("Failed to search '" + str + "': " + e.message);
+            return;
         }
+
+        log (locations.length + " locations found");
+        if (locations.length == 0)
+            return;
+
+        locations.forEach(Lang.bind(this,
+            function(location) {
+                log ("location: " + location);
+                let marker = new Champlain.Label();
+                marker.set_text(location.description);
+                marker.set_location(location.latitude, location.longitude);
+                this._markerLayer.add_marker(marker);
+                log ("Added marker at " + location.latitude + ", " + location.longitude);
+            }));
     }
 });


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]