]> err.no Git - mapper/commitdiff
Remove more references to POIs in variables
authorKaj-Michael Lang <milang@angel.tal.org>
Tue, 24 Jul 2007 09:53:47 +0000 (12:53 +0300)
committerKaj-Michael Lang <milang@angel.tal.org>
Tue, 24 Jul 2007 09:53:47 +0000 (12:53 +0300)
as the database is not just for POIs anymore.
Start to a a track point filter using OSM data.

src/config.c
src/poi.c
src/settings-gconf.h
src/settings-gui.c

index ec1df432f3d63ca83f3df6912a6c065b486e1108..049463673b25520c5f524b59e6a95aeb9dd3a796 100644 (file)
@@ -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);
index 1446993ff9cc8d3f88dcc8c7317b9ffe2bfc2017..adc3e99cc60dd3c38f00a9b38223b987b34585d0 100644 (file)
--- 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");
index cbbaf80bc85309d684fda5391c0f8cd7be2b4c72..3c07f4150f8c4d5c9756af3cd943c616120dd905 100644 (file)
 #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"
index 3933351c8f4f6840e3f1d9a5d53f2d1583f8dc4d..772b6f5122bb528f316d5e4609413648c3cfb9a3 100644 (file)
@@ -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);