mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Use proper helper functions for dive location and for_each_dive
This makes the code use the "dive_has_location()" function rather than check the longitude and latitude directly. It also uses "for_each_dive()" rather than open-coding it. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									1f3024152c
								
							
						
					
					
						commit
						e618a245b9
					
				
					 2 changed files with 4 additions and 5 deletions
				
			
		|  | @ -982,7 +982,7 @@ static void get_suit(struct dive *dive, char **str) | ||||||
| 
 | 
 | ||||||
| static GdkPixbuf *get_gps_icon(struct dive *dive) | static GdkPixbuf *get_gps_icon(struct dive *dive) | ||||||
| { | { | ||||||
| 	if (dive->latitude.udeg || dive->longitude.udeg) | 	if (dive_has_location(dive)) | ||||||
| 		return gdk_pixbuf_from_pixdata(&my_pixbuf, TRUE, NULL); | 		return gdk_pixbuf_from_pixdata(&my_pixbuf, TRUE, NULL); | ||||||
| 	else | 	else | ||||||
| 		return NULL; | 		return NULL; | ||||||
|  | @ -1714,7 +1714,7 @@ gboolean icon_click_cb(GtkWidget *w, GdkEventButton *event, gpointer data) | ||||||
| 			gtk_tree_model_get_iter(MODEL(dive_list), &iter, path); | 			gtk_tree_model_get_iter(MODEL(dive_list), &iter, path); | ||||||
| 			gtk_tree_model_get(MODEL(dive_list), &iter, DIVE_INDEX, &idx, -1); | 			gtk_tree_model_get(MODEL(dive_list), &iter, DIVE_INDEX, &idx, -1); | ||||||
| 			dive = get_dive(idx); | 			dive = get_dive(idx); | ||||||
| 			if (dive && (dive->latitude.udeg || dive->longitude.udeg)) | 			if (dive && dive_has_location(dive)) | ||||||
| 				show_gps_location(dive); | 				show_gps_location(dive); | ||||||
| 		} | 		} | ||||||
| 		gtk_tree_path_free(path); | 		gtk_tree_path_free(path); | ||||||
|  |  | ||||||
							
								
								
									
										5
									
								
								gps.c
									
										
									
									
									
								
							
							
						
						
									
										5
									
								
								gps.c
									
										
									
									
									
								
							|  | @ -139,9 +139,8 @@ void show_gps_locations() | ||||||
| 	if (!window || !map) | 	if (!window || !map) | ||||||
| 		map = init_map(); | 		map = init_map(); | ||||||
| 
 | 
 | ||||||
| 	for (idx = 0; idx < dive_table.nr; idx++) { | 	for_each_dive(idx, dp) { | ||||||
| 		dp = dive_table.dives[idx]; | 		if (dive_has_location(dp)) { | ||||||
| 		if (dp->latitude.udeg != 0 || dp->longitude.udeg != 0){ |  | ||||||
| 			add_gps_point(map, dp->latitude.udeg / 1000000.0, | 			add_gps_point(map, dp->latitude.udeg / 1000000.0, | ||||||
| 				dp->longitude.udeg / 1000000.0); | 				dp->longitude.udeg / 1000000.0); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue