summaryrefslogtreecommitdiffstats
path: root/gps.c
diff options
context:
space:
mode:
authorGravatar Pierre-Yves Chibon <pingou@pingoured.fr>2013-01-29 08:53:45 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-30 12:07:13 +1100
commit410c439aef09a72fe828f6c7b8a69558684c67f4 (patch)
treef6dfa037d14c80be6e5c3f4a8481f71a2aba8f46 /gps.c
parent0fb1fe8c6e16279f1c69d912edccdac04bfe76d2 (diff)
downloadsubsurface-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.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gps.c b/gps.c
index e97e58892..31be2bbc5 100644
--- a/gps.c
+++ b/gps.c
@@ -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);