Diff of /trunk/src/geotoad.c

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

revision 251 by harbaum, Wed Dec 9 19:45:36 2009 UTC revision 252 by harbaum, Thu Feb 4 20:15:19 2010 UTC
# Line 67  typedef struct { Line 67  typedef struct {
67    } log;    } log;
68    
69    GtkWidget *username, *password;    GtkWidget *username, *password;
70    GtkWidget *lat, *lon, *dst;    GtkWidget *lat, *lon, *dst, *no_of;
71    char *filename;    char *filename;
72    
73    int use_cnt;    int use_cnt;
# Line 298  static void arg_dsp(gpointer data, gpoin Line 298  static void arg_dsp(gpointer data, gpoin
298    
299  static void run(gt_context_t *context) {  static void run(gt_context_t *context) {
300    GError *error = NULL;    GError *error = NULL;
   char str[8];  
301    
302    /* build list of arguments to call geotoad */    /* build list of arguments to call geotoad */
303    context->argv = g_ptr_array_new();    context->argv = g_ptr_array_new();
304    g_ptr_array_add (context->argv, g_strdup_printf(GEOTOAD));    g_ptr_array_add (context->argv, g_strdup_printf(GEOTOAD));
   g_ascii_dtostr(str, sizeof(str), context->appdata->gt.distance);  
305    g_ptr_array_add (context->argv,    g_ptr_array_add (context->argv,
306               g_strdup_printf("--distanceMax=%s", str));               g_strdup_printf("--distanceMax=%u",
307                                 (int)ceil(context->appdata->gt.distance)));
308    g_ptr_array_add (context->argv,    g_ptr_array_add (context->argv,
309               g_strdup_printf("--output=%s", context->appdata->gt.filename));               g_strdup_printf("--output=%s", context->appdata->gt.filename));
310    g_ptr_array_add (context->argv,    g_ptr_array_add (context->argv,
# Line 315  static void run(gt_context_t *context) { Line 314  static void run(gt_context_t *context) {
314    g_ptr_array_add (context->argv,    g_ptr_array_add (context->argv,
315               g_strdup_printf("--user=%s", context->appdata->username));               g_strdup_printf("--user=%s", context->appdata->username));
316    
317      if(context->appdata->gt.no_owned_found) {
318        g_ptr_array_add (context->argv,
319                 g_strdup_printf("--userExclude=%s", context->appdata->username));
320        g_ptr_array_add (context->argv,
321                 g_strdup_printf("--ownerExclude=%s", context->appdata->username));
322      }
323    
324    /* check if we need to add proxy config */    /* check if we need to add proxy config */
325    char *proxy = NULL;    char *proxy = NULL;
326    
# Line 471  static gboolean gui_setup(gt_context_t * Line 477  static gboolean gui_setup(gt_context_t *
477    gtk_box_pack_start_defaults(GTK_BOX(hbox), popup);    gtk_box_pack_start_defaults(GTK_BOX(hbox), popup);
478    table_attach(table, hbox, 1, 0);    table_attach(table, hbox, 1, 0);
479    
480    float dst = appdata->gt.distance;  // distance is given in kilometers    hbox = gtk_hbox_new(FALSE, 0);
481    if(appdata->imperial) dst /= 1.609344;    float dst = appdata->gt.distance;  // distance is given in miles
482      if(!appdata->imperial) dst *= 1.609344;
483    context->dst = dist_entry_new(dst, appdata->imperial);    context->dst = dist_entry_new(dst, appdata->imperial);
484    table_attach(table, context->dst, 1, 1);    gtk_box_pack_start_defaults(GTK_BOX(hbox), context->dst);
485    
486      context->no_of = check_button_new_with_label(_("No owned/found"));
487      check_button_set_active(context->no_of, appdata->gt.no_owned_found);
488      gtk_box_pack_start_defaults(GTK_BOX(hbox), context->no_of);
489    
490      table_attach(table, hbox, 1, 1);
491    
492    /* ------------------- Username/Password ------------------------- */    /* ------------------- Username/Password ------------------------- */
493    table_attach(table, left_label_new(_("Username:")), 0, 2);    table_attach(table, left_label_new(_("Username:")), 0, 2);
# Line 529  static gboolean gui_setup(gt_context_t * Line 542  static gboolean gui_setup(gt_context_t *
542      if(context->filename)      if(context->filename)
543        appdata->gt.filename = g_strdup(context->filename);        appdata->gt.filename = g_strdup(context->filename);
544    
545      /* get distance in kilometers */      /* get distance in miles */
546      appdata->gt.distance = dist_entry_get(context->dst, FALSE);      appdata->gt.distance = dist_entry_get(context->dst, TRUE);
547    
548        /* get "no owned/found" state */
549        appdata->gt.no_owned_found = check_button_get_active(context->no_of);
550    
551      /* check for valid entries */      /* check for valid entries */
552      if(isnan(appdata->gt.lat) || isnan(appdata->gt.lon) ||      if(isnan(appdata->gt.lat) || isnan(appdata->gt.lon) ||

Legend:
Removed from v.251  
changed lines
  Added in v.252