[chronojump] several improvements to copy database DONE!



commit e7d3884989d458ecd8b5dd2df15e304da2f8601a
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Jul 17 18:11:46 2019 +0200

    several improvements to copy database DONE!

 glade/preferences_win.glade | 38 ++++++++++++++++++++++++++++++++++++--
 src/gui/preferences.cs      | 13 ++++++++-----
 src/util.cs                 |  4 ++--
 3 files changed, 46 insertions(+), 9 deletions(-)
---
diff --git a/glade/preferences_win.glade b/glade/preferences_win.glade
index da806d23..09b0cc30 100644
--- a/glade/preferences_win.glade
+++ b/glade/preferences_win.glade
@@ -256,13 +256,47 @@
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkLabel" id="label_backup">
+                          <widget class="GtkHBox" id="hbox49">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
+                            <child>
+                              <widget class="GtkHBox" id="hbox50">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="spacing">20</property>
+                                <child>
+                                  <widget class="GtkLabel" id="label_backup">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">0</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkProgressBar" id="pulsebarBackupActivity">
+                                    <property name="width_request">50</property>
+                                    <property name="can_focus">False</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">1</property>
+                                  </packing>
+                                </child>
+                              </widget>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">False</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
                           </widget>
                           <packing>
                             <property name="expand">False</property>
-                            <property name="fill">True</property>
+                            <property name="fill">False</property>
                             <property name="position">2</property>
                           </packing>
                         </child>
diff --git a/src/gui/preferences.cs b/src/gui/preferences.cs
index 9c9cc45a..e66c0738 100644
--- a/src/gui/preferences.cs
+++ b/src/gui/preferences.cs
@@ -61,6 +61,7 @@ public class PreferencesWindow
        [Widget] Gtk.Button button_db_backup;
        [Widget] Gtk.HBox hbox_backup_doing;
        [Widget] Gtk.Label label_backup;
+       [Widget] Gtk.ProgressBar pulsebarBackupActivity;
        [Widget] Gtk.ProgressBar pulsebarBackupDirs;
        [Widget] Gtk.ProgressBar pulsebarBackupSecondDirs;
 
@@ -1587,21 +1588,22 @@ public class PreferencesWindow
                        return false;
                }
        
+               pulsebarBackupActivity.Pulse();
                pulsebarBackupDirs.Fraction = Util.DivideSafeFraction(uc.BackupMainDirsCount, 6); //6 for: 
database, encoder, forceSensor, logs, multimedia, raceAnalyzer
                pulsebarBackupDirs.Text = uc.LastMainDir;
-               //pulsebarBackupActivity.Pulse();
                pulsebarBackupSecondDirs.Fraction = Util.DivideSafeFraction(uc.BackupSecondDirsCount, 
uc.BackupSecondDirsLength);
                pulsebarBackupSecondDirs.Text = uc.LastSecondDir;
 
-               Thread.Sleep (10);
+               Thread.Sleep (30);
                //LogB.Debug(thread.ThreadState.ToString());
                return true;
        }
 
-       private void endPulse() {
+       private void endPulse()
+       {
+               pulsebarBackupActivity.Fraction = 1;
                pulsebarBackupDirs.Fraction = 1;
                pulsebarBackupSecondDirs.Fraction = 1;
-               //pulsebarBackupActivity.Fraction = 1;
                backup_doing_sensitive_start_end(false);
                fc.Hide ();
                string myString = string.Format(Catalog.GetString("Copied to {0} in {1} ms"), fileCopy, 
copyRecursiveElapsedMs);
@@ -1613,8 +1615,9 @@ public class PreferencesWindow
                if(start)
                        label_backup.Text = Catalog.GetString("Please, wait.");
 
+               pulsebarBackupActivity.Visible = start;
                hbox_backup_doing.Visible = start;
-       
+
                button_db_backup.Sensitive = ! start;
                button_data_folder_open.Sensitive = ! start;
                
diff --git a/src/util.cs b/src/util.cs
index a2697a49..7f727931 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -2243,12 +2243,12 @@ public class UtilCopy
                                        BackupMainDirsCount ++;
                                        LastMainDir = Util.GetLastPartOfPath (dir.ToString());
                                        BackupSecondDirsCount = 0;
-                                       LogB.Information("at level 0: " + dir);
+                                       //LogB.Information("at level 0: " + dir);
                                } else if(level == 1) {
                                        BackupSecondDirsLength = diArray.Length;
                                        BackupSecondDirsCount ++;
                                        LastSecondDir = Util.GetLastPartOfPath (dir.ToString());
-                                       LogB.Information("at level 1: " + dir);
+                                       //LogB.Information("at level 1: " + dir);
                                }
                                CopyFilesRecursively(dir, target.CreateSubdirectory(dir.Name), level +1);
 


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