diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-01-28 07:54:30 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-01-28 13:07:08 -0800 |
commit | 332d372b809476df48c987b24476801a61e7e0f2 (patch) | |
tree | 37fd62e0ffe2ee54636c4f18af84258b7fc5a4ad /divelist.c | |
parent | 075aba8f7da8139c1dced48e5c0b8ea60cc7ae8f (diff) | |
download | subsurface-332d372b809476df48c987b24476801a61e7e0f2.tar.gz |
Pick GPS coordinates of dive location via map widget
I have some concerns about the way this is implemented - especially the
use of gtk_grab_add to make the map widget work has me worried. But it
seems to work and survived some test cases that I threw at it.
The GtkButton with the Pixmap looks a little off on my screen, but this
way it was easy to implement. Feel free to come up with a better design.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'divelist.c')
-rw-r--r-- | divelist.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/divelist.c b/divelist.c index 245ff4499..f6ddb0cd3 100644 --- a/divelist.c +++ b/divelist.c @@ -980,10 +980,15 @@ static void get_suit(struct dive *dive, char **str) get_string(str, dive->suit); } -static GdkPixbuf *get_gps_icon(struct dive *dive) +GdkPixbuf *get_gps_icon(void) +{ + return gdk_pixbuf_from_pixdata(&my_pixbuf, TRUE, NULL); +} + +GdkPixbuf *get_gps_icon_for_dive(struct dive *dive) { if (dive_has_location(dive)) - return gdk_pixbuf_from_pixdata(&my_pixbuf, TRUE, NULL); + return get_gps_icon(); else return NULL; } @@ -1010,7 +1015,7 @@ static void fill_one_dive(struct dive *dive, get_cylinder(dive, &cylinder); get_location(dive, &location); get_suit(dive, &suit); - icon = get_gps_icon(dive); + icon = get_gps_icon_for_dive(dive); gtk_tree_store_set(GTK_TREE_STORE(model), iter, DIVE_NR, dive->number, DIVE_LOCATION, location, @@ -1413,7 +1418,7 @@ static void fill_dive_list(void) /* store dive */ update_cylinder_related_info(dive); gtk_tree_store_append(treestore, &iter, parent_ptr); - icon = get_gps_icon(dive); + icon = get_gps_icon_for_dive(dive); gtk_tree_store_set(treestore, &iter, DIVE_INDEX, i, DIVE_NR, dive->number, @@ -1694,7 +1699,7 @@ void edit_dive_when_cb(GtkWidget *menuitem, struct dive *dive) #if HAVE_OSM_GPS_MAP static void show_gps_location_cb(GtkWidget *menuitem, struct dive *dive) { - show_gps_location(dive); + show_gps_location(dive, NULL); } #endif @@ -1716,7 +1721,7 @@ gboolean icon_click_cb(GtkWidget *w, GdkEventButton *event, gpointer data) gtk_tree_model_get(MODEL(dive_list), &iter, DIVE_INDEX, &idx, -1); dive = get_dive(idx); if (dive && dive_has_location(dive)) - show_gps_location(dive); + show_gps_location(dive, NULL); } if (path) gtk_tree_path_free(path); |