120 |
HELP_ID_IMPORT, appdata->osso_context); |
HELP_ID_IMPORT, appdata->osso_context); |
121 |
#endif |
#endif |
122 |
#else |
#else |
123 |
dialog = gtk_file_chooser_dialog_new (whole_dir?_("Open Directory"): |
dialog = gtk_file_chooser_dialog_new (whole_dir?_("Import directory"): |
124 |
_("Open File"), |
_("Import file"), |
125 |
GTK_WINDOW(appdata->window), |
GTK_WINDOW(appdata->window), |
126 |
whole_dir?GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER : |
whole_dir?GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER : |
127 |
GTK_FILE_CHOOSER_ACTION_OPEN, |
GTK_FILE_CHOOSER_ACTION_OPEN, |
168 |
|
|
169 |
if(whole_dir) |
if(whole_dir) |
170 |
appdata->path = strdup(filename); |
appdata->path = strdup(filename); |
171 |
} |
} else |
172 |
|
errorf(_("Load error")); |
173 |
|
|
174 |
g_free (filename); |
g_free (filename); |
175 |
} |
} |
203 |
GtkTreeIter iter; |
GtkTreeIter iter; |
204 |
GtkTreeModel *model = gtk_tree_view_get_model(treeview); |
GtkTreeModel *model = gtk_tree_view_get_model(treeview); |
205 |
|
|
206 |
|
#ifdef USE_MAEMO |
207 |
|
/* check if a cache is already selected and ignore click if yes */ |
208 |
|
/* (was probably a double click) */ |
209 |
|
if(appdata->cur_cache) return; |
210 |
|
#endif |
211 |
|
|
212 |
if(gtk_tree_model_get_iter(model, &iter, path)) { |
if(gtk_tree_model_get_iter(model, &iter, path)) { |
213 |
cache_t *cache; |
cache_t *cache; |
214 |
gtk_tree_model_get(model, &iter, CACHELIST_COL_DATA, &cache, -1); |
gtk_tree_model_get(model, &iter, CACHELIST_COL_DATA, &cache, -1); |
271 |
// gtk_widget_show_all(appdata->vbox); |
// gtk_widget_show_all(appdata->vbox); |
272 |
#else |
#else |
273 |
|
|
274 |
|
if(!appdata->cur_view) { |
275 |
|
printf("cachelist redraw: no active view\n"); |
276 |
|
return; |
277 |
|
} |
278 |
|
|
279 |
g_assert(!appdata->cur_cache); |
g_assert(!appdata->cur_cache); |
280 |
int redraw = 0; |
int redraw = 0; |
281 |
if(appdata->search_results) |
if(appdata->search_results) |
286 |
} |
} |
287 |
|
|
288 |
if(redraw) { |
if(redraw) { |
289 |
gtk_container_remove(GTK_CONTAINER(appdata->vbox), appdata->cur_view); |
GtkWidget *container = appdata->vbox; |
290 |
|
|
291 |
|
printf("redraw %d\n", redraw); |
292 |
|
|
293 |
|
#ifdef USE_STACKABLE_WINDOW |
294 |
|
HildonWindowStack *stack = hildon_window_stack_get_default(); |
295 |
|
container = hildon_window_stack_peek(stack); |
296 |
|
#endif |
297 |
|
|
298 |
|
gtk_container_remove(GTK_CONTAINER(container), appdata->cur_view); |
299 |
switch(redraw) { |
switch(redraw) { |
300 |
case 1: |
case 1: |
301 |
appdata->cur_view = cachelist_create(appdata, |
appdata->cur_view = cachelist_create(appdata, |
307 |
break; |
break; |
308 |
} |
} |
309 |
|
|
310 |
gtk_box_pack_start_defaults(GTK_BOX(appdata->vbox), appdata->cur_view); |
#ifdef USE_STACKABLE_WINDOW |
311 |
gtk_widget_show_all(appdata->vbox); |
if(container != appdata->vbox) |
312 |
|
gtk_container_add(GTK_CONTAINER(container), appdata->cur_view); |
313 |
|
else |
314 |
|
#endif |
315 |
|
gtk_box_pack_start_defaults(GTK_BOX(container), appdata->cur_view); |
316 |
|
|
317 |
|
gtk_widget_show_all(container); |
318 |
} |
} |
319 |
#endif |
#endif |
320 |
} |
} |
327 |
#ifdef USE_MAEMO |
#ifdef USE_MAEMO |
328 |
appdata_t *appdata = (appdata_t*)data; |
appdata_t *appdata = (appdata_t*)data; |
329 |
|
|
330 |
|
if(appdata->cur_cache) |
331 |
|
return TRUE; |
332 |
|
|
333 |
if(appdata->cachelist_disable_screensaver) |
if(appdata->cachelist_disable_screensaver) |
334 |
if (osso_display_blanking_pause(appdata->osso_context) != OSSO_OK) |
if (osso_display_blanking_pause(appdata->osso_context) != OSSO_OK) |
335 |
fprintf(stderr, "error with display blank\n"); |
fprintf(stderr, "error with display blank\n"); |
342 |
} |
} |
343 |
|
|
344 |
static void cachelist_timer_reset(appdata_t *appdata) { |
static void cachelist_timer_reset(appdata_t *appdata) { |
345 |
|
printf("cachelist timer reset\n"); |
346 |
g_assert(appdata->cachelist_handler_id); |
g_assert(appdata->cachelist_handler_id); |
347 |
gtk_timeout_remove(appdata->cachelist_handler_id); |
gtk_timeout_remove(appdata->cachelist_handler_id); |
348 |
appdata->cachelist_handler_id = |
appdata->cachelist_handler_id = |
574 |
} |
} |
575 |
#else |
#else |
576 |
#ifdef USE_STACKABLE_WINDOW |
#ifdef USE_STACKABLE_WINDOW |
577 |
|
static void search_result_free(gpx_t *result); |
578 |
|
|
579 |
|
void on_cachelist_destroy(GtkWidget *widget, appdata_t *appdata) { |
580 |
|
if(appdata->search_results) { |
581 |
|
search_result_free(appdata->search_results); |
582 |
|
appdata->search_results = NULL; |
583 |
|
} |
584 |
|
appdata->cur_gpx = NULL; |
585 |
|
|
586 |
|
/* restore cur_view */ |
587 |
|
appdata->cur_view = g_object_get_data(G_OBJECT(widget), "cur_view"); |
588 |
|
} |
589 |
|
|
590 |
void cachelist_dialog(appdata_t *appdata, gpx_t *gpx) { |
void cachelist_dialog(appdata_t *appdata, gpx_t *gpx) { |
591 |
GtkWidget *window = hildon_stackable_window_new(); |
GtkWidget *window = hildon_stackable_window_new(); |
592 |
|
|
593 |
gtk_window_set_title(GTK_WINDOW(window), gpx->name); |
/* store last "cur_view" in window */ |
594 |
|
g_object_set_data(G_OBJECT(window), "cur_view", appdata->cur_view); |
595 |
|
|
596 |
gtk_container_add(GTK_CONTAINER(window), |
appdata->cur_gpx = gpx; |
597 |
cachelist_create(appdata, gpx, NULL)); |
char *title = g_strdup_printf("%s - GPXView", gpx->name); |
598 |
|
gtk_window_set_title(GTK_WINDOW(window), title); |
599 |
|
g_free(title); |
600 |
|
|
601 |
|
appdata->cur_view = cachelist_create(appdata, gpx, NULL); |
602 |
|
gtk_container_add(GTK_CONTAINER(window), appdata->cur_view); |
603 |
|
|
604 |
|
|
605 |
hildon_window_set_app_menu(HILDON_WINDOW(window), |
hildon_window_set_app_menu(HILDON_WINDOW(window), |
606 |
menu_create(appdata, MENU_CACHELIST)); |
menu_create(appdata, MENU_CACHELIST)); |
607 |
|
|
608 |
|
g_signal_connect(G_OBJECT(window), "destroy", |
609 |
|
G_CALLBACK(on_cachelist_destroy), appdata); |
610 |
|
|
611 |
gtk_widget_show_all(window); |
gtk_widget_show_all(window); |
612 |
} |
} |
613 |
#endif |
#endif |
720 |
GtkTreeIter iter; |
GtkTreeIter iter; |
721 |
GtkTreeModel *model = gtk_tree_view_get_model(treeview); |
GtkTreeModel *model = gtk_tree_view_get_model(treeview); |
722 |
|
|
723 |
|
#ifdef USE_MAEMO |
724 |
|
/* check if a cache is already selected and ignore click if yes */ |
725 |
|
/* (was probably a double click) */ |
726 |
|
if(appdata->cur_gpx) return; |
727 |
|
#endif |
728 |
|
|
729 |
if (gtk_tree_model_get_iter(model, &iter, path)) { |
if (gtk_tree_model_get_iter(model, &iter, path)) { |
730 |
gpx_t *gpx; |
gpx_t *gpx; |
731 |
gtk_tree_model_get(model, &iter, GPXLIST_COL_DATA, &gpx, -1); |
gtk_tree_model_get(model, &iter, GPXLIST_COL_DATA, &gpx, -1); |
824 |
gpx_busy_dialog_destroy(dialog); |
gpx_busy_dialog_destroy(dialog); |
825 |
} |
} |
826 |
#ifndef USE_BREAD_CRUMB_TRAIL |
#ifndef USE_BREAD_CRUMB_TRAIL |
827 |
cachelist_dialog(appdata, gpx); |
#ifdef USE_STACKABLE_WINDOW |
828 |
|
if(!appdata->cur_gpx) |
829 |
|
#endif |
830 |
|
cachelist_dialog(appdata, gpx); |
831 |
|
#ifdef USE_STACKABLE_WINDOW |
832 |
|
else |
833 |
|
printf("selected gpx, but cachelist window already present\n"); |
834 |
|
#endif |
835 |
#else |
#else |
836 |
gtk_container_remove(GTK_CONTAINER(appdata->vbox), appdata->cur_view); |
gtk_container_remove(GTK_CONTAINER(appdata->vbox), appdata->cur_view); |
837 |
appdata->cur_view = cachelist_create(appdata, gpx, NULL); |
appdata->cur_view = cachelist_create(appdata, gpx, NULL); |
967 |
GtkTreeIter sel_iter; |
GtkTreeIter sel_iter; |
968 |
gboolean sel_iter_valid = FALSE; |
gboolean sel_iter_valid = FALSE; |
969 |
while(gpx) { |
while(gpx) { |
970 |
GtkTreeIter iter; |
/* don't display entries that failed at load */ |
971 |
gtk_list_store_append(appdata->gpxstore, &iter); |
if(!gpx->failed) { |
972 |
gpxlist_set(appdata->gpxstore, &iter, gpx); |
GtkTreeIter iter; |
973 |
|
gtk_list_store_append(appdata->gpxstore, &iter); |
974 |
if(gpx == sel_gpx) { |
gpxlist_set(appdata->gpxstore, &iter, gpx); |
975 |
sel_iter = iter; |
|
976 |
sel_iter_valid = TRUE; |
if(gpx == sel_gpx) { |
977 |
|
sel_iter = iter; |
978 |
|
sel_iter_valid = TRUE; |
979 |
|
} |
980 |
} |
} |
981 |
|
|
982 |
gpx = gpx->next; |
gpx = gpx->next; |
1033 |
|
|
1034 |
/******************** begin of menu *********************/ |
/******************** begin of menu *********************/ |
1035 |
|
|
1036 |
|
typedef struct { |
1037 |
|
appdata_t *appdata; |
1038 |
|
GtkWidget *dialog; |
1039 |
|
} about_context_t; |
1040 |
|
|
1041 |
|
#ifdef ENABLE_BROWSER_INTERFACE |
1042 |
|
void on_paypal_button_clicked(GtkButton *button, about_context_t *context) { |
1043 |
|
gtk_dialog_response(GTK_DIALOG(context->dialog), GTK_RESPONSE_ACCEPT); |
1044 |
|
browser_url(context->appdata, |
1045 |
|
"https://www.paypal.com/cgi-bin/webscr" |
1046 |
|
"?cmd=_s-xclick&hosted_button_id=7400558"); |
1047 |
|
} |
1048 |
|
#endif |
1049 |
|
|
1050 |
static void |
static void |
1051 |
cb_menu_about(GtkWidget *window, gpointer data) { |
cb_menu_about(GtkWidget *window, gpointer data) { |
1052 |
GtkAboutDialog *about = GTK_ABOUT_DIALOG(gtk_about_dialog_new()); |
about_context_t context; |
1053 |
|
|
1054 |
|
context.appdata = (appdata_t *)data; |
1055 |
|
|
1056 |
gtk_about_dialog_set_name(about, "GPXView"); |
#ifdef ENABLE_LIBLOCATION |
1057 |
gtk_about_dialog_set_version(about, VERSION); |
char *uses = "uses liblocation"; |
1058 |
gtk_about_dialog_set_copyright(about, |
#elif defined(ENABLE_GPSBT) |
1059 |
_("GPXView (c) 2008 by\n" |
char *uses = "uses gpsbt and gpsd"; |
1060 |
"Till Harbaum <till@harbaum.org>\n" |
#else |
1061 |
"Geocaching.com: Tantil")); |
char *uses = "uses gpsd"; |
1062 |
|
#endif |
1063 |
gtk_about_dialog_set_website(about, |
|
1064 |
_("http://www.harbaum.org/till/maemo")); |
const gchar *authors[] = { |
1065 |
|
"Till Harbaum <till@harbaum.org>", |
1066 |
gtk_about_dialog_set_comments(about, |
"John Stowers <john.stowers@gmail.com>", |
1067 |
_("Geocaching.com GPX file viewer")); |
NULL }; |
1068 |
|
|
1069 |
gtk_widget_show_all(GTK_WIDGET(about)); |
context.dialog = g_object_new(GTK_TYPE_ABOUT_DIALOG, |
1070 |
gtk_dialog_run(GTK_DIALOG(about)); |
"name", "GPXView", |
1071 |
gtk_widget_destroy(GTK_WIDGET(about)); |
"version", VERSION, |
1072 |
|
"copyright", _("Copyright 2008-2009"), |
1073 |
|
"authors", authors, |
1074 |
|
"website", _("http://www.harbaum.org/till/maemo"), |
1075 |
|
"comments", _(uses), |
1076 |
|
NULL); |
1077 |
|
|
1078 |
|
#ifdef ENABLE_BROWSER_INTERFACE |
1079 |
|
/* add a way to donate to the project */ |
1080 |
|
GtkWidget *alignment = gtk_alignment_new(0.5, 0, 0, 0); |
1081 |
|
|
1082 |
|
GtkWidget *hbox = gtk_hbox_new(FALSE, 8); |
1083 |
|
gtk_box_pack_start(GTK_BOX(hbox), |
1084 |
|
gtk_label_new(_("Do you like GPXView?")), |
1085 |
|
FALSE, FALSE, 0); |
1086 |
|
|
1087 |
|
GtkWidget *button = gtk_button_new(); |
1088 |
|
gtk_button_set_image(GTK_BUTTON(button), |
1089 |
|
icon_get_widget(ICON_MISC, 8)); |
1090 |
|
gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); |
1091 |
|
g_signal_connect(button, "clicked", |
1092 |
|
G_CALLBACK(on_paypal_button_clicked), &context); |
1093 |
|
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
1094 |
|
|
1095 |
|
gtk_container_add(GTK_CONTAINER(alignment), hbox); |
1096 |
|
gtk_box_pack_start_defaults(GTK_BOX((GTK_DIALOG(context.dialog))->vbox), |
1097 |
|
alignment); |
1098 |
|
|
1099 |
|
gtk_widget_show_all(alignment); |
1100 |
|
#endif |
1101 |
|
|
1102 |
|
gtk_dialog_run(GTK_DIALOG(context.dialog)); |
1103 |
|
gtk_widget_destroy(context.dialog); |
1104 |
} |
} |
1105 |
|
|
1106 |
#if defined(USE_MAEMO) && defined(HILDON_HELP) |
#if defined(USE_MAEMO) && defined(HILDON_HELP) |
1446 |
/* don't search if we are asked to search for nothing */ |
/* don't search if we are asked to search for nothing */ |
1447 |
if(((appdata->search & (SEARCH_ID|SEARCH_NAME|SEARCH_DESC|SEARCH_OWNER)) && |
if(((appdata->search & (SEARCH_ID|SEARCH_NAME|SEARCH_DESC|SEARCH_OWNER)) && |
1448 |
strlen(p) > 0) || (appdata->search & SEARCH_FINDS)) { |
strlen(p) > 0) || (appdata->search & SEARCH_FINDS)) { |
|
gpx_t *found = NULL; |
|
1449 |
|
|
1450 |
printf("Search for %s (flags = %x)...\n", p, appdata->search); |
printf("Search for %s (flags = %x)...\n", p, appdata->search); |
1451 |
|
|
1452 |
#ifndef USE_BREAD_CRUMB_TRAIL |
#ifndef USE_BREAD_CRUMB_TRAIL |
1453 |
found = search_do(appdata, appdata->gpx, p, appdata->search, FALSE); |
gpx_t *found = |
1454 |
|
search_do(appdata, appdata->gpx, p, appdata->search, FALSE); |
1455 |
|
|
1456 |
/* do search result dialog here ... */ |
/* do search result dialog here ... */ |
1457 |
cachelist_dialog(appdata, found); |
cachelist_dialog(appdata, found); |
1458 |
|
#ifndef USE_STACKABLE_WINDOW |
1459 |
search_result_free(found); |
search_result_free(found); |
1460 |
#else |
#else |
1461 |
|
appdata->search_results = found; |
1462 |
|
#endif |
1463 |
|
#else |
1464 |
|
gpx_t *found = NULL; |
1465 |
|
|
1466 |
if(appdata->cur_gpx) |
if(appdata->cur_gpx) |
1467 |
found = search_do(appdata, appdata->cur_gpx, p, appdata->search, TRUE); |
found = search_do(appdata, appdata->cur_gpx, p, appdata->search, TRUE); |
1468 |
else |
else |
1483 |
gtk_widget_destroy(dialog); |
gtk_widget_destroy(dialog); |
1484 |
} |
} |
1485 |
|
|
1486 |
void on_window_destroy (GtkWidget *widget, gpointer data); |
static void on_window_destroy (GtkWidget *widget, gpointer data); |
1487 |
|
|
1488 |
#ifndef USE_MAEMO |
#ifndef USE_MAEMO |
1489 |
static void |
static void |
1539 |
} |
} |
1540 |
#endif |
#endif |
1541 |
|
|
1542 |
#ifdef USE_STACKABLE_WINDOW |
static void |
1543 |
typedef struct { |
cb_menu_export_log(GtkWidget *widget, gpointer data) { |
1544 |
appdata_t *appdata; |
appdata_t *appdata = (appdata_t*)data; |
1545 |
GtkWidget *dialog; |
notes_log_export(appdata); |
1546 |
} appmenu_context_t; |
} |
1547 |
|
|
1548 |
void on_export_mmpoi_clicked(appmenu_context_t *context) { |
#ifdef USE_MAEMO |
1549 |
gtk_widget_destroy(context->dialog); |
static void |
1550 |
while(gtk_events_pending()) |
cb_menu_export_mmpoi(GtkWidget *widget, gpointer data) { |
1551 |
gtk_main_iteration(); |
appdata_t *appdata = (appdata_t*)data; |
1552 |
|
mmpoi_export(appdata); |
1553 |
|
} |
1554 |
|
#endif |
1555 |
|
|
1556 |
mmpoi_export(context->appdata); |
static void |
1557 |
|
cb_menu_export_garmin(GtkWidget *widget, gpointer data) { |
1558 |
|
appdata_t *appdata = (appdata_t*)data; |
1559 |
|
garmin_export(appdata); |
1560 |
} |
} |
1561 |
|
|
1562 |
void on_export_garmin_clicked(appmenu_context_t *context) { |
#ifdef ENABLE_OSM_GPS_MAP |
1563 |
gtk_widget_destroy(context->dialog); |
static void |
1564 |
while(gtk_events_pending()) |
cb_menu_map(GtkWidget *window, gpointer data) { |
1565 |
gtk_main_iteration(); |
map((appdata_t *)data); |
1566 |
|
} |
1567 |
|
#endif |
1568 |
|
|
1569 |
garmin_export(context->appdata); |
static void |
1570 |
|
cb_menu_geomath(GtkWidget *window, gpointer data) { |
1571 |
|
geomath_dialog((appdata_t *)data); |
1572 |
} |
} |
1573 |
|
|
1574 |
void on_export_notes_log_clicked(appmenu_context_t *context) { |
static void |
1575 |
gtk_widget_destroy(context->dialog); |
cb_menu_geotext(GtkWidget *window, gpointer data) { |
1576 |
while(gtk_events_pending()) |
geotext_dialog((appdata_t *)data); |
1577 |
gtk_main_iteration(); |
} |
1578 |
|
|
1579 |
notes_log_export(context->appdata); |
static void |
1580 |
|
cb_menu_precpos(GtkWidget *window, gpointer data) { |
1581 |
|
precise_position((appdata_t *)data); |
1582 |
} |
} |
1583 |
|
|
1584 |
void on_export_clicked(GtkButton *button, appdata_t *appdata) { |
#ifdef USE_STACKABLE_WINDOW |
1585 |
GtkWidget *but; |
typedef struct { |
1586 |
appmenu_context_t context; |
char *label, *desc; |
1587 |
|
GtkSignalFunc activate_cb; |
1588 |
|
} menu_entry_t; |
1589 |
|
|
1590 |
context.appdata = appdata; |
typedef struct { |
1591 |
context.dialog = gtk_dialog_new(); |
const char *title; |
1592 |
|
const menu_entry_t *menu; |
1593 |
|
int len; |
1594 |
|
} submenu_t; |
1595 |
|
|
1596 |
gtk_window_set_decorated(GTK_WINDOW(context.dialog), FALSE); |
#define COLUMNS 1 |
1597 |
|
|
1598 |
but = hildon_button_new_with_text(HILDON_SIZE_AUTO, |
void on_submenu_entry_clicked(GtkButton *button, GtkWidget *menu) { |
|
HILDON_BUTTON_ARRANGEMENT_VERTICAL, |
|
|
_("Export to Maemo Mapper"), |
|
|
_("Save a Maemo Mapper POI file")); |
|
|
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(context.dialog)->vbox), but); |
|
|
g_signal_connect_swapped(but, "clicked", |
|
|
G_CALLBACK(on_export_mmpoi_clicked), &context); |
|
|
|
|
|
but = hildon_button_new_with_text(HILDON_SIZE_AUTO, |
|
|
HILDON_BUTTON_ARRANGEMENT_VERTICAL, |
|
|
_("Export Field Notes"), |
|
|
_("Save a Garmin Field Notes file")); |
|
|
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(context.dialog)->vbox), but); |
|
|
g_signal_connect_swapped(but, "clicked", |
|
|
G_CALLBACK(on_export_notes_log_clicked), &context); |
|
|
|
|
|
|
|
|
but = hildon_button_new_with_text(HILDON_SIZE_AUTO, |
|
|
HILDON_BUTTON_ARRANGEMENT_VERTICAL, |
|
|
_("Export Garmin GPX"), |
|
|
_("Save a GPX file of modified points")); |
|
|
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(context.dialog)->vbox), but); |
|
|
g_signal_connect_swapped(but, "clicked", |
|
|
G_CALLBACK(on_export_garmin_clicked), &context); |
|
|
|
|
|
gtk_widget_show_all(context.dialog); |
|
|
gint result = gtk_dialog_run(GTK_DIALOG(context.dialog)); |
|
|
|
|
|
/* user clicked outside dialog */ |
|
|
if(result == GTK_RESPONSE_DELETE_EVENT) |
|
|
gtk_widget_destroy(context.dialog); |
|
|
} |
|
1599 |
|
|
1600 |
void on_tools_geomath_clicked(appmenu_context_t *context) { |
/* force closing of submenu dialog */ |
1601 |
gtk_widget_destroy(context->dialog); |
gtk_dialog_response(GTK_DIALOG(menu), GTK_RESPONSE_NONE); |
1602 |
|
gtk_widget_hide(menu); |
1603 |
|
|
1604 |
|
/* let gtk clean up */ |
1605 |
while(gtk_events_pending()) |
while(gtk_events_pending()) |
1606 |
gtk_main_iteration(); |
gtk_main_iteration(); |
|
|
|
|
geomath_dialog(context->appdata); |
|
1607 |
} |
} |
1608 |
|
|
1609 |
void on_tools_geotext_clicked(appmenu_context_t *context) { |
static GtkWidget *app_submenu_create(appdata_t *appdata, |
1610 |
gtk_widget_destroy(context->dialog); |
const submenu_t *submenu) { |
1611 |
while(gtk_events_pending()) |
|
1612 |
gtk_main_iteration(); |
/* create a oridinary dialog box */ |
1613 |
|
GtkWidget *dialog = gtk_dialog_new(); |
1614 |
|
gtk_window_set_title(GTK_WINDOW(dialog), _(submenu->title)); |
1615 |
|
gtk_window_set_modal(GTK_WINDOW(dialog), TRUE); |
1616 |
|
gtk_window_set_transient_for(GTK_WINDOW(dialog), |
1617 |
|
GTK_WINDOW(appdata->window)); |
1618 |
|
gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); |
1619 |
|
|
1620 |
|
GtkWidget *table = gtk_table_new(submenu->len/COLUMNS, COLUMNS, TRUE); |
1621 |
|
int x = 0, y = 0; |
1622 |
|
|
1623 |
|
const menu_entry_t *menu_entries = submenu->menu; |
1624 |
|
while(menu_entries->label) { |
1625 |
|
GtkWidget *button = NULL; |
1626 |
|
|
1627 |
|
button = hildon_button_new_with_text( |
1628 |
|
HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH, |
1629 |
|
HILDON_BUTTON_ARRANGEMENT_VERTICAL, |
1630 |
|
_(menu_entries->label), _(menu_entries->desc)); |
1631 |
|
|
1632 |
|
/* try to center both texts */ |
1633 |
|
hildon_button_set_title_alignment(HILDON_BUTTON(button), 0.5, 0.5); |
1634 |
|
hildon_button_set_value_alignment(HILDON_BUTTON(button), 0.5, 0.5); |
1635 |
|
|
1636 |
geotext_dialog(context->appdata); |
g_signal_connect(button, "clicked", |
1637 |
|
G_CALLBACK(on_submenu_entry_clicked), dialog); |
1638 |
|
|
1639 |
|
g_signal_connect(button, "clicked", |
1640 |
|
menu_entries->activate_cb, appdata); |
1641 |
|
|
1642 |
|
gtk_table_attach_defaults(GTK_TABLE(table), button, x, x+1, y, y+1); |
1643 |
|
|
1644 |
|
x++; |
1645 |
|
if(x == COLUMNS) { x = 0; y++; } |
1646 |
|
|
1647 |
|
menu_entries++; |
1648 |
|
} |
1649 |
|
|
1650 |
|
gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(dialog)->vbox), table); |
1651 |
|
|
1652 |
|
return dialog; |
1653 |
} |
} |
1654 |
|
|
1655 |
void on_tools_precpos_clicked(appmenu_context_t *context) { |
/* popup the dialog shaped submenu */ |
1656 |
gtk_widget_destroy(context->dialog); |
static void submenu_popup(GtkWidget *menu) { |
1657 |
while(gtk_events_pending()) |
gtk_widget_show_all(menu); |
1658 |
gtk_main_iteration(); |
gtk_dialog_run(GTK_DIALOG(menu)); |
1659 |
|
gtk_widget_hide(menu); |
1660 |
|
} |
1661 |
|
|
1662 |
precise_position(context->appdata); |
static void submenu_cleanup(GtkWidget *menu) { |
1663 |
|
gtk_widget_destroy(menu); |
1664 |
} |
} |
1665 |
|
|
1666 |
void on_tools_clicked(GtkButton *button, appdata_t *appdata) { |
static const menu_entry_t submenu_export_entries[] = { |
1667 |
GtkWidget *but; |
{ "Export to Maemo Mapper" , "Save a Maemo Mapper POI file", |
1668 |
appmenu_context_t context; |
G_CALLBACK(cb_menu_export_mmpoi) }, |
1669 |
|
{ "Export Field Notes", "Save a Garmin Field Notes file", |
1670 |
|
G_CALLBACK(cb_menu_export_log) }, |
1671 |
|
{ "Export Garmin GPX", "Save modified waypoints in GPX file", |
1672 |
|
G_CALLBACK(cb_menu_export_garmin) }, |
1673 |
|
{ NULL, NULL, NULL } |
1674 |
|
}; |
1675 |
|
|
1676 |
context.appdata = appdata; |
static const submenu_t submenu_export = { |
1677 |
context.dialog = gtk_dialog_new(); |
"Export", submenu_export_entries, |
1678 |
|
sizeof(submenu_export_entries)/sizeof(menu_entry_t)-1 |
1679 |
|
}; |
1680 |
|
|
1681 |
gtk_window_set_decorated(GTK_WINDOW(context.dialog), FALSE); |
/* the export submenu */ |
1682 |
|
void on_export_clicked(GtkButton *button, appdata_t *appdata) { |
1683 |
|
if(!appdata->export_menu) |
1684 |
|
appdata->export_menu = app_submenu_create(appdata, &submenu_export); |
1685 |
|
|
1686 |
but = hildon_button_new_with_text(HILDON_SIZE_AUTO, |
submenu_popup(appdata->export_menu); |
1687 |
HILDON_BUTTON_ARRANGEMENT_VERTICAL, |
} |
1688 |
_("Geomath"), |
|
1689 |
_("Geocoordinate calculation")); |
static const menu_entry_t submenu_tools_entries[] = { |
1690 |
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(context.dialog)->vbox), but); |
{ "Geomath", "Geocoordinate calculation", |
1691 |
g_signal_connect_swapped(but, "clicked", |
G_CALLBACK(cb_menu_geomath) }, |
1692 |
G_CALLBACK(on_tools_geomath_clicked), &context); |
{ "Geotext", "Text analysis", |
1693 |
|
G_CALLBACK(cb_menu_geotext) }, |
1694 |
but = hildon_button_new_with_text(HILDON_SIZE_AUTO, |
{ "Precise Position", "Calculate a precise GPS position", |
1695 |
HILDON_BUTTON_ARRANGEMENT_VERTICAL, |
G_CALLBACK(cb_menu_precpos) }, |
1696 |
_("Geotext"), |
{ NULL, NULL, NULL } |
1697 |
_("Text analysis, letter counting etc")); |
}; |
1698 |
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(context.dialog)->vbox), but); |
|
1699 |
g_signal_connect_swapped(but, "clicked", |
static const submenu_t submenu_tools = { |
1700 |
G_CALLBACK(on_tools_geotext_clicked), &context); |
"Tools", submenu_tools_entries, |
1701 |
|
sizeof(submenu_tools_entries)/sizeof(menu_entry_t)-1 |
1702 |
|
}; |
1703 |
but = hildon_button_new_with_text(HILDON_SIZE_AUTO, |
|
1704 |
HILDON_BUTTON_ARRANGEMENT_VERTICAL, |
/* the tools submenu */ |
1705 |
_("Precise Position"), |
void on_tools_clicked(GtkButton *button, appdata_t *appdata) { |
1706 |
_("Calculate a very precise GPS posotions")); |
if(!appdata->tools_menu) |
1707 |
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(context.dialog)->vbox), but); |
appdata->tools_menu = app_submenu_create(appdata, &submenu_tools); |
1708 |
g_signal_connect_swapped(but, "clicked", |
|
1709 |
G_CALLBACK(on_tools_precpos_clicked), &context); |
submenu_popup(appdata->tools_menu); |
|
|
|
|
gtk_widget_show_all(context.dialog); |
|
|
gint result = gtk_dialog_run(GTK_DIALOG(context.dialog)); |
|
|
|
|
|
/* user clicked outside dialog */ |
|
|
if(result == GTK_RESPONSE_DELETE_EVENT) |
|
|
gtk_widget_destroy(context.dialog); |
|
1710 |
} |
} |
1711 |
|
|
1712 |
HildonAppMenu *menu_create(appdata_t *appdata, int mode) { |
HildonAppMenu *menu_create(appdata_t *appdata, int mode) { |
1714 |
HildonAppMenu *menu = HILDON_APP_MENU(hildon_app_menu_new()); |
HildonAppMenu *menu = HILDON_APP_MENU(hildon_app_menu_new()); |
1715 |
|
|
1716 |
/* ------- */ |
/* ------- */ |
1717 |
|
button = gtk_button_new_with_label(_("About")); |
1718 |
|
g_signal_connect_after(button, "clicked", |
1719 |
|
G_CALLBACK(cb_menu_about), appdata); |
1720 |
|
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
1721 |
|
|
1722 |
button = gtk_button_new_with_label(_("Settings")); |
button = gtk_button_new_with_label(_("Settings")); |
1723 |
g_signal_connect_after(button, "clicked", G_CALLBACK(cb_menu_settings), |
g_signal_connect_after(button, "clicked", G_CALLBACK(cb_menu_settings), |
1724 |
appdata); |
appdata); |
1730 |
G_CALLBACK(cb_menu_add), appdata); |
G_CALLBACK(cb_menu_add), appdata); |
1731 |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
1732 |
|
|
1733 |
button = gtk_button_new_with_label(_("Import dir")); |
button = gtk_button_new_with_label(_("Import directory")); |
1734 |
g_signal_connect_after(button, "clicked", |
g_signal_connect_after(button, "clicked", |
1735 |
G_CALLBACK(cb_menu_adddir), appdata); |
G_CALLBACK(cb_menu_adddir), appdata); |
1736 |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
|
} |
|
1737 |
|
|
|
if(mode == MENU_GPXLIST) { |
|
1738 |
button = gtk_button_new_with_label(_("Export")); |
button = gtk_button_new_with_label(_("Export")); |
1739 |
g_signal_connect_after(button, "clicked", |
g_signal_connect_after(button, "clicked", |
1740 |
G_CALLBACK(on_export_clicked), appdata); |
G_CALLBACK(on_export_clicked), appdata); |
1751 |
G_CALLBACK(on_tools_clicked), appdata); |
G_CALLBACK(on_tools_clicked), appdata); |
1752 |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
1753 |
|
|
1754 |
button = gtk_button_new_with_label(_("About")); |
#ifdef ENABLE_OSM_GPS_MAP |
1755 |
|
if((mode == MENU_GPXLIST) || (mode == MENU_CACHELIST)) { |
1756 |
|
button = gtk_button_new_with_label(_("Map")); |
1757 |
|
g_signal_connect_after(button, "clicked", |
1758 |
|
G_CALLBACK(cb_menu_map), appdata); |
1759 |
|
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
1760 |
|
} |
1761 |
|
#endif |
1762 |
|
|
1763 |
|
#ifdef HILDON_HELP |
1764 |
|
button = gtk_button_new_with_label(_("Help")); |
1765 |
g_signal_connect_after(button, "clicked", |
g_signal_connect_after(button, "clicked", |
1766 |
G_CALLBACK(cb_menu_about), appdata); |
G_CALLBACK(cb_menu_help), appdata); |
1767 |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
1768 |
|
#endif |
1769 |
|
|
1770 |
gtk_widget_show(GTK_WIDGET(menu)); |
gtk_widget_show_all(GTK_WIDGET(menu)); |
1771 |
|
|
1772 |
return menu; |
return menu; |
1773 |
} |
} |
1774 |
#else |
#else |
|
static void |
|
|
cb_menu_export_log(GtkWidget *widget, gpointer data) { |
|
|
appdata_t *appdata = (appdata_t*)data; |
|
|
notes_log_export(appdata); |
|
|
} |
|
|
|
|
|
#ifdef USE_MAEMO |
|
|
static void |
|
|
cb_menu_export_mmpoi(GtkWidget *widget, gpointer data) { |
|
|
appdata_t *appdata = (appdata_t*)data; |
|
|
mmpoi_export(appdata); |
|
|
} |
|
|
#endif |
|
|
|
|
|
static void |
|
|
cb_menu_export_garmin(GtkWidget *widget, gpointer data) { |
|
|
appdata_t *appdata = (appdata_t*)data; |
|
|
garmin_export(appdata); |
|
|
} |
|
|
|
|
|
static void |
|
|
cb_menu_geomath(GtkWidget *window, gpointer data) { |
|
|
geomath_dialog((appdata_t *)data); |
|
|
} |
|
|
|
|
|
static void |
|
|
cb_menu_geotext(GtkWidget *window, gpointer data) { |
|
|
geotext_dialog((appdata_t *)data); |
|
|
} |
|
|
|
|
|
static void |
|
|
cb_menu_precpos(GtkWidget *window, gpointer data) { |
|
|
precise_position((appdata_t *)data); |
|
|
} |
|
1775 |
|
|
1776 |
void menu_create(appdata_t *appdata) { |
void menu_create(appdata_t *appdata) { |
1777 |
GtkWidget *menu, *item; |
GtkWidget *menu, *item; |
1785 |
GtkWidget *submenu = gtk_menu_new(); |
GtkWidget *submenu = gtk_menu_new(); |
1786 |
gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu); |
gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu); |
1787 |
|
|
1788 |
item = gtk_menu_item_new_with_label( _("File...") ); |
item = gtk_menu_item_new_with_label( _("File") ); |
1789 |
gtk_menu_append(GTK_MENU_SHELL(submenu), item); |
gtk_menu_append(GTK_MENU_SHELL(submenu), item); |
1790 |
g_signal_connect(item, "activate", GTK_SIGNAL_FUNC(cb_menu_add), appdata); |
g_signal_connect(item, "activate", GTK_SIGNAL_FUNC(cb_menu_add), appdata); |
1791 |
|
|
1792 |
item = gtk_menu_item_new_with_label( _("Directory...") ); |
item = gtk_menu_item_new_with_label( _("Directory") ); |
1793 |
gtk_menu_append(GTK_MENU_SHELL(submenu), item); |
gtk_menu_append(GTK_MENU_SHELL(submenu), item); |
1794 |
g_signal_connect(item, "activate", GTK_SIGNAL_FUNC(cb_menu_adddir), appdata); |
g_signal_connect(item, "activate", GTK_SIGNAL_FUNC(cb_menu_adddir), appdata); |
1795 |
|
|
1816 |
gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu); |
gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu); |
1817 |
|
|
1818 |
#ifdef USE_MAEMO |
#ifdef USE_MAEMO |
1819 |
item = gtk_menu_item_new_with_label( _("Maemo Mapper POI...") ); |
item = gtk_menu_item_new_with_label( _("Maemo Mapper POI") ); |
1820 |
gtk_menu_append(GTK_MENU_SHELL(submenu), item); |
gtk_menu_append(GTK_MENU_SHELL(submenu), item); |
1821 |
g_signal_connect(item, "activate", |
g_signal_connect(item, "activate", |
1822 |
GTK_SIGNAL_FUNC(cb_menu_export_mmpoi), appdata); |
GTK_SIGNAL_FUNC(cb_menu_export_mmpoi), appdata); |
1823 |
#endif |
#endif |
1824 |
|
|
1825 |
item = gtk_menu_item_new_with_label( _("Garmin Field Notes...") ); |
item = gtk_menu_item_new_with_label( _("Garmin Field Notes") ); |
1826 |
gtk_menu_append(GTK_MENU_SHELL(submenu), item); |
gtk_menu_append(GTK_MENU_SHELL(submenu), item); |
1827 |
g_signal_connect(item, "activate", |
g_signal_connect(item, "activate", |
1828 |
GTK_SIGNAL_FUNC(cb_menu_export_log), appdata); |
GTK_SIGNAL_FUNC(cb_menu_export_log), appdata); |
1829 |
|
|
1830 |
item = gtk_menu_item_new_with_label( _("Garmin GPX...") ); |
item = gtk_menu_item_new_with_label( _("Garmin GPX") ); |
1831 |
gtk_menu_append(GTK_MENU_SHELL(submenu), item); |
gtk_menu_append(GTK_MENU_SHELL(submenu), item); |
1832 |
g_signal_connect(item, "activate", |
g_signal_connect(item, "activate", |
1833 |
GTK_SIGNAL_FUNC(cb_menu_export_garmin), appdata); |
GTK_SIGNAL_FUNC(cb_menu_export_garmin), appdata); |
1835 |
#ifdef USE_BREAD_CRUMB_TRAIL |
#ifdef USE_BREAD_CRUMB_TRAIL |
1836 |
appdata->menu_search = |
appdata->menu_search = |
1837 |
#endif |
#endif |
1838 |
item = gtk_menu_item_new_with_label( _("Search...") ); |
item = gtk_menu_item_new_with_label( _("Search") ); |
1839 |
gtk_menu_append(GTK_MENU_SHELL(menu), item); |
gtk_menu_append(GTK_MENU_SHELL(menu), item); |
1840 |
g_signal_connect(item, "activate", GTK_SIGNAL_FUNC(cb_menu_search), appdata); |
g_signal_connect(item, "activate", GTK_SIGNAL_FUNC(cb_menu_search), appdata); |
1841 |
|
|
1872 |
|
|
1873 |
gtk_menu_append(GTK_MENU_SHELL(menu), gtk_separator_menu_item_new()); |
gtk_menu_append(GTK_MENU_SHELL(menu), gtk_separator_menu_item_new()); |
1874 |
|
|
1875 |
|
#ifdef ENABLE_OSM_GPS_MAP |
1876 |
|
item = gtk_menu_item_new_with_label( _("Map") ); |
1877 |
|
gtk_menu_append(GTK_MENU_SHELL(menu), item); |
1878 |
|
g_signal_connect(item, "activate", |
1879 |
|
GTK_SIGNAL_FUNC(cb_menu_map), appdata); |
1880 |
|
#endif |
1881 |
|
|
1882 |
item = gtk_menu_item_new_with_label(_("Tools")); |
item = gtk_menu_item_new_with_label(_("Tools")); |
1883 |
gtk_menu_append(GTK_MENU_SHELL(menu), item); |
gtk_menu_append(GTK_MENU_SHELL(menu), item); |
1884 |
submenu = gtk_menu_new(); |
submenu = gtk_menu_new(); |
1885 |
gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu); |
gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu); |
1886 |
|
|
1887 |
item = gtk_menu_item_new_with_label( _("Geomath...") ); |
item = gtk_menu_item_new_with_label( _("Geomath") ); |
1888 |
gtk_menu_append(GTK_MENU_SHELL(submenu), item); |
gtk_menu_append(GTK_MENU_SHELL(submenu), item); |
1889 |
g_signal_connect(item, "activate", |
g_signal_connect(item, "activate", |
1890 |
GTK_SIGNAL_FUNC(cb_menu_geomath), appdata); |
GTK_SIGNAL_FUNC(cb_menu_geomath), appdata); |
1891 |
|
|
1892 |
item = gtk_menu_item_new_with_label( _("Geotext...") ); |
item = gtk_menu_item_new_with_label( _("Geotext") ); |
1893 |
gtk_menu_append(GTK_MENU_SHELL(submenu), item); |
gtk_menu_append(GTK_MENU_SHELL(submenu), item); |
1894 |
g_signal_connect(item, "activate", |
g_signal_connect(item, "activate", |
1895 |
GTK_SIGNAL_FUNC(cb_menu_geotext), appdata); |
GTK_SIGNAL_FUNC(cb_menu_geotext), appdata); |
1896 |
|
|
1897 |
item = gtk_menu_item_new_with_label( _("Precise Position...") ); |
item = gtk_menu_item_new_with_label( _("Precise Position") ); |
1898 |
gtk_menu_append(GTK_MENU_SHELL(submenu), item); |
gtk_menu_append(GTK_MENU_SHELL(submenu), item); |
1899 |
g_signal_connect(item, "activate", |
g_signal_connect(item, "activate", |
1900 |
GTK_SIGNAL_FUNC(cb_menu_precpos), appdata); |
GTK_SIGNAL_FUNC(cb_menu_precpos), appdata); |
1902 |
gtk_menu_append(GTK_MENU_SHELL(menu), gtk_separator_menu_item_new()); |
gtk_menu_append(GTK_MENU_SHELL(menu), gtk_separator_menu_item_new()); |
1903 |
|
|
1904 |
#if defined(USE_MAEMO) && defined(HILDON_HELP) |
#if defined(USE_MAEMO) && defined(HILDON_HELP) |
1905 |
item = gtk_menu_item_new_with_label( _("Help...") ); |
item = gtk_menu_item_new_with_label( _("Help") ); |
1906 |
gtk_menu_append(GTK_MENU_SHELL(menu), item); |
gtk_menu_append(GTK_MENU_SHELL(menu), item); |
1907 |
g_signal_connect(item, "activate", GTK_SIGNAL_FUNC(cb_menu_help), appdata); |
g_signal_connect(item, "activate", GTK_SIGNAL_FUNC(cb_menu_help), appdata); |
1908 |
#endif |
#endif |
1909 |
|
|
1910 |
item = gtk_menu_item_new_with_label( _("About...") ); |
item = gtk_menu_item_new_with_label( _("About") ); |
1911 |
gtk_menu_append(GTK_MENU_SHELL(menu), item); |
gtk_menu_append(GTK_MENU_SHELL(menu), item); |
1912 |
g_signal_connect(item, "activate", GTK_SIGNAL_FUNC(cb_menu_about), appdata); |
g_signal_connect(item, "activate", GTK_SIGNAL_FUNC(cb_menu_about), appdata); |
1913 |
|
|
1943 |
if(appdata->image_path) free(appdata->image_path); |
if(appdata->image_path) free(appdata->image_path); |
1944 |
if(appdata->search_str) free(appdata->search_str); |
if(appdata->search_str) free(appdata->search_str); |
1945 |
|
|
1946 |
|
#ifdef USE_STACKABLE_WINDOW |
1947 |
|
if(appdata->export_menu) submenu_cleanup(appdata->export_menu); |
1948 |
|
if(appdata->tools_menu) submenu_cleanup(appdata->tools_menu); |
1949 |
|
#endif |
1950 |
|
|
1951 |
gnome_vfs_shutdown(); |
gnome_vfs_shutdown(); |
1952 |
icons_free(); |
icons_free(); |
1953 |
gps_release(appdata); |
gps_release(appdata); |
1976 |
puts("everything is gone"); |
puts("everything is gone"); |
1977 |
} |
} |
1978 |
|
|
1979 |
void on_window_destroy (GtkWidget *widget, gpointer data) { |
static void on_window_destroy (GtkWidget *widget, gpointer data) { |
1980 |
appdata_t *appdata = (appdata_t*)data; |
appdata_t *appdata = (appdata_t*)data; |
1981 |
|
|
1982 |
gconf_save_state(appdata); |
gconf_save_state(appdata); |
1985 |
} |
} |
1986 |
|
|
1987 |
gboolean on_window_key_press(GtkWidget *widget, |
gboolean on_window_key_press(GtkWidget *widget, |
1988 |
GdkEventKey *event, gpointer data) { |
GdkEventKey *event, appdata_t *appdata) { |
|
appdata_t *appdata = (appdata_t*)data; |
|
1989 |
int handled = FALSE; |
int handled = FALSE; |
1990 |
|
|
1991 |
// printf("key event %d\n", event->keyval); |
// printf("key event %d\n", event->keyval); |
1993 |
switch(event->keyval) { |
switch(event->keyval) { |
1994 |
#ifdef USE_MAEMO |
#ifdef USE_MAEMO |
1995 |
|
|
|
#if 0 /* don't do this as it interferes with gtkentry fields */ |
|
|
case HILDON_HARDKEY_SELECT: |
|
|
/* remove as long as we haven't reached the main gpx list */ |
|
|
if(appdata->cur_gpx) |
|
|
hildon_bread_crumb_trail_pop(HILDON_BREAD_CRUMB_TRAIL(appdata->bct)); |
|
|
handled = TRUE; |
|
|
break; |
|
|
#endif |
|
|
|
|
1996 |
#ifdef HILDON_HARDKEY_INCREASE |
#ifdef HILDON_HARDKEY_INCREASE |
1997 |
case HILDON_HARDKEY_INCREASE: |
case HILDON_HARDKEY_INCREASE: |
1998 |
html_zoom(appdata, TRUE); |
html_zoom(appdata, TRUE); |
2177 |
#endif // USE_BREAD_CRUMB_TRAIL |
#endif // USE_BREAD_CRUMB_TRAIL |
2178 |
|
|
2179 |
void main_after_settings_redraw(appdata_t *appdata, int flags) { |
void main_after_settings_redraw(appdata_t *appdata, int flags) { |
2180 |
|
printf("main after settings redraw\n"); |
2181 |
|
|
2182 |
|
if(!appdata->cur_view) { |
2183 |
|
printf("no active view\n"); |
2184 |
|
return; |
2185 |
|
} |
2186 |
|
|
2187 |
#ifndef USE_MAEMO |
#ifndef USE_MAEMO |
2188 |
// in non-maemo setup this can only affect the main screen as |
// in non-maemo setup this can only affect the main screen as |
2189 |
// the menu is blocked while a dialog is open. also the main |
// the menu is blocked while a dialog is open. also the main |
2219 |
} |
} |
2220 |
|
|
2221 |
if(redraw) { |
if(redraw) { |
2222 |
gtk_container_remove(GTK_CONTAINER(appdata->vbox), appdata->cur_view); |
GtkWidget *container = appdata->vbox; |
2223 |
|
|
2224 |
|
#ifdef USE_STACKABLE_WINDOW |
2225 |
|
HildonWindowStack *stack = hildon_window_stack_get_default(); |
2226 |
|
container = hildon_window_stack_peek(stack); |
2227 |
|
#endif |
2228 |
|
|
2229 |
|
gtk_container_remove(GTK_CONTAINER(container), appdata->cur_view); |
2230 |
switch(redraw) { |
switch(redraw) { |
2231 |
case 1: |
case 1: |
2232 |
appdata->cur_view = cachelist_create(appdata, |
appdata->cur_view = cachelist_create(appdata, |
2241 |
break; |
break; |
2242 |
} |
} |
2243 |
|
|
2244 |
gtk_box_pack_start_defaults(GTK_BOX(appdata->vbox), appdata->cur_view); |
#ifdef USE_STACKABLE_WINDOW |
2245 |
gtk_widget_show_all(appdata->vbox); |
if(container != appdata->vbox) |
2246 |
} |
gtk_container_add(GTK_CONTAINER(container), appdata->cur_view); |
2247 |
|
else |
2248 |
#endif |
#endif |
2249 |
|
gtk_box_pack_start_defaults(GTK_BOX(container), appdata->cur_view); |
2250 |
|
|
2251 |
|
gtk_widget_show_all(container); |
2252 |
|
} |
2253 |
|
#endif // USE_MAEMO |
2254 |
} |
} |
2255 |
|
|
2256 |
int main(int argc, char *argv[]) { |
int main(int argc, char *argv[]) { |
2307 |
gtk_window_set_default_size(GTK_WINDOW(appdata.window), 500, 300); |
gtk_window_set_default_size(GTK_WINDOW(appdata.window), 500, 300); |
2308 |
#endif |
#endif |
2309 |
|
|
2310 |
|
#if MAEMO_VERSION_MAJOR == 5 |
2311 |
gtk_window_set_title(GTK_WINDOW(appdata.window), "GPXView"); |
gtk_window_set_title(GTK_WINDOW(appdata.window), "GPXView"); |
2312 |
|
#endif |
2313 |
|
|
2314 |
g_signal_connect(G_OBJECT(appdata.window), "destroy", |
g_signal_connect(G_OBJECT(appdata.window), "destroy", |
2315 |
G_CALLBACK(on_window_destroy), &appdata); |
G_CALLBACK(on_window_destroy), &appdata); |
2316 |
|
|
2319 |
|
|
2320 |
appdata.vbox = gtk_vbox_new(FALSE, 2); |
appdata.vbox = gtk_vbox_new(FALSE, 2); |
2321 |
gtk_container_add(GTK_CONTAINER(appdata.window), appdata.vbox); |
gtk_container_add(GTK_CONTAINER(appdata.window), appdata.vbox); |
|
|
|
2322 |
#ifndef USE_STACKABLE_WINDOW |
#ifndef USE_STACKABLE_WINDOW |
2323 |
menu_create(&appdata); |
menu_create(&appdata); |
2324 |
#else |
#else |