[gnome-maps/wip/contacts: 2/2] test contacts



commit c5b3aef3ab2e1bf3aed71a7ea23eec9a63a21b71
Author: Jonas Danielsson <jonas threetimestwo org>
Date:   Thu Dec 4 03:10:35 2014 -0500

    test contacts

 src/application.js |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index 9315d30..6e370f5 100644
--- a/src/application.js
+++ b/src/application.js
@@ -34,6 +34,7 @@ const Format = imports.format;
 const Geoclue = imports.geoclue;
 const GeocodeService = imports.geocodeService;
 const MainWindow = imports.mainWindow;
+const MapsC = imports.gi.MapsC;
 const NotificationManager = imports.notificationManager;
 const Path = imports.path;
 const PlaceStore = imports.placeStore;
@@ -105,6 +106,21 @@ const Application = new Lang.Class({
         placeStore = new PlaceStore.PlaceStore();
         try {
             placeStore.load();
+
+            this._contacts = new MapsC.Contacts();
+            this._contacts.load(function(contacts) {
+                contacts.get_list().forEach(function(contact) {
+                    log('ID: ' + contact.id);
+                    log('Name: ' + contact.name);
+                    log('Street: ' + contact.street);
+                    log('Postal code: ' + contact.postal_code);
+                    log('Locality: ' + contact.locality);
+                    log('Region: ' + contact.region);
+                    log('Country: ' + contact.country);
+                    log('Icon: ' + contact.icon);
+                    log('');
+                });
+            });
         } catch (e) {
             log('Failed to parse Maps places file, ' +
                 'subsequent writes will overwrite the file!');


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