- const gchar *constname = gtk_entry_get_text ( GTK_ENTRY(nameentry) );
- if ( strlen(constname) == 0 ) /* TODO: other checks (isalpha or whatever ) */
- a_dialog_info_msg ( parent, _("Please enter a name for the waypoint.") );
- else {
- gchar *name = g_strdup ( constname );
-
- if ( g_hash_table_lookup ( waypoints, name ) && !a_dialog_overwrite ( parent, _("The waypoint \"%s\" exists, do you want to overwrite it?"), name ) )
- g_free ( name );
- else
- {
- /* Do It */
- *dest = name;
- ll.lat = convert_dms_to_dec ( gtk_entry_get_text ( GTK_ENTRY(latentry) ) );
- ll.lon = convert_dms_to_dec ( gtk_entry_get_text ( GTK_ENTRY(lonentry) ) );
- vik_coord_load_from_latlon ( &(wp->coord), coord_mode, &ll );
- wp->altitude = atof ( gtk_entry_get_text ( GTK_ENTRY(altentry) ) );
- vik_waypoint_set_comment ( wp, gtk_entry_get_text ( GTK_ENTRY(commententry) ) );
- vik_waypoint_set_image ( wp, vik_file_entry_get_filename ( VIK_FILE_ENTRY(imageentry) ) );
- if ( wp->image && *(wp->image) && (!a_thumbnails_exists(wp->image)) )
- a_thumbnails_create ( wp->image );
-
- {
- GtkTreeIter iter, first;
- gtk_tree_model_get_iter_first ( GTK_TREE_MODEL(store), &first );
- if ( !gtk_combo_box_get_active_iter ( GTK_COMBO_BOX(symbolentry), &iter ) || !memcmp(&iter, &first, sizeof(GtkTreeIter)) ) {
- vik_waypoint_set_symbol ( wp, NULL );
- } else {
- gchar *sym;
- gtk_tree_model_get ( GTK_TREE_MODEL(store), &iter, 0, (void *)&sym, -1 );
- vik_waypoint_set_symbol ( wp, sym );
- g_free(sym);
- }
- }
-
- gtk_widget_destroy ( dialog );
- return TRUE;
- }
- } /* else (valid name) */
- }
- else
- {
- ll.lat = convert_dms_to_dec ( gtk_entry_get_text ( GTK_ENTRY(latentry) ) );
- ll.lon = convert_dms_to_dec ( gtk_entry_get_text ( GTK_ENTRY(lonentry) ) );
- vik_coord_load_from_latlon ( &(wp->coord), coord_mode, &ll );
- wp->altitude = atof ( gtk_entry_get_text ( GTK_ENTRY(altentry) ) );
- if ( (! wp->comment) || strcmp ( wp->comment, gtk_entry_get_text ( GTK_ENTRY(commententry) ) ) != 0 )
- vik_waypoint_set_comment ( wp, gtk_entry_get_text ( GTK_ENTRY(commententry) ) );
- if ( (! wp->image) || strcmp ( wp->image, vik_file_entry_get_filename ( VIK_FILE_ENTRY ( imageentry ) ) ) != 0 )
- {
- vik_waypoint_set_image ( wp, vik_file_entry_get_filename ( VIK_FILE_ENTRY(imageentry) ) );
- if ( wp->image && *(wp->image) && (!a_thumbnails_exists(wp->image)) )
- a_thumbnails_create ( wp->image );
- }
-
- {
- GtkTreeIter iter, first;
- gtk_tree_model_get_iter_first ( GTK_TREE_MODEL(store), &first );
- if ( !gtk_combo_box_get_active_iter ( GTK_COMBO_BOX(symbolentry), &iter ) || !memcmp(&iter, &first, sizeof(GtkTreeIter)) ) {
- vik_waypoint_set_symbol ( wp, NULL );
- } else {
- gchar *sym;
- gtk_tree_model_get ( GTK_TREE_MODEL(store), &iter, 0, (void *)&sym, -1 );
- vik_waypoint_set_symbol ( wp, sym );
- g_free(sym);
- }
- }
-