static void datasource_gc_get_cmd_string ( datasource_gc_widgets_t *widgets, gchar **cmd, gchar **input_file_type ) { //gchar *safe_string = g_shell_quote ( gtk_entry_get_text ( GTK_ENTRY(widgets->center_entry) ) ); gchar *safe_user = g_shell_quote ( a_preferences_get ( VIKING_GC_PARAMS_NAMESPACE "username")->s ); gchar *safe_pass = g_shell_quote ( a_preferences_get ( VIKING_GC_PARAMS_NAMESPACE "password")->s ); gdouble lat, lon; if ( 2 != sscanf ( gtk_entry_get_text ( GTK_ENTRY(widgets->center_entry) ), "%lf,%lf", &lat, &lon ) ) { g_warning (_("Broken input - using some defaults")); lat = a_vik_get_default_lat(); lon = a_vik_get_default_long(); } // Unix specific shell commands // 1. Remove geocache webpages (maybe be from different location) // 2, Gets upto n geocaches as webpages for the specified user in radius r Miles // 3. Converts webpages into a single waypoint file, ignoring zero location waypoints '-z' // Probably as they are premium member only geocaches and user is only a basic member // Final output is piped into GPSbabel - hence removal of *html is done at beginning of the command sequence *cmd = g_strdup_printf( "rm -f ~/.geo/caches/*html ; %s -P -n%d -r%.1fM -u %s -p %s %.4f %.4f ; %s -z ~/.geo/caches/*html ", GC_PROGRAM1, gtk_spin_button_get_value_as_int ( GTK_SPIN_BUTTON(widgets->num_spin) ), gtk_spin_button_get_value_as_float ( GTK_SPIN_BUTTON(widgets->miles_radius_spin) ), safe_user, safe_pass, lat, lon, GC_PROGRAM2 ); *input_file_type = NULL; //g_free ( safe_string ); g_free ( safe_user ); g_free ( safe_pass ); }
static void vik_viewport_init ( VikViewport *vvp ) { viewport_init_ra(); struct UTM utm; struct LatLon ll; ll.lat = a_vik_get_default_lat(); ll.lon = a_vik_get_default_long(); gdouble zoom_x = 4.0; gdouble zoom_y = 4.0; if ( a_vik_get_startup_method ( ) == VIK_STARTUP_METHOD_LAST_LOCATION ) { gdouble lat, lon, dzoom; if ( a_settings_get_double ( VIK_SETTINGS_VIEW_LAST_LATITUDE, &lat ) ) ll.lat = lat; if ( a_settings_get_double ( VIK_SETTINGS_VIEW_LAST_LONGITUDE, &lon ) ) ll.lon = lon; if ( a_settings_get_double ( VIK_SETTINGS_VIEW_LAST_ZOOM_X, &dzoom ) ) zoom_x = dzoom; if ( a_settings_get_double ( VIK_SETTINGS_VIEW_LAST_ZOOM_Y, &dzoom ) ) zoom_y = dzoom; } a_coords_latlon_to_utm ( &ll, &utm ); vvp->xmpp = zoom_x; vvp->ympp = zoom_y; vvp->xmfactor = MERCATOR_FACTOR (vvp->xmpp); vvp->ymfactor = MERCATOR_FACTOR (vvp->ympp); vvp->coord_mode = VIK_COORD_LATLON; vvp->drawmode = VIK_VIEWPORT_DRAWMODE_MERCATOR; vvp->center.mode = VIK_COORD_LATLON; vvp->center.north_south = ll.lat; vvp->center.east_west = ll.lon; vvp->center.utm_zone = (int)utm.zone; vvp->center.utm_letter = utm.letter; vvp->scr_buffer = NULL; vvp->alpha_pixbuf = NULL; vvp->alpha_pixbuf_width = vvp->alpha_pixbuf_height = 0; vvp->utm_zone_width = 0.0; vvp->background_gc = NULL; vvp->highlight_gc = NULL; vvp->scale_bg_gc = NULL; vvp->copyrights = NULL; vvp->draw_scale = TRUE; vvp->draw_centermark = TRUE; vvp->draw_highlight = TRUE; vvp->trigger = NULL; vvp->snapshot_buffer = NULL; vvp->half_drawn = FALSE; g_signal_connect (G_OBJECT(vvp), "configure_event", G_CALLBACK(vik_viewport_configure), NULL); #if GTK_CHECK_VERSION (2,18,0) gtk_widget_set_can_focus ( GTK_WIDGET(vvp), TRUE ); #else GTK_WIDGET_SET_FLAGS(vvp, GTK_CAN_FOCUS); /* allow VVP to have focus -- enabling key events, etc */ #endif }