Diff of /trunk/src/geotoad.c

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

revision 210 by harbaum, Tue Nov 24 20:19:08 2009 UTC revision 211 by harbaum, Wed Nov 25 10:13:26 2009 UTC
# Line 119  static void appendf(struct log_s *log, c Line 119  static void appendf(struct log_s *log, c
119    g_free(buf);    g_free(buf);
120    
121    gtk_text_view_scroll_to_iter(GTK_TEXT_VIEW(log->view),    gtk_text_view_scroll_to_iter(GTK_TEXT_VIEW(log->view),
122                                 &end, 0.0, TRUE, 0, 1.0);                                 &end, 0.0, TRUE, 1.0, 1.0);
123  }  }
124    
125  // This function receives a requst from a worker thread asking to  // This function receives a requst from a worker thread asking to
# Line 312  static void run(gt_context_t *context) { Line 312  static void run(gt_context_t *context) {
312    
313    /* check if we need to add proxy config */    /* check if we need to add proxy config */
314    char *proxy = NULL;    char *proxy = NULL;
315    
316    if(context->appdata->proxy && context->appdata->proxy->host) {    if(context->appdata->proxy && context->appdata->proxy->host) {
317      if(context->appdata->proxy->use_authentication &&      if(context->appdata->proxy->use_authentication &&
318         context->appdata->proxy->authentication_user &&         context->appdata->proxy->authentication_user &&
# Line 326  static void run(gt_context_t *context) { Line 327  static void run(gt_context_t *context) {
327                                context->appdata->proxy->host,                                context->appdata->proxy->host,
328                                context->appdata->proxy->port);                                context->appdata->proxy->port);
329    
330      g_ptr_array_add (context->argv, proxy);    } else {
331        /* use environment settings if preset (for scratchbox) */
332        const char *proxy_env = g_getenv("http_proxy");
333        if(proxy_env)
334          proxy = g_strdup_printf("--proxy=%s", proxy_env);
335    }    }
336    
337      if(proxy)
338        g_ptr_array_add (context->argv, proxy);
339    
340    /* convert coordinates into simple ascii format */    /* convert coordinates into simple ascii format */
341    char n = (context->appdata->gt.lat >= 0)?'N':'S';    char n = (context->appdata->gt.lat >= 0)?'N':'S';
# Line 407  static void gui_run(gt_context_t *contex Line 415  static void gui_run(gt_context_t *contex
415    gtk_dialog_run(GTK_DIALOG(dialog));    gtk_dialog_run(GTK_DIALOG(dialog));
416    
417    gtk_widget_destroy(dialog);    gtk_widget_destroy(dialog);
   
   errorf("Fertig!\n");  
   
418  }  }
419    
420  static void on_browse(GtkWidget *widget, gpointer data) {  static void on_browse(GtkWidget *widget, gpointer data) {
# Line 591  static gboolean gui_setup(gt_context_t * Line 596  static gboolean gui_setup(gt_context_t *
596      if(isnan(appdata->gt.lat) || isnan(appdata->gt.lon) ||      if(isnan(appdata->gt.lat) || isnan(appdata->gt.lon) ||
597         isnan(appdata->gt.distance) || !appdata->gt.filename ||         isnan(appdata->gt.distance) || !appdata->gt.filename ||
598         !appdata->username || !appdata->gt.password)         !appdata->username || !appdata->gt.password)
599        errorf(_("GeoToad setup not complete"));        errorf(_("The GeoToad setup is not complete."));
600      else      else
601        ok = TRUE;        ok = TRUE;
602    }    }
# Line 614  void geotoad(appdata_t *appdata) { Line 619  void geotoad(appdata_t *appdata) {
619    
620    context->update_mutex = g_mutex_new();    context->update_mutex = g_mutex_new();
621    context->update_cond = g_cond_new();    context->update_cond = g_cond_new();
   //  context->mutex_to_run = mutex_to_run;  
622    
623    printf("geoToad\n");    printf("geoToad\n");
624    
625    if(gui_setup(context))    if(gui_setup(context))
626      gui_run(context);      gui_run(context);
627    
628      /* continue to process if something has actually been saved */
629      if(context->state == GT_STATE_SAVE_FOUND) {
630        /* download seems to be successful. Make sure the GUI is */
631        /* updated if required */
632    
633        gpx_t **gpx = &(appdata->gpx);
634        while(*gpx && strcmp((*gpx)->filename, appdata->gt.filename))
635          gpx = &(*gpx)->next;
636    
637        if(*gpx) {
638          /* return main GUI to GPX list */
639    
640    #ifdef USE_BREAD_CRUMB_TRAIL
641          while(appdata->cur_gpx)
642            hildon_bread_crumb_trail_pop(HILDON_BREAD_CRUMB_TRAIL(appdata->bct));
643    #elif defined(BCT)
644          while(appdata->cur_gpx)
645            bct_pop(appdata->bct);
646    #else
647          HildonWindowStack *stack = hildon_window_stack_get_default();
648          gint num = hildon_window_stack_size(stack)-1;
649          while(num--) {
650            GtkWidget *top = hildon_window_stack_peek(stack);
651            gtk_widget_destroy(top);
652          }
653    #endif
654    
655          GtkTreeIter iter;
656          g_assert(gpxlist_find(appdata, &iter, *gpx));
657    
658          gpx_t *next = (*gpx)->next;
659    
660          gpx_free(*gpx);
661          *gpx = gpx_parse(NULL, appdata->gt.filename, appdata->username);
662          (*gpx)->next = next;
663    
664          /* update gpxlist */
665          gpxlist_set(appdata->gpxstore, &iter, *gpx);
666    
667          /* select that row */
668          GtkTreeSelection *selection =
669            gtk_tree_view_get_selection(GTK_TREE_VIEW(appdata->gpxview));
670          gtk_tree_selection_select_iter(selection, &iter);
671          GtkTreePath *path =
672            gtk_tree_model_get_path(GTK_TREE_MODEL(appdata->gpxstore), &iter);
673          gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(appdata->gpxview),
674                                       path, NULL, TRUE, 0.0, 0.0);
675          gtk_tree_path_free(path);
676    
677        } else
678          printf("GPX file not imported\n");
679    
680      } else
681        errorf(_("GeoToad finished without result"));
682    
683    printf("main context free\n");    printf("main context free\n");
684    context_free(context);    context_free(context);
685  }  }

Legend:
Removed from v.210  
changed lines
  Added in v.211