From 35436b655975ac849c7432d736ef379f500c545b Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Sun, 8 Apr 2018 18:56:09 +0200
Subject: Avoided to create a hidden main window in batch mode.

---
 src/core/global.c |  7 +++++--
 src/main.c        | 17 +++++++----------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/core/global.c b/src/core/global.c
index 2deb9f7..b227a5d 100644
--- a/src/core/global.c
+++ b/src/core/global.c
@@ -95,13 +95,16 @@ void set_current_project(GStudyProject *project)
 {
     if (_project != NULL)
     {
-        _project_notify(_project, false);
+        if (_project_notify != NULL)
+            _project_notify(_project, false);
+
         g_object_unref(G_OBJECT(_project));
+
     }
 
     _project = project;
 
-    if (_project != NULL)
+    if (_project != NULL && _project_notify != NULL)
         _project_notify(_project, true);
 
 }
diff --git a/src/main.c b/src/main.c
index f112842..98d1263 100644
--- a/src/main.c
+++ b/src/main.c
@@ -232,8 +232,6 @@ int main(int argc, char **argv)
 
     /* Lancement des choses sérieuses */
 
-
-
     setlocale(LC_ALL, "");
     bindtextdomain(PACKAGE, LOCALE_DIR);
     textdomain(PACKAGE);
@@ -252,14 +250,15 @@ int main(int argc, char **argv)
 
     /* Création de l'interface */
 
-
-
-    editor = create_editor();
-    if (editor == NULL) goto failed_to_load_editor;
-
     if (!batch_mode)
+    {
+        editor = create_editor();
+        if (editor == NULL) goto failed_to_load_editor;
+
         gtk_widget_show_now(editor);
 
+    }
+
     init_all_plugins(true);
 
     config = get_main_configuration();
@@ -267,8 +266,6 @@ int main(int argc, char **argv)
     status = complete_loading_of_all_gui_components(config);
     if (!status) goto exit_complete_gui;
 
-
-
     /* Utilisateur représenté */
 
     if (!g_generic_config_get_value(config, MPK_AUTHOR_NAME, &author))
@@ -316,7 +313,7 @@ int main(int argc, char **argv)
 
     exit_all_plugins();
 
-    if (!batch_mode)    /* FIXME */
+    if (!batch_mode)
         gtk_widget_destroy(editor);
 
  failed_to_load_editor:
-- 
cgit v0.11.2-87-g4458