From: Kaj-Michael Lang Date: Wed, 8 Aug 2007 11:16:41 +0000 (+0300) Subject: Remove some useless output. Some cleanups. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f091eba8cd34bc0efc25d19c57d7469d76dd803e;p=mapper Remove some useless output. Some cleanups. --- diff --git a/src/poi.c b/src/poi.c index 728b0d4..7cc0ad9 100644 --- a/src/poi.c +++ b/src/poi.c @@ -401,11 +401,10 @@ return TRUE; } 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; @@ -413,7 +412,7 @@ 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 */ @@ -442,18 +441,11 @@ while (SQLITE_ROW == sqlite3_step(poisql.select_poi)) { 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, @@ -466,7 +458,6 @@ while (SQLITE_ROW == sqlite3_step(poisql.select_poi)) { } sqlite3_reset(poisql.select_poi); sqlite3_clear_bindings(poisql.select_poi); -*_store=store; *_num_cats=num_cats; return TRUE; } @@ -511,7 +502,6 @@ return TRUE; PoiInfo * poi_find_nearest(gdouble lat, gdouble lon) { -const gchar *_poi_label, *_cat_label; PoiInfo *p; if (!_db) @@ -525,14 +515,10 @@ if (SQLITE_OK == sqlite3_bind_double(poisql.select_nearest_poi, 1, lat) && 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; @@ -559,6 +545,7 @@ while (SQLITE_ROW == sqlite3_step(poisql.selall_cat)) { 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);