while (SQLITE_ROW == sqlite3_step(sql.select_way_name_search)) {
gdouble rlat, rlon, dist;
- rlat=sqlite3_column_double(sql.select_way_name_search, 2);
- rlon=sqlite3_column_double(sql.select_way_name_search, 3);
+ rlat=sqlite3_column_double(sql.select_way_name_search, 3);
+ rlon=sqlite3_column_double(sql.select_way_name_search, 4);
lat_format(rlat, tmp1);
lon_format(rlon, tmp2);
- dist=0.0;
+ dist=calculate_distance(lat, lon, rlat, rlon) * UNITS_CONVERT[_units];
gtk_list_store_append(*store, &iter);
gtk_list_store_set(*store, &iter,
ITEM_DIST, dist,
ITEM_LATLON, g_strdup_printf("%s, %s", tmp1, tmp2),
ITEM_LABEL, sqlite3_column_text(sql.select_way_name_search, 1),
- ITEM_DESC, sqlite3_column_text(sql.select_way_name_search, 4),
-1);
rows++;
}
rlon=sqlite3_column_double(sql, 1);
lat_format(rlat, tmp1);
lon_format(rlon, tmp2);
-
- dist=calculate_distance(lat, lon, rlat, rlon);
+ dist=calculate_distance(lat, lon, rlat, rlon) * UNITS_CONVERT[_units];
gtk_list_store_append(*store, &iter);
gtk_list_store_set(*store, &iter,
gchar *st;
guint cid;
GtkTreeIter iter;
+guint slen;
search_dialog *s=(search_dialog *)data;
-if ((strlen(gtk_entry_get_text(GTK_ENTRY(s->search_entry)))<2) && (cid==-1)) {
+slen=strlen(gtk_entry_get_text(GTK_ENTRY(s->search_entry)));
+
+if (slen<2 && s->stype==SEARCH_TYPE_POI && cid!=-1) {
popup_error(s->dialog, _("Query string too short. Minimum 2 characters."));
return TRUE;
+} else if (slen<3 && s->stype!=SEARCH_TYPE_POI) {
+ popup_error(s->dialog, _("Query string too short. Minimum 3 characters."));
+ return TRUE;
}
st=g_strdup(gtk_entry_get_text(GTK_ENTRY(s->search_entry)));