mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Fix saving of changed GPS entry
We can't use gps_changed() in the gps_map_callback function, because that will actually change the GPS data in the dive being edited, which in turn will then cause us to later (when we *really* want to change it) not match the master dive data any more, and think we shouldn't edit the dive at all. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									68eca79dfd
								
							
						
					
					
						commit
						05990b107d
					
				
					 1 changed files with 10 additions and 5 deletions
				
			
		
							
								
								
									
										15
									
								
								info.c
									
										
									
									
									
								
							
							
						
						
									
										15
									
								
								info.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -669,22 +669,27 @@ static void update_gps_entry(int lat, int lon)
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#if HAVE_OSM_GPS_MAP
 | 
			
		||||
static void update_gps_entry_callback(float lat, float lon)
 | 
			
		||||
{
 | 
			
		||||
	update_gps_entry(lat * 1000000, lon * 1000000);
 | 
			
		||||
	location_update.set_by_hand = 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#if HAVE_OSM_GPS_MAP
 | 
			
		||||
static gboolean gps_map_callback(GtkWidget *w, gpointer data)
 | 
			
		||||
{
 | 
			
		||||
	double latitude, longitude;
 | 
			
		||||
	const char *gps_text = NULL;
 | 
			
		||||
	struct dive *dive = location_update.dive;
 | 
			
		||||
	struct dive fake_dive;
 | 
			
		||||
 | 
			
		||||
	memset(&fake_dive, 0, sizeof(fake_dive));
 | 
			
		||||
	if (location_update.entry) {
 | 
			
		||||
		gps_text = gtk_entry_get_text(location_update.entry);
 | 
			
		||||
		(void)gps_changed(dive, NULL, gps_text);
 | 
			
		||||
		parse_gps_text(gps_text, &latitude, &longitude);
 | 
			
		||||
		fake_dive.latitude.udeg = rint(latitude * 1000000);
 | 
			
		||||
		fake_dive.longitude.udeg = rint(longitude * 1000000);
 | 
			
		||||
	}
 | 
			
		||||
	show_gps_location(dive, update_gps_entry_callback);
 | 
			
		||||
	location_update.set_by_hand = 1;
 | 
			
		||||
	show_gps_location(&fake_dive, update_gps_entry_callback);
 | 
			
		||||
	return TRUE;
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue