Diff of /trunk/src/main.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 243 by harbaum, Mon Dec 14 20:07:54 2009 UTC revision 246 by harbaum, Tue Jan 19 20:26:37 2010 UTC
# Line 31  Line 31 
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
# Line 1487  cb_menu_search(GtkWidget *window, gpoint Line 1491  cb_menu_search(GtkWidget *window, gpoint
1491    g_signal_connect(G_OBJECT(context.in_finds), "toggled",    g_signal_connect(G_OBJECT(context.in_finds), "toggled",
1492                     G_CALLBACK(callback_finds_toggled), &context);                     G_CALLBACK(callback_finds_toggled), &context);
1493    
1494  #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  
1495    gtk_box_pack_start_defaults(GTK_BOX(hbox), context.spinner);    gtk_box_pack_start_defaults(GTK_BOX(hbox), context.spinner);
1496    
1497    gtk_box_pack_start_defaults(GTK_BOX(hbox), gtk_label_new(_("days")));    gtk_box_pack_start_defaults(GTK_BOX(hbox), gtk_label_new(_("days")));
1498    
1499    gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox);    gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox);
# Line 1514  cb_menu_search(GtkWidget *window, gpoint Line 1511  cb_menu_search(GtkWidget *window, gpoint
1511      if(strlen(p) > 0)      if(strlen(p) > 0)
1512        appdata->search_str = strdup(p);        appdata->search_str = strdup(p);
1513    
1514  #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  
1515    
1516      if(check_button_get_active(context.in_finds))      if(check_button_get_active(context.in_finds))
1517        appdata->search |=  SEARCH_FINDS;        appdata->search |=  SEARCH_FINDS;
# Line 1556  cb_menu_search(GtkWidget *window, gpoint Line 1547  cb_menu_search(GtkWidget *window, gpoint
1547        printf("Search for %s (flags = %x)...\n", p, appdata->search);        printf("Search for %s (flags = %x)...\n", p, appdata->search);
1548    
1549  #if !defined(USE_BREAD_CRUMB_TRAIL) && !defined(BCT)  #if !defined(USE_BREAD_CRUMB_TRAIL) && !defined(BCT)
1550        gpx_t *found =  
1551          search_do(appdata, appdata->gpx, p, appdata->search, FALSE);        if(appdata->cur_gpx)
1552            appdata->search_results =
1553              search_do(appdata, appdata->cur_gpx, p, appdata->search, TRUE);
1554          else
1555            appdata->search_results =
1556              search_do(appdata, appdata->gpx, p, appdata->search, FALSE);
1557    
1558        /* do search result dialog here ... */        /* do search result dialog here ... */
1559        cachelist_dialog(appdata, found);        cachelist_dialog(appdata, appdata->search_results);
1560    
1561  #ifndef USE_STACKABLE_WINDOW  #ifndef USE_STACKABLE_WINDOW
1562        search_result_free(found);        search_result_free(appdata->search_results);
1563  #else        appdata->search_results = NULL;
       appdata->search_results = found;  
1564  #endif  #endif
1565  #else  #else
1566        gpx_t *found = NULL;        gpx_t *found = NULL;
# Line 2061  void cleanup(appdata_t *appdata) { Line 2057  void cleanup(appdata_t *appdata) {
2057    
2058    gpx_free_all(appdata->gpx);    gpx_free_all(appdata->gpx);
2059    
2060    #ifdef ESPEAK
2061      espeak_Terminate();
2062    #endif
2063    
2064  #ifdef USE_STACKABLE_WINDOW  #ifdef USE_STACKABLE_WINDOW
2065    if(appdata->export_menu) submenu_cleanup(appdata->export_menu);    if(appdata->export_menu) submenu_cleanup(appdata->export_menu);
2066    if(appdata->tools_menu)  submenu_cleanup(appdata->tools_menu);    if(appdata->tools_menu)  submenu_cleanup(appdata->tools_menu);
# Line 2391  int main(int argc, char *argv[]) { Line 2391  int main(int argc, char *argv[]) {
2391    
2392    curl_global_init(CURL_GLOBAL_ALL);    curl_global_init(CURL_GLOBAL_ALL);
2393    
2394    #ifdef ESPEAK
2395    #if ESPEAK_API_REVISION == 1
2396      appdata.espeak.sample_rate =
2397        espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 512, NULL);
2398    #else
2399      appdata.espeak.sample_rate =
2400        espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 512, NULL, 0);
2401    #endif
2402      if(appdata.espeak.sample_rate < 0)
2403        printf("espeak: init error\n");
2404      else
2405        printf("espeak: running at %dhz\n", appdata.espeak.sample_rate);
2406    
2407      /* set language */
2408      espeak_VOICE voice_spec;
2409      voice_spec.name = NULL;
2410      voice_spec.languages = _("en");
2411      voice_spec.gender = 0;
2412      voice_spec.age = 0;
2413      voice_spec.variant = 0;
2414      if(EE_OK != espeak_SetVoiceByProperties(&voice_spec)) {
2415        printf("failed to set voice spec for %s\n", voice_spec.languages);
2416        appdata.espeak.sample_rate = -1;
2417      }
2418    #endif
2419    
2420  #ifdef USE_MAEMO  #ifdef USE_MAEMO
2421    printf("Installing osso context for \"org.harbaum." APP "\"\n");    printf("Installing osso context for \"org.harbaum." APP "\"\n");
2422    appdata.osso_context = osso_initialize("org.harbaum."APP,    appdata.osso_context = osso_initialize("org.harbaum."APP,
# Line 2478  int main(int argc, char *argv[]) { Line 2504  int main(int argc, char *argv[]) {
2504    
2505    appdata.gconf_client = gconf_client_get_default();    appdata.gconf_client = gconf_client_get_default();
2506    gconf_load_state(&appdata);    gconf_load_state(&appdata);
2507    
2508    gps_init(&appdata);    gps_init(&appdata);
2509    
2510    appdata.cur_view = gpxlist_create_view_and_model(&appdata, NULL);    appdata.cur_view = gpxlist_create_view_and_model(&appdata, NULL);

Legend:
Removed from v.243  
changed lines
  Added in v.246