[chronojump] Chronojump import GUI - Many improvements



commit 5df859d99bea0e0d50ef50d75c19570892b13d60
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Oct 17 13:30:34 2019 +0200

    Chronojump import GUI - Many improvements

 glade/session_load.glade      | 404 ++++++++++++++++++++++++++++--------------
 src/gui/chronojumpImporter.cs |   4 +-
 src/gui/session.cs            |  86 ++++++---
 3 files changed, 330 insertions(+), 164 deletions(-)
---
diff --git a/glade/session_load.glade b/glade/session_load.glade
index 077e1244..6cc78998 100644
--- a/glade/session_load.glade
+++ b/glade/session_load.glade
@@ -18,19 +18,84 @@
         <property name="can_focus">False</property>
         <property name="spacing">10</property>
         <child>
-          <widget class="GtkVBox" id="session_import_box">
+          <widget class="GtkNotebook" id="notebook_import">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="spacing">12</property>
+            <property name="can_focus">True</property>
+            <property name="show_tabs">False</property>
+            <property name="show_border">False</property>
             <child>
-              <widget class="GtkHBox" id="filename_box">
+              <widget class="GtkVBox" id="session_import_box">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
+                <property name="spacing">20</property>
                 <child>
-                  <widget class="GtkLabel" id="file_label">
+                  <widget class="GtkVBox" id="vbox9">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="label" translatable="yes">Import from file:</property>
+                    <property name="spacing">30</property>
+                    <child>
+                      <widget class="GtkLabel" id="label11">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">Where do you want to import?</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkAlignment" id="alignment1">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="bottom_padding">10</property>
+                        <property name="left_padding">20</property>
+                        <child>
+                          <widget class="GtkVBox" id="vbox10">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="spacing">20</property>
+                            <child>
+                              <widget class="GtkRadioButton" id="radio_import_new_session">
+                                <property name="label" translatable="yes">Import into a new 
session</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="active">True</property>
+                                <property name="draw_indicator">True</property>
+                              </widget>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkRadioButton" id="radio_import_current_session">
+                                <property name="label" translatable="yes">Import into the current 
session</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="draw_indicator">True</property>
+                                <property name="group">radio_import_new_session</property>
+                              </widget>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                          </widget>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
                   </widget>
                   <packing>
                     <property name="expand">False</property>
@@ -39,127 +104,101 @@
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkButton" id="select_file_import">
+                  <widget class="GtkHButtonBox" id="hbuttonbox3">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">True</property>
-                    <signal name="clicked" handler="on_select_file_import_clicked" swapped="no"/>
+                    <property name="can_focus">False</property>
+                    <property name="layout_style">spread</property>
                     <child>
-                      <widget class="GtkHBox" id="hbox2">
+                      <widget class="GtkButton" id="button_cancel0">
+                        <property name="label">gtk-cancel</property>
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="spacing">8</property>
-                        <child>
-                          <widget class="GtkImage" id="image_open_database">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="stock">gtk-missing-image</property>
-                          </widget>
-                          <packing>
-                            <property name="expand">True</property>
-                            <property name="fill">True</property>
-                            <property name="position">0</property>
-                          </packing>
-                        </child>
+                        <property name="can_focus">True</property>
+                        <property name="can_default">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_stock">True</property>
+                        <signal name="clicked" handler="on_button_cancel0_clicked" swapped="no"/>
+                        <accelerator key="Escape" signal="clicked"/>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkButton" id="select_file_import">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <signal name="clicked" handler="on_select_file_import_clicked" swapped="no"/>
                         <child>
-                          <widget class="GtkLabel" id="label2">
+                          <widget class="GtkHBox" id="hbox2">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="label" translatable="yes">Open database file</property>
+                            <property name="spacing">8</property>
+                            <child>
+                              <widget class="GtkImage" id="image_open_database">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="stock">gtk-missing-image</property>
+                              </widget>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkLabel" id="label2">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">Open database file</property>
+                              </widget>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
                           </widget>
-                          <packing>
-                            <property name="expand">True</property>
-                            <property name="fill">True</property>
-                            <property name="position">1</property>
-                          </packing>
                         </child>
                       </widget>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">False</property>
+                        <property name="position">1</property>
+                      </packing>
                     </child>
                   </widget>
                   <packing>
-                    <property name="expand">True</property>
+                    <property name="expand">False</property>
                     <property name="fill">False</property>
+                    <property name="pack_type">end</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
               </widget>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
             </child>
             <child>
-              <widget class="GtkLabel" id="file_path_import">
+              <widget class="GtkLabel" id="label7">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
+                <property name="label">main options</property>
               </widget>
               <packing>
-                <property name="expand">True</property>
-                <property name="fill">True</property>
-                <property name="position">1</property>
+                <property name="tab_fill">False</property>
+                <property name="type">tab</property>
               </packing>
             </child>
-          </widget>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-        <child>
-          <widget class="GtkNotebook" id="notebook_import">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="show_tabs">False</property>
             <child>
               <widget class="GtkVBox" id="vbox1">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="spacing">10</property>
                 <child>
-                  <widget class="GtkAlignment" id="alignment1">
+                  <widget class="GtkLabel" id="file_path_import">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="bottom_padding">10</property>
-                    <property name="left_padding">20</property>
-                    <child>
-                      <widget class="GtkHBox" id="import_options_box">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="spacing">20</property>
-                        <child>
-                          <widget class="GtkRadioButton" id="radio_import_new_session">
-                            <property name="label" translatable="yes">Import into a new session</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">False</property>
-                            <property name="active">True</property>
-                            <property name="draw_indicator">True</property>
-                          </widget>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">True</property>
-                            <property name="position">0</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkRadioButton" id="radio_import_current_session">
-                            <property name="label" translatable="yes">Import into the current 
session</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">False</property>
-                            <property name="draw_indicator">True</property>
-                            <property name="group">radio_import_new_session</property>
-                          </widget>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">True</property>
-                            <property name="position">1</property>
-                          </packing>
-                        </child>
-                      </widget>
-                    </child>
                   </widget>
                   <packing>
                     <property name="expand">False</property>
@@ -286,7 +325,7 @@
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkHButtonBox" id="hbuttonbox4">
+                  <widget class="GtkHButtonBox" id="hbuttonbox_page1_load">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="layout_style">spread</property>
@@ -298,7 +337,7 @@
                         <property name="can_default">True</property>
                         <property name="receives_default">False</property>
                         <property name="use_stock">True</property>
-                        <signal name="clicked" handler="on_button_cancel_clicked" swapped="no"/>
+                        <signal name="clicked" handler="on_button_cancel1_clicked" swapped="no"/>
                         <accelerator key="Escape" signal="clicked"/>
                       </widget>
                       <packing>
@@ -324,6 +363,35 @@
                         <property name="position">1</property>
                       </packing>
                     </child>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">3</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkHButtonBox" id="hbuttonbox_page1_import">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="layout_style">spread</property>
+                    <child>
+                      <widget class="GtkButton" id="button_back">
+                        <property name="label">gtk-go-back</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="can_default">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_stock">True</property>
+                        <signal name="clicked" handler="on_button_back_clicked" swapped="no"/>
+                        <accelerator key="Escape" signal="clicked"/>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
                     <child>
                       <widget class="GtkButton" id="button_import">
                         <property name="visible">True</property>
@@ -367,17 +435,20 @@
                       <packing>
                         <property name="expand">False</property>
                         <property name="fill">False</property>
-                        <property name="position">2</property>
+                        <property name="position">1</property>
                       </packing>
                     </child>
                   </widget>
                   <packing>
                     <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">3</property>
+                    <property name="fill">False</property>
+                    <property name="position">4</property>
                   </packing>
                 </child>
               </widget>
+              <packing>
+                <property name="position">1</property>
+              </packing>
             </child>
             <child>
               <widget class="GtkLabel" id="label4">
@@ -386,6 +457,7 @@
                 <property name="label">select session</property>
               </widget>
               <packing>
+                <property name="position">1</property>
                 <property name="tab_fill">False</property>
                 <property name="type">tab</property>
               </packing>
@@ -398,13 +470,13 @@
                   <widget class="GtkVBox" id="vbox5">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="spacing">12</property>
+                    <property name="spacing">30</property>
                     <child>
                       <widget class="GtkLabel" id="label10">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="xalign">0</property>
-                        <property name="label" translatable="yes">The current session will be modified. The 
data from:</property>
+                        <property name="label" translatable="yes">The current session will be 
modified.</property>
                       </widget>
                       <packing>
                         <property name="expand">False</property>
@@ -413,9 +485,62 @@
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkLabel" id="label_import_session_name">
+                      <widget class="GtkTable" id="table1">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
+                        <property name="n_rows">2</property>
+                        <property name="n_columns">2</property>
+                        <property name="column_spacing">10</property>
+                        <property name="row_spacing">10</property>
+                        <child>
+                          <widget class="GtkLabel" id="label13">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">The data from session:</property>
+                          </widget>
+                          <packing>
+                            <property name="x_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkLabel" id="label8">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">From file:</property>
+                          </widget>
+                          <packing>
+                            <property name="top_attach">1</property>
+                            <property name="bottom_attach">2</property>
+                            <property name="x_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkLabel" id="label_import_file">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="wrap">True</property>
+                          </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="GtkLabel" id="label_import_session_name">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                          </widget>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                          </packing>
+                        </child>
                       </widget>
                       <packing>
                         <property name="expand">False</property>
@@ -423,30 +548,6 @@
                         <property name="position">1</property>
                       </packing>
                     </child>
-                    <child>
-                      <widget class="GtkLabel" id="label8">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="xalign">0</property>
-                        <property name="label" translatable="yes">From file:</property>
-                      </widget>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">False</property>
-                        <property name="position">2</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <widget class="GtkLabel" id="label_import_file">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                      </widget>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">3</property>
-                      </packing>
-                    </child>
                     <child>
                       <widget class="GtkLabel" id="label9">
                         <property name="visible">True</property>
@@ -454,10 +555,10 @@
                         <property name="label" translatable="yes">Will be imported into the current 
session.</property>
                       </widget>
                       <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
                         <property name="padding">12</property>
-                        <property name="position">4</property>
+                        <property name="position">2</property>
                       </packing>
                     </child>
                   </widget>
@@ -516,7 +617,7 @@
                 </child>
               </widget>
               <packing>
-                <property name="position">1</property>
+                <property name="position">2</property>
               </packing>
             </child>
             <child>
@@ -526,7 +627,7 @@
                 <property name="label">import confirm</property>
               </widget>
               <packing>
-                <property name="position">1</property>
+                <property name="position">2</property>
                 <property name="tab_fill">False</property>
                 <property name="type">tab</property>
               </packing>
@@ -545,6 +646,7 @@
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">False</property>
+                    <property name="padding">10</property>
                     <property name="position">0</property>
                   </packing>
                 </child>
@@ -603,7 +705,7 @@
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkHButtonBox" id="hbuttonbox2">
+                  <widget class="GtkHButtonBox" id="hbuttonbox_page3">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="layout_style">spread</property>
@@ -625,11 +727,41 @@
                     </child>
                     <child>
                       <widget class="GtkButton" id="button_import_again">
-                        <property name="label" translatable="yes">Import another session</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">True</property>
                         <signal name="clicked" handler="on_button_import_again_clicked" swapped="no"/>
+                        <child>
+                          <widget class="GtkHBox" id="hbox5">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="spacing">4</property>
+                            <child>
+                              <widget class="GtkImage" id="image_import1">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="stock">gtk-missing-image</property>
+                              </widget>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkLabel" id="label12">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">Import another session</property>
+                              </widget>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                          </widget>
+                        </child>
                       </widget>
                       <packing>
                         <property name="expand">False</property>
@@ -647,7 +779,7 @@
                 </child>
               </widget>
               <packing>
-                <property name="position">2</property>
+                <property name="position">3</property>
               </packing>
             </child>
             <child>
@@ -657,7 +789,7 @@
                 <property name="label">import do and end</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>
@@ -666,7 +798,7 @@
           <packing>
             <property name="expand">True</property>
             <property name="fill">True</property>
-            <property name="position">1</property>
+            <property name="position">0</property>
           </packing>
         </child>
       </widget>
diff --git a/src/gui/chronojumpImporter.cs b/src/gui/chronojumpImporter.cs
index 5f43e0e6..3d5ae9b5 100644
--- a/src/gui/chronojumpImporter.cs
+++ b/src/gui/chronojumpImporter.cs
@@ -73,7 +73,7 @@ public partial class ChronoJumpWindow
 
                if(destinationSessionId == 0)
                {
-                       sessionLoadWin.NotebookPage(2); //import do and end page
+                       sessionLoadWin.NotebookPage(SessionLoadWindow.PAGE_IMPORT_RESULT); //import do and 
end page
                        importSessionFromDatabasePrepare2 (new object(), new EventArgs());
                } else
                {
@@ -81,7 +81,7 @@ public partial class ChronoJumpWindow
                        sessionLoadWin.LabelImportSessionName(sessionName);
                        sessionLoadWin.LabelImportFile(chronojumpImporter.SourceFile);
 
-                       sessionLoadWin.NotebookPage(1); //import confirm page
+                       sessionLoadWin.NotebookPage(SessionLoadWindow.PAGE_IMPORT_CONFIRM); //import confirm 
page
                }
        }
 
diff --git a/src/gui/session.cs b/src/gui/session.cs
index 720f0857..1c23f624 100644
--- a/src/gui/session.cs
+++ b/src/gui/session.cs
@@ -685,31 +685,36 @@ public class SessionLoadWindow
 
        [Widget] Gtk.Notebook notebook_import;
 
-       //notebook import first tab
+       //notebook import tab 0
        [Widget] Gtk.RadioButton radio_import_new_session;
        [Widget] Gtk.RadioButton radio_import_current_session;
+       [Widget] Gtk.Image image_open_database;
+
+       //notebook import tab 1
        [Widget] Gtk.TreeView treeview_session_load;
        [Widget] Gtk.Button button_accept;
        [Widget] Gtk.Button button_import;
        [Widget] Gtk.Image image_import;
        [Widget] Gtk.Entry entry_search_filter;
-       [Widget] Gtk.Image image_open_database;
        [Widget] Gtk.CheckButton checkbutton_show_data_jump_run;
        [Widget] Gtk.CheckButton checkbutton_show_data_other_tests;
        [Widget] Gtk.Label file_path_import;
-       [Widget] Gtk.VBox session_import_box;
+       [Widget] Gtk.HButtonBox hbuttonbox_page1_load;
+       [Widget] Gtk.HButtonBox hbuttonbox_page1_import;
 
-       //notebook import second tab
+       //notebook import tab 2
        [Widget] Gtk.Label label_import_session_name;
        [Widget] Gtk.Label label_import_file;
        [Widget] Gtk.Button button_import_confirm_accept;
 
-       //notebook import third tab
+       //notebook import tab 3
        [Widget] Gtk.ProgressBar progressbarImport;
        [Widget] Gtk.Label label_import_done_at_new_session;
        [Widget] Gtk.Label label_import_done_at_current_session;
        [Widget] Gtk.ScrolledWindow scrolledwindow_import_error;
        [Widget] Gtk.TextView textview_import_error;
+       [Widget] Gtk.Image image_import1;
+       [Widget] Gtk.HButtonBox hbuttonbox_page3;
 
 
        static SessionLoadWindow SessionLoadWindowBox;
@@ -717,27 +722,33 @@ public class SessionLoadWindow
        private Session currentSession;
        private WindowType type;
 
-       SessionLoadWindow (Gtk.Window parent, WindowType type)
+       const int PAGE_IMPORT_START = 0;
+       const int PAGE_SELECT_SESSION = 1; //for load session and for import
+       public const int PAGE_IMPORT_CONFIRM = 2;
+       public const int PAGE_IMPORT_RESULT = 3;
+
+       SessionLoadWindow (Gtk.Window parent)
        {
-               this.type = type;
                Glade.XML gladeXML;
                gladeXML = Glade.XML.FromAssembly (Util.GetGladePath() + "session_load.glade", 
"session_load", null);
                gladeXML.Autoconnect(this);
                session_load.Parent = parent;
+       }
 
-               // Hides and shows widgets only needed by some of the functionality
-               session_import_box.Visible = (type == WindowType.IMPORT_SESSION);
-               checkbutton_show_data_other_tests.Visible = (type == WindowType.LOAD_SESSION);
-               checkbutton_show_data_jump_run.Visible = (type == WindowType.LOAD_SESSION);
-
+       private void initializeGui()
+       {
                if (type == WindowType.LOAD_SESSION) {
-                       button_accept.Visible = true;
-                       button_import.Visible = false;
+                       file_path_import.Visible = false;
+                       hbuttonbox_page1_load.Visible = true;
+                       hbuttonbox_page1_import.Visible = false;
                        session_load.Title = Catalog.GetString ("Load session");
+                       notebook_import.CurrentPage = PAGE_SELECT_SESSION;
                } else {
-                       button_accept.Visible = false;
-                       button_import.Visible = true;
+                       file_path_import.Visible = true;
+                       hbuttonbox_page1_load.Visible = false;
+                       hbuttonbox_page1_import.Visible = true;
                        session_load.Title = Catalog.GetString ("Import session");
+                       notebook_import.CurrentPage = PAGE_IMPORT_START;
                }
 
                //put an icon to window
@@ -745,6 +756,7 @@ public class SessionLoadWindow
 
                image_open_database.Pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "folder_open.png");
                image_import.Pixbuf = new Pixbuf (null, Util.GetImagePath(false) + Constants.FileNameImport);
+               image_import1.Pixbuf = new Pixbuf (null, Util.GetImagePath(false) + Constants.FileNameImport);
 
                createTreeView(treeview_session_load, false, false);
                store = getStore(false, false);
@@ -837,8 +849,11 @@ public class SessionLoadWindow
        static public SessionLoadWindow Show (Gtk.Window parent, WindowType type)
        {
                if (SessionLoadWindowBox == null) {
-                       SessionLoadWindowBox = new SessionLoadWindow (parent, type);
+                       SessionLoadWindowBox = new SessionLoadWindow (parent);
                }
+
+               SessionLoadWindowBox.type = type;
+               SessionLoadWindowBox.initializeGui();
                SessionLoadWindowBox.recreateTreeView("loaded the dialog");
 
                SessionLoadWindowBox.session_load.Show ();
@@ -898,9 +913,6 @@ public class SessionLoadWindow
        protected void on_entry_search_filter_changed (object o, EventArgs args) {
                recreateTreeView("changed search filter");
        }
-       protected void on_select_file_import_clicked(object o, EventArgs args) {
-               chooseDatabaseToImport ();
-       }
 
        private void chooseDatabaseToImport()
        {
@@ -919,6 +931,7 @@ public class SessionLoadWindow
                        //file_path_import.Text = System.IO.Path.GetFileName (import_file_path);
                        file_path_import.Text = import_file_path;
                        file_path_import.TooltipText = import_file_path;
+                       notebook_import.CurrentPage = PAGE_SELECT_SESSION;
                }
                filechooser.Destroy ();
                recreateTreeView ("file path changed");
@@ -1138,6 +1151,7 @@ public class SessionLoadWindow
        public void PulseEnd()
        {
                progressbarImport.Fraction = 1;
+               hbuttonbox_page3.Sensitive = true;
        }
 
        public void ShowLabelImportedOk()
@@ -1156,11 +1170,24 @@ public class SessionLoadWindow
 
        public void NotebookPage(int i)
        {
+               if(i == PAGE_IMPORT_RESULT)
+                       hbuttonbox_page3.Sensitive = false;
+
                notebook_import.CurrentPage = i;
        }
 
        //import notebook page 0 buttons
-       void on_button_cancel_clicked (object o, EventArgs args)
+       void on_button_cancel0_clicked (object o, EventArgs args)
+       {
+               SessionLoadWindowBox.session_load.Hide();
+               SessionLoadWindowBox = null;
+       }
+       protected void on_select_file_import_clicked(object o, EventArgs args) {
+               chooseDatabaseToImport ();
+       }
+
+       //import notebook page 1 (load sesion) buttons
+       void on_button_cancel1_clicked (object o, EventArgs args)
        {
                SessionLoadWindowBox.session_load.Hide();
                SessionLoadWindowBox = null;
@@ -1172,6 +1199,7 @@ public class SessionLoadWindow
                TreeModel model;
                TreeIter iter;
 
+               LogB.Information("double! type: " + type.ToString());
                if (tv.Selection.GetSelected (out model, out iter)) {
                        //put selection in selected
                        selected = (string) model.GetValue (iter, 0);
@@ -1194,6 +1222,11 @@ public class SessionLoadWindow
                }
        }
 
+       //import notebook page 1 (import) buttons
+       void on_button_back_clicked (object o, EventArgs args)
+       {
+               notebook_import.CurrentPage = PAGE_IMPORT_START;
+       }
        void on_button_import_clicked (object o, EventArgs args)
        {
                if(selected != "-1") {
@@ -1201,17 +1234,18 @@ public class SessionLoadWindow
                }
        }
 
-       //import notebook page 1 buttons
+       //import notebook page 2 buttons
        private void on_button_import_confirm_back_clicked(object o, EventArgs args)
        {
-               notebook_import.CurrentPage = 0;
+               notebook_import.CurrentPage = PAGE_IMPORT_START;
        }
        private void on_button_import_confirm_accept_clicked(object o, EventArgs args)
        {
-               notebook_import.CurrentPage = 2;
+               hbuttonbox_page3.Sensitive = false;
+               notebook_import.CurrentPage = PAGE_IMPORT_RESULT;
        }
 
-       //import notebook page 2 buttons
+       //import notebook page 3 buttons
        private void on_button_import_close_clicked(object o, EventArgs args)
        {
                SessionLoadWindowBox.session_load.Hide();
@@ -1223,7 +1257,7 @@ public class SessionLoadWindow
                label_import_done_at_current_session.Visible = false;
                scrolledwindow_import_error.Visible = false;
 
-               notebook_import.CurrentPage = 0;
+               notebook_import.CurrentPage = PAGE_IMPORT_START;
        }
 
        



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