[gnome-maps] application: Add contacts to place store
- From: Jonas Danielsson <jonasdn src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps] application: Add contacts to place store
- Date: Sat, 31 Jan 2015 23:50:23 +0000 (UTC)
commit 09adee66e567c1d94ca4a888c4c1932894aaacfa
Author: Jonas Danielsson <jonas threetimestwo org>
Date: Mon Jan 12 06:52:02 2015 -0500
application: Add contacts to place store
https://bugzilla.gnome.org/show_bug.cgi?id=736803
src/application.js | 24 +++++++++++++++++++++++-
1 files changed, 23 insertions(+), 1 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index 4f3e153..c469874 100644
--- a/src/application.js
+++ b/src/application.js
@@ -29,13 +29,13 @@ const GtkClutter = imports.gi.GtkClutter;
const Lang = imports.lang;
const CheckIn = imports.checkIn;
+const ContactPlace = imports.contactPlace;
const Format = imports.format;
const Geoclue = imports.geoclue;
const GeocodeService = imports.geocodeService;
const MainWindow = imports.mainWindow;
const Maps = imports.gi.GnomeMaps;
const NotificationManager = imports.notificationManager;
-const Place = imports.place;
const PlaceStore = imports.placeStore;
const RouteService = imports.routeService;
const Settings = imports.settings;
@@ -127,6 +127,19 @@ const Application = new Lang.Class({
this._mainWindow.window.destroy();
},
+ _addContacts: function() {
+ contactStore.get_contacts().forEach(function(contact) {
+ contact.geocode(function() {
+ contact.get_places().forEach(function(p) {
+ Utils.debug('Adding contact address: ' + p.name);
+ let place = new ContactPlace.ContactPlace({ place: p,
+ contact: contact });
+ placeStore.addPlace(place, PlaceStore.PlaceType.CONTACT);
+ });
+ });
+ });
+ },
+
_initPlaceStore: function() {
placeStore = new PlaceStore.PlaceStore();
try {
@@ -135,6 +148,15 @@ const Application = new Lang.Class({
log('Failed to parse Maps places file, ' +
'subsequent writes will overwrite the file!');
}
+
+ if (contactStore.state === Maps.ContactStoreState.LOADED) {
+ this. _addContacts();
+ } else {
+ Utils.once(contactStore, 'notify::state', (function() {
+ if (contactStore.state === Maps.ContactStoreState.LOADED)
+ this._addContacts();
+ }).bind(this));
+ }
},
_initAppMenu: function() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]