]> ToastFreeware Gitweb - gregoa/zavai.git/blobdiff - src/app_gps.vala
butcher butcher butcher
[gregoa/zavai.git] / src / app_gps.vala
index f479ab4bae1de44bc02cf2ef6692a199ed8e87d6..65aebb464bcef68fff24f93f7d6567cb85cb88b6 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * gpx_trace - zavai GPX trace functions
  *
- * Copyright (C) 2009  Enrico Zini <enrico@enricozini.org>
+ * Copyright (C) 2009--2010  Enrico Zini <enrico@enricozini.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -24,18 +24,17 @@ namespace zavai {
 namespace ui {
 namespace gps {
 
-#if 0
 public class Waypoint : BigButton
 {
     public Waypoint()
     {
         set_label("Take waypoint");
-        zavai.gps.gpx.tracking_changed += on_gpx_tracking_changed;
+        zavai.gps.gpx.toggled += on_gpx_toggled;
         clicked += on_clicked;
-        set_sensitive(zavai.gps.gpx.tracking);
+        set_sensitive(zavai.gps.gpx.started);
     }
 
-    protected void on_gpx_tracking_changed(zavai.gps.GPX gpx, bool new_state)
+    protected void on_gpx_toggled(bool new_state)
     {
         stderr.printf("Toggled %d\n", (int)new_state);
         set_sensitive(new_state);
@@ -93,7 +92,6 @@ class GPXAudioTracer(gtk.ToggleAction):
         else:
             self.recorder.stop()
 */
-#endif
 
 public class GPSRequestLink : Gtk.ToggleButton
 {
@@ -107,6 +105,7 @@ public class GPSRequestLink : Gtk.ToggleButton
         label_start = "Keep GPS on";
         label_stop = "Stop keeping GPS on";
         set_size_request(0, zavai.config.min_button_height);
+        set_active(zavai.gps.gps.started);
         toggled += on_toggled;
 
         set_label(get_active() ? label_stop : label_start);
@@ -141,7 +140,6 @@ public class GPSRequestLink : Gtk.ToggleButton
 
     private void on_toggled(Gtk.Button src)
     {
-stderr.printf("TOGGOLED\n");
         if (get_active())
             zavai.gps.gps.request("servicerequestlink");
         else
@@ -156,30 +154,6 @@ stderr.printf("TOGGOLED\n");
     }
 }
 
-#if 0
-public class GPSStuck : Gtk.Button
-{
-    protected bool happened;
-
-    public GPSStuck()
-    {
-        label = "The GPS is stuck";
-        happened = false;
-        clicked += on_clicked;
-        set_size_request(0, zavai.config.min_button_height);
-    }
-
-    public void on_clicked()
-    {
-        zavai.gps.gps.power_cycle(happened);
-        happened = !happened;
-        if (happened)
-            label = "The GPS is stuck AGAIN";
-        else
-            label = "The GPS is stuck";
-    }
-}
-#endif
 public void init()
 {
     /*
@@ -187,13 +161,13 @@ public void init()
     */
 
     // Apps
-    // var menu_waypoint = new Waypoint();
+    var menu_waypoint = new Waypoint();
     var menu_gpsrequest = new GPSRequestLink();
 
     // Menus
     zavai.menu_gps.add_service_toggle(zavai.gps.gpx, "Start GPX trace", "Stop GPX trace");
     //zavai.menu_gps.add_applet("ui.gps.monitor");
-    //zavai.menu_gps.add_widget(menu_waypoint);
+    zavai.menu_gps.add_widget(menu_waypoint);
     zavai.menu_gps.add_widget(menu_gpsrequest);
     //zavai.menu_gps.add_widget(new GPSStuck());
 }