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, |
264 |
// gtk_widget_show_all(appdata->vbox); |
// gtk_widget_show_all(appdata->vbox); |
265 |
#else |
#else |
266 |
|
|
267 |
|
if(!appdata->cur_view) { |
268 |
|
printf("cachelist redraw: no active view\n"); |
269 |
|
return; |
270 |
|
} |
271 |
|
|
272 |
g_assert(!appdata->cur_cache); |
g_assert(!appdata->cur_cache); |
273 |
int redraw = 0; |
int redraw = 0; |
274 |
if(appdata->search_results) |
if(appdata->search_results) |
279 |
} |
} |
280 |
|
|
281 |
if(redraw) { |
if(redraw) { |
282 |
gtk_container_remove(GTK_CONTAINER(appdata->vbox), appdata->cur_view); |
GtkWidget *container = appdata->vbox; |
283 |
|
|
284 |
|
printf("redraw %d\n", redraw); |
285 |
|
|
286 |
|
#ifdef USE_STACKABLE_WINDOW |
287 |
|
HildonWindowStack *stack = hildon_window_stack_get_default(); |
288 |
|
container = hildon_window_stack_peek(stack); |
289 |
|
#endif |
290 |
|
|
291 |
|
gtk_container_remove(GTK_CONTAINER(container), appdata->cur_view); |
292 |
switch(redraw) { |
switch(redraw) { |
293 |
case 1: |
case 1: |
294 |
appdata->cur_view = cachelist_create(appdata, |
appdata->cur_view = cachelist_create(appdata, |
300 |
break; |
break; |
301 |
} |
} |
302 |
|
|
303 |
gtk_box_pack_start_defaults(GTK_BOX(appdata->vbox), appdata->cur_view); |
#ifdef USE_STACKABLE_WINDOW |
304 |
gtk_widget_show_all(appdata->vbox); |
if(container != appdata->vbox) |
305 |
|
gtk_container_add(GTK_CONTAINER(container), appdata->cur_view); |
306 |
|
else |
307 |
|
#endif |
308 |
|
gtk_box_pack_start_defaults(GTK_BOX(container), appdata->cur_view); |
309 |
|
|
310 |
|
gtk_widget_show_all(container); |
311 |
} |
} |
312 |
#endif |
#endif |
313 |
} |
} |
320 |
#ifdef USE_MAEMO |
#ifdef USE_MAEMO |
321 |
appdata_t *appdata = (appdata_t*)data; |
appdata_t *appdata = (appdata_t*)data; |
322 |
|
|
323 |
|
if(appdata->cur_cache) |
324 |
|
return TRUE; |
325 |
|
|
326 |
if(appdata->cachelist_disable_screensaver) |
if(appdata->cachelist_disable_screensaver) |
327 |
if (osso_display_blanking_pause(appdata->osso_context) != OSSO_OK) |
if (osso_display_blanking_pause(appdata->osso_context) != OSSO_OK) |
328 |
fprintf(stderr, "error with display blank\n"); |
fprintf(stderr, "error with display blank\n"); |
335 |
} |
} |
336 |
|
|
337 |
static void cachelist_timer_reset(appdata_t *appdata) { |
static void cachelist_timer_reset(appdata_t *appdata) { |
338 |
|
printf("cachelist timer reset\n"); |
339 |
g_assert(appdata->cachelist_handler_id); |
g_assert(appdata->cachelist_handler_id); |
340 |
gtk_timeout_remove(appdata->cachelist_handler_id); |
gtk_timeout_remove(appdata->cachelist_handler_id); |
341 |
appdata->cachelist_handler_id = |
appdata->cachelist_handler_id = |
567 |
} |
} |
568 |
#else |
#else |
569 |
#ifdef USE_STACKABLE_WINDOW |
#ifdef USE_STACKABLE_WINDOW |
570 |
|
static void search_result_free(gpx_t *result); |
571 |
|
|
572 |
|
void on_cachelist_destroy(GtkWidget *widget, appdata_t *appdata) { |
573 |
|
if(appdata->search_results) { |
574 |
|
search_result_free(appdata->search_results); |
575 |
|
appdata->search_results = NULL; |
576 |
|
} |
577 |
|
appdata->cur_gpx = NULL; |
578 |
|
|
579 |
|
/* restore cur_view */ |
580 |
|
appdata->cur_view = g_object_get_data(G_OBJECT(widget), "cur_view"); |
581 |
|
} |
582 |
|
|
583 |
void cachelist_dialog(appdata_t *appdata, gpx_t *gpx) { |
void cachelist_dialog(appdata_t *appdata, gpx_t *gpx) { |
584 |
GtkWidget *window = hildon_stackable_window_new(); |
GtkWidget *window = hildon_stackable_window_new(); |
585 |
|
|
586 |
gtk_window_set_title(GTK_WINDOW(window), gpx->name); |
/* store last "cur_view" in window */ |
587 |
|
g_object_set_data(G_OBJECT(window), "cur_view", appdata->cur_view); |
588 |
|
|
589 |
gtk_container_add(GTK_CONTAINER(window), |
appdata->cur_gpx = gpx; |
590 |
cachelist_create(appdata, gpx, NULL)); |
char *title = g_strdup_printf("GPXView - %s", gpx->name); |
591 |
|
gtk_window_set_title(GTK_WINDOW(window), title); |
592 |
|
g_free(title); |
593 |
|
|
594 |
|
appdata->cur_view = cachelist_create(appdata, gpx, NULL); |
595 |
|
gtk_container_add(GTK_CONTAINER(window), appdata->cur_view); |
596 |
|
|
597 |
|
|
598 |
hildon_window_set_app_menu(HILDON_WINDOW(window), |
hildon_window_set_app_menu(HILDON_WINDOW(window), |
599 |
menu_create(appdata, MENU_CACHELIST)); |
menu_create(appdata, MENU_CACHELIST)); |
600 |
|
|
601 |
|
g_signal_connect(G_OBJECT(window), "destroy", |
602 |
|
G_CALLBACK(on_cachelist_destroy), appdata); |
603 |
|
|
604 |
gtk_widget_show_all(window); |
gtk_widget_show_all(window); |
605 |
} |
} |
606 |
#endif |
#endif |
811 |
gpx_busy_dialog_destroy(dialog); |
gpx_busy_dialog_destroy(dialog); |
812 |
} |
} |
813 |
#ifndef USE_BREAD_CRUMB_TRAIL |
#ifndef USE_BREAD_CRUMB_TRAIL |
814 |
cachelist_dialog(appdata, gpx); |
#ifdef USE_STACKABLE_WINDOW |
815 |
|
if(!appdata->cur_gpx) |
816 |
|
#endif |
817 |
|
cachelist_dialog(appdata, gpx); |
818 |
|
#ifdef USE_STACKABLE_WINDOW |
819 |
|
else |
820 |
|
printf("selected gpx, but cachelist window already present\n"); |
821 |
|
#endif |
822 |
#else |
#else |
823 |
gtk_container_remove(GTK_CONTAINER(appdata->vbox), appdata->cur_view); |
gtk_container_remove(GTK_CONTAINER(appdata->vbox), appdata->cur_view); |
824 |
appdata->cur_view = cachelist_create(appdata, gpx, NULL); |
appdata->cur_view = cachelist_create(appdata, gpx, NULL); |
1023 |
|
|
1024 |
gtk_about_dialog_set_name(about, "GPXView"); |
gtk_about_dialog_set_name(about, "GPXView"); |
1025 |
gtk_about_dialog_set_version(about, VERSION); |
gtk_about_dialog_set_version(about, VERSION); |
1026 |
gtk_about_dialog_set_copyright(about, |
|
1027 |
_("GPXView (c) 2008 by\n" |
#ifdef ENABLE_LIBLOCATION |
1028 |
"Till Harbaum <till@harbaum.org>\n" |
char *uses = "uses liblocation"; |
1029 |
"Geocaching.com: Tantil")); |
#elif defined(ENABLE_GPSBT) |
1030 |
|
char *uses = "uses gpsbt and gpsd"; |
1031 |
|
#else |
1032 |
|
char *uses = "uses gpsd"; |
1033 |
|
#endif |
1034 |
|
|
1035 |
|
char *str = g_strdup_printf("%s\n\n(%s)", |
1036 |
|
_("GPXView (c) 2008-2009 by\n" |
1037 |
|
"Till Harbaum <till@harbaum.org>\n" |
1038 |
|
"Mailing list: gpxview-users@garage.maemo.org"), |
1039 |
|
_(uses) |
1040 |
|
); |
1041 |
|
|
1042 |
|
gtk_about_dialog_set_copyright(about, str); |
1043 |
|
g_free(str); |
1044 |
|
|
1045 |
gtk_about_dialog_set_website(about, |
gtk_about_dialog_set_website(about, |
1046 |
_("http://www.harbaum.org/till/maemo")); |
_("http://www.harbaum.org/till/maemo")); |
1396 |
/* don't search if we are asked to search for nothing */ |
/* don't search if we are asked to search for nothing */ |
1397 |
if(((appdata->search & (SEARCH_ID|SEARCH_NAME|SEARCH_DESC|SEARCH_OWNER)) && |
if(((appdata->search & (SEARCH_ID|SEARCH_NAME|SEARCH_DESC|SEARCH_OWNER)) && |
1398 |
strlen(p) > 0) || (appdata->search & SEARCH_FINDS)) { |
strlen(p) > 0) || (appdata->search & SEARCH_FINDS)) { |
|
gpx_t *found = NULL; |
|
1399 |
|
|
1400 |
printf("Search for %s (flags = %x)...\n", p, appdata->search); |
printf("Search for %s (flags = %x)...\n", p, appdata->search); |
1401 |
|
|
1402 |
#ifndef USE_BREAD_CRUMB_TRAIL |
#ifndef USE_BREAD_CRUMB_TRAIL |
1403 |
found = search_do(appdata, appdata->gpx, p, appdata->search, FALSE); |
gpx_t *found = |
1404 |
|
search_do(appdata, appdata->gpx, p, appdata->search, FALSE); |
1405 |
|
|
1406 |
/* do search result dialog here ... */ |
/* do search result dialog here ... */ |
1407 |
cachelist_dialog(appdata, found); |
cachelist_dialog(appdata, found); |
1408 |
|
#ifndef USE_STACKABLE_WINDOW |
1409 |
search_result_free(found); |
search_result_free(found); |
1410 |
#else |
#else |
1411 |
|
appdata->search_results = found; |
1412 |
|
#endif |
1413 |
|
#else |
1414 |
|
gpx_t *found = NULL; |
1415 |
|
|
1416 |
if(appdata->cur_gpx) |
if(appdata->cur_gpx) |
1417 |
found = search_do(appdata, appdata->cur_gpx, p, appdata->search, TRUE); |
found = search_do(appdata, appdata->cur_gpx, p, appdata->search, TRUE); |
1418 |
else |
else |
1493 |
cb_menu_export_log(GtkWidget *widget, gpointer data) { |
cb_menu_export_log(GtkWidget *widget, gpointer data) { |
1494 |
appdata_t *appdata = (appdata_t*)data; |
appdata_t *appdata = (appdata_t*)data; |
1495 |
notes_log_export(appdata); |
notes_log_export(appdata); |
1496 |
|
#ifdef USE_STACKABLE_WINDOW |
1497 |
|
hildon_window_stack_pop_1 (hildon_window_stack_get_default()); |
1498 |
|
#endif |
1499 |
} |
} |
1500 |
|
|
1501 |
#ifdef USE_MAEMO |
#ifdef USE_MAEMO |
1503 |
cb_menu_export_mmpoi(GtkWidget *widget, gpointer data) { |
cb_menu_export_mmpoi(GtkWidget *widget, gpointer data) { |
1504 |
appdata_t *appdata = (appdata_t*)data; |
appdata_t *appdata = (appdata_t*)data; |
1505 |
mmpoi_export(appdata); |
mmpoi_export(appdata); |
1506 |
|
#ifdef USE_STACKABLE_WINDOW |
1507 |
|
hildon_window_stack_pop_1 (hildon_window_stack_get_default()); |
1508 |
|
#endif |
1509 |
} |
} |
1510 |
#endif |
#endif |
1511 |
|
|
1513 |
cb_menu_export_garmin(GtkWidget *widget, gpointer data) { |
cb_menu_export_garmin(GtkWidget *widget, gpointer data) { |
1514 |
appdata_t *appdata = (appdata_t*)data; |
appdata_t *appdata = (appdata_t*)data; |
1515 |
garmin_export(appdata); |
garmin_export(appdata); |
1516 |
|
#ifdef USE_STACKABLE_WINDOW |
1517 |
|
hildon_window_stack_pop_1 (hildon_window_stack_get_default()); |
1518 |
|
#endif |
1519 |
} |
} |
1520 |
|
|
1521 |
static void |
static void |
1522 |
cb_menu_geomath(GtkWidget *window, gpointer data) { |
cb_menu_geomath(GtkWidget *window, gpointer data) { |
1523 |
geomath_dialog((appdata_t *)data); |
geomath_dialog((appdata_t *)data); |
1524 |
|
#ifdef USE_STACKABLE_WINDOW |
1525 |
|
hildon_window_stack_pop_1 (hildon_window_stack_get_default()); |
1526 |
|
#endif |
1527 |
} |
} |
1528 |
|
|
1529 |
static void |
static void |
1530 |
cb_menu_geotext(GtkWidget *window, gpointer data) { |
cb_menu_geotext(GtkWidget *window, gpointer data) { |
1531 |
geotext_dialog((appdata_t *)data); |
geotext_dialog((appdata_t *)data); |
1532 |
|
#ifdef USE_STACKABLE_WINDOW |
1533 |
|
hildon_window_stack_pop_1 (hildon_window_stack_get_default()); |
1534 |
|
#endif |
1535 |
} |
} |
1536 |
|
|
1537 |
static void |
static void |
1538 |
cb_menu_precpos(GtkWidget *window, gpointer data) { |
cb_menu_precpos(GtkWidget *window, gpointer data) { |
1539 |
precise_position((appdata_t *)data); |
precise_position((appdata_t *)data); |
1540 |
|
#ifdef USE_STACKABLE_WINDOW |
1541 |
|
hildon_window_stack_pop_1 (hildon_window_stack_get_default()); |
1542 |
|
#endif |
1543 |
} |
} |
1544 |
|
|
1545 |
#ifdef USE_STACKABLE_WINDOW |
#ifdef USE_STACKABLE_WINDOW |
1546 |
|
static GtkWidget *export_menu_create(appdata_t *appdata) { |
1547 |
|
GtkWidget *button; |
1548 |
|
HildonAppMenu *menu = HILDON_APP_MENU(hildon_app_menu_new()); |
1549 |
|
|
1550 |
void on_export_clicked(GtkButton *button, appdata_t *appdata) { |
button = hildon_button_new_with_text( |
|
HildonStackableWindow *view_window; |
|
|
GtkWidget *but; |
|
|
|
|
|
view_window = HILDON_STACKABLE_WINDOW (hildon_stackable_window_new ()); |
|
|
gtk_window_set_title (GTK_WINDOW (view_window), "Export"); |
|
|
|
|
|
GtkVBox *contents = GTK_VBOX(gtk_vbox_new (12, FALSE)); |
|
|
|
|
|
but = hildon_button_new_with_text( |
|
1551 |
HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH, |
HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH, |
1552 |
HILDON_BUTTON_ARRANGEMENT_VERTICAL, |
HILDON_BUTTON_ARRANGEMENT_VERTICAL, |
1553 |
_("Export to Maemo Mapper"), |
_("Export to Maemo Mapper"), |
1554 |
_("Save a Maemo Mapper POI file")); |
_("Save a Maemo Mapper POI file")); |
1555 |
g_signal_connect(but, "clicked", |
g_signal_connect(button, "clicked", |
1556 |
G_CALLBACK(cb_menu_export_mmpoi), appdata); |
G_CALLBACK(cb_menu_export_mmpoi), appdata); |
1557 |
gtk_box_pack_start(GTK_BOX(contents), but, FALSE, FALSE, 0); |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
|
|
|
1558 |
|
|
1559 |
but = hildon_button_new_with_text( |
button = hildon_button_new_with_text( |
1560 |
HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH, |
HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH, |
1561 |
HILDON_BUTTON_ARRANGEMENT_VERTICAL, |
HILDON_BUTTON_ARRANGEMENT_VERTICAL, |
1562 |
_("Export Field Notes"), |
_("Export Field Notes"), |
1563 |
_("Save a Garmin Field Notes file")); |
_("Save a Garmin Field Notes file")); |
1564 |
g_signal_connect(but, "clicked", |
g_signal_connect(button, "clicked", |
1565 |
G_CALLBACK(cb_menu_export_log), appdata); |
G_CALLBACK(cb_menu_export_log), appdata); |
1566 |
gtk_box_pack_start(GTK_BOX(contents), but, FALSE, FALSE, 0); |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
|
|
|
1567 |
|
|
1568 |
but = hildon_button_new_with_text( |
button = hildon_button_new_with_text( |
1569 |
HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH, |
HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH, |
1570 |
HILDON_BUTTON_ARRANGEMENT_VERTICAL, |
HILDON_BUTTON_ARRANGEMENT_VERTICAL, |
1571 |
_("Export Garmin GPX"), |
_("Export Garmin GPX"), |
1572 |
_("Save a GPX file containing modified waypoints")); |
_("Save modified waypoints in GPX file")); |
1573 |
g_signal_connect(but, "clicked", |
g_signal_connect(button, "clicked", |
1574 |
G_CALLBACK(cb_menu_export_garmin), appdata); |
G_CALLBACK(cb_menu_export_garmin), appdata); |
1575 |
gtk_box_pack_start(GTK_BOX(contents), but, FALSE, FALSE, 0); |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
1576 |
|
|
1577 |
|
gtk_widget_show_all(GTK_WIDGET(menu)); |
1578 |
|
|
1579 |
gtk_container_add (GTK_CONTAINER (view_window), GTK_WIDGET (contents)); |
return GTK_WIDGET(menu); |
|
gtk_widget_show_all (GTK_WIDGET (view_window)); |
|
1580 |
} |
} |
1581 |
|
|
1582 |
void on_tools_clicked(GtkButton *button, appdata_t *appdata) { |
/* the export submenu */ |
1583 |
HildonStackableWindow *view_window; |
void on_export_clicked(GtkButton *button, appdata_t *appdata) { |
1584 |
GtkWidget *but; |
if(!appdata->export_menu) |
1585 |
|
appdata->export_menu = export_menu_create(appdata); |
1586 |
|
|
1587 |
view_window = HILDON_STACKABLE_WINDOW (hildon_stackable_window_new ()); |
/* draw a popup menu */ |
1588 |
gtk_window_set_title (GTK_WINDOW (view_window), "Export"); |
hildon_app_menu_popup(HILDON_APP_MENU(appdata->export_menu), |
1589 |
|
GTK_WINDOW(hildon_window_stack_peek( |
1590 |
|
hildon_window_stack_get_default()))); |
1591 |
|
} |
1592 |
|
|
1593 |
GtkVBox *contents = GTK_VBOX(gtk_vbox_new (12, FALSE)); |
static GtkWidget *tools_menu_create(appdata_t *appdata) { |
1594 |
|
GtkWidget *button; |
1595 |
|
HildonAppMenu *menu = HILDON_APP_MENU(hildon_app_menu_new()); |
1596 |
|
|
1597 |
but = hildon_button_new_with_text( |
/* the following doesn't have an effect */ |
1598 |
|
// gtk_window_set_title(GTK_WINDOW(menu), "Tools"); |
1599 |
|
|
1600 |
|
button = hildon_button_new_with_text( |
1601 |
HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH, |
HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH, |
1602 |
HILDON_BUTTON_ARRANGEMENT_VERTICAL, |
HILDON_BUTTON_ARRANGEMENT_VERTICAL, |
1603 |
_("Geomath"), |
_("Geomath"), |
1604 |
_("Geocoordinate calculation")); |
_("Geocoordinate calculation")); |
1605 |
g_signal_connect(but, "clicked", |
g_signal_connect(button, "clicked", |
1606 |
G_CALLBACK(cb_menu_geomath), appdata); |
G_CALLBACK(cb_menu_geomath), appdata); |
1607 |
gtk_box_pack_start(GTK_BOX(contents), but, FALSE, FALSE, 0); |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
1608 |
|
|
1609 |
|
|
1610 |
but = hildon_button_new_with_text( |
button = hildon_button_new_with_text( |
1611 |
HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH, |
HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH, |
1612 |
HILDON_BUTTON_ARRANGEMENT_VERTICAL, |
HILDON_BUTTON_ARRANGEMENT_VERTICAL, |
1613 |
_("Geotext"), |
_("Geotext"), |
1614 |
_("Text analysis, letter counting etc")); |
_("Text analysis")); |
1615 |
g_signal_connect(but, "clicked", |
g_signal_connect(button, "clicked", |
1616 |
G_CALLBACK(cb_menu_geotext), appdata); |
G_CALLBACK(cb_menu_geotext), appdata); |
1617 |
gtk_box_pack_start(GTK_BOX(contents), but, FALSE, FALSE, 0); |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
1618 |
|
|
1619 |
|
|
1620 |
but = hildon_button_new_with_text( |
button = hildon_button_new_with_text( |
1621 |
HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH, |
HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH, |
1622 |
HILDON_BUTTON_ARRANGEMENT_VERTICAL, |
HILDON_BUTTON_ARRANGEMENT_VERTICAL, |
1623 |
_("Precise Position"), |
_("Precise Position"), |
1624 |
_("Calculate a very precise GPS position")); |
_("Calculate a precise GPS position")); |
1625 |
g_signal_connect(but, "clicked", |
g_signal_connect(button, "clicked", |
1626 |
G_CALLBACK(cb_menu_precpos), appdata); |
G_CALLBACK(cb_menu_precpos), appdata); |
1627 |
gtk_box_pack_start(GTK_BOX(contents), but, FALSE, FALSE, 0); |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
1628 |
|
|
1629 |
|
gtk_widget_show_all(GTK_WIDGET(menu)); |
1630 |
|
|
1631 |
gtk_container_add (GTK_CONTAINER (view_window), GTK_WIDGET (contents)); |
return GTK_WIDGET(menu); |
|
gtk_widget_show_all (GTK_WIDGET (view_window)); |
|
1632 |
} |
} |
1633 |
|
|
1634 |
|
/* the tools submenu */ |
1635 |
|
void on_tools_clicked(GtkButton *button, appdata_t *appdata) { |
1636 |
|
if(!appdata->tools_menu) |
1637 |
|
appdata->tools_menu = tools_menu_create(appdata); |
1638 |
|
|
1639 |
|
/* draw a popup menu */ |
1640 |
|
hildon_app_menu_popup(HILDON_APP_MENU(appdata->tools_menu), |
1641 |
|
GTK_WINDOW(hildon_window_stack_peek( |
1642 |
|
hildon_window_stack_get_default()))); |
1643 |
|
} |
1644 |
|
|
1645 |
|
|
1646 |
HildonAppMenu *menu_create(appdata_t *appdata, int mode) { |
HildonAppMenu *menu_create(appdata_t *appdata, int mode) { |
1647 |
GtkWidget *button; |
GtkWidget *button; |
1648 |
HildonAppMenu *menu = HILDON_APP_MENU(hildon_app_menu_new()); |
HildonAppMenu *menu = HILDON_APP_MENU(hildon_app_menu_new()); |
1687 |
G_CALLBACK(on_tools_clicked), appdata); |
G_CALLBACK(on_tools_clicked), appdata); |
1688 |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
1689 |
|
|
1690 |
gtk_widget_show(GTK_WIDGET(menu)); |
#ifdef HILDON_HELP |
1691 |
|
button = gtk_button_new_with_label(_("Help")); |
1692 |
|
g_signal_connect_after(button, "clicked", |
1693 |
|
G_CALLBACK(cb_menu_help), appdata); |
1694 |
|
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
1695 |
|
#endif |
1696 |
|
|
1697 |
|
gtk_widget_show_all(GTK_WIDGET(menu)); |
1698 |
|
|
1699 |
return menu; |
return menu; |
1700 |
} |
} |
1900 |
} |
} |
1901 |
|
|
1902 |
gboolean on_window_key_press(GtkWidget *widget, |
gboolean on_window_key_press(GtkWidget *widget, |
1903 |
GdkEventKey *event, gpointer data) { |
GdkEventKey *event, appdata_t *appdata) { |
|
appdata_t *appdata = (appdata_t*)data; |
|
1904 |
int handled = FALSE; |
int handled = FALSE; |
1905 |
|
|
1906 |
// printf("key event %d\n", event->keyval); |
// printf("key event %d\n", event->keyval); |
1908 |
switch(event->keyval) { |
switch(event->keyval) { |
1909 |
#ifdef USE_MAEMO |
#ifdef USE_MAEMO |
1910 |
|
|
|
#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 |
|
|
|
|
1911 |
#ifdef HILDON_HARDKEY_INCREASE |
#ifdef HILDON_HARDKEY_INCREASE |
1912 |
case HILDON_HARDKEY_INCREASE: |
case HILDON_HARDKEY_INCREASE: |
1913 |
html_zoom(appdata, TRUE); |
html_zoom(appdata, TRUE); |
2092 |
#endif // USE_BREAD_CRUMB_TRAIL |
#endif // USE_BREAD_CRUMB_TRAIL |
2093 |
|
|
2094 |
void main_after_settings_redraw(appdata_t *appdata, int flags) { |
void main_after_settings_redraw(appdata_t *appdata, int flags) { |
2095 |
|
printf("main after settings redraw\n"); |
2096 |
|
|
2097 |
|
if(!appdata->cur_view) { |
2098 |
|
printf("no active view\n"); |
2099 |
|
return; |
2100 |
|
} |
2101 |
|
|
2102 |
#ifndef USE_MAEMO |
#ifndef USE_MAEMO |
2103 |
// in non-maemo setup this can only affect the main screen as |
// in non-maemo setup this can only affect the main screen as |
2104 |
// the menu is blocked while a dialog is open. also the main |
// the menu is blocked while a dialog is open. also the main |
2134 |
} |
} |
2135 |
|
|
2136 |
if(redraw) { |
if(redraw) { |
2137 |
gtk_container_remove(GTK_CONTAINER(appdata->vbox), appdata->cur_view); |
GtkWidget *container = appdata->vbox; |
2138 |
|
|
2139 |
|
#ifdef USE_STACKABLE_WINDOW |
2140 |
|
HildonWindowStack *stack = hildon_window_stack_get_default(); |
2141 |
|
container = hildon_window_stack_peek(stack); |
2142 |
|
#endif |
2143 |
|
|
2144 |
|
gtk_container_remove(GTK_CONTAINER(container), appdata->cur_view); |
2145 |
switch(redraw) { |
switch(redraw) { |
2146 |
case 1: |
case 1: |
2147 |
appdata->cur_view = cachelist_create(appdata, |
appdata->cur_view = cachelist_create(appdata, |
2156 |
break; |
break; |
2157 |
} |
} |
2158 |
|
|
2159 |
gtk_box_pack_start_defaults(GTK_BOX(appdata->vbox), appdata->cur_view); |
#ifdef USE_STACKABLE_WINDOW |
2160 |
gtk_widget_show_all(appdata->vbox); |
if(container != appdata->vbox) |
2161 |
} |
gtk_container_add(GTK_CONTAINER(container), appdata->cur_view); |
2162 |
|
else |
2163 |
#endif |
#endif |
2164 |
|
gtk_box_pack_start_defaults(GTK_BOX(container), appdata->cur_view); |
2165 |
|
|
2166 |
|
gtk_widget_show_all(container); |
2167 |
|
} |
2168 |
|
#endif // USE_MAEMO |
2169 |
} |
} |
2170 |
|
|
2171 |
int main(int argc, char *argv[]) { |
int main(int argc, char *argv[]) { |
2222 |
gtk_window_set_default_size(GTK_WINDOW(appdata.window), 500, 300); |
gtk_window_set_default_size(GTK_WINDOW(appdata.window), 500, 300); |
2223 |
#endif |
#endif |
2224 |
|
|
2225 |
|
#if MAEMO_VERSION_MAJOR == 5 |
2226 |
gtk_window_set_title(GTK_WINDOW(appdata.window), "GPXView"); |
gtk_window_set_title(GTK_WINDOW(appdata.window), "GPXView"); |
2227 |
|
#endif |
2228 |
|
|
2229 |
g_signal_connect(G_OBJECT(appdata.window), "destroy", |
g_signal_connect(G_OBJECT(appdata.window), "destroy", |
2230 |
G_CALLBACK(on_window_destroy), &appdata); |
G_CALLBACK(on_window_destroy), &appdata); |
2231 |
|
|