]> err.no Git - mapper/commitdiff
Add more init stages for connecting to db, init poi and osm
authorKaj-Michael Lang <milang@tal.org>
Tue, 30 Oct 2007 20:04:41 +0000 (22:04 +0200)
committerKaj-Michael Lang <milang@tal.org>
Tue, 30 Oct 2007 20:04:41 +0000 (22:04 +0200)
src/mapper.c

index d830df8e4b80700bf069cc3174899d77c4cc64e9..9bb6d2e185cf600790493408274bda04740c5dbc 100644 (file)
@@ -67,6 +67,7 @@
 #include "ui-common.h"
 #include "db.h"
 #include "osm-db.h"
+#include "poi.h"
 #include "cb.h"
 #include "speak.h"
 #include "gpx.h"
@@ -101,8 +102,10 @@ enum {
        MAPPER_INIT_MISC,
        MAPPER_INIT_CONFIG,
        MAPPER_INIT_GPS,
-       MAPPER_INIT_VOICE,
        MAPPER_INIT_DB,
+       MAPPER_INIT_POI,
+       MAPPER_INIT_OSM,
+       MAPPER_INIT_VOICE,
        MAPPER_INIT_UI,
        MAPPER_INIT_GOTO,
        MAPPER_INIT_DONE
@@ -222,7 +225,18 @@ switch (mis) {
                mis=MAPPER_INIT_DB;
        break;
        case MAPPER_INIT_DB:
-               osm_init();
+               if (db_connect(&_db, _mapper_db)) {
+                       mis=MAPPER_INIT_POI;
+               } else {
+                       mis=MAPPER_INIT_VOICE;
+               }
+       break;
+       case MAPPER_INIT_POI:
+               poi_init(&_db);
+               mis=MAPPER_INIT_OSM;
+       break;
+       case MAPPER_INIT_OSM:
+               osm_init(&_db);
                mis=MAPPER_INIT_VOICE;
        break;
        case MAPPER_INIT_VOICE: