Fix:vehicle_demo:Made vehicle_demo use event system
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Fri, 24 Oct 2008 17:01:25 +0000 (17:01 +0000)
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Fri, 24 Oct 2008 17:01:25 +0000 (17:01 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk/navit@1556 ffa7fe5e-494d-0410-b361-a75ebd5db220

configure.in
navit/vehicle/demo/vehicle_demo.c

index cdc14e6..715991c 100644 (file)
@@ -101,7 +101,6 @@ if test "x${glib}" = "xyes"; then
 else
        GLIB_CFLAGS="-I\$(top_srcdir)/navit/support -I\$(top_srcdir)/navit/support/glib -I\$(top_srcdir)/navit/support/ezxml"
        GLIB_LIBS="-L\$(top_builddir)/navit/support/glib -lsupport_glib -L\$(top_builddir)/navit/support/ezxml -lsupport_ezxml"
-       vehicle_demo=no; vehicle_demo_reason="not yet supported without glib"
        vehicle_file=no; vehicle_file_reason="not yet supported without glib"
 fi
 
index 4c73ed2..24e36dd 100644 (file)
@@ -30,6 +30,7 @@
 #include "transform.h"
 #include "plugin.h"
 #include "vehicle.h"
+#include "event.h"
 
 struct vehicle_priv {
        int interval;
@@ -41,6 +42,9 @@ struct vehicle_priv {
        double config_speed;
        double speed;
        double direction;
+       struct callback *timer_callback;
+       struct event_timeout *timer;
+
 };
 
 static void
@@ -87,7 +91,7 @@ struct vehicle_methods vehicle_demo_methods = {
        vehicle_demo_set_attr,
 };
 
-static int
+static void
 vehicle_demo_timer(struct vehicle_priv *priv)
 {
        struct coord c, c2, pos, ci;
@@ -154,7 +158,6 @@ vehicle_demo_timer(struct vehicle_priv *priv)
        }
        if (mr)
                map_rect_destroy(mr);
-       return 1;
 }
 
 
@@ -183,7 +186,8 @@ vehicle_demo_new(struct vehicle_methods
                dbg(0,"position_set %f %f\n", ret->geo.lat, ret->geo.lng);
        }
        *meth = vehicle_demo_methods;
-       g_timeout_add(ret->interval, (GSourceFunc) vehicle_demo_timer, ret);
+       ret->timer_callback=callback_new_1(callback_cast(vehicle_demo_timer), ret);
+       ret->timer=event_add_timeout(ret->interval, 1, ret->timer_callback);
        return ret;
 }