diff options
author | Pierre-Yves Chibon <pingou@pingoured.fr> | 2013-01-29 08:53:45 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-01-30 12:07:13 +1100 |
commit | 410c439aef09a72fe828f6c7b8a69558684c67f4 (patch) | |
tree | f6dfa037d14c80be6e5c3f4a8481f71a2aba8f46 /gps.c | |
parent | 0fb1fe8c6e16279f1c69d912edccdac04bfe76d2 (diff) | |
download | subsurface-410c439aef09a72fe828f6c7b8a69558684c67f4.tar.gz |
Enable to key 'Esc' to close the map view
This commit makes the behavior consistent between the map window and the yearly
statistics window. Both can now be closed by just pressing the 'Esc' key.
Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'gps.c')
-rw-r--r-- | gps.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -135,6 +135,14 @@ static void add_gps_point(OsmGpsMap *map, float latitude, float longitude) osm_gps_map_track_add(map, track); } +static void key_press_event(GtkWidget *window, GdkEventKey *event, gpointer data) +{ + if ((event->string != NULL && event->keyval == GDK_Escape) || + (event->string != NULL && event->keyval == GDK_w && event->state & GDK_CONTROL_MASK)) { + gtk_widget_destroy(window); + } +} + OsmGpsMap *init_map(void) { OsmGpsMap *map; @@ -187,6 +195,7 @@ void show_map(OsmGpsMap *map, GtkWidget **window, struct dive *dive, void (*call gtk_window_set_modal(GTK_WINDOW(*window), TRUE); g_signal_connect(*window, "destroy", G_CALLBACK(on_close), (gpointer)window); g_signal_connect(G_OBJECT(map), "scroll-event", G_CALLBACK(scroll_cb), NULL); + g_signal_connect(*window, "key_press_event", G_CALLBACK (key_press_event), NULL); } if (callback) g_signal_connect(G_OBJECT(map), "button-press-event", G_CALLBACK(button_cb), callback); |