From 4ed8f24200c6e4df4c3fe922fc81923fb39f44be Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Fri, 25 Apr 2014 22:32:21 +0000
Subject: Closed the 'About' dialog box with the escape key.

git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@372 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
---
 ChangeLog           |  5 +++++
 src/dialogs/about.c | 40 +++++++++++++++++++++++++++++++++++++++-
 2 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index e685ee7..fe71156 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+14-04-26  Cyrille Bagard <nocbos@gmail.com>
+
+	* src/dialogs/about.c:
+	Close the 'About' dialog box with the escape key.
+
 14-04-24  Cyrille Bagard <nocbos@gmail.com>
 
 	* configure.ac:
diff --git a/src/dialogs/about.c b/src/dialogs/about.c
index 1a1b064..89c52df 100644
--- a/src/dialogs/about.c
+++ b/src/dialogs/about.c
@@ -26,6 +26,7 @@
 
 #include <math.h>
 #include <stdio.h>
+#include <gdk/gdkkeysyms.h>
 
 
 #include <i18n.h>
@@ -37,11 +38,16 @@
 
 
 
+/* Réagit à l'appui d'une touche sur la fenêtre 'A propos'. */
+static gboolean close_about_window_on_escape(GtkWidget *, GdkEventKey *, gpointer);
+
+
+
 /******************************************************************************
 *                                                                             *
 *  Paramètres  : parent = fenêtre parente à surpasser.                        *
 *                                                                             *
-*  Description : Construit la fenêtre de sélection des sections.              *
+*  Description : Construit la fenêtre d'informations sur le logiciel.         *
 *                                                                             *
 *  Retour      : Adresse de la fenêtre mise en place.                         *
 *                                                                             *
@@ -71,6 +77,8 @@ GtkWidget *create_about_dialog(GtkWindow *parent)
     gtk_window_set_default_size(GTK_WINDOW(result), 350, 430);
     gtk_window_set_type_hint(GTK_WINDOW(result), GDK_WINDOW_TYPE_HINT_DIALOG);
 
+    g_signal_connect(result, "key_press_event", G_CALLBACK(close_about_window_on_escape), NULL);
+
     gdk_rgba_parse(&color, "black");
     gtk_widget_override_background_color(GTK_WIDGET(result), GTK_STATE_FLAG_NORMAL, &color);
 
@@ -126,3 +134,33 @@ GtkWidget *create_about_dialog(GtkWindow *parent)
     return result;
 
 }
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : window = fenêtre visée par la procédure.                     *
+*                event  = informations liées à l'événement.                   *
+*                dummy  = donnée non utilisée ici.                            *
+*                                                                             *
+*  Description : Réagit à l'appui d'une touche sur la fenêtre 'A propos'.     *
+*                                                                             *
+*  Retour      : TRUE pour poursuivre la propagation, FALSE autrement.        *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static gboolean close_about_window_on_escape(GtkWidget *widget, GdkEventKey *event, gpointer dummy)
+{
+    gboolean result;                        /* Ordre à retourner           */
+
+    if (event->keyval == GDK_KEY_Escape)
+    {
+        gtk_widget_destroy(widget);
+        result = TRUE;
+    }
+    else result = FALSE;
+
+    return result;
+
+}
-- 
cgit v0.11.2-87-g4458