[gnome-maps] mainWindow: add storing of recent places



commit 2d1f346684f77ab2cc34b398c9e93c24468df5a8
Author: Jonas Danielsson <jonas threetimestwo org>
Date:   Mon Jan 13 13:46:35 2014 +0100

    mainWindow: add storing of recent places
    
    Add recent places visited to the PlaceStore.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=722102

 src/mainWindow.js |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 7b4ed28..d2eea46 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -35,6 +35,7 @@ const Application = imports.application;
 const MapView = imports.mapView;
 const SearchPopup = imports.searchPopup;
 const ContextMenu = imports.contextMenu;
+const PlaceStore = imports.placeStore;
 const Utils = imports.utils;
 const Config = imports.config;
 
@@ -73,6 +74,7 @@ const MainWindow = new Lang.Class({
 
         this._contextMenu = new ContextMenu.ContextMenu(this.mapView);
 
+        this._initPlaces();
         this._initSearchWidgets();
         this._initActions();
         this._initSignals();
@@ -85,6 +87,16 @@ const MainWindow = new Lang.Class({
         grid.show_all();
     },
 
+    _initPlaces: function() {
+        this._placeStore = new PlaceStore.PlaceStore();
+        try {
+            this._placeStore.load();
+        } catch (e) {
+            log('Failed to parse Maps places file, ' +
+                'subsequent writes will overwrite the file!');
+        }
+    },
+
     _initSearchWidgets: function() {
         this._searchPopup = new SearchPopup.SearchPopup(10);
 
@@ -221,6 +233,7 @@ const MainWindow = new Lang.Class({
 
         this.mapView.showNGotoLocation(place.location);
 
+        this._placeStore.addRecent(place);
         this._searchPopup.hide();
     },
 


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