--- trunk/src/main.c 2009/11/24 12:42:31 206 +++ trunk/src/main.c 2009/11/25 10:13:26 211 @@ -597,6 +597,8 @@ static void search_result_free(gpx_t *result); void on_cachelist_destroy(GtkWidget *widget, appdata_t *appdata) { + printf("cachelist destroy\n"); + if(appdata->search_results) { search_result_free(appdata->search_results); appdata->search_results = NULL; @@ -669,7 +671,7 @@ return icon_get(ICON_FILE, 0); } -static void gpxlist_set(GtkListStore *store, GtkTreeIter *iter, gpx_t *gpx) { +void gpxlist_set(GtkListStore *store, GtkTreeIter *iter, gpx_t *gpx) { char date_str[32], cnum[32]; if(gpx->year && gpx->month && gpx->day) { @@ -912,6 +914,28 @@ } } +/* search gpx file in gpx list */ +gboolean gpxlist_find(appdata_t *appdata, GtkTreeIter *iter, gpx_t *gpx) { + GtkTreeModel *model = + gtk_tree_view_get_model(GTK_TREE_VIEW(appdata->gpxview)); + + gboolean found = + gtk_tree_model_get_iter_first(model, iter); + + while(found) { + gpx_t *this_gpx; + gtk_tree_model_get(model, iter, GPXLIST_COL_DATA, &this_gpx, -1); + + if(gpx == this_gpx) + return TRUE; + + found = gtk_tree_model_iter_next(model, iter); + } + + return FALSE; +} + + #ifndef USE_PANNABLE_AREA static gboolean view_selection_func(GtkTreeSelection *selection, GtkTreeModel *model,