[chronojump] Implemented scheduled backup: do not ask again
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Implemented scheduled backup: do not ask again
- Date: Thu, 19 Aug 2021 10:53:04 +0000 (UTC)
commit ad6408d4868cca33a076845f79f30b456f0c21fc
Author: Xavier de Blas <xaviblas gmail com>
Date: Thu Aug 19 12:52:36 2021 +0200
Implemented scheduled backup: do not ask again
glade/app1.glade | 30 ++++++++++++++++++++++++++----
src/gui/app1/session/backup.cs | 38 ++++++++++++++++++++++++++++++--------
src/gui/app1/session/main.cs | 1 +
3 files changed, 57 insertions(+), 12 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index be2720828..be9824248 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -46733,7 +46733,7 @@ then click this button.</property>
<widget class="GtkLabel" id="label120">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label">autobackup
questions</property>
+ <property name="label">scheduled
questions</property>
</widget>
<packing>
<property name="position">1</property>
@@ -46742,6 +46742,28 @@ then click this button.</property>
</packing>
</child>
<child>
+ <widget class="GtkLabel"
id="app1s_label_remind_feedback">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="wrap">True</property>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label657">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label">scheduled remind
feedback</property>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ <property name="tab_fill">False</property>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkVBox" id="vbox117">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -46836,17 +46858,17 @@ Since Chronojump 2.1.3, scheduled backups contain the complete data.</property>
</child>
</widget>
<packing>
- <property name="position">2</property>
+ <property name="position">3</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label122">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label">ask deleting
old</property>
+ <property name="label">delete old</property>
</widget>
<packing>
- <property name="position">2</property>
+ <property name="position">3</property>
<property name="tab_fill">False</property>
<property name="type">tab</property>
</packing>
diff --git a/src/gui/app1/session/backup.cs b/src/gui/app1/session/backup.cs
index 522879d7e..a4c91d869 100644
--- a/src/gui/app1/session/backup.cs
+++ b/src/gui/app1/session/backup.cs
@@ -33,9 +33,16 @@ public partial class ChronoJumpWindow
static UtilCopy app1s_uc;
private Thread app1s_threadBackup;
+ private enum notebook_session_backup_pages { BACKUP_DO, SCHEDULED_QUESTIONS, SCHEDULED_FEEDBACK,
DELETE_OLD }
+
+ //if entered from more, cancel_close should go to more again
+ //but, if entered directly by scheduled, go to app1
+ private bool backup_cancel_close_show_more_notebook;
+
//user clicks on backup
private void on_button_db_backup_pre_clicked (object o, EventArgs args)
{
+ backup_cancel_close_show_more_notebook = true; //coming from more, so should go to more
label_backup_why.Visible = true; //user clicked on backup from more window. Show this label
db_backup_pre_2 ();
}
@@ -48,7 +55,7 @@ public partial class ChronoJumpWindow
return;
}
- notebook_session_backup.Page = 0;
+ notebook_session_backup.Page = Convert.ToInt32(notebook_session_backup_pages.BACKUP_DO);
app1s_label_backup_destination.Text = "";
app1s_label_backup_progress.Text = "";
app1s_button_backup_select.Sensitive = true;
@@ -66,14 +73,14 @@ public partial class ChronoJumpWindow
private bool shouldAskBackupScheduled ()
{
- // 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
+ // 1) if next days is -1 (never ask agan), do not show widget
if(preferences.backupScheduledNextDays < 0)
return false;
+ // 2) if never scheduled, need to show widget
+ if(preferences.backupScheduledCreatedDate == DateTime.MinValue)
+ return true;
+
// 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)
@@ -89,7 +96,7 @@ public partial class ChronoJumpWindow
app1s_notebook_sup_entered_from = notebook_sup.CurrentPage;
notebook_sup.CurrentPage = Convert.ToInt32(notebook_sup_pages.SESSION);
- notebook_session_backup.Page = 1;
+ notebook_session_backup.Page =
Convert.ToInt32(notebook_session_backup_pages.SCHEDULED_QUESTIONS);
app1s_notebook.CurrentPage = app1s_PAGE_BACKUP;
@@ -112,6 +119,16 @@ public partial class ChronoJumpWindow
private void on_app1s_button_backup_scheduled_never_clicked (object o, EventArgs args)
{
+ SqlitePreferences.Update(SqlitePreferences.BackupScheduledNextDaysStr, "-1", false);
+
+ label_backup_why.Visible = false;
+ notebook_session_backup.Page =
Convert.ToInt32(notebook_session_backup_pages.SCHEDULED_FEEDBACK);
+ app1s_label_remind_feedback.Text =
+ Catalog.GetString("You will no longer be bothered with scheduled backups, but you can
continue backing up by clicking on Session / More.");
+
+ backup_cancel_close_show_more_notebook = false; //clicking on close should not show session
more
+ app1s_label_backup_cancel_close.Text = Catalog.GetString("Close");
+ app1s_button_backup_cancel_close.Visible = true;
}
private bool app1s_getDatabaseFile ()
@@ -383,6 +400,11 @@ public partial class ChronoJumpWindow
private void on_app1s_button_backup_cancel_or_close_clicked (object o, EventArgs args)
{
- app1s_notebook.CurrentPage = app1s_PAGE_MODES;
+ if(backup_cancel_close_show_more_notebook)
+ app1s_notebook.CurrentPage = app1s_PAGE_MODES;
+ else {
+ menus_sensitive_import_not_danger(true);
+ notebook_supSetOldPage();
+ }
}
}
diff --git a/src/gui/app1/session/main.cs b/src/gui/app1/session/main.cs
index 4ef40db63..da6f35d3f 100644
--- a/src/gui/app1/session/main.cs
+++ b/src/gui/app1/session/main.cs
@@ -169,6 +169,7 @@ public partial class ChronoJumpWindow
[Widget] Gtk.ProgressBar app1s_pulsebarBackupActivity;
[Widget] Gtk.ProgressBar app1s_pulsebarBackupDirs;
[Widget] Gtk.ProgressBar app1s_pulsebarBackupSecondDirs;
+ [Widget] Gtk.Label app1s_label_remind_feedback;
//notebook tab 8 (export)
[Widget] Gtk.Button app1s_button_export_select;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]