[gnome-maps] geoclue: Add 'connected' property



commit 552008f2c32498c704706f129abe3670ee84d52d
Author: Jonas Danielsson <jonas threetimestwo org>
Date:   Wed May 7 08:09:45 2014 +0200

    geoclue: Add 'connected' property
    
    Turn geoclue into a GObject and add a 'connected' property that tells
    us if we are connected to the GeoClue2 DBus service.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=727706

 src/geoclue.js |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/src/geoclue.js b/src/geoclue.js
index cde528d..87692c4 100644
--- a/src/geoclue.js
+++ b/src/geoclue.js
@@ -79,6 +79,18 @@ const LocationProxy = Gio.DBusProxy.makeProxyWrapper(LocationInterface);
 
 const Geoclue = new Lang.Class({
     Name: 'Geoclue',
+    Extends: GObject.Object,
+    Properties: {
+        'connected': GObject.ParamSpec.boolean('connected',
+                                               'Connected',
+                                               'Connected to DBus service',
+                                               GObject.ParamFlags.READABLE,
+                                               false)
+    },
+
+    get connected() {
+        return this._connected;
+    },
 
     overrideLocation: function(location) {
         if (this._clientProxy && this._locationUpdatedId > 0) {
@@ -110,6 +122,9 @@ const Geoclue = new Lang.Class({
     },
 
     _init: function() {
+        this.parent();
+        this._connected = false;
+
         let lastLocation = Application.settings.get('last-location');
         if (lastLocation.length >= 3) {
             let [lat, lng, accuracy] = lastLocation;
@@ -148,6 +163,9 @@ const Geoclue = new Lang.Class({
 
         if (!this.userSetLocation)
             this.findLocation();
+
+        this._connected = true;
+        this.notify('connected');
     },
 
     _onLocationUpdated: function(proxy, sender, [oldPath, newPath]) {


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