35 |
|
|
36 |
extern char *strcasestr (__const char *__haystack, __const char *__needle); |
extern char *strcasestr (__const char *__haystack, __const char *__needle); |
37 |
|
|
38 |
#ifdef USE_BREAD_CRUMB_TRAIL |
#if defined(USE_BREAD_CRUMB_TRAIL) || defined(MY_BCT) |
39 |
static void crumb_add(appdata_t *appdata, char *name, int level, |
static void crumb_add(appdata_t *appdata, char *name, int level, |
40 |
gpointer user_data); |
gpointer user_data); |
41 |
|
|
95 |
GtkWidget *dialog = gtk_message_dialog_new( |
GtkWidget *dialog = gtk_message_dialog_new( |
96 |
GTK_WINDOW(NULL), |
GTK_WINDOW(NULL), |
97 |
GTK_DIALOG_DESTROY_WITH_PARENT, |
GTK_DIALOG_DESTROY_WITH_PARENT, |
98 |
GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, |
#if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5) |
99 |
buf); |
GTK_MESSAGE_ERROR, |
100 |
|
#else |
101 |
|
GTK_MESSAGE_OTHER, |
102 |
|
#endif |
103 |
|
GTK_BUTTONS_CLOSE, buf); |
104 |
|
|
105 |
gtk_window_set_title(GTK_WINDOW(dialog), _("ERROR")); |
gtk_window_set_title(GTK_WINDOW(dialog), _("ERROR")); |
106 |
|
|
142 |
gtk_widget_show_all (GTK_WIDGET(dialog)); |
gtk_widget_show_all (GTK_WIDGET(dialog)); |
143 |
if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_FM_OK) { |
if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_FM_OK) { |
144 |
char *filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); |
char *filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); |
145 |
|
|
146 |
|
if(filename) { |
147 |
|
gpx_dialog_t *dialog = gpx_busy_dialog_new(GTK_WIDGET(appdata->window)); |
148 |
|
|
149 |
gpx_dialog_t *dialog = gpx_busy_dialog_new(GTK_WIDGET(appdata->window)); |
if(!whole_dir) |
150 |
|
gpx = gpx_parse(dialog, filename); |
151 |
if(!whole_dir) |
else { |
152 |
gpx = gpx_parse(dialog, filename); |
/* cur trailing '/' if present */ |
153 |
else { |
if(strlastchr(filename) == '/') |
154 |
/* cur trailing '/' if present */ |
filename[strlen(filename)] = 0; |
155 |
if(strlastchr(filename) == '/') |
|
156 |
filename[strlen(filename)] = 0; |
gpx = gpx_parse_dir(dialog, filename); |
|
|
|
|
gpx = gpx_parse_dir(dialog, filename); |
|
|
} |
|
|
|
|
|
gpx_busy_dialog_destroy(dialog); |
|
|
|
|
|
/* save path if gpx was successfully loaded */ |
|
|
if(gpx) { |
|
|
char *r = strrchr(filename, '/'); |
|
|
|
|
|
/* there is a delimiter, use everything left of it as path */ |
|
|
if(r && !whole_dir) { |
|
|
*r = 0; |
|
|
if(appdata->path) free(appdata->path); |
|
|
appdata->path = strdup(filename); |
|
|
/* restore path ... just in case ... */ |
|
|
*r = '/'; |
|
157 |
} |
} |
158 |
|
|
159 |
|
gpx_busy_dialog_destroy(dialog); |
160 |
|
|
161 |
|
/* save path if gpx was successfully loaded */ |
162 |
|
if(gpx) { |
163 |
|
char *r = strrchr(filename, '/'); |
164 |
|
|
165 |
|
/* there is a delimiter, use everything left of it as path */ |
166 |
|
if(r && !whole_dir) { |
167 |
|
*r = 0; |
168 |
|
if(appdata->path) free(appdata->path); |
169 |
|
appdata->path = strdup(filename); |
170 |
|
/* restore path ... just in case ... */ |
171 |
|
*r = '/'; |
172 |
|
} |
173 |
|
|
174 |
|
if(whole_dir) |
175 |
|
appdata->path = strdup(filename); |
176 |
|
} else |
177 |
|
errorf(_("Load error")); |
178 |
|
|
179 |
if(whole_dir) |
g_free (filename); |
180 |
appdata->path = strdup(filename); |
} else { |
181 |
|
#ifndef USE_MAEMO |
182 |
|
errorf(_("Error accessing the file.")); |
183 |
|
#else |
184 |
|
errorf(_("Error accessing the file. This may happen if the file " |
185 |
|
"resides on a remote file system. Please copy the file onto " |
186 |
|
"the device (e.g. onto the memory card) and try again.")); |
187 |
|
#endif |
188 |
} |
} |
|
|
|
|
g_free (filename); |
|
189 |
} |
} |
190 |
|
|
191 |
gtk_widget_destroy (dialog); |
gtk_widget_destroy (dialog); |
226 |
if(gtk_tree_model_get_iter(model, &iter, path)) { |
if(gtk_tree_model_get_iter(model, &iter, path)) { |
227 |
cache_t *cache; |
cache_t *cache; |
228 |
gtk_tree_model_get(model, &iter, CACHELIST_COL_DATA, &cache, -1); |
gtk_tree_model_get(model, &iter, CACHELIST_COL_DATA, &cache, -1); |
229 |
#ifndef USE_BREAD_CRUMB_TRAIL |
#if !defined(USE_BREAD_CRUMB_TRAIL) && !defined(MY_BCT) |
230 |
cache_dialog(appdata, cache); |
cache_dialog(appdata, cache); |
231 |
#else |
#else |
232 |
gtk_container_remove(GTK_CONTAINER(appdata->vbox), appdata->cur_view); |
gtk_container_remove(GTK_CONTAINER(appdata->vbox), appdata->cur_view); |
350 |
|
|
351 |
if(appdata->cachelist_update) |
if(appdata->cachelist_update) |
352 |
cachelist_redraw(appdata); |
cachelist_redraw(appdata); |
353 |
|
|
354 |
#endif |
#endif |
355 |
|
|
356 |
return TRUE; |
return TRUE; |
838 |
|
|
839 |
gpx_busy_dialog_destroy(dialog); |
gpx_busy_dialog_destroy(dialog); |
840 |
} |
} |
841 |
#ifndef USE_BREAD_CRUMB_TRAIL |
#if !defined(USE_BREAD_CRUMB_TRAIL) && !defined(MY_BCT) |
842 |
#ifdef USE_STACKABLE_WINDOW |
#ifdef USE_STACKABLE_WINDOW |
843 |
if(!appdata->cur_gpx) |
if(!appdata->cur_gpx) |
844 |
#endif |
#endif |
985 |
GtkTreeIter iter; |
GtkTreeIter iter; |
986 |
gtk_list_store_append(appdata->gpxstore, &iter); |
gtk_list_store_append(appdata->gpxstore, &iter); |
987 |
gpxlist_set(appdata->gpxstore, &iter, gpx); |
gpxlist_set(appdata->gpxstore, &iter, gpx); |
988 |
|
|
989 |
if(gpx == sel_gpx) { |
if(gpx == sel_gpx) { |
990 |
sel_iter = iter; |
sel_iter = iter; |
991 |
sel_iter_valid = TRUE; |
sel_iter_valid = TRUE; |
1461 |
|
|
1462 |
printf("Search for %s (flags = %x)...\n", p, appdata->search); |
printf("Search for %s (flags = %x)...\n", p, appdata->search); |
1463 |
|
|
1464 |
#ifndef USE_BREAD_CRUMB_TRAIL |
#if !defined(USE_BREAD_CRUMB_TRAIL) && !defined(MY_BCT) |
1465 |
gpx_t *found = |
gpx_t *found = |
1466 |
search_do(appdata, appdata->gpx, p, appdata->search, FALSE); |
search_do(appdata, appdata->gpx, p, appdata->search, FALSE); |
1467 |
|
|
1557 |
notes_log_export(appdata); |
notes_log_export(appdata); |
1558 |
} |
} |
1559 |
|
|
1560 |
#ifdef USE_MAEMO |
#ifdef ENABLE_MAEMO_MAPPER |
1561 |
static void |
static void |
1562 |
cb_menu_export_mmpoi(GtkWidget *widget, gpointer data) { |
cb_menu_export_mmpoi(GtkWidget *widget, gpointer data) { |
1563 |
appdata_t *appdata = (appdata_t*)data; |
appdata_t *appdata = (appdata_t*)data; |
1676 |
} |
} |
1677 |
|
|
1678 |
static const menu_entry_t submenu_export_entries[] = { |
static const menu_entry_t submenu_export_entries[] = { |
1679 |
|
#ifdef ENABLE_MAEMO_MAPPER |
1680 |
{ "Export to Maemo Mapper" , "Save a Maemo Mapper POI file", |
{ "Export to Maemo Mapper" , "Save a Maemo Mapper POI file", |
1681 |
G_CALLBACK(cb_menu_export_mmpoi) }, |
G_CALLBACK(cb_menu_export_mmpoi) }, |
1682 |
|
#endif |
1683 |
{ "Export Field Notes", "Save a Garmin Field Notes file", |
{ "Export Field Notes", "Save a Garmin Field Notes file", |
1684 |
G_CALLBACK(cb_menu_export_log) }, |
G_CALLBACK(cb_menu_export_log) }, |
1685 |
{ "Export Garmin GPX", "Save modified waypoints in GPX file", |
{ "Export Garmin GPX", "Save modified waypoints in GPX file", |
1766 |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
1767 |
|
|
1768 |
#ifdef ENABLE_OSM_GPS_MAP |
#ifdef ENABLE_OSM_GPS_MAP |
|
if((mode == MENU_GPXLIST) || (mode == MENU_CACHELIST)) { |
|
1769 |
button = gtk_button_new_with_label(_("Map")); |
button = gtk_button_new_with_label(_("Map")); |
1770 |
g_signal_connect_after(button, "clicked", |
g_signal_connect_after(button, "clicked", |
1771 |
G_CALLBACK(cb_menu_map), appdata); |
G_CALLBACK(cb_menu_map), appdata); |
1772 |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
|
} |
|
1773 |
#endif |
#endif |
1774 |
|
|
1775 |
#ifdef HILDON_HELP |
#ifdef HILDON_HELP |
1789 |
GtkWidget *menu, *item; |
GtkWidget *menu, *item; |
1790 |
menu = gtk_menu_new(); |
menu = gtk_menu_new(); |
1791 |
|
|
1792 |
#ifdef USE_BREAD_CRUMB_TRAIL |
#if defined(USE_BREAD_CRUMB_TRAIL) || defined(MY_BCT) |
1793 |
appdata->menu_import = |
appdata->menu_import = |
1794 |
#endif |
#endif |
1795 |
item = gtk_menu_item_new_with_label(_("Import")); |
item = gtk_menu_item_new_with_label(_("Import")); |
1819 |
g_signal_connect(item, "activate", GTK_SIGNAL_FUNC(cb_menu_remove), appdata); |
g_signal_connect(item, "activate", GTK_SIGNAL_FUNC(cb_menu_remove), appdata); |
1820 |
#endif |
#endif |
1821 |
|
|
1822 |
#ifdef USE_BREAD_CRUMB_TRAIL |
#if defined(USE_BREAD_CRUMB_TRAIL) || defined(MY_BCT) |
1823 |
appdata->menu_export = |
appdata->menu_export = |
1824 |
#endif |
#endif |
1825 |
item = gtk_menu_item_new_with_label(_("Export")); |
item = gtk_menu_item_new_with_label(_("Export")); |
1827 |
submenu = gtk_menu_new(); |
submenu = gtk_menu_new(); |
1828 |
gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu); |
gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu); |
1829 |
|
|
1830 |
#ifdef USE_MAEMO |
#ifdef ENABLE_MAEMO_MAPPER |
1831 |
item = gtk_menu_item_new_with_label( _("Maemo Mapper POI") ); |
item = gtk_menu_item_new_with_label( _("Maemo Mapper POI") ); |
1832 |
gtk_menu_append(GTK_MENU_SHELL(submenu), item); |
gtk_menu_append(GTK_MENU_SHELL(submenu), item); |
1833 |
g_signal_connect(item, "activate", |
g_signal_connect(item, "activate", |
1844 |
g_signal_connect(item, "activate", |
g_signal_connect(item, "activate", |
1845 |
GTK_SIGNAL_FUNC(cb_menu_export_garmin), appdata); |
GTK_SIGNAL_FUNC(cb_menu_export_garmin), appdata); |
1846 |
|
|
1847 |
#ifdef USE_BREAD_CRUMB_TRAIL |
#if defined(USE_BREAD_CRUMB_TRAIL) || defined(MY_BCT) |
1848 |
appdata->menu_search = |
appdata->menu_search = |
1849 |
#endif |
#endif |
1850 |
item = gtk_menu_item_new_with_label( _("Search") ); |
item = gtk_menu_item_new_with_label( _("Search") ); |
2051 |
return handled; |
return handled; |
2052 |
} |
} |
2053 |
|
|
2054 |
#ifdef USE_BREAD_CRUMB_TRAIL |
#if defined(USE_BREAD_CRUMB_TRAIL) || defined(MY_BCT) |
2055 |
typedef struct { |
typedef struct { |
2056 |
int level; |
int level; |
2057 |
appdata_t *appdata; |
appdata_t *appdata; |
2183 |
#endif |
#endif |
2184 |
} |
} |
2185 |
|
|
2186 |
|
#ifdef USE_BREAD_CRUMB_TRAIL |
2187 |
hildon_bread_crumb_trail_push_text(HILDON_BREAD_CRUMB_TRAIL(appdata->bct), |
hildon_bread_crumb_trail_push_text(HILDON_BREAD_CRUMB_TRAIL(appdata->bct), |
2188 |
name, crumb, (GDestroyNotify)crumb_back); |
name, crumb, (GDestroyNotify)crumb_back); |
2189 |
|
#else |
2190 |
|
#warning replacement missing |
2191 |
|
#endif |
2192 |
} |
} |
2193 |
#endif // USE_BREAD_CRUMB_TRAIL |
#endif // USE_BREAD_CRUMB_TRAIL |
2194 |
|
|
2295 |
fprintf(stderr, "error initiating osso context\n"); |
fprintf(stderr, "error initiating osso context\n"); |
2296 |
} |
} |
2297 |
|
|
2298 |
|
#ifdef ENABLE_MAEMO_MAPPER |
2299 |
dbus_register(&appdata); |
dbus_register(&appdata); |
2300 |
#endif |
#endif |
2301 |
|
#endif |
2302 |
|
|
2303 |
icons_init(); |
icons_init(); |
2304 |
|
|
2351 |
|
|
2352 |
hildon_bread_crumb_trail_clear(HILDON_BREAD_CRUMB_TRAIL(appdata.bct)); |
hildon_bread_crumb_trail_clear(HILDON_BREAD_CRUMB_TRAIL(appdata.bct)); |
2353 |
crumb_add(&appdata, "GPX", CRUMB_GPXLIST, NULL); |
crumb_add(&appdata, "GPX", CRUMB_GPXLIST, NULL); |
2354 |
|
#else |
2355 |
|
#ifdef MY_BCT |
2356 |
|
/* on non-hildon machines we use some custom made breadcrumbtrail */ |
2357 |
|
/* replacement */ |
2358 |
|
appdata.bct = my_bct_new(); |
2359 |
|
gtk_box_pack_start(GTK_BOX(appdata.vbox), appdata.bct, FALSE,FALSE,0); |
2360 |
|
#endif |
2361 |
#endif |
#endif |
2362 |
|
|
2363 |
/* wait for main gui to appear */ |
/* wait for main gui to appear */ |