[chronojump] Import gui with notebook and without other windows



commit 4980e27a9c983181d0d81e4104cd6b8b945f32c3
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Oct 16 19:39:43 2019 +0200

    Import gui with notebook and without other windows

 glade/session_load.glade      | 599 ++++++++++++++++++++++++++++++------------
 src/chronojumpImporter.cs     |  33 ++-
 src/gui/chronojumpImporter.cs |  25 +-
 src/gui/session.cs            |  84 +++++-
 4 files changed, 550 insertions(+), 191 deletions(-)
---
diff --git a/glade/session_load.glade b/glade/session_load.glade
index b74c9b5f..0eabff2c 100644
--- a/glade/session_load.glade
+++ b/glade/session_load.glade
@@ -100,52 +100,269 @@
                 <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="GtkNotebook" id="notebook_import">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="show_tabs">False</property>
             <child>
-              <widget class="GtkAlignment" id="alignment1">
+              <widget class="GtkVBox" id="vbox1">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="bottom_padding">10</property>
-                <property name="left_padding">20</property>
+                <property name="spacing">10</property>
                 <child>
-                  <widget class="GtkHBox" id="import_options_box">
+                  <widget class="GtkAlignment" id="alignment1">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="spacing">20</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>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkHBox" id="hbox1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="spacing">10</property>
+                    <child>
+                      <widget class="GtkVBox" id="vbox2">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="spacing">4</property>
+                        <child>
+                          <widget class="GtkCheckButton" id="checkbutton_show_data_jump_run">
+                            <property name="label" translatable="yes">Show data of jump and race 
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="toggled" handler="on_checkbutton_show_data_jump_run_toggled" 
swapped="no"/>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkCheckButton" id="checkbutton_show_data_other_tests">
+                            <property name="label" translatable="yes">Show data of other 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="toggled" handler="on_checkbutton_show_data_other_tests_toggled" 
swapped="no"/>
+                          </widget>
+                          <packing>
+                            <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">False</property>
+                        <property name="pack_type">end</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
                     <child>
-                      <widget class="GtkRadioButton" id="radio_import_new_session">
-                        <property name="label" translatable="yes">Import into a new session</property>
+                      <widget class="GtkVBox" id="vbox3">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="spacing">4</property>
+                        <child>
+                          <widget class="GtkLabel" id="label1">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">Search filter</property>
+                          </widget>
+                          <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkEntry" id="entry_search_filter">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="invisible_char">●</property>
+                            <property name="invisible_char_set">True</property>
+                            <property name="primary_icon_activatable">False</property>
+                            <property name="secondary_icon_activatable">False</property>
+                            <property name="primary_icon_sensitive">True</property>
+                            <property name="secondary_icon_sensitive">True</property>
+                            <signal name="changed" handler="on_entry_search_filter_changed" swapped="no"/>
+                          </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">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkScrolledWindow" id="scrolledwindow5">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <child>
+                      <widget class="GtkTreeView" id="treeview_session_load">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
+                        <property name="enable_search">False</property>
+                        <signal name="row_activated" handler="on_row_double_clicked" swapped="no"/>
+                      </widget>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkHButtonBox" id="hbuttonbox4">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="layout_style">spread</property>
+                    <child>
+                      <widget class="GtkButton" id="button_cancel">
+                        <property name="label">gtk-cancel</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="active">True</property>
-                        <property name="draw_indicator">True</property>
+                        <property name="use_stock">True</property>
+                        <signal name="clicked" handler="on_button_cancel_clicked" swapped="no"/>
+                        <accelerator key="Escape" signal="clicked"/>
                       </widget>
                       <packing>
                         <property name="expand">False</property>
-                        <property name="fill">True</property>
+                        <property name="fill">False</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>
+                      <widget class="GtkButton" id="button_accept">
+                        <property name="label">gtk-ok</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
+                        <property name="can_default">True</property>
+                        <property name="has_default">True</property>
                         <property name="receives_default">False</property>
-                        <property name="active">True</property>
-                        <property name="draw_indicator">True</property>
-                        <property name="group">radio_import_new_session</property>
+                        <property name="use_stock">True</property>
+                        <signal name="clicked" handler="on_button_accept_clicked" swapped="no"/>
                       </widget>
                       <packing>
                         <property name="expand">False</property>
-                        <property name="fill">True</property>
+                        <property name="fill">False</property>
                         <property name="position">1</property>
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkProgressBar" id="progressbarImport">
+                      <widget class="GtkButton" id="button_import">
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
+                        <property name="can_focus">True</property>
+                        <property name="can_default">True</property>
+                        <property name="has_default">True</property>
+                        <property name="receives_default">False</property>
+                        <signal name="clicked" handler="on_button_import_clicked" swapped="no"/>
+                        <child>
+                          <widget class="GtkHBox" id="hbox3">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="spacing">4</property>
+                            <child>
+                              <widget class="GtkImage" id="image_import">
+                                <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="label3">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">Import</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>
@@ -154,39 +371,95 @@
                       </packing>
                     </child>
                   </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">3</property>
+                  </packing>
                 </child>
               </widget>
+            </child>
+            <child>
+              <widget class="GtkLabel" id="label4">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label">select session</property>
+              </widget>
               <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">2</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="GtkHBox" id="hbox1">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="spacing">10</property>
             <child>
-              <widget class="GtkVBox" id="vbox1">
+              <widget class="GtkVBox" id="vbox4">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="spacing">4</property>
                 <child>
-                  <widget class="GtkCheckButton" id="checkbutton_show_data_jump_run">
-                    <property name="label" translatable="yes">Show data of jump and race tests</property>
+                  <widget class="GtkVBox" id="vbox5">
                     <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="toggled" handler="on_checkbutton_show_data_jump_run_toggled" swapped="no"/>
+                    <property name="can_focus">False</property>
+                    <property name="spacing">12</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>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkLabel" id="label_import_session_name">
+                        <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">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>
+                        <property name="can_focus">False</property>
+                        <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="padding">12</property>
+                        <property name="position">4</property>
+                      </packing>
+                    </child>
                   </widget>
                   <packing>
                     <property name="expand">False</property>
@@ -195,13 +468,44 @@
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkCheckButton" id="checkbutton_show_data_other_tests">
-                    <property name="label" translatable="yes">Show data of other tests</property>
+                  <widget class="GtkHButtonBox" id="hbuttonbox1">
                     <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="toggled" handler="on_checkbutton_show_data_other_tests_toggled" 
swapped="no"/>
+                    <property name="can_focus">False</property>
+                    <property name="layout_style">spread</property>
+                    <child>
+                      <widget class="GtkButton" id="button_import_confirm_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_import_confirm_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_confirm_accept">
+                        <property name="label">gtk-ok</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="can_default">True</property>
+                        <property name="has_default">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_stock">True</property>
+                        <signal name="clicked" handler="on_button_import_confirm_accept_clicked" 
swapped="no"/>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
                   </widget>
                   <packing>
                     <property name="expand">False</property>
@@ -212,172 +516,137 @@
                 </child>
               </widget>
               <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="pack_type">end</property>
-                <property name="position">0</property>
+                <property name="position">1</property>
               </packing>
             </child>
             <child>
-              <widget class="GtkVBox" id="vbox2">
+              <widget class="GtkLabel" id="label5">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="spacing">4</property>
+                <property name="label">import confirm</property>
+              </widget>
+              <packing>
+                <property name="position">1</property>
+                <property name="tab_fill">False</property>
+                <property name="type">tab</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkVBox" id="vbox7">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="spacing">20</property>
                 <child>
-                  <widget class="GtkLabel" id="label1">
+                  <widget class="GtkProgressBar" id="progressbarImport">
+                    <property name="height_request">30</property>
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">Search filter</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="position">0</property>
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkEntry" id="entry_search_filter">
+                  <widget class="GtkVBox" id="vbox8">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="invisible_char">●</property>
-                    <property name="invisible_char_set">True</property>
-                    <property name="primary_icon_activatable">False</property>
-                    <property name="secondary_icon_activatable">False</property>
-                    <property name="primary_icon_sensitive">True</property>
-                    <property name="secondary_icon_sensitive">True</property>
-                    <signal name="changed" handler="on_entry_search_filter_changed" swapped="no"/>
+                    <child>
+                      <widget class="GtkLabel" id="label_import_done_at_new_session">
+                        <property name="can_focus">False</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">Imported to a new session. You can load it 
now in Session - Load.</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkLabel" id="label_import_done_at_current_session">
+                        <property name="can_focus">False</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">Data merged into the open 
session.</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">True</property>
+                    <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">True</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-          </widget>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">False</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-        <child>
-          <widget class="GtkScrolledWindow" id="scrolledwindow5">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <child>
-              <widget class="GtkTreeView" id="treeview_session_load">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="has_focus">True</property>
-                <property name="enable_search">False</property>
-                <signal name="row_activated" handler="on_row_double_clicked" swapped="no"/>
-              </widget>
-            </child>
-          </widget>
-          <packing>
-            <property name="expand">True</property>
-            <property name="fill">True</property>
-            <property name="position">2</property>
-          </packing>
-        </child>
-        <child>
-          <widget class="GtkHButtonBox" id="hbuttonbox4">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="layout_style">spread</property>
-            <child>
-              <widget class="GtkButton" id="button_cancel">
-                <property name="label">gtk-cancel</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_cancel_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_accept">
-                <property name="label">gtk-ok</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="has_default">True</property>
-                <property name="receives_default">False</property>
-                <property name="use_stock">True</property>
-                <signal name="clicked" handler="on_button_accept_clicked" swapped="no"/>
-              </widget>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkButton" id="button_import">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="has_default">True</property>
-                <property name="receives_default">False</property>
-                <signal name="clicked" handler="on_button_import_clicked" swapped="no"/>
                 <child>
-                  <widget class="GtkHBox" id="hbox3">
+                  <widget class="GtkHButtonBox" id="hbuttonbox2">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="spacing">4</property>
                     <child>
-                      <widget class="GtkImage" id="image_import">
+                      <widget class="GtkButton" id="button_import_close">
+                        <property name="label">gtk-close</property>
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="stock">gtk-missing-image</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <property name="use_stock">True</property>
+                        <signal name="clicked" handler="on_button_import_close_clicked" swapped="no"/>
+                        <accelerator key="Escape" signal="clicked"/>
                       </widget>
                       <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
                         <property name="position">0</property>
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkLabel" id="label3">
+                      <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">False</property>
-                        <property name="label" translatable="yes">Import</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <signal name="clicked" handler="on_button_import_again_clicked" swapped="no"/>
                       </widget>
                       <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
                         <property name="position">1</property>
                       </packing>
                     </child>
                   </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="pack_type">end</property>
+                    <property name="position">2</property>
+                  </packing>
                 </child>
               </widget>
               <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
                 <property name="position">2</property>
               </packing>
             </child>
+            <child>
+              <widget class="GtkLabel" id="label6">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label">import do and end</property>
+              </widget>
+              <packing>
+                <property name="position">2</property>
+                <property name="tab_fill">False</property>
+                <property name="type">tab</property>
+              </packing>
+            </child>
           </widget>
           <packing>
-            <property name="expand">False</property>
+            <property name="expand">True</property>
             <property name="fill">True</property>
-            <property name="position">3</property>
+            <property name="position">1</property>
           </packing>
         </child>
       </widget>
diff --git a/src/chronojumpImporter.cs b/src/chronojumpImporter.cs
index f9fda892..1d9d355b 100644
--- a/src/chronojumpImporter.cs
+++ b/src/chronojumpImporter.cs
@@ -83,6 +83,10 @@ class ChronojumpImporter
                MessageToPulsebar = "";
        }
 
+       /*
+        * interesting method for showing a dialog on the future
+        * now we do not used because there is a notebook on session_load
+        *
        // Shows a dialogue to the user and lets him cancel the operation. The dialog information depends on
        // this class configuration: depends if the session is going to be inserted in a new session or an
        // existing one.
@@ -90,7 +94,7 @@ class ChronojumpImporter
        public Gtk.ResponseType showImportConfirmation()
        {
                string message;
-               string sessionName = getSessionName (sourceFile, sourceSession);
+               string sessionName = GetSessionName (sourceFile, sourceSession);
 
                if (importsToNew ()) {
                        // We don't need any confirmation to import into a new session (the user could delete 
it easily if it was a mistake)
@@ -113,18 +117,7 @@ class ChronojumpImporter
                        return response;
                }
        }
-
-       public void showImportCorrectlyFinished()
-       {
-               string message;
-
-               if (importsToNew()) {
-                       message = Catalog.GetString ("Imported to a new session. You can load it now in 
Session - Load.");
-               } else {
-                       message = Catalog.GetString ("Data merged into the open session.");
-               }
-               new DialogMessage (Catalog.GetString("Chronojump importer"), Constants.MessageTypes.INFO, 
message);
-       }
+       */
 
        private bool importsToNew()
        {
@@ -238,6 +231,7 @@ LogB.Information("import A ");
 
                Result result = executeChronojumpImporter (parameters);
 
+               MessageToPulsebar = "Done!";
                File.Delete (temporarySourceFile);
 
                return result;
@@ -291,7 +285,7 @@ LogB.Information("import A ");
                }
        }
 
-       private static string getSessionName(string filePath, int sessionId)
+       public static string GetSessionName(string filePath, int sessionId)
        {
                Result information = getImporterInformation (filePath);
                if (information.success == false) {
@@ -368,4 +362,15 @@ LogB.Information("import A ");
                // All good, returns the output
                return new Result (true, execute_result.allOutput);
        }
+
+       public string SourceFile
+       {
+               get { return sourceFile; }
+       }
+
+       public int SourceSession
+       {
+               get { return sourceSession; }
+       }
+
 }
diff --git a/src/gui/chronojumpImporter.cs b/src/gui/chronojumpImporter.cs
index 5550ae14..41a48f12 100644
--- a/src/gui/chronojumpImporter.cs
+++ b/src/gui/chronojumpImporter.cs
@@ -37,7 +37,10 @@ public partial class ChronoJumpWindow
                        sessionLoadWin.DisableImportToCurrentSession ();
                }
 
+               sessionLoadWin.Button_import.Clicked -= new EventHandler(on_load_session_accepted_to_import);
                sessionLoadWin.Button_import.Clicked += new EventHandler(on_load_session_accepted_to_import);
+               sessionLoadWin.Button_import_confirm_accept.Clicked -= new 
EventHandler(importSessionFromDatabasePrepare2);
+               sessionLoadWin.Button_import_confirm_accept.Clicked += new 
EventHandler(importSessionFromDatabasePrepare2);
        }
 
        //from import session
@@ -69,12 +72,22 @@ public partial class ChronoJumpWindow
 
                chronojumpImporter = new ChronojumpImporter (app1, source_filename, destination_filename, 
sourceSession, destinationSessionId, preferences.debugMode);
 
-               Gtk.ResponseType response = chronojumpImporter.showImportConfirmation ();
+               if(destinationSessionId == 0)
+               {
+                       sessionLoadWin.NotebookPage(2); //import do and end page
+                       importSessionFromDatabasePrepare2 (new object(), new EventArgs());
+               } else
+               {
+                       string sessionName = ChronojumpImporter.GetSessionName 
(chronojumpImporter.SourceFile, chronojumpImporter.SourceSession);
+                       sessionLoadWin.LabelImportSessionName(sessionName);
+                       sessionLoadWin.LabelImportFile(chronojumpImporter.SourceFile);
 
-               if (response != Gtk.ResponseType.Ok) {
-                       return;
+                       sessionLoadWin.NotebookPage(1); //import confirm page
                }
+       }
 
+       private void importSessionFromDatabasePrepare2 (object o, EventArgs args)
+       {
                LogB.Information("import before thread");       
                LogB.PrintAllThreads = true; //TODO: remove this
 
@@ -98,6 +111,9 @@ public partial class ChronoJumpWindow
                        LogB.ThreadEnding();
                        importSessionFromDatabaseEnd();
 
+                       sessionLoadWin.Pulse(ChronojumpImporter.MessageToPulsebar);
+                       sessionLoadWin.PulseEnd();
+
                        LogB.ThreadEnded();
                        return false;
                }
@@ -156,7 +172,8 @@ public partial class ChronoJumpWindow
 
                        reloadSession ();
 
-                       chronojumpImporter.showImportCorrectlyFinished ();
+                       //chronojumpImporter.showImportCorrectlyFinished ();
+                       sessionLoadWin.ShowLabelImportedOk();
                } else {
                        LogB.Debug ("Chronojump Importer error: ", importerResult.error);
                        new DialogMessage (Catalog.GetString("Chronojump importer"), 
Constants.MessageTypes.WARNING, importerResult.error, true);
diff --git a/src/gui/session.cs b/src/gui/session.cs
index 4b444169..522f6367 100644
--- a/src/gui/session.cs
+++ b/src/gui/session.cs
@@ -682,6 +682,12 @@ public class SessionLoadWindow
        private TreeStore store;
        private string selected;
        private string import_file_path;
+
+       [Widget] Gtk.Notebook notebook_import;
+
+       //notebook import first tab
+       [Widget] Gtk.RadioButton radio_import_new_session;
+       [Widget] Gtk.RadioButton radio_import_current_session;
        [Widget] Gtk.TreeView treeview_session_load;
        [Widget] Gtk.Button button_accept;
        [Widget] Gtk.Button button_import;
@@ -692,10 +698,17 @@ public class SessionLoadWindow
        [Widget] Gtk.CheckButton checkbutton_show_data_other_tests;
        [Widget] Gtk.Label file_path_import;
        [Widget] Gtk.VBox session_import_box;
+
+       //notebook import second tab
+       [Widget] Gtk.Label label_import_session_name;
+       [Widget] Gtk.Label label_import_file;
+       [Widget] Gtk.Button button_import_confirm_accept;
+
+       //notebook import third tab
        [Widget] Gtk.ProgressBar progressbarImport;
-       
-       [Widget] Gtk.RadioButton radio_import_new_session;
-       [Widget] Gtk.RadioButton radio_import_current_session;
+       [Widget] Gtk.Label label_import_done_at_new_session;
+       [Widget] Gtk.Label label_import_done_at_current_session;
+
 
        static SessionLoadWindow SessionLoadWindowBox;
        
@@ -1106,6 +1119,45 @@ public class SessionLoadWindow
                radio_import_current_session.Sensitive = false;
        }
 
+       public void LabelImportSessionName (string str)
+       {
+               label_import_session_name.Text = str;
+       }
+       public void LabelImportFile (string str)
+       {
+               label_import_file.Text = str;
+       }
+
+       public void Pulse(string str)
+       {
+               progressbarImport.Pulse();
+               progressbarImport.Text = str;
+       }
+       public void PulseEnd()
+       {
+               progressbarImport.Fraction = 1;
+       }
+
+       public void ShowLabelImportedOk()
+       {
+               if(radio_import_new_session.Active)
+                       label_import_done_at_new_session.Visible = true;
+               else
+                       label_import_done_at_current_session.Visible = true;
+       }
+
+       public void NotebookPage(int i)
+       {
+               notebook_import.CurrentPage = i;
+       }
+
+       //import notebook page 0 buttons
+       void on_button_cancel_clicked (object o, EventArgs args)
+       {
+               SessionLoadWindowBox.session_load.Hide();
+               SessionLoadWindowBox = null;
+       }
+
        void on_row_double_clicked (object o, Gtk.RowActivatedArgs args)
        {
                TreeView tv = (TreeView) o;
@@ -1141,17 +1193,30 @@ public class SessionLoadWindow
                }
        }
 
-       public void Pulse(string str)
+       //import notebook page 1 buttons
+       private void on_button_import_confirm_back_clicked(object o, EventArgs args)
        {
-               progressbarImport.Pulse();
-               progressbarImport.Text = str;
+               notebook_import.CurrentPage = 0;
+       }
+       private void on_button_import_confirm_accept_clicked(object o, EventArgs args)
+       {
+               notebook_import.CurrentPage = 2;
        }
 
-       void on_button_cancel_clicked (object o, EventArgs args)
+       //import notebook page 2 buttons
+       private void on_button_import_close_clicked(object o, EventArgs args)
        {
                SessionLoadWindowBox.session_load.Hide();
                SessionLoadWindowBox = null;
        }
+       private void on_button_import_again_clicked(object o, EventArgs args)
+       {
+               label_import_done_at_new_session.Visible = false;
+               label_import_done_at_current_session.Visible = false;
+
+               notebook_import.CurrentPage = 0;
+       }
+
        
        void on_session_load_delete_event (object o, DeleteEventArgs args)
        {
@@ -1166,9 +1231,12 @@ public class SessionLoadWindow
        }
        public Button Button_import
        {
-               //set { button_accept = value; }
                get { return button_import; }
        }
+       public Button Button_import_confirm_accept
+       {
+               get { return button_import_confirm_accept; }
+       }
        
        public Session CurrentSession 
        {



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