}
gboolean
-poi_get_list(guint unitx, guint unity, GtkListStore **_store, guint *_num_cats)
+poi_get_list(guint unitx, guint unity, GtkListStore **store, guint *_num_cats)
{
guint x, y;
gdouble lat1, lon1, lat2, lon2;
-GtkListStore *store;
GtkTreeIter iter;
gchar tmp1[16], tmp2[16];
gint num_cats=0;
if (!_db)
return FALSE;
-store = gtk_list_store_new(POI_NUM_COLUMNS, G_TYPE_INT, /* POI ID */
+*store = gtk_list_store_new(POI_NUM_COLUMNS, G_TYPE_INT, /* POI ID */
G_TYPE_INT, /* Category ID */
G_TYPE_DOUBLE, /* Latitude */
G_TYPE_DOUBLE, /* Longitude */
gdouble lat, lon;
lat = sqlite3_column_double(poisql.select_poi, 0);
lon = sqlite3_column_double(poisql.select_poi, 1);
- g_printf("Found POI(%d): %f, %f, %s, %s, %s\n",
- num_cats,
- lat,
- lon,
- sqlite3_column_text(poisql.select_poi, 3),
- sqlite3_column_text(poisql.select_poi, 4),
- sqlite3_column_text(poisql.select_poi, 6));
-
lat_format(lat, tmp1);
lon_format(lon, tmp2);
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
+
+ gtk_list_store_append(*store, &iter);
+ gtk_list_store_set(*store, &iter,
POI_POIID, sqlite3_column_int(poisql.select_poi, 2),
POI_CATID, sqlite3_column_int(poisql.select_poi, 5),
POI_LAT, lat, POI_LON, lon, POI_LATLON,
}
sqlite3_reset(poisql.select_poi);
sqlite3_clear_bindings(poisql.select_poi);
-*_store=store;
*_num_cats=num_cats;
return TRUE;
}
PoiInfo *
poi_find_nearest(gdouble lat, gdouble lon)
{
-const gchar *_poi_label, *_cat_label;
PoiInfo *p;
if (!_db)
&& SQLITE_ROW == sqlite3_step(poisql.select_nearest_poi)) {
p=poi_new();
-
p->lat = sqlite3_column_double(poisql.select_nearest_poi, 0);
p->lon = sqlite3_column_double(poisql.select_nearest_poi, 1);
- _poi_label = sqlite3_column_text(poisql.select_nearest_poi, 2);
- _cat_label = sqlite3_column_text(poisql.select_nearest_poi, 3);
- p->label=g_strdup(_poi_label);
- p->cat_label=g_strdup(_cat_label);
- g_printf("%f %f %s %s\n", p->lat, p->lon, p->label, p->cat_label);
+ p->label=g_strdup(sqlite3_column_text(poisql.select_nearest_poi, 2));
+ p->cat_label=g_strdup(sqlite3_column_text(poisql.select_nearest_poi, 3));
return p;
}
return NULL;
CAT_DESC, sqlite3_column_text(poisql.selall_cat, 2),
CAT_POI_CNT, sqlite3_column_int(poisql.selall_cat, 6), -1);
}
+
sqlite3_reset(poisql.selall_cat);
sqlite3_clear_bindings(poisql.selall_cat);