31 |
#include "custom_rating_renderer.h" |
#include "custom_rating_renderer.h" |
32 |
#include "custom_type_renderer.h" |
#include "custom_type_renderer.h" |
33 |
|
|
34 |
|
#ifdef ESPEAK |
35 |
|
#include <espeak/speak_lib.h> |
36 |
|
#endif |
37 |
|
|
38 |
#ifdef USE_MAEMO |
#ifdef USE_MAEMO |
39 |
#include <hildon/hildon-banner.h> |
#include <hildon/hildon-banner.h> |
40 |
#if MAEMO_VERSION_MAJOR >= 5 |
#if MAEMO_VERSION_MAJOR >= 5 |
412 |
static gboolean on_cachelist_focus_in(GtkWidget *widget, GdkEventFocus *event, |
static gboolean on_cachelist_focus_in(GtkWidget *widget, GdkEventFocus *event, |
413 |
gpointer data) { |
gpointer data) { |
414 |
|
|
|
|
|
415 |
/* we don't want a runnign timer yet */ |
/* we don't want a runnign timer yet */ |
416 |
if(!g_object_get_data(G_OBJECT(data), "handler_id")) { |
if(!g_object_get_data(G_OBJECT(data), "handler_id")) { |
417 |
printf("focus received: restarting cachelist timer\n"); |
printf("focus received: restarting cachelist timer\n"); |
422 |
|
|
423 |
g_object_set_data(G_OBJECT(data), "handler_id", (gpointer) |
g_object_set_data(G_OBJECT(data), "handler_id", (gpointer) |
424 |
gtk_timeout_add(CACHELIST_UPDATE_TIMEOUT, cachelist_update, data)); |
gtk_timeout_add(CACHELIST_UPDATE_TIMEOUT, cachelist_update, data)); |
425 |
|
|
426 |
|
/* and redo list immediately */ |
427 |
|
cachelist_redraw(appdata); |
428 |
} |
} |
429 |
|
|
430 |
return FALSE; |
return FALSE; |
1493 |
g_signal_connect(G_OBJECT(context.in_finds), "toggled", |
g_signal_connect(G_OBJECT(context.in_finds), "toggled", |
1494 |
G_CALLBACK(callback_finds_toggled), &context); |
G_CALLBACK(callback_finds_toggled), &context); |
1495 |
|
|
1496 |
#ifndef USE_MAEMO |
context.spinner = number_editor_new(appdata->search_days, 0, 99); |
|
GtkObject *adj = gtk_adjustment_new(appdata->search_days, 0, 99, 1, 10, 10); |
|
|
context.spinner = gtk_spin_button_new(GTK_ADJUSTMENT(adj), 1, 0); |
|
|
#else |
|
|
context.spinner = hildon_number_editor_new(0, 99); |
|
|
hildon_number_editor_set_value(HILDON_NUMBER_EDITOR(context.spinner), |
|
|
appdata->search_days); |
|
|
#endif |
|
1497 |
gtk_box_pack_start_defaults(GTK_BOX(hbox), context.spinner); |
gtk_box_pack_start_defaults(GTK_BOX(hbox), context.spinner); |
1498 |
|
|
1499 |
gtk_box_pack_start_defaults(GTK_BOX(hbox), gtk_label_new(_("days"))); |
gtk_box_pack_start_defaults(GTK_BOX(hbox), gtk_label_new(_("days"))); |
1500 |
|
|
1501 |
gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox); |
gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox); |
1513 |
if(strlen(p) > 0) |
if(strlen(p) > 0) |
1514 |
appdata->search_str = strdup(p); |
appdata->search_str = strdup(p); |
1515 |
|
|
1516 |
#ifndef USE_MAEMO |
appdata->search_days = number_editor_get_value(context.spinner); |
|
appdata->search_days = gtk_spin_button_get_value_as_int( |
|
|
GTK_SPIN_BUTTON(context.spinner)); |
|
|
#else |
|
|
appdata->search_days = hildon_number_editor_get_value( |
|
|
HILDON_NUMBER_EDITOR(context.spinner)); |
|
|
#endif |
|
1517 |
|
|
1518 |
if(check_button_get_active(context.in_finds)) |
if(check_button_get_active(context.in_finds)) |
1519 |
appdata->search |= SEARCH_FINDS; |
appdata->search |= SEARCH_FINDS; |
1549 |
printf("Search for %s (flags = %x)...\n", p, appdata->search); |
printf("Search for %s (flags = %x)...\n", p, appdata->search); |
1550 |
|
|
1551 |
#if !defined(USE_BREAD_CRUMB_TRAIL) && !defined(BCT) |
#if !defined(USE_BREAD_CRUMB_TRAIL) && !defined(BCT) |
1552 |
gpx_t *found = |
|
1553 |
search_do(appdata, appdata->gpx, p, appdata->search, FALSE); |
if(appdata->cur_gpx) |
1554 |
|
appdata->search_results = |
1555 |
|
search_do(appdata, appdata->cur_gpx, p, appdata->search, TRUE); |
1556 |
|
else |
1557 |
|
appdata->search_results = |
1558 |
|
search_do(appdata, appdata->gpx, p, appdata->search, FALSE); |
1559 |
|
|
1560 |
/* do search result dialog here ... */ |
/* do search result dialog here ... */ |
1561 |
cachelist_dialog(appdata, found); |
cachelist_dialog(appdata, appdata->search_results); |
1562 |
|
|
1563 |
#ifndef USE_STACKABLE_WINDOW |
#ifndef USE_STACKABLE_WINDOW |
1564 |
search_result_free(found); |
search_result_free(appdata->search_results); |
1565 |
#else |
appdata->search_results = NULL; |
|
appdata->search_results = found; |
|
1566 |
#endif |
#endif |
1567 |
#else |
#else |
1568 |
gpx_t *found = NULL; |
gpx_t *found = NULL; |
1854 |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
1855 |
} |
} |
1856 |
|
|
1857 |
if((mode == MENU_GPXLIST) || (mode == MENU_CACHELIST)) { |
/* if search results exist, don't allow another search */ |
1858 |
|
if(!appdata->search_results && |
1859 |
|
((mode == MENU_GPXLIST) || (mode == MENU_CACHELIST))) { |
1860 |
button = gtk_button_new_with_label(_("Search")); |
button = gtk_button_new_with_label(_("Search")); |
1861 |
g_signal_connect_after(button, "clicked", |
g_signal_connect_after(button, "clicked", |
1862 |
G_CALLBACK(cb_menu_search), appdata); |
G_CALLBACK(cb_menu_search), appdata); |
2056 |
|
|
2057 |
void cleanup(appdata_t *appdata) { |
void cleanup(appdata_t *appdata) { |
2058 |
gconf_save_state(appdata); |
gconf_save_state(appdata); |
2059 |
|
|
2060 |
gpx_free_all(appdata->gpx); |
gpx_free_all(appdata->gpx); |
2061 |
|
|
2062 |
|
#ifdef ESPEAK |
2063 |
|
espeak_Terminate(); |
2064 |
|
#endif |
2065 |
|
|
2066 |
#ifdef USE_STACKABLE_WINDOW |
#ifdef USE_STACKABLE_WINDOW |
2067 |
if(appdata->export_menu) submenu_cleanup(appdata->export_menu); |
if(appdata->export_menu) submenu_cleanup(appdata->export_menu); |
2068 |
if(appdata->tools_menu) submenu_cleanup(appdata->tools_menu); |
if(appdata->tools_menu) submenu_cleanup(appdata->tools_menu); |
2072 |
icons_free(); |
icons_free(); |
2073 |
gps_release(appdata); |
gps_release(appdata); |
2074 |
|
|
|
#ifdef USE_MAEMO |
|
2075 |
if(appdata->search_results) { |
if(appdata->search_results) { |
2076 |
printf("freeing pending search\n"); |
printf("freeing pending search\n"); |
2077 |
search_result_free(appdata->search_results); |
search_result_free(appdata->search_results); |
2078 |
} |
} |
2079 |
|
|
2080 |
|
#ifdef USE_MAEMO |
2081 |
if(appdata->osso_context) |
if(appdata->osso_context) |
2082 |
osso_deinitialize(appdata->osso_context); |
osso_deinitialize(appdata->osso_context); |
2083 |
|
|
2393 |
|
|
2394 |
curl_global_init(CURL_GLOBAL_ALL); |
curl_global_init(CURL_GLOBAL_ALL); |
2395 |
|
|
2396 |
|
#ifdef ESPEAK |
2397 |
|
#if ESPEAK_API_REVISION == 1 |
2398 |
|
appdata.espeak.sample_rate = |
2399 |
|
espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 512, NULL); |
2400 |
|
#else |
2401 |
|
appdata.espeak.sample_rate = |
2402 |
|
espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 512, NULL, 0); |
2403 |
|
#endif |
2404 |
|
if(appdata.espeak.sample_rate < 0) |
2405 |
|
printf("espeak: init error\n"); |
2406 |
|
else |
2407 |
|
printf("espeak: running at %dhz\n", appdata.espeak.sample_rate); |
2408 |
|
|
2409 |
|
/* set language */ |
2410 |
|
espeak_VOICE voice_spec; |
2411 |
|
voice_spec.name = NULL; |
2412 |
|
voice_spec.languages = _("en"); |
2413 |
|
voice_spec.gender = 0; |
2414 |
|
voice_spec.age = 0; |
2415 |
|
voice_spec.variant = 0; |
2416 |
|
if(EE_OK != espeak_SetVoiceByProperties(&voice_spec)) { |
2417 |
|
printf("failed to set voice spec for %s\n", voice_spec.languages); |
2418 |
|
appdata.espeak.sample_rate = -1; |
2419 |
|
} |
2420 |
|
#endif |
2421 |
|
|
2422 |
#ifdef USE_MAEMO |
#ifdef USE_MAEMO |
2423 |
printf("Installing osso context for \"org.harbaum." APP "\"\n"); |
printf("Installing osso context for \"org.harbaum." APP "\"\n"); |
2424 |
appdata.osso_context = osso_initialize("org.harbaum."APP, |
appdata.osso_context = osso_initialize("org.harbaum."APP, |
2506 |
|
|
2507 |
appdata.gconf_client = gconf_client_get_default(); |
appdata.gconf_client = gconf_client_get_default(); |
2508 |
gconf_load_state(&appdata); |
gconf_load_state(&appdata); |
2509 |
|
|
2510 |
gps_init(&appdata); |
gps_init(&appdata); |
2511 |
|
|
2512 |
appdata.cur_view = gpxlist_create_view_and_model(&appdata, NULL); |
appdata.cur_view = gpxlist_create_view_and_model(&appdata, NULL); |