[gnome-clocks/wip/geoclue] initial support for geoclue



commit 5928fb51d26106aa106c7584057e838bf5b381e9
Author: Evgeny Bobkin <evgen ibqn gmail com>
Date:   Mon Aug 26 08:52:49 2013 +0200

    initial support for geoclue

 Makefile.am                  |    7 +--
 configure.ac                 |    2 -
 src/geolocation-info.vala    |   59 -----------------
 src/geolocation-monitor.vala |  143 ------------------------------------------
 src/geolocation-utils.vala   |   53 ----------------
 src/world.vala               |   49 +++++++--------
 6 files changed, 24 insertions(+), 289 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 6c85fc0..16007a5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -89,9 +89,6 @@ AM_VALAFLAGS = \
        --pkg libcanberra \
        --pkg libnotify \
        --pkg gio-2.0 \
-       --pkg libsoup-2.4 \
-       --pkg json-glib-1.0 \
-       --thread \
        --gresources  $(top_srcdir)/data/gnome-clocks.gresource.xml
 
 bin_PROGRAMS = gnome-clocks
@@ -113,9 +110,7 @@ VALA_SOURCES = \
        src/timer.vala \
        src/utils.vala \
        src/widgets.vala \
-       src/geolocation-monitor.vala \
-       src/geolocation-info.vala \
-       src/geolocation-utils.vala \
+       src/geoclue.vala \
        src/main.vala
 
 gnome_clocks_SOURCES = \
diff --git a/configure.ac b/configure.ac
index 6a2df26..193dfd4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -56,8 +56,6 @@ PKG_CHECK_MODULES(CLOCKS, [
     gweather-3.0 >= 3.9.3
     gnome-desktop-3.0 >= 3.7.90
     libnotify >= 0.7.0
-    libsoup-2.4 >= 2.43.90
-    json-glib-1.0 >= 0.16.1
 ])
 
 AC_CONFIG_FILES([
diff --git a/src/world.vala b/src/world.vala
index f4b0824..5ea52a9 100644
--- a/src/world.vala
+++ b/src/world.vala
@@ -349,37 +349,34 @@ public class MainPanel : Gtk.Stack, Clocks.Clock {
     }
     
     private async void use_geolocation () {
-        GeoInfo.LocationInfo? geo_location = null;
-        GWeather.Location? found_location = null;
-
-        GeoInfo.LocationMonitor monitor = new GeoInfo.LocationMonitor ();
-
-        try {
-            geo_location = yield monitor.search ();
-
-            found_location = GeoInfo.Utils.search_locations (geo_location.latitude, 
-                                                             geo_location.longitude);
-        } catch (IOError e) {
-            warning ("obtaining geolocation: %s", e.message);
-        }
-
-        if (found_location != null) {
-            bool not_included = true;
+        GClue.GeoInfo geo_info = new GClue.GeoInfo ();
+        
+        geo_info.location_changed.connect ((geo_location) => {
+            GWeather.Location? found_location = null;
+            
+            found_location = Utils.search_locations (geo_location.latitude, 
+                                                     geo_location.longitude);
+            
+            if (found_location != null) {
+                bool not_included = true;
 
-            foreach (Item i in locations) {
-                if (i.location == found_location) {
-                    not_included = false;
+                foreach (Item i in locations) {
+                    if (i.location == found_location) {
+                        not_included = false;
+                    }
                 }
-            }
             
-            if (not_included) {
-                var item = new Item (found_location);
+                if (not_included) {
+                    var item = new Item (found_location);
 
-                locations.append (item);
-                content_view.add_item (item);
-                save ();
+                    locations.append (item);
+                    content_view.add_item (item);
+                    //save ();
+                }
             }
-        }
+        });
+        
+        yield geo_info.seek ();
     }
 
     public void activate_new () {


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