From: Kaj-Michael Lang Date: Tue, 24 Jul 2007 09:53:47 +0000 (+0300) Subject: Remove more references to POIs in variables X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=57dfd6098bb3818cda0b50720ca596489be4bf19;p=mapper Remove more references to POIs in variables as the database is not just for POIs anymore. Start to a a track point filter using OSM data. --- diff --git a/src/config.c b/src/config.c index ec1df43..0494636 100644 --- a/src/config.c +++ b/src/config.c @@ -372,11 +372,11 @@ config_save() } } - /* Save POI database. */ + /* Save Mapper database. */ if (_mapper_db) - gconf_client_set_string(gconf_client, GCONF_KEY_POI_DB, _mapper_db, NULL); + gconf_client_set_string(gconf_client, GCONF_KEY_MAPPER_DB, _mapper_db, NULL); else - gconf_client_unset(gconf_client, GCONF_KEY_POI_DB, NULL); + gconf_client_unset(gconf_client, GCONF_KEY_MAPPER_DB, NULL); /* Save Show POI below zoom. */ gconf_client_set_int(gconf_client, GCONF_KEY_POI_ZOOM, _poi_zoom, NULL); @@ -734,16 +734,14 @@ void config_init() } } - /* Get POI Database. Default is in REPO_DEFAULT_CACHE_BASE */ - _mapper_db = gconf_client_get_string(gconf_client, GCONF_KEY_POI_DB, NULL); + /* Get Mapper Database. Default is in REPO_DEFAULT_CACHE_BASE */ + _mapper_db = gconf_client_get_string(gconf_client, GCONF_KEY_MAPPER_DB, NULL); if (_mapper_db == NULL) { - gchar *poi_base = - gnome_vfs_expand_initial_tilde(REPO_DEFAULT_CACHE_BASE); - _mapper_db = - gnome_vfs_uri_make_full_from_relative(poi_base, "poi.db"); + gchar *poi_base = gnome_vfs_expand_initial_tilde(REPO_DEFAULT_CACHE_BASE); + _mapper_db = gnome_vfs_uri_make_full_from_relative(poi_base, "poi.db"); g_free(poi_base); } - poi_db_connect(&_db, _mapper_db); + mapper_db_connect(&_db, _mapper_db); _poi_zoom = gconf_client_get_int(gconf_client, GCONF_KEY_POI_ZOOM, NULL); diff --git a/src/poi.c b/src/poi.c index 1446993..adc3e99 100644 --- a/src/poi.c +++ b/src/poi.c @@ -250,10 +250,14 @@ poi_db_prepare(sqlite3 *db) } gboolean -poi_db_disconnect(sqlite3 **db) +mapper_db_disconnect(sqlite3 **db) { if (db && *db) { - /* XXX: Handle prepared statements */ + /* XXX: Handle the prepared statements */ +#if 0 + poi_db_unprepare(*db); + osm_db_unprepare(*db); +#endif sqlite3_close(*db); return TRUE; } @@ -261,9 +265,9 @@ return FALSE; } gboolean -poi_db_connect(sqlite3 **db, const gchar *poi_db) +mapper_db_connect(sqlite3 **db, const gchar *data_db) { -if (db_connect(db, poi_db)) { +if (db_connect(db, data_db)) { poi_db_create(*db); if (poi_db_prepare(*db)==FALSE) g_printerr("Failed to prepare POI SQL statements"); diff --git a/src/settings-gconf.h b/src/settings-gconf.h index cbbaf80..3c07f41 100644 --- a/src/settings-gconf.h +++ b/src/settings-gconf.h @@ -59,8 +59,10 @@ #define GCONF_KEY_SPEED_LIMIT GCONF_KEY_PREFIX"/speed_limit" #define GCONF_KEY_SPEED_LOCATION GCONF_KEY_PREFIX"/speed_location" +/* Database */ +#define GCONF_KEY_MAPPER_DB GCONF_KEY_PREFIX"/mapper_db" + /* POI */ -#define GCONF_KEY_POI_DB GCONF_KEY_PREFIX"/poi_db" #define GCONF_KEY_POI_ZOOM GCONF_KEY_PREFIX"/poi_zoom" #define GCONF_KEY_AUTOCENTER_MODE GCONF_KEY_PREFIX"/autocenter_mode" diff --git a/src/settings-gui.c b/src/settings-gui.c index 3933351..772b6f5 100644 --- a/src/settings-gui.c +++ b/src/settings-gui.c @@ -415,6 +415,7 @@ gboolean settings_dialog() GtkWidget *num_angle; GtkWidget *num_hdop_ratio; GtkWidget *num_vdop_ratio; + GtkWidget *num_osm_dist; BrowseInfo browse_info = { 0, 0 }; ScanInfo scan_info = { 0 }; @@ -474,7 +475,7 @@ gboolean settings_dialog() gtk_misc_set_alignment(GTK_MISC(label), 0.5f, 0.5f); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), - table = gtk_table_new(2, 4, FALSE), + table = gtk_table_new(2, 5, FALSE), label = gtk_label_new(_("Filter"))); gtk_table_attach(GTK_TABLE(table), @@ -506,6 +507,15 @@ gboolean settings_dialog() hildon_controlbar_set_range(HILDON_CONTROLBAR(num_angle), 0, 45); force_min_visible_bars(HILDON_CONTROLBAR(num_angle), 1); + /* Distance to OSM data */ + gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("OSM Data")), + 0, 1, 4, 5, GTK_FILL, 0, 2, 4); + gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f); + gtk_table_attach(GTK_TABLE(table), num_osm_dist = hildon_controlbar_new(), + 1, 2, 4, 5, GTK_EXPAND | GTK_FILL, 0, 2, 4); + hildon_controlbar_set_range(HILDON_CONTROLBAR(num_osm_dist), 0, 5000); + force_min_visible_bars(HILDON_CONTROLBAR(num_osm_dist), 1); + /* Auto-Center page. */ gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table = gtk_table_new(2, 2, FALSE), @@ -677,7 +687,7 @@ gboolean settings_dialog() gtk_combo_box_append_text(GTK_COMBO_BOX(cmb_speed_location), SPEED_LOCATION_TEXT[i]); - /* POI page */ + /* Database page */ gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table = gtk_table_new(2, 3, FALSE), label = gtk_label_new(_("Database"))); @@ -822,18 +832,18 @@ gboolean settings_dialog() _gps_filter = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chk_gps_filter)); if (_db) { - poi_db_disconnect(&_db); + mapper_db_disconnect(&_db); _db = NULL; } g_free(_mapper_db); if (strlen(gtk_entry_get_text(GTK_ENTRY(txt_mapper_db)))) { _mapper_db = g_strdup(gtk_entry_get_text(GTK_ENTRY(txt_mapper_db))); - poi_db_connect(&_db, _mapper_db); + mapper_db_connect(&_db, _mapper_db); } else { _mapper_db = NULL; } - /* Sensitize menus based on whether we have a POI database conn. */ + /* Sensitize menus based on whether we have a database conn. */ gtk_widget_set_sensitive(_cmenu_loc_add_poi, _db != NULL); gtk_widget_set_sensitive(_cmenu_way_add_poi, _db != NULL); gtk_widget_set_sensitive(_cmenu_poi, _db != NULL);