[chronojump] loadLastModeAtStart does not avoid to show log. And after log opens mode if appropritate.



commit 4560c4dccd51f5ac5428c77322dc174207d10884
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Aug 17 17:44:40 2020 +0100

    loadLastModeAtStart does not avoid to show log. And after log opens mode if appropritate.

 src/gui/app1/chronojump.cs |  4 +++-
 src/gui/sendLog.cs         | 19 +++++++++++++++++--
 2 files changed, 20 insertions(+), 3 deletions(-)
---
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index 893efe0c..3bc79898 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -729,8 +729,10 @@ public partial class ChronoJumpWindow
                        SqlitePreferences.Update(SqlitePreferences.LoadLastSessionAtStart, true, false);
                }
 
-               if(preferences.loadLastModeAtStart && preferences.lastMode != 
Constants.Menuitem_modes.UNDEFINED && ! configChronojump.Compujump)
+               if(! showSendLog && preferences.loadLastModeAtStart &&
+                               preferences.lastMode != Constants.Menuitem_modes.UNDEFINED && ! 
configChronojump.Compujump)
                {
+                       // 0) note this code is repeated on gui/sendLog.cs on_button_open_chronojump_clicked()
                        // 1) to avoid impossibility to start Chronojump if there's any problem with this 
mode, first put this to false
                        SqlitePreferences.Update(SqlitePreferences.LoadLastModeAtStart, false, false);
 
diff --git a/src/gui/sendLog.cs b/src/gui/sendLog.cs
index e26fa2fc..9b2afe0b 100644
--- a/src/gui/sendLog.cs
+++ b/src/gui/sendLog.cs
@@ -133,7 +133,22 @@ public partial class ChronoJumpWindow
        private void on_button_open_chronojump_clicked(object o, EventArgs args)
        {
                notebook_start.CurrentPage = Convert.ToInt32(notebook_start_pages.PROGRAM);
-               notebook_sup.CurrentPage = Convert.ToInt32(notebook_sup_pages.START);
-               new ChronojumpLogo (drawingarea_chronojump_logo, viewport_chronojump_logo, 
preferences.logoAnimatedShow);
+
+               if(preferences.loadLastModeAtStart &&
+                               preferences.lastMode != Constants.Menuitem_modes.UNDEFINED && ! 
configChronojump.Compujump)
+               {
+                       // 0) note this code is repeated on gui/app1/chronojump.cs public ChronoJumpWindow()
+                       // 1) to avoid impossibility to start Chronojump if there's any problem with this 
mode, first put this to false
+                       SqlitePreferences.Update(SqlitePreferences.LoadLastModeAtStart, false, false);
+
+                       // 2) change mode
+                       changeMode(preferences.lastMode);
+
+                       // 3) put preference to true again
+                       SqlitePreferences.Update(SqlitePreferences.LoadLastModeAtStart, true, false);
+               } else {
+                       notebook_sup.CurrentPage = Convert.ToInt32(notebook_sup_pages.START);
+                       new ChronojumpLogo (drawingarea_chronojump_logo, viewport_chronojump_logo, 
preferences.logoAnimatedShow);
+               }
        }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]