]> err.no Git - mapper/commitdiff
First try of way search, untested...
authorKaj-Michael Lang <milang@tal.org>
Thu, 1 Nov 2007 00:47:42 +0000 (02:47 +0200)
committerKaj-Michael Lang <milang@tal.org>
Thu, 1 Nov 2007 00:47:42 +0000 (02:47 +0200)
src/osm-db.h
src/search.c

index 9a3292e15ee6d004b91c019e546feed64acc1616..dccc2ed747c37a86f426d8299f6f2b59c5e5d6bf 100644 (file)
@@ -37,6 +37,8 @@ gboolean osm_way_search(gdouble lat, gdouble lon, gchar *text, GtkListStore **st
 void osm_progress_set_widget(sqlite3 *db, GtkProgressBar *w);
 gboolean osm_db_prepare(sqlite3 *db);
 
+gboolean osm_way_search(gdouble lat, gdouble lon, gchar *text, GtkListStore **store);
+
 gboolean osm_way_get_nodes(osm_way *w);
 gboolean osm_way_get_name(osm_way *w);
 gboolean osm_way_get_ref(osm_way *w);
index 930c2e031c418d09fff2e8e5a5dab229643b6d58..9a6c804d4c55b87c514827a7ce3a1c7a9a5e211d 100644 (file)
@@ -86,12 +86,12 @@ guint cid;
 GtkTreeIter iter;
 search_dialog *s=(search_dialog *)data;
 
-if ((strlen(gtk_entry_get_text(s->search_entry))<2) && (cid==-1)) {
+if ((strlen(gtk_entry_get_text(GTK_ENTRY(s->search_entry)))<2) && (cid==-1)) {
        popup_error(s->dialog, _("Query string too short. Minimum 2 characters."));
        return TRUE;
 }
 
-st=g_strdup(gtk_entry_get_text(s->search_entry));
+st=g_strdup(gtk_entry_get_text(GTK_ENTRY(s->search_entry)));
 
 switch (s->stype) {
        case SEARCH_TYPE_POI:
@@ -109,6 +109,13 @@ switch (s->stype) {
        }
        break;
        case SEARCH_TYPE_WAY:
+               if (osm_way_search(s->lat, s->lon, st, &s->store)==TRUE) {
+                       gtk_tree_view_set_model(GTK_TREE_VIEW(s->list), GTK_TREE_MODEL(s->store));
+                       g_object_unref(G_OBJECT(s->store));
+               } else {
+                       s->store=NULL;
+                       gtk_tree_view_set_model(GTK_TREE_VIEW(s->list), GTK_TREE_MODEL(s->store));
+               }
                popup_error(s->dialog, "Not yet implemented");
        break;
        case SEARCH_TYPE_PLACE: