-1, &poisql.select_poi_by_id, NULL)!=SQLITE_OK)
return FALSE;
- /* Search POIs by label */
+ /* Search POIs by label and any category */
if (sqlite3_prepare_v2(db,
"select "
POI_BASE_SQL_FIELDS
-1, &poisql.select_poi_search, NULL)!=SQLITE_OK)
return FALSE;
- /* Search POI by label and specific category */
+ /* Search POI by label and category */
if (sqlite3_prepare_v2(db,
"select "
POI_BASE_SQL_FIELDS
-1, &poisql.select_poi_search_cat, NULL)!=SQLITE_OK)
return FALSE;
- /* Search specific category */
+ /* Search POIs by category */
if (sqlite3_prepare_v2(db,
"select "
POI_BASE_SQL_FIELDS
-1, &poisql.select_poi_by_cat, NULL)!=SQLITE_OK)
return FALSE;
- /* Select nearest POI */
+ /* Select any nearest POI */
if (sqlite3_prepare_v2(db,
"select "
POI_MINI_SQL_FIELDS
gboolean
poi_get_list_inside(gdouble lat1, gdouble lon1, gdouble lat2, gdouble lon2, GtkListStore **store, guint *num_poi)
{
+static active=FALSE;
GtkTreeIter iter;
gchar tmp1[16], tmp2[16];
if (!_db)
return FALSE;
+if (active)
+ return FALSE;
+
+active=TRUE;
if (SQLITE_OK != sqlite3_bind_double(poisql.select_poi, 1, lat1) ||
SQLITE_OK != sqlite3_bind_double(poisql.select_poi, 2, lat2) ||
SQLITE_OK != sqlite3_bind_double(poisql.select_poi, 3, lon1) ||
}
sqlite3_reset(poisql.select_poi);
sqlite3_clear_bindings(poisql.select_poi);
+active=FALSE;
return TRUE;
}
GdkPixbuf *
poi_get_icon(gchar *icon, gboolean big)
{
-gchar buffer[100];
+static guint hit=0;
+static guint miss=0;
+gchar buffer[256];
GdkPixbuf *pixbuf;
GError *error = NULL;
if (strlen(icon)==0)
return NULL;
+g_debug("POI icon cache: %d / %d\n", hit, miss);
+
g_snprintf(buffer, sizeof(buffer), "%s/%s.%s/%s.png",
theme_base, theme, (big==TRUE) ? "big" : "small", icon);
+g_debug("Loading POI icon: %s", buffer);
pixbuf=g_hash_table_lookup(poi_icon_hash, buffer);
-if (pixbuf)
+if (pixbuf) {
+ hit++;
return pixbuf;
+}
+miss++;
pixbuf=gdk_pixbuf_new_from_file(buffer, &error);