From 60499b90f7998af3b63b14f100615261e44901b9 Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Thu, 1 Nov 2007 02:47:42 +0200 Subject: [PATCH] First try of way search, untested... --- src/osm-db.h | 2 ++ src/search.c | 11 +++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/osm-db.h b/src/osm-db.h index 9a3292e..dccc2ed 100644 --- a/src/osm-db.h +++ b/src/osm-db.h @@ -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); diff --git a/src/search.c b/src/search.c index 930c2e0..9a6c804 100644 --- a/src/search.c +++ b/src/search.c @@ -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: -- 2.39.5