diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-01-22 21:26:53 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-01-22 22:26:12 -0800 |
commit | e618a245b97a0e1dce9524aae5efdd031cb94d83 (patch) | |
tree | 05d853e7765cfc437d612d8c31e4e6a6a668d6cc | |
parent | 1f3024152c036fe158080beb9fcbe476aa8ae171 (diff) | |
download | subsurface-e618a245b97a0e1dce9524aae5efdd031cb94d83.tar.gz |
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>
-rw-r--r-- | divelist.c | 4 | ||||
-rw-r--r-- | gps.c | 5 |
2 files changed, 4 insertions, 5 deletions
diff --git a/divelist.c b/divelist.c index be5cd68b7..d033f93cf 100644 --- a/divelist.c +++ b/divelist.c @@ -982,7 +982,7 @@ static void get_suit(struct dive *dive, char **str) 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); else 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(MODEL(dive_list), &iter, DIVE_INDEX, &idx, -1); dive = get_dive(idx); - if (dive && (dive->latitude.udeg || dive->longitude.udeg)) + if (dive && dive_has_location(dive)) show_gps_location(dive); } gtk_tree_path_free(path); @@ -139,9 +139,8 @@ void show_gps_locations() if (!window || !map) map = init_map(); - for (idx = 0; idx < dive_table.nr; idx++) { - dp = dive_table.dives[idx]; - if (dp->latitude.udeg != 0 || dp->longitude.udeg != 0){ + for_each_dive(idx, dp) { + if (dive_has_location(dp)) { add_gps_point(map, dp->latitude.udeg / 1000000.0, dp->longitude.udeg / 1000000.0); } |