[chronojump] Logic for asking for scheduled backup (but hidden until 4 buttons do anything)
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Logic for asking for scheduled backup (but hidden until 4 buttons do anything)
- Date: Tue, 17 Aug 2021 17:36:38 +0000 (UTC)
commit d5c057a290cf119196c47916de6f2d525fbc88a9
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Aug 17 19:35:46 2021 +0200
Logic for asking for scheduled backup (but hidden until 4 buttons do anything)
src/gui/app1/chronojump.cs | 9 +++++++--
src/gui/app1/session/backup.cs | 38 ++++++++++++++++++++++++++++++++++++++
2 files changed, 45 insertions(+), 2 deletions(-)
---
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index 7c51defbd..e3b757c47 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -836,8 +836,13 @@ public partial class ChronoJumpWindow
chronopicRegisterWin.Show();
}
- if(! showSendLog && ! showSocialNetworkPoll && notebook_sup.CurrentPage ==
Convert.ToInt32(notebook_sup_pages.START))
- new ChronojumpLogo (notebook_chronojump_logo, drawingarea_chronojump_logo,
viewport_chronojump_logo, preferences.logoAnimatedShow, preferences.fontType.ToString());
+ if(! showSendLog && ! showSocialNetworkPoll)
+ {
+ if (shouldAskBackupScheduled ())
+ backupScheduledAsk ();
+ else if(notebook_sup.CurrentPage == Convert.ToInt32(notebook_sup_pages.START))
+ new ChronojumpLogo (notebook_chronojump_logo, drawingarea_chronojump_logo,
viewport_chronojump_logo, preferences.logoAnimatedShow, preferences.fontType.ToString());
+ }
//done at the end to ensure main window is shown
if(splashWin != null) {
diff --git a/src/gui/app1/session/backup.cs b/src/gui/app1/session/backup.cs
index 39e528970..ac6cc948f 100644
--- a/src/gui/app1/session/backup.cs
+++ b/src/gui/app1/session/backup.cs
@@ -33,6 +33,7 @@ public partial class ChronoJumpWindow
static UtilCopy app1s_uc;
private Thread app1s_threadBackup;
+ //user clicks on backup
private void on_button_db_backup_pre_clicked (object o, EventArgs args)
{
if(! app1s_getDatabaseFile())
@@ -52,6 +53,43 @@ public partial class ChronoJumpWindow
app1s_notebook.CurrentPage = app1s_PAGE_BACKUP;
}
+ private bool shouldAskBackupScheduled ()
+ {
+ /*
+ TODO: disabled until 4 buttons do something
+
+ // 1) if never scheduled, need to show widget
+ if(preferences.backupScheduledCreatedDate == DateTime.MinValue)
+ return true;
+
+ // 2) if next days is -1 (never ask agan), do not show widget
+ if(preferences.backupScheduledNextDays < 0)
+ return false;
+
+ // 3) if backup has to be done, show widget
+ // <0 means "This instance is earlier than value.". So if created date + nextDays is < than
current date, need to do backup
+
if(preferences.backupScheduledCreatedDate.AddDays(preferences.backupScheduledNextDays).CompareTo(DateTime.Now)
<= 0)
+ return true;
+ */
+
+ return false;
+ }
+
+ //scheduled backup on start
+ private void backupScheduledAsk ()
+ {
+ menus_sensitive_import_not_danger(false);
+ app1s_notebook_sup_entered_from = notebook_sup.CurrentPage;
+ notebook_sup.CurrentPage = Convert.ToInt32(notebook_sup_pages.SESSION);
+
+ notebook_session_backup.Page = 1;
+
+ app1s_notebook.CurrentPage = app1s_PAGE_BACKUP;
+
+ app1s_button_backup_cancel_close.Visible = false;
+ //TODO: remember to show again after pressing any of the buttons
+ }
+
private bool app1s_getDatabaseFile ()
{
string databaseURL = Util.GetDatabaseDir() +
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]