From de209a01e646d6d240d3d98ac1f1b0e100939a12 Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Wed, 18 Jul 2018 19:03:41 +0200
Subject: Provided a way to skip the exit message box.

---
 src/core/params.c | 3 +++
 src/core/params.h | 1 +
 src/gui/editor.c  | 8 ++++++++
 3 files changed, 12 insertions(+)

diff --git a/src/core/params.c b/src/core/params.c
index 1a724eb..8cc7b3a 100644
--- a/src/core/params.c
+++ b/src/core/params.c
@@ -186,6 +186,9 @@ bool load_main_config_parameters(void)
     param = g_generic_config_create_param(config, MPK_LAST_PROJECT, CPT_STRING, NULL);
     if (param == NULL) return false;
 
+    param = g_generic_config_create_param(config, MPK_SKIP_EXIT_MSG, CPT_BOOLEAN, false);
+    if (param == NULL) return false;
+
     param = g_generic_config_create_param(config, MPK_MAXIMIZED, CPT_BOOLEAN, true);
     if (param == NULL) return false;
 
diff --git a/src/core/params.h b/src/core/params.h
index 6fa39b2..bcb6f53 100644
--- a/src/core/params.h
+++ b/src/core/params.h
@@ -56,6 +56,7 @@
 #define MPK_INTERNAL_THEME      "gui.editor.theme"
 #define MPK_TITLE_BAR           "gui.editor.hide_titlebar"
 #define MPK_LAST_PROJECT        "gui.editor.last_project"
+#define MPK_SKIP_EXIT_MSG       "gui.editor.skip_exit_msg"
 #define MPK_MAXIMIZED           "gui.editor.start_maximized"
 #define MPK_ELLIPSIS_HEADER     "gui.editor.panels.ellipsis_header"
 #define MPK_ELLIPSIS_TAB        "gui.editor.panels.ellipsis_tab"
diff --git a/src/gui/editor.c b/src/gui/editor.c
index 6934869..5034104 100644
--- a/src/gui/editor.c
+++ b/src/gui/editor.c
@@ -421,11 +421,17 @@ GtkWidget *create_editor(void)
 static gboolean on_delete_editor(GtkWidget *widget, GdkEvent *event, gpointer data)
 {
     gboolean result;                        /* Continuation à retourner    */
+    bool skip;                              /* Saut de la vérification ?   */
     GStudyProject *project;                 /* Projet courant              */
     GtkWidget *dialog;                      /* Boîte à afficher            */
 
     result = FALSE;
 
+    g_generic_config_get_value(get_main_configuration(), MPK_SKIP_EXIT_MSG, &skip);
+
+    if (skip)
+        goto skip_warning;
+
     project = get_current_project();
 
     if (g_study_project_get_filename(project) == NULL)
@@ -461,6 +467,8 @@ static gboolean on_delete_editor(GtkWidget *widget, GdkEvent *event, gpointer da
 
     g_object_unref(G_OBJECT(project));
 
+ skip_warning:
+
     return result;
 
 }
-- 
cgit v0.11.2-87-g4458