GtkWidget *list;
GtkWidget *search_entry;
GtkWidget *btn_edit;
+ GtkWidget *label;
GtkListStore *store;
gdouble lat;
gdouble lon;
GtkTreeIter iter;
guint slen;
search_dialog *s=(search_dialog *)data;
-
+gboolean sres=FALSE;
slen=strlen(gtk_entry_get_text(GTK_ENTRY(s->search_entry)));
if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(s->cmb_category), &iter)==TRUE)
switch (s->stype) {
case SEARCH_TYPE_POI:
- if (poi_search((cid==-1) ? POI_SEARCH_TEXT : POI_SEARCH_TEXT_CAT, s->lat, s->lon, st, cid, &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));
- }
+ sres=poi_search((cid==-1) ? POI_SEARCH_TEXT : POI_SEARCH_TEXT_CAT, s->lat, s->lon, st, cid, &s->store);
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));
- }
+ sres=osm_way_search(s->lat, s->lon, st, &s->store);
break;
case SEARCH_TYPE_PLACE:
popup_error(s->dialog, "Not yet implemented");
+ sres=FALSE;
break;
}
+
+if (sres==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));
+}
+
g_free(st);
return TRUE;
}
gtk_tree_view_set_search_column (GTK_TREE_VIEW(sd.list), ITEM_LABEL);
gtk_container_add(GTK_CONTAINER(sw), sd.list);
+sd.label=gtk_label_new("");
+gtk_box_pack_start(GTK_BOX(hbox), sd.label, FALSE, FALSE, 0);
+
g_signal_connect(G_OBJECT(btn_search), "clicked", G_CALLBACK(search_do_cb), &sd);
g_signal_connect(G_OBJECT(btn_goto), "clicked", G_CALLBACK(search_goto_cb), &sd);
g_signal_connect(G_OBJECT(btn_route_to), "clicked", G_CALLBACK(search_route_to_cb), &sd);