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



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

    test contacts

 src/application.js |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index 9315d30..6ce8c7d 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,24 @@ 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('Icon: ' + contact.icon);
+                    contact.get_addresses().forEach(function(address) {
+                        log('Type: ' + address.type);
+                        log('Street: ' + address.street);
+                        log('Postal code: ' + address.postal_code);
+                        log('Locality: ' + address.locality);
+                        log('Region: ' + address.region);
+                        log('Country: ' + address.country);
+                    });
+                    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]