[chronojump] Simplified database backup



commit ca695bdfd22ae232e5a68e6fcc7831c05e339487
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Sep 21 15:32:21 2015 +0200

    Simplified database backup

 glade/chronojump.glade |  125 ++++++++++++++++++++++++++++++++---------------
 src/gui/preferences.cs |   24 +++------
 2 files changed, 93 insertions(+), 56 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 4aeb4c0..a0a90a5 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -7896,6 +7896,9 @@ after time</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             </child>
                                                             <child>
@@ -9340,6 +9343,9 @@ after time</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="position">2</property>
@@ -10425,6 +10431,9 @@ after time</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="position">4</property>
@@ -22123,6 +22132,9 @@ by you</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                     </child>
                   </widget>
@@ -23107,6 +23119,9 @@ by you</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                     </child>
                   </widget>
@@ -24583,6 +24598,9 @@ by you</property>
               <placeholder/>
             </child>
             <child>
+              <placeholder/>
+            </child>
+            <child>
               <widget class="GtkButton" id="button_video_url">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
@@ -25116,6 +25134,9 @@ by you</property>
             <child>
               <placeholder/>
             </child>
+            <child>
+              <placeholder/>
+            </child>
           </widget>
           <packing>
             <property name="expand">True</property>
@@ -36922,6 +36943,24 @@ options</property>
                             <child>
                               <placeholder/>
                             </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
                           </widget>
                         </child>
                       </widget>
@@ -38821,6 +38860,18 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
@@ -40137,9 +40188,6 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                                       <placeholder/>
                                     </child>
                                     <child>
-                                      <placeholder/>
-                                    </child>
-                                    <child>
                                       <widget class="GtkLabel" id="label218">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
@@ -41123,6 +41171,9 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                                     <child>
                                       <placeholder/>
                                     </child>
+                                    <child>
+                                      <placeholder/>
+                                    </child>
                                   </widget>
                                 </child>
                               </widget>
@@ -41271,7 +41322,7 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                               <widget class="GtkTable" id="table2">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <property name="n_rows">3</property>
+                                <property name="n_rows">2</property>
                                 <property name="n_columns">2</property>
                                 <property name="column_spacing">6</property>
                                 <property name="row_spacing">6</property>
@@ -41287,33 +41338,19 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                                   </widget>
                                 </child>
                                 <child>
-                                  <widget class="GtkCheckButton" id="check_backup_encoder_tests">
-                                    <property name="label" translatable="yes">Encoder tests</property>
+                                  <widget class="GtkCheckButton" id="check_backup_multimedia_and_encoder">
+                                    <property name="label" translatable="yes">Multimedia and encoder 
tests</property>
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">False</property>
                                     <property name="draw_indicator">True</property>
-                                    <signal name="clicked" handler="on_check_backup_encoder_tests_clicked" 
swapped="no"/>
                                   </widget>
                                   <packing>
                                     <property name="left_attach">1</property>
                                     <property name="right_attach">2</property>
                                     <property name="top_attach">1</property>
                                     <property name="bottom_attach">2</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <widget class="GtkCheckButton" id="check_backup_multimedia">
-                                    <property name="label" translatable="yes">Images and Videos</property>
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">False</property>
-                                    <property name="draw_indicator">True</property>
-                                    <signal name="clicked" handler="on_check_backup_multimedia_clicked" 
swapped="no"/>
-                                  </widget>
-                                  <packing>
-                                    <property name="top_attach">2</property>
-                                    <property name="bottom_attach">3</property>
+                                    <property name="x_options">GTK_FILL</property>
                                   </packing>
                                 </child>
                                 <child>
@@ -41344,23 +41381,6 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                                   <packing>
                                     <property name="left_attach">1</property>
                                     <property name="right_attach">2</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <widget class="GtkButton" id="button_db_backup">
-                                    <property name="label" translatable="yes">Backup database</property>
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">False</property>
-                                    <property name="tooltip" translatable="yes">Make a copy of the 
database</property>
-                                    <property name="use_underline">True</property>
-                                    <signal name="clicked" handler="on_button_db_backup_clicked" 
swapped="no"/>
-                                  </widget>
-                                  <packing>
-                                    <property name="left_attach">1</property>
-                                    <property name="right_attach">2</property>
-                                    <property name="top_attach">2</property>
-                                    <property name="bottom_attach">3</property>
                                     <property name="x_options">GTK_FILL</property>
                                   </packing>
                                 </child>
@@ -41418,6 +41438,22 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                             <property name="can_focus">False</property>
                             <property name="spacing">20</property>
                             <child>
+                              <widget class="GtkButton" id="button_db_backup">
+                                <property name="label" translatable="yes">Backup database</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="tooltip" translatable="yes">Make a copy of the 
database</property>
+                                <property name="use_underline">True</property>
+                                <signal name="clicked" handler="on_button_db_backup_clicked" swapped="no"/>
+                              </widget>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">False</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
                               <widget class="GtkButton" id="button_db_folder_open">
                                 <property name="label" translatable="yes">Open database folder</property>
                                 <property name="visible">True</property>
@@ -41430,7 +41466,7 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                                 <property name="expand">True</property>
                                 <property name="fill">False</property>
                                 <property name="padding">10</property>
-                                <property name="position">0</property>
+                                <property name="position">1</property>
                               </packing>
                             </child>
                             <child>
@@ -41445,7 +41481,7 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                                 <property name="expand">True</property>
                                 <property name="fill">False</property>
                                 <property name="padding">10</property>
-                                <property name="position">1</property>
+                                <property name="position">2</property>
                               </packing>
                             </child>
                           </widget>
@@ -44894,6 +44930,9 @@ It starts before and arrives there with some speed.</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                       <packing>
                         <property name="left_attach">2</property>
@@ -45542,6 +45581,9 @@ It starts before and arrives there with some speed.</property>
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
@@ -46205,6 +46247,9 @@ It starts before and arrives there with some speed.</property>
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
diff --git a/src/gui/preferences.cs b/src/gui/preferences.cs
index dc24492..038da8d 100644
--- a/src/gui/preferences.cs
+++ b/src/gui/preferences.cs
@@ -44,8 +44,7 @@ public class PreferencesWindow {
        //[Widget] Gtk.CheckButton check_backup_sessions;
        //[Widget] Gtk.CheckButton check_backup_persons;
        //[Widget] Gtk.CheckButton check_backup_contact_tests;
-       [Widget] Gtk.CheckButton check_backup_encoder_tests;
-       [Widget] Gtk.CheckButton check_backup_multimedia;
+       [Widget] Gtk.CheckButton check_backup_multimedia_and_encoder;
        
        [Widget] Gtk.Button button_db_backup;
        [Widget] Gtk.Box hbox_backup_doing;
@@ -456,13 +455,6 @@ public class PreferencesWindow {
                */
        }
 
-       void on_check_backup_multimedia_clicked(object o, EventArgs args) {
-               check_backup_encoder_tests.Active = check_backup_multimedia.Active;
-       }       
-       void on_check_backup_encoder_tests_clicked(object o, EventArgs args) {
-               check_backup_multimedia.Active = check_backup_encoder_tests.Active;
-       }       
-       
        
        void on_button_logs_folder_open_clicked (object o, EventArgs args)
        {
@@ -522,8 +514,8 @@ public class PreferencesWindow {
 
                if (fc.Run() == (int)ResponseType.Accept) 
                {
-                       //if encoder_tests or multimedia, then copy the folder. If not checked, then copy 
only the db file
-                       if(check_backup_encoder_tests.Active || check_backup_multimedia.Active)
+                       //if multimedia_and_encoder, then copy the folder. If not checked, then copy only the 
db file
+                       if(check_backup_multimedia_and_encoder.Active)
                                fileCopy = fc.Filename + Path.DirectorySeparatorChar + "chronojump";
                        else
                                fileCopy = fc.Filename + Path.DirectorySeparatorChar + "chronojump_copy.db";
@@ -532,7 +524,7 @@ public class PreferencesWindow {
                                fc.Hide ();
                        
                                bool exists = false;
-                               if(check_backup_encoder_tests.Active || check_backup_multimedia.Active) {
+                               if(check_backup_multimedia_and_encoder.Active) {
                                        if(Directory.Exists(fileCopy)) {
                                                LogB.Information(string.Format("Directory {0} exists, created 
at {1}", 
                                                                        fileCopy, 
Directory.GetCreationTime(fileCopy)));
@@ -551,8 +543,8 @@ public class PreferencesWindow {
                                        ConfirmWindow confirmWin = ConfirmWindow.Show(Catalog.GetString("Are 
you sure you want to overwrite: "), "", fileCopy);
                                        confirmWin.Button_accept.Clicked += new 
EventHandler(on_overwrite_file_accepted);
                                } else {
-                                       //if encoder_tests or multimedia, then copy the folder. If not 
checked, then copy only the db file
-                                       if(check_backup_encoder_tests.Active || 
check_backup_multimedia.Active) 
+                                       //if multimedia_and_encoder, then copy the folder. If not checked, 
then copy only the db file
+                                       if(check_backup_multimedia_and_encoder.Active)
                                        {
                                                thread = new Thread(new ThreadStart(copyRecursive));
                                                GLib.Idle.Add (new GLib.IdleHandler (PulseGTK));
@@ -624,8 +616,8 @@ public class PreferencesWindow {
        private void on_overwrite_file_accepted(object o, EventArgs args)
        {
                try {
-                       //if encoder_tests or multimedia, then copy the folder. If not checked, then copy 
only the db file
-                       if(check_backup_encoder_tests.Active || check_backup_multimedia.Active) {
+                       //if multimedia_and_encoder, then copy the folder. If not checked, then copy only the 
db file
+                       if(check_backup_multimedia_and_encoder.Active) {
                                Directory.Delete(fileCopy, true);
                                thread = new Thread(new ThreadStart(copyRecursive));
                                GLib.Idle.Add (new GLib.IdleHandler (PulseGTK));


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