along with this program. If not, see <http://www.gnu.org/licenses/>.
****/
+#include <math.h>
+
#include "callbacks.h"
+#include "appdata.h"
+#include "util.h"
-static void print_stuff(LocationGPSDevice* device) {
+// this is just here for debugging
+static void print_location(LocationGPSDevice* device) {
g_print("Latitude: %.2f\n"
"Longitude: %.2f\n"
"Altitude: %.2f\n"
- "Speed: %d",
+ "Speed: %.2d\n",
device->fix->latitude,
device->fix->longitude,
device->fix->altitude,
device->fix->speed);
}
-void location_changed(LocationGPSDevice* device, gpointer userdata) {
+void location_changed(LocationGPSDevice* device, gpointer data) {
+ //print_location(device);
+ g_assert(data);
+ g_assert(device);
+
+ AppData* appdata = (AppData*) data;
+
+ // check for NaN before passing values
+ if(device->fix->fields & LOCATION_GPS_DEVICE_SPEED_SET) {
+ if(!isnan(device->fix->speed)) {
+ interpret_speed_from_gps(appdata, device->fix->speed);
+ }
+ }
}
gboolean key_press_cb(GtkWidget* widget, GdkEventKey* event, HildonWindow* window) {
return FALSE;
}
+
+gboolean top_event_box_button_press(GtkWidget* widget, GdkEventButton* event, gpointer data) {
+ gdouble x = event->x;
+ g_print("Top event box pressed at: %f\n", x);
+ AppData* appdata = (AppData*) data;
+
+ if(x > 750) {
+ g_print("Exiting..\n");
+ stop_gps(appdata);
+ g_signal_emit_by_name(appdata->window, "delete_event");
+ }
+ else {
+ randomize(appdata);
+ }
+ return TRUE;
+}
+
+
+gboolean bottom_event_box_button_press(GtkWidget* widget, GdkEventButton* event, gpointer data) {
+ gdouble x = event->x;
+ g_print("Bottom event box pressed at: %f\n", x);
+ AppData* appdata = (AppData*) data;
+
+ randomize(data);
+ return TRUE;
+}
+