15 |
* along with GPXView. If not, see <http://www.gnu.org/licenses/>. |
* along with GPXView. If not, see <http://www.gnu.org/licenses/>. |
16 |
*/ |
*/ |
17 |
|
|
18 |
#include <stdio.h> |
#define __USE_GNU |
19 |
#include <string.h> |
#include <string.h> |
20 |
|
|
21 |
|
#include <stdio.h> |
22 |
#include <math.h> |
#include <math.h> |
23 |
|
|
24 |
#include <curl/curl.h> |
#include <curl/curl.h> |
157 |
gpx_dialog_t *dialog = gpx_busy_dialog_new(GTK_WIDGET(appdata->window)); |
gpx_dialog_t *dialog = gpx_busy_dialog_new(GTK_WIDGET(appdata->window)); |
158 |
|
|
159 |
if(!whole_dir) |
if(!whole_dir) |
160 |
gpx = gpx_parse(dialog, filename); |
gpx = gpx_parse(dialog, filename, appdata->username); |
161 |
else { |
else { |
162 |
/* cur trailing '/' if present */ |
/* cur trailing '/' if present */ |
163 |
if(strlastchr(filename) == '/') |
if(strlastchr(filename) == '/') |
164 |
filename[strlen(filename)] = 0; |
filename[strlen(filename)] = 0; |
165 |
|
|
166 |
gpx = gpx_parse_dir(dialog, filename); |
gpx = gpx_parse_dir(dialog, filename, appdata->username); |
167 |
} |
} |
168 |
|
|
169 |
gpx_busy_dialog_destroy(dialog); |
gpx_busy_dialog_destroy(dialog); |
170 |
|
|
171 |
/* save path if gpx was successfully loaded */ |
/* save path if gpx was successfully loaded */ |
476 |
if(tint > 8) tint = 8; |
if(tint > 8) tint = 8; |
477 |
|
|
478 |
/* cache type includes "solved" flag in lowest bit */ |
/* cache type includes "solved" flag in lowest bit */ |
479 |
int type = (cache->type<<8) + |
int type = cache->type<<8; |
480 |
(cache->notes?4:0) + |
if(cache->notes) type |= 4; |
481 |
((cache->notes && cache->notes->override)?1:0) + |
if(cache->notes && cache->notes->override) type |= 1; |
482 |
((cache->notes && cache->notes->found)?2:0); |
if(cache->notes && cache->notes->found) type |= 2; |
483 |
|
if(cache->found) type |= 2; |
484 |
|
if(cache->mine) type |= 8; |
485 |
|
|
486 |
if((!(type & 2)) || !appdata->cachelist_hide_found) { |
if((!(type & 2)) || !appdata->cachelist_hide_found) { |
487 |
|
|
597 |
static void search_result_free(gpx_t *result); |
static void search_result_free(gpx_t *result); |
598 |
|
|
599 |
void on_cachelist_destroy(GtkWidget *widget, appdata_t *appdata) { |
void on_cachelist_destroy(GtkWidget *widget, appdata_t *appdata) { |
600 |
|
printf("cachelist destroy\n"); |
601 |
|
|
602 |
if(appdata->search_results) { |
if(appdata->search_results) { |
603 |
search_result_free(appdata->search_results); |
search_result_free(appdata->search_results); |
604 |
appdata->search_results = NULL; |
appdata->search_results = NULL; |
671 |
return icon_get(ICON_FILE, 0); |
return icon_get(ICON_FILE, 0); |
672 |
} |
} |
673 |
|
|
674 |
static void gpxlist_set(GtkListStore *store, GtkTreeIter *iter, gpx_t *gpx) { |
void gpxlist_set(GtkListStore *store, GtkTreeIter *iter, gpx_t *gpx) { |
675 |
char date_str[32], cnum[32]; |
char date_str[32], cnum[32]; |
676 |
|
|
677 |
if(gpx->year && gpx->month && gpx->day) { |
if(gpx->year && gpx->month && gpx->day) { |
870 |
gpx_t *new = NULL; |
gpx_t *new = NULL; |
871 |
|
|
872 |
if(g_file_test(gpx->filename, G_FILE_TEST_IS_DIR)) |
if(g_file_test(gpx->filename, G_FILE_TEST_IS_DIR)) |
873 |
new = gpx_parse_dir(dialog, gpx->filename); |
new = gpx_parse_dir(dialog, gpx->filename, appdata->username); |
874 |
else |
else |
875 |
new = gpx_parse(dialog, gpx->filename); |
new = gpx_parse(dialog, gpx->filename, appdata->username); |
876 |
|
|
877 |
if(new) { |
if(new) { |
878 |
gpx_t **prev = &(appdata->gpx); |
gpx_t **prev = &(appdata->gpx); |
914 |
} |
} |
915 |
} |
} |
916 |
|
|
917 |
|
/* search gpx file in gpx list */ |
918 |
|
gboolean gpxlist_find(appdata_t *appdata, GtkTreeIter *iter, gpx_t *gpx) { |
919 |
|
GtkTreeModel *model = |
920 |
|
gtk_tree_view_get_model(GTK_TREE_VIEW(appdata->gpxview)); |
921 |
|
|
922 |
|
gboolean found = |
923 |
|
gtk_tree_model_get_iter_first(model, iter); |
924 |
|
|
925 |
|
while(found) { |
926 |
|
gpx_t *this_gpx; |
927 |
|
gtk_tree_model_get(model, iter, GPXLIST_COL_DATA, &this_gpx, -1); |
928 |
|
|
929 |
|
if(gpx == this_gpx) |
930 |
|
return TRUE; |
931 |
|
|
932 |
|
found = gtk_tree_model_iter_next(model, iter); |
933 |
|
} |
934 |
|
|
935 |
|
return FALSE; |
936 |
|
} |
937 |
|
|
938 |
|
|
939 |
#ifndef USE_PANNABLE_AREA |
#ifndef USE_PANNABLE_AREA |
940 |
static gboolean |
static gboolean |
941 |
view_selection_func(GtkTreeSelection *selection, GtkTreeModel *model, |
view_selection_func(GtkTreeSelection *selection, GtkTreeModel *model, |